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

[PATCH 2/2] x86: Remove stubs from asm/pv/domain.h


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Wed, 12 Nov 2025 16:22:31 +0100
  • 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=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=aAc/ZghjNNJf/U8+nHmCJOTDYsRUBccDQGmMHB8S8v4=; b=OV6sX4fdmNHZO6GQE4v72BtCskiELP5kqmIHwlBzbdSgRtpTFSC17t9SiX5rWwxGV82iOS+RTPIemmQA+v9chsBNVjvPZ/snO+2YM054grGJJDgfKLtRESoO7JzuKVNRK8Xv+uF56/gOHKhMwRajIfI1bLaB9rmvBCGUNBJXo5Y8IijJjbVB4b5ZrLUCoWi4f4ukgcS3CdP0r3HFaoATzgOMQJ/dOOVqCAZcHxhdKcLvlJ2faPuOE3AiX3ZHzSL6KNqJZmarEZmA67K9lzHY37hG0ErColGE/ONQTWWoje+FM6xH2/8s1P5YFPWW7yM+laq+WyQ1xYBjWAYLbHXL4w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mDWf6E5ssYzP5urjrqp/F4+TSWg+UL4rvEk+RsbGzcpwCMf5AF3BonkDYVArwe3UU6J+PohbsEfORF+ALNeXzRYR3mC8SfeuuNY83MZKNjImLi5ugNYs7Ba1gwHzfQeCXSVppzPoqu1Ya7Tl8FfTaWO/bXwD6vwda/6/2za/oGdAM1DOcenAEhT1ivbY9vI4AFPqVK34JTl4u58wnmd2X9LI0OzZDuCXGqoU3TgD15KTbHSRCNlPQ2vDqPLA2KAfWwwBvzBpz+suri85NKnqyysaMQwI19T+PbO9BVBoj/E9FqkZYPXijoFhWLZRbhKbiQ21VICvXOsccEEHI7188w==
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 12 Nov 2025 15:23:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

They are unnecessary. The only two cases with link-time failures are
fallback else branches that can just as well be adjusted with explicit
IS_ENABLED(CONFIG_PV). HVM has no equivalent stubs and there's no reason
to keep the asymmetry.

No functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
I'd rather remove the "rc = -EOPNOTSUPP" branch altogether, or replace
it with ASSERT_UNREACHABLE(), but I kept it here to preserve prior behaviour.

Thoughts?

---
 xen/arch/x86/domain.c                | 10 ++++++----
 xen/arch/x86/include/asm/pv/domain.h | 25 -------------------------
 2 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 19fd86ce88..0977d9323d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -571,15 +571,17 @@ int arch_vcpu_create(struct vcpu *v)
 
     if ( is_hvm_domain(d) )
         rc = hvm_vcpu_initialise(v);
-    else if ( !is_idle_domain(d) )
-        rc = pv_vcpu_initialise(v);
-    else
+    else if ( is_idle_domain(d) )
     {
         /* Idle domain */
         v->arch.cr3 = __pa(idle_pg_table);
         rc = 0;
         v->arch.msrs = ZERO_BLOCK_PTR; /* Catch stray misuses */
     }
+    else if ( IS_ENABLED(CONFIG_PV) )
+        rc = pv_vcpu_initialise(v);
+    else
+        rc = -EOPNOTSUPP;
 
     if ( rc )
         goto fail;
@@ -614,7 +616,7 @@ void arch_vcpu_destroy(struct vcpu *v)
 
     if ( is_hvm_vcpu(v) )
         hvm_vcpu_destroy(v);
-    else
+    else if ( IS_ENABLED(CONFIG_PV) )
         pv_vcpu_destroy(v);
 }
 
diff --git a/xen/arch/x86/include/asm/pv/domain.h 
b/xen/arch/x86/include/asm/pv/domain.h
index 75a6b9e5c7..582d004051 100644
--- a/xen/arch/x86/include/asm/pv/domain.h
+++ b/xen/arch/x86/include/asm/pv/domain.h
@@ -54,8 +54,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu 
*v, bool is_xpti)
 #endif
 }
 
-#ifdef CONFIG_PV
-
 void pv_vcpu_destroy(struct vcpu *v);
 int pv_vcpu_initialise(struct vcpu *v);
 void pv_domain_destroy(struct domain *d);
@@ -84,29 +82,6 @@ void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t 
val);
 
 bool xpti_pcid_enabled(void);
 
-#else  /* !CONFIG_PV */
-
-#include <xen/errno.h>
-
-static inline void pv_vcpu_destroy(struct vcpu *v) {}
-static inline int pv_vcpu_initialise(struct vcpu *v) { return -EOPNOTSUPP; }
-static inline void pv_domain_destroy(struct domain *d) {}
-static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; 
}
-
-static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0UL; }
-
-static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
-{
-    ASSERT_UNREACHABLE();
-    return 0;
-}
-static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
-{
-    ASSERT_UNREACHABLE();
-}
-
-#endif /* CONFIG_PV */
-
 void cf_check paravirt_ctxt_switch_from(struct vcpu *v);
 void cf_check paravirt_ctxt_switch_to(struct vcpu *v);
 
-- 
2.43.0




 


Rackspace

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