From: Julien Grall Date: Tue, 13 Jun 2017 16:13:03 +0000 (+0100) Subject: xen/arm: mm: Introduce clear_table and use it X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1999 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=615656a91050898f49b00e6933ab195ada08ec49;p=xen.git xen/arm: mm: Introduce clear_table and use it Add a new helper clear_table to clear a page table entry and invalidate the cache. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 082c872c72..b4ff777b55 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -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++ )