When domain on static allocation and is directly mapped, in terms of
GPA == HPA(guest physical address == host physical address), we could use
mfn_to_page() to easily find the page, so there is no need to store pages
in resv_page_list.
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
xen/common/memory.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 2122ceeba7..2865e09a33 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -445,8 +445,11 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
* When domain on static allocation, we shall store pages to resv_page_list,
* so the hypercall populate_physmap could retrieve pages from it,
* rather than allocating from heap.
+ * No need to store pages in resv_page_list when domain on static
+ * allocation and directly mapped, since we could use mfn_to_page() to
+ * easily find the page.
*/
- if ( is_domain_on_static_allocation(d) )
+ if ( is_domain_on_static_allocation(d) && !is_domain_direct_mapped(d) )
{
page_list_add_tail(page, &d->resv_page_list);
d->resv_pages++;
--
2.25.1