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

[RFC PATCH v6 04/43] x86/altp2m: Rename hvm_altp2m_supported to altp2m_supported


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
  • Date: Mon, 20 Apr 2026 17:18:28 -0400
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 40.93.13.69) smtp.rcpttodomain=citrix.com smtp.mailfrom=elektrobit.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=elektrobit.com; dkim=pass (signature was verified) header.d=elektrobit.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=elektrobit.com] dmarc=[1,1,header.from=elektrobit.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 213.95.148.172) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=elektrobit.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=elektrobit.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=HCpfUimCCQkOtqeuUzULZSjqPkZv/1OumHTvfODlnj8=; b=yV7veiXiJk+2BSsy7FuyH09r3nkpwiZUVZE5iDpehrkJ5OLK+ifjl1wB5m4y3ny1qQc6U14cWmceZdffDw3iPEg6G67mgvlv1ShmEsP4U+6qJzvZeHAtLnEumgmqT2vU/RStPuS+2wCTyOkc6UThOAIQMphgYGGLSKLXbFDej08ogNnPrN72kmuDpCM6QcyV07t8y7RxjoTytbpZ/Vl5WhJgKYsjR6sa6yH1Puc2pr9uVJ55XkBVgC5EyMeE7/1T5K+AeC9vsED5tNFnPxVo1sFEySsoLdxs/rGLmTuraIAueeKfhQQRfnYg7kcNw3/ZFeYGsGM3yiqvfzz3S2J/TQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=HCpfUimCCQkOtqeuUzULZSjqPkZv/1OumHTvfODlnj8=; b=u4DwST9OXo/iIY83P18O0lIvA5qoaA5HGliE+hEGnZOyirZXjIAED98znHCmRjkqM0X1IxOS80zQ7X3e730bP99Ikg7/27ufxnkSKO1/DSZaJLXUau8rt9AZ+7SLnB8J8Z54VG7J1r/cMWjH9XcYT8Rxmz4g6OH9mANY+U2vsPT4RmIi85wXzR4N8nX77EENjMUH9y6c9q1IC4qhew4SVmzBY1l94w/OwfRY1sbkxQack3LjQF3dX5HxQwNzOwJ2cv2c9K0ppV1BFD4HaQetIdJ47xv83Yoykr84oOO8JF7IKU8WLcyApANJLP/rT1lFUgZ/iVAUjctLzMvcx4dprQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=csBjKEiHYBo257UQ2Hp2tbVuO196RUQhiK9Rp1vz0sfzNEa/NDf0WqjQuzf/mK00ZLY1e+RQNoyMKilm/rwRE9LlOhmuUvvJoHXWvek50nf8yveU6ZZScmfcr9NmtcruH83T9X5A0aCFlm0XE+i8zOfNymZTNIdTQZ9+JdxowsUoPBQndH5M4eCCeX/yQGqryNnq0Y412WNmHLcJGT95oQiSaB1AOmptIHcX7UK6lCVJtQxV4O+ru+q5quN71YXfecuGsenFYvgBWc0C3GlxGsKN+G7b+8P+CGA/E9XC6vucMm8ybyCLnTPFtCpavQFJOEZia6au/7AgWBSj1oRJjg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=voUyNLs34usTXE4LwAsNG9JvlY6roeZMi1LDdYbe+lPmIoZTpcWa5V6qzAM30P+2SNhiDkmLm57i+bVFgQgYTkseQv97ciCC+A8ptNO4lbziwtc3cfYjarFFUWGQZJTQzoUqZoipFnnayV2QY3RlJVu7UOqw9l0sxX5ahfC3Qu0/kt2XjgNwaVXAAxOxlzACrhk/fOgJVNGfwytUGr9vuUqqD8WUOldWY/2uT5jo1yez/2hwvwwc/2hxEXZSNatm3Do2AoyL5CYLtwO9iOEOcqLwqa79Gcw5EkfppdRkx9X3Ng3waSHRXqatAJD3qm6e9xl6LqhTgFolcWNYpAcz0A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=elektrobit.com header.i="@elektrobit.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=elektrobit.com header.i="@elektrobit.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Mon, 20 Apr 2026 21:19:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Using a generic name for altp2m_supported makes it possible to indicate
whether altp2m is supported on other architectures as well. Even if other
architectures always support altp2m at a hardware level (like ARM), altp2m
might not be supported due to CONFIG_ALTP2M being disabled. Therefore, the
altp2m_supported function can be implemented on all architectures to
indicate if the hardware supports altp2m *and* if CONFIG_ALTP2M is enabled.

This is commit 4/8 of the preparation phase.

Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.
---
 xen/arch/x86/domain.c              | 2 +-
 xen/arch/x86/hvm/hvm.c             | 6 +++---
 xen/arch/x86/include/asm/hvm/hvm.h | 4 ++--
 xen/arch/x86/mm/hap/hap.c          | 6 +++---
 xen/arch/x86/mm/p2m-basic.c        | 4 ++--
 xen/arch/x86/mm/p2m-ept.c          | 2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 1d458f1372e5..512b18d4010f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -698,7 +698,7 @@ int arch_sanitise_domain_config(struct 
xen_domctl_createdomain *config)
 
     if ( altp2m_mode )
     {
-        if ( !hvm_altp2m_supported() )
+        if ( !altp2m_supported() )
         {
             dprintk(XENLOG_INFO, "altp2m is not supported\n");
             return -EINVAL;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 86c12c0d1ef4..bc35efdf2c02 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1692,7 +1692,7 @@ void hvm_vcpu_destroy(struct vcpu *v)
 
     ioreq_server_remove_vcpu_all(v->domain, v);
 
-    if ( hvm_altp2m_supported() )
+    if ( altp2m_supported() )
         altp2m_vcpu_destroy(v);
 
     nestedhvm_vcpu_destroy(v);
@@ -4566,7 +4566,7 @@ static int do_altp2m_op(
     int rc = 0;
     uint64_t mode;
 
-    if ( !hvm_altp2m_supported() )
+    if ( !altp2m_supported() )
         return -EOPNOTSUPP;
 
     if ( copy_from_guest(&a, arg, 1) )
@@ -4965,7 +4965,7 @@ static int compat_altp2m_op(
         struct xen_hvm_altp2m_op *altp2m_op;
     } nat;
 
-    if ( !hvm_altp2m_supported() )
+    if ( !altp2m_supported() )
         return -EOPNOTSUPP;
 
     if ( copy_from_guest(&a, arg, 1) )
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h 
b/xen/arch/x86/include/asm/hvm/hvm.h
index e7c1364802f8..6406bb687718 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -702,7 +702,7 @@ static inline bool hvm_hap_supported(void)
 }
 
 /* returns true if hardware supports alternate p2m's */
-static inline bool hvm_altp2m_supported(void)
+static inline bool altp2m_supported(void)
 {
     return IS_ENABLED(CONFIG_ALTP2M) && hvm_funcs.caps.altp2m;
 }
@@ -876,7 +876,7 @@ static inline bool hvm_hap_supported(void)
     return false;
 }
 
-static inline bool hvm_altp2m_supported(void)
+static inline bool altp2m_supported(void)
 {
     return false;
 }
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 6918a00a2a25..563eba3c0d36 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -501,7 +501,7 @@ int hap_enable(struct domain *d, u32 mode)
     }
 
 #ifdef CONFIG_ALTP2M
-    if ( hvm_altp2m_supported() )
+    if ( altp2m_supported() )
     {
         /* Init alternate p2m data */
         if ( (d->arch.altp2m_eptp = alloc_xenheap_page()) == NULL )
@@ -546,7 +546,7 @@ void hap_final_teardown(struct domain *d)
     unsigned int i;
 
 #ifdef CONFIG_ALTP2M
-    if ( hvm_altp2m_supported() )
+    if ( altp2m_supported() )
         for ( i = 0; i < d->nr_altp2m; i++ )
             p2m_teardown(d->altp2m_p2m[i], true, NULL);
 #endif
@@ -590,7 +590,7 @@ void hap_teardown(struct domain *d, bool *preempted)
 
 #ifdef CONFIG_ALTP2M
     /* Leave the root pt in case we get further attempts to modify the p2m. */
-    if ( hvm_altp2m_supported() )
+    if ( altp2m_supported() )
     {
         if ( altp2m_active(d) )
             for_each_vcpu ( d, v )
diff --git a/xen/arch/x86/mm/p2m-basic.c b/xen/arch/x86/mm/p2m-basic.c
index e126fda26760..ce14066fedaf 100644
--- a/xen/arch/x86/mm/p2m-basic.c
+++ b/xen/arch/x86/mm/p2m-basic.c
@@ -128,7 +128,7 @@ int p2m_init(struct domain *d)
         return rc;
     }
 
-    rc = hvm_altp2m_supported() ? p2m_init_altp2m(d) : 0;
+    rc = altp2m_supported() ? p2m_init_altp2m(d) : 0;
     if ( rc )
     {
         p2m_teardown_hostp2m(d);
@@ -197,7 +197,7 @@ void p2m_final_teardown(struct domain *d)
 {
     if ( is_hvm_domain(d) )
     {
-        if ( hvm_altp2m_supported() )
+        if ( altp2m_supported() )
             p2m_teardown_altp2m(d);
         /*
          * We must tear down nestedp2m unconditionally because
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index ddb4c7606be1..84159198f3a0 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -995,7 +995,7 @@ out:
     if ( is_epte_present(&old_entry) )
         ept_free_entry(p2m, &old_entry, target);
 
-    if ( hvm_altp2m_supported() && entry_written && p2m_is_hostp2m(p2m) )
+    if ( altp2m_supported() && entry_written && p2m_is_hostp2m(p2m) )
     {
         ret = p2m_altp2m_propagate_change(d, _gfn(gfn), mfn, order, p2mt, 
p2ma);
         if ( !rc )
-- 
2.34.1




 


Rackspace

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