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

Re: [PATCH 02/16] acpi: vmap pages in acpi_os_alloc_memory



On Thu, Apr 30, 2020 at 09:44:11PM +0100, Hongyan Xia wrote:
> From: Hongyan Xia <hongyxia@xxxxxxxxxx>
> 
> Also, introduce a wrapper around vmap that maps a contiguous range for
> boot allocations.
> 
> Signed-off-by: Hongyan Xia <hongyxia@xxxxxxxxxx>
> ---
>  xen/drivers/acpi/osl.c | 9 ++++++++-
>  xen/include/xen/vmap.h | 5 +++++
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
> index 4c8bb7839e..d0762dad4e 100644
> --- a/xen/drivers/acpi/osl.c
> +++ b/xen/drivers/acpi/osl.c
> @@ -219,7 +219,11 @@ void *__init acpi_os_alloc_memory(size_t sz)
>       void *ptr;
>  
>       if (system_state == SYS_STATE_early_boot)
> -             return mfn_to_virt(mfn_x(alloc_boot_pages(PFN_UP(sz), 1)));
> +     {
> +             mfn_t mfn = alloc_boot_pages(PFN_UP(sz), 1);
> +
> +             return vmap_boot_pages(mfn, PFN_UP(sz));
> +     }
>  
>       ptr = xmalloc_bytes(sz);
>       ASSERT(!ptr || is_xmalloc_memory(ptr));
> @@ -244,5 +248,8 @@ void __init acpi_os_free_memory(void *ptr)
>       if (is_xmalloc_memory(ptr))
>               xfree(ptr);
>       else if (ptr && system_state == SYS_STATE_early_boot)
> +     {
> +             vunmap(ptr);
>               init_boot_pages(__pa(ptr), __pa(ptr) + PAGE_SIZE);
> +     }
>  }
> diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
> index 369560e620..c70801e195 100644
> --- a/xen/include/xen/vmap.h
> +++ b/xen/include/xen/vmap.h
> @@ -23,6 +23,11 @@ void *vmalloc_xen(size_t size);
>  void *vzalloc(size_t size);
>  void vfree(void *va);
>  
> +static inline void *vmap_boot_pages(mfn_t mfn, unsigned int nr_pages)

Nothing seems to tie this to boot pages only. Maybe it is better to name
it after what it does, like vmap_mfns?

> +{
> +    return __vmap(&mfn, nr_pages, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
> +}
> +
>  void __iomem *ioremap(paddr_t, size_t);
>  
>  static inline void iounmap(void __iomem *va)
> -- 
> 2.24.1.AMZN
> 



 


Rackspace

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