@@ -639,7 +639,8 @@ static void __init init_staticmem_pages(void)
if ( mfn_x(bank_end) <= mfn_x(bank_start) )
return;
- free_staticmem_pages(mfn_to_page(bank_start), bank_pages, false);
+ unprepare_staticmem_pages(mfn_to_page(bank_start),
+ bank_pages, false);
}
}
#endif
@@ -2693,9 +2693,12 @@ struct domain *get_pg_owner(domid_t domid)
}
#ifdef CONFIG_STATIC_MEMORY
-/* Equivalent of free_heap_pages to free nr_mfns pages of static memory. */
-void free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
- bool need_scrub)
+/*
+ * It is the opposite of prepare_staticmem_pages, and it aims to unprepare
+ * nr_mfns pages of static memory.
+ */
+void unprepare_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
+ bool need_scrub)
{
mfn_t mfn = page_to_mfn(pg);
unsigned long i;
@@ -2740,7 +2743,7 @@ void free_domstatic_page(struct page_info *page)
drop_dom_ref = !domain_adjust_tot_pages(d, -1);
- free_staticmem_pages(page, 1, scrub_debug);
+ unprepare_staticmem_pages(page, 1, scrub_debug);
/* Add page on the resv_page_list *after* it has been freed. */
page_list_add_tail(page, &d->resv_page_list);
@@ -2848,7 +2851,7 @@ static int assign_domstatic_pages(struct domain *d, struct page_info *pg,
if ( assign_pages(pg, nr_mfns, d, memflags) )
{
- free_staticmem_pages(pg, nr_mfns, memflags & MEMF_no_scrub);
+ unprepare_staticmem_pages(pg, nr_mfns, memflags & MEMF_no_scrub);
return -EINVAL;
}
@@ -2902,7 +2905,7 @@ mfn_t acquire_reserved_page(struct domain *d, unsigned int memflags)
return page_to_mfn(page);
fail_assign:
- free_staticmem_pages(page, 1, memflags & MEMF_no_scrub);
+ unprepare_staticmem_pages(page, 1, memflags & MEMF_no_scrub);
fail:
spin_lock(&d->page_alloc_lock);
page_list_add_tail(page, &d->resv_page_list);
@@ -86,8 +86,8 @@ bool scrub_free_pages(void);
#define FREE_XENHEAP_PAGE(p) FREE_XENHEAP_PAGES(p, 0)
/* These functions are for static memory */
-void free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
- bool need_scrub);
+void unprepare_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
+ bool need_scrub);
void free_domstatic_page(struct page_info *page);
int acquire_domstatic_pages(struct domain *d, mfn_t smfn, unsigned int nr_mfns,
unsigned int memflags);
The name of free_staticmem_pages is inappropriate, considering it is the opposite of function prepare_staticmem_pages. Rename free_staticmem_pages to unprepare_staticmem_pages. Signed-off-by: Penny Zheng <penny.zheng@arm.com> --- v10 changes: - new commit --- xen/arch/arm/setup.c | 3 ++- xen/common/page_alloc.c | 15 +++++++++------ xen/include/xen/mm.h | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-)