]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen/arm: mm: Introduce clear_table and use it
authorJulien Grall <julien.grall@arm.com>
Tue, 13 Jun 2017 16:13:03 +0000 (17:13 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 15 Jun 2017 23:52:06 +0000 (16:52 -0700)
Add a new helper clear_table to clear a page table entry and invalidate
the cache.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c

index 082c872c72c7ea0d1674196587812708614f9a82..b4ff777b5576559a21ccf34b43fb7c90f22e510f 100644 (file)
@@ -529,6 +529,13 @@ void __init remove_early_mappings(void)
 
 extern void relocate_xen(uint64_t ttbr, void *src, void *dst, size_t len);
 
+/* Clear a translation table and clean & invalidate the cache */
+static void clear_table(void *table)
+{
+    clear_page(table);
+    clean_and_invalidate_dcache_va_range(table, PAGE_SIZE);
+}
+
 /* Boot-time pagetable setup.
  * Changes here may need matching changes in head.S */
 void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
@@ -604,18 +611,13 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
 
     /* Clear the copy of the boot pagetables. Each secondary CPU
      * rebuilds these itself (see head.S) */
-    memset(boot_pgtable, 0x0, PAGE_SIZE);
-    clean_and_invalidate_dcache(boot_pgtable);
+    clear_table(boot_pgtable);
 #ifdef CONFIG_ARM_64
-    memset(boot_first, 0x0, PAGE_SIZE);
-    clean_and_invalidate_dcache(boot_first);
-    memset(boot_first_id, 0x0, PAGE_SIZE);
-    clean_and_invalidate_dcache(boot_first_id);
+    clear_table(boot_first);
+    clear_table(boot_first_id);
 #endif
-    memset(boot_second, 0x0, PAGE_SIZE);
-    clean_and_invalidate_dcache(boot_second);
-    memset(boot_third, 0x0, PAGE_SIZE);
-    clean_and_invalidate_dcache(boot_third);
+    clear_table(boot_second);
+    clear_table(boot_third);
 
     /* Break up the Xen mapping into 4k pages and protect them separately. */
     for ( i = 0; i < LPAE_ENTRIES; i++ )