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

[PATCH v2 2/4] xen/arm: Add new HVM_PARAM_HV_RSRV_{BASE_PFN,SIZE} keys in HVMOP


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Sat, 11 May 2024 08:56:09 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=8pDtPG/gwtKzswtOqvdxKDHnF7RDE7VlIypy2jSq22o=; b=B5lhSGdWmNKbjWDV7srQNFt4QaBPG/CT6c0Jweo5eJrSV/TJoeetYN9TzBDserlSrme+IfrdElCy72UPml+8iHA8Ox0sHBLtX1bvIfjmfuStkuty5daS4daEoJGRsYITSydE/T7zX5gUE/FylwSiskfgj9UH1fiR/3Va+S+Bmx/ih7HSLpOOg5OvJfHiy2wfutNY9/MgEM2vlIf3yEofoSoKVsE6bnHoO8mZ5NgNGH0d2ES1w2hKXXYk0nuctveeXpVBwYn1GZPPf1Mk+A8CFGM4r55FoVCPYB+Jh/VJ2S1e5yeYWTDg/HOi0Dr0CfgIQFlkEmVv9s4VGHOE3YGl6A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M/GTqvrUh3lG7vVOODAiuRg5gsaArpYy5zp/D0mu5yZ1/RudkWsk9y5k/zKjMRuiVxcZmSdgpXQy1CP4vWIFnVGUAWMMDEbPxzeEJU9R9xk8XvG5R7zMxY96NOMJeI3BZzVECwJ90oQhCLJIWPFlvoKMt+EW5/QQCGQqhO1OsrKISo2mmoq2V1DfMcA+0WneXI6603qySECDsXZdR2lUTd+c3VbXgKRktzWrQc8SX/FVPE8brgVhvVThSxh6u5U3hVhS0NZX1G8H54k4WvBF5PHdqwvczry/eionr/HapQOTA1zJZ0SVndvbT0deQ/14iiXGi/t3hktVwywb+agAXQ==
  • Cc: Henry Wang <xin.wang2@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Alec Kwapis <alec.kwapis@xxxxxxxxxxxxx>
  • Delivery-date: Sat, 11 May 2024 00:56:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

For use cases such as Dom0less PV drivers, a mechanism to communicate
Dom0less DomU's static data with the runtime control plane (Dom0) is
needed. Since on Arm HVMOP is already the existing approach to address
such use cases (for example the allocation of HVM_PARAM_CALLBACK_IRQ),
add new HVMOP keys HVM_PARAM_HV_RSRV_{BASE_PFN,SIZE} for storing the
hypervisor reserved pages region base PFN and size.

Currently, the hypervisor reserved pages region is used as the Arm
Dom0less DomU guest magic pages region. Therefore protect the HVMOP
keys with "#if defined(__arm__) || defined(__aarch64__)". The values
will be set at Dom0less DomU construction time after Dom0less DomU's
magic pages region has been allocated.

Reported-by: Alec Kwapis <alec.kwapis@xxxxxxxxxxxxx>
Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
---
v2:
- Rename the HVMOP keys to HVM_PARAM_HV_RSRV_{BASE_PFN,SIZE}. (Daniel)
- Add comment on top of HVM_PARAM_HV_RSRV_{BASE_PFN,SIZE} to describe
  its usage. Protect them with #ifdef. (Daniel, Jan)
---
 xen/arch/arm/dom0less-build.c   |  3 +++
 xen/arch/arm/hvm.c              |  2 ++
 xen/include/public/hvm/params.h | 11 ++++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 4b96ddd9ce..5bb53ebb47 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -764,6 +764,9 @@ static int __init alloc_magic_pages(struct domain *d)
         return rc;
     }
 
+    d->arch.hvm.params[HVM_PARAM_HV_RSRV_BASE_PFN] = gfn_x(gfn);
+    d->arch.hvm.params[HVM_PARAM_HV_RSRV_SIZE] = NR_MAGIC_PAGES;
+
     return 0;
 }
 
diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index 0989309fea..949d804f8b 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -55,6 +55,8 @@ static int hvm_allow_get_param(const struct domain *d, 
unsigned int param)
     case HVM_PARAM_STORE_EVTCHN:
     case HVM_PARAM_CONSOLE_PFN:
     case HVM_PARAM_CONSOLE_EVTCHN:
+    case HVM_PARAM_HV_RSRV_BASE_PFN:
+    case HVM_PARAM_HV_RSRV_SIZE:
         return 0;
 
         /*
diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index a22b4ed45d..337f5b0bf8 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -296,6 +296,15 @@
 #define XEN_HVM_MCA_CAP_LMCE   (xen_mk_ullong(1) << 0)
 #define XEN_HVM_MCA_CAP_MASK   XEN_HVM_MCA_CAP_LMCE
 
-#define HVM_NR_PARAMS 39
+/*
+ * Base PFN and number of pages of the hypervisor reserved pages region.
+ * Currently only used on Arm for Dom0less DomUs as guest magic pages region.
+ */
+#if defined(__arm__) || defined(__aarch64__)
+#define HVM_PARAM_HV_RSRV_BASE_PFN 39
+#define HVM_PARAM_HV_RSRV_SIZE 40
+#endif
+
+#define HVM_NR_PARAMS 41
 
 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
-- 
2.34.1




 


Rackspace

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