When domain on static allocation populates memory through populate_physmap, other than allocating from heap, it shall allocate from resv_page_list to make sure that all guest RAM are still restricted in statically configured regions.
Signed-off-by: Penny Zheng <penny.zh...@arm.com> --- xen/common/memory.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xen/common/memory.c b/xen/common/memory.c index 2afc3c6f10..2122ceeba7 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -249,6 +249,26 @@ static void populate_physmap(struct memop_args *a) mfn = _mfn(gpfn); } +#ifdef CONFIG_STATIC_MEMORY + else if ( is_domain_on_static_allocation(d) ) + { + for ( j = 0; j < (1U << a->extent_order); j++ ) + { + page = page_list_remove_head(&d->resv_page_list); + if ( unlikely(!page) ) + { + gdprintk(XENLOG_INFO, + "Could not allocate guest page number %lx\n", + gfn_x(_gfn(gpfn))); + goto out; + } + d->resv_pages--; + + if ( j == 0 ) + mfn = page_to_mfn(page); + } + } +#endif else { page = alloc_domheap_pages(d, a->extent_order, a->memflags); -- 2.25.1