]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: mm: Use typesafe MFN in set_fixmap
authorJulien Grall <julien.grall@arm.com>
Tue, 13 Jun 2017 16:13:16 +0000 (17:13 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 15 Jun 2017 23:55:42 +0000 (16:55 -0700)
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/acpi/lib.c
xen/arch/arm/kernel.c
xen/arch/arm/mm.c
xen/arch/arm/platforms/vexpress.c
xen/drivers/video/arm_hdlcd.c
xen/include/asm-arm/mm.h

index 9bd769cff6bffdbbb4da8126011e387fee2ac31f..70131b0736ea276bd766b670d6b47225a7916e94 100644 (file)
@@ -31,7 +31,7 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
 
     offset = phys & (PAGE_SIZE - 1);
     mapped_size = PAGE_SIZE - offset;
-    set_fixmap(FIXMAP_ACPI_BEGIN, phys >> PAGE_SHIFT, PAGE_HYPERVISOR);
+    set_fixmap(FIXMAP_ACPI_BEGIN, maddr_to_mfn(phys), PAGE_HYPERVISOR);
     base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN);
 
     /* Most cases can be covered by the below. */
@@ -41,7 +41,7 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
         if ( ++idx > FIXMAP_ACPI_END )
             return NULL;    /* cannot handle this */
         phys += PAGE_SIZE;
-        set_fixmap(idx, phys >> PAGE_SHIFT, PAGE_HYPERVISOR);
+        set_fixmap(idx, maddr_to_mfn(phys), PAGE_HYPERVISOR);
         mapped_size += PAGE_SIZE;
     }
 
index 1b32d552846045af73f211b0e810b02d258b747e..7403ec0c0e2f1dda7ad32636bc1226a84a8f5980 100644 (file)
@@ -49,14 +49,12 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
     void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
 
     while (len) {
-        paddr_t p;
         unsigned long l, s;
 
-        p = paddr >> PAGE_SHIFT;
         s = paddr & (PAGE_SIZE-1);
         l = min(PAGE_SIZE - s, len);
 
-        set_fixmap(FIXMAP_MISC, p, BUFFERABLE);
+        set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), BUFFERABLE);
         memcpy(dst, src + s, l);
         clean_dcache_va_range(dst, l);
 
index 0014c24ecc7f32428f7a9ed817e56d49699e0187..3b92abffc46b57725e278a52dd626a449a44e5cd 100644 (file)
@@ -323,9 +323,9 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr)
 }
 
 /* Map a 4k page in a fixmap entry */
-void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
+void set_fixmap(unsigned map, mfn_t mfn, unsigned attributes)
 {
-    lpae_t pte = mfn_to_xen_entry(_mfn(mfn), attributes);
+    lpae_t pte = mfn_to_xen_entry(mfn, attributes);
     pte.pt.table = 1; /* 4k mappings always have this bit set */
     pte.pt.xn = 1;
     write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
index 8e6a4eaa32e4267529ac370eee0e76994c81e515..a26ac324ba590ab3cf3249b3508debc4cc2f5916 100644 (file)
@@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, uint32_t *data)
     uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC);
     int ret = -1;
 
-    set_fixmap(FIXMAP_MISC, V2M_SYS_MMIO_BASE >> PAGE_SHIFT, DEV_SHARED);
+    set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), DEV_SHARED);
 
     if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START )
         goto out;
index 8241cae117e1231ce59af05390d529ce0a4e7c6d..3915f731f545b2000e1690c36faeed87e40a2eb9 100644 (file)
@@ -227,7 +227,7 @@ void __init video_init(void)
     /* uses FIXMAP_MISC */
     set_pixclock(videomode->pixclock);
 
-    set_fixmap(FIXMAP_MISC, hdlcd_start >> PAGE_SHIFT, DEV_SHARED);
+    set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), DEV_SHARED);
     HDLCD[HDLCD_COMMAND] = 0;
 
     HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel;
index a42da20f0a5be78e9b8d49ab7cc048e04a88316c..274b1752b31168c398555e859f442532392afc08 100644 (file)
@@ -175,7 +175,7 @@ extern void setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns
 /* Map a frame table to cover physical addresses ps through pe */
 extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
 /* Map a 4k page in a fixmap entry */
-extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes);
+extern void set_fixmap(unsigned map, mfn_t mfn, unsigned attributes);
 /* Remove a mapping from a fixmap entry */
 extern void clear_fixmap(unsigned map);
 /* map a physical range in virtual memory */