[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 04/24] xen/arm: mm: Introduce clear_table and use it



On Tue, 13 Jun 2017, Julien Grall wrote:
> Add a new helper clear_table to clear a page table entry and invalidate
> the cache.
> 
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
> ---
>  xen/arch/arm/mm.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> 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)

This could be a static inline. In any case:

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> +{
> +    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++ )
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.