xen/arm: map_dev_mmio_region: The iomem permission check should be done on MFN
authorJulien Grall <julien.grall@arm.com>
Tue, 14 Jun 2016 11:50:26 +0000 (12:50 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Mon, 11 Jul 2016 17:41:48 +0000 (18:41 +0100)
The helper iomem_access_permitted expects MFNs in parameters and not
GNFs. Thankfully only the hardware domain can call this function and
it will always be with GFNS == MFNs for now.

Also, fix the printf to use the MFN range and not the GFN one.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/p2m.c

index aa4e7747dd53f488f7dff02a9c614f10f42f4560..0395a40bc096a852dc763d13420d1ab94882753a 100644 (file)
@@ -1277,14 +1277,14 @@ int map_dev_mmio_region(struct domain *d,
 {
     int res;
 
-    if ( !(nr && iomem_access_permitted(d, start_gfn, start_gfn + nr - 1)) )
+    if ( !(nr && iomem_access_permitted(d, mfn, mfn + nr - 1)) )
         return 0;
 
     res = map_mmio_regions(d, start_gfn, nr, mfn);
     if ( res < 0 )
     {
         printk(XENLOG_G_ERR "Unable to map [%#lx - %#lx] in Dom%d\n",
-               start_gfn, start_gfn + nr - 1, d->domain_id);
+               mfn, mfn + nr - 1, d->domain_id);
         return res;
     }