[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 4/5] xen/arm: retrieve reserved pages on populate_physmap
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Penny Zheng <Penny.Zheng@xxxxxxx>
- Date: Wed, 30 Mar 2022 17:36:16 +0800
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7qVkQ1qo3iAE+FDwNj2htVkkE7SSyq5qLjILB2koE80=; b=TQDLUM0LjpUCo2mKoyL2Kgbmrt3i52/Ig28MiMU7dORGkJBACFq7J1A7smvX6Y1Sfgt9TrwCCywnuwQWQ8JmQBZxJli0L0r1RtS4Urk+PmaWXJRjWlpU1O5xfYngKB4QAEkBEHNjYEJXJfVmBOcQqb0zGf2mM9xNLz4A7bs2mxEPveBDmV0vRk8hgS26sFa49HmUr2Ph95UswBnwjxkZt7oZF6L2v1C9mXhgW87rMGJ4XwXyMJr/l33guoHq18YgsuGVkodjTDnv9rYYQgbEFPfAE8JZ0wdeReygO4TC8Bf1CnWw4lGeTxf5M6LNOgcQaPcpsFocw8zen2tkx+o2UQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nI5SacCHGDtkOJa5lwav/L2kfYGKAczzup1+Stp52WPMAamgRp13IUY+6eKUdFW24fRAyn4aOq74pEiqbZJ0EAhEtydlWxXuSgrJugVphfAKdOKwKql7z+kA49PUj8VfO0ixGwvZaACPLJlO3t6b++aq/hmcky14kf71WUlSY+DXSK/HVuveW2SFqSzziwulTlxp4bdkJ8w55D0houhq5hCxSIPs9kQjftL4rUmwWv0YfLN7X/e3e05BI4+Yh5PM4rH3JfTSbVuEObd+f331tWGfMH5LdSZ+tZT2SYkpBYpI7ozcR62hfXJXkPrrZW8eUCSR0Ql02QsfzaySkTdf9A==
- Cc: <wei.chen@xxxxxxx>, <henry.wang@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "George Dunlap" <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>
- Delivery-date: Wed, 30 Mar 2022 09:48:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
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.zheng@xxxxxxx>
---
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
|