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

Re: [Xen-devel] [RFC 22/22] xen/arm: p2m: Do not handle shattering in p2m_create_table



On Thu, 28 Jul 2016, Julien Grall wrote:
> The helper p2m_create_table is only called to create a brand new table.
> 
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


>  xen/arch/arm/p2m.c | 51 ++++++---------------------------------------------
>  1 file changed, 6 insertions(+), 45 deletions(-)
> 
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 16ed393..4aaa96f 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -264,8 +264,7 @@ static p2m_access_t p2m_mem_access_radix_get(struct 
> p2m_domain *p2m, gfn_t gfn)
>  #define GUEST_TABLE_SUPER_PAGE 1
>  #define GUEST_TABLE_NORMAL_PAGE 2
>  
> -static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry,
> -                            int level_shift);
> +static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry);
>  
>  /*
>   * Take the currently mapped table, find the corresponding GFN entry,
> @@ -291,7 +290,7 @@ static int p2m_next_level(struct p2m_domain *p2m, bool 
> read_only,
>          if ( read_only )
>              return GUEST_TABLE_MAP_FAILED;
>  
> -        ret = p2m_create_table(p2m, entry, /* not used */ ~0);
> +        ret = p2m_create_table(p2m, entry);
>          if ( ret )
>              return GUEST_TABLE_MAP_FAILED;
>      }
> @@ -557,25 +556,14 @@ static inline void p2m_remove_pte(lpae_t *p, bool 
> clean_pte)
>      p2m_write_pte(p, pte, clean_pte);
>  }
>  
> -/*
> - * Allocate a new page table page and hook it in via the given entry.
> - * apply_one_level relies on this returning 0 on success
> - * and -ve on failure.
> - *
> - * If the existing entry is present then it must be a mapping and not
> - * a table and it will be shattered into the next level down.
> - *
> - * level_shift is the number of bits at the level we want to create.
> - */
> -static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry,
> -                            int level_shift)
> +/* Allocate a new page table page and hook it in via the given entry. */
> +static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry)
>  {
>      struct page_info *page;
>      lpae_t *p;
>      lpae_t pte;
> -    int splitting = p2m_valid(*entry);
>  
> -    BUG_ON(p2m_table(*entry));
> +    ASSERT(!p2m_valid(*entry));
>  
>      page = alloc_domheap_page(NULL, 0);
>      if ( page == NULL )
> @@ -584,35 +572,8 @@ static int p2m_create_table(struct p2m_domain *p2m, 
> lpae_t *entry,
>      page_list_add(page, &p2m->pages);
>  
>      p = __map_domain_page(page);
> -    if ( splitting )
> -    {
> -        p2m_type_t t = entry->p2m.type;
> -        mfn_t mfn = _mfn(entry->p2m.base);
> -        int i;
>  
> -        /*
> -         * We are either splitting a first level 1G page into 512 second 
> level
> -         * 2M pages, or a second level 2M page into 512 third level 4K pages.
> -         */
> -         for ( i=0 ; i < LPAE_ENTRIES; i++ )
> -         {
> -             pte = mfn_to_p2m_entry(mfn_add(mfn, i << (level_shift - 
> LPAE_SHIFT)),
> -                                    t, p2m->default_access);
> -
> -             /*
> -              * First and second level super pages set p2m.table = 0, but
> -              * third level entries set table = 1.
> -              */
> -             if ( level_shift - LPAE_SHIFT )
> -                 pte.p2m.table = 0;
> -
> -             write_pte(&p[i], pte);
> -         }
> -
> -         page->u.inuse.p2m_refcount = LPAE_ENTRIES;
> -    }
> -    else
> -        clear_page(p);
> +    clear_page(p);
>  
>      if ( p2m->clean_pte )
>          clean_dcache_va_range(p, PAGE_SIZE);
> -- 
> 1.9.1
> 

_______________________________________________
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®.