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

[PATCH] x86/cpuid: gate the hypervisor PV-only leaf on is_pv_domain()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
  • Date: Wed, 26 Aug 2026 15:25:26 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 149.199.90.133) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine 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=8VD7YGXn1R4mrSF8Z9nVENyoKgDNQ1X3q79iAvYgzDY=; b=NBeU+vgTTV1GTQXYEUNGYmijRlc2LjqxxsyGJzueB+LT/mpWVkzOg4U2cFFntkcAbWfk6ha2i6mJCFo0301zIqaotuYo4ivjwalJw803ZLfAUES3s4PC0o/XwK7QFN7ZWfe4/Zh2Eg2o8AZKx6xJpqVEDwS9I8rzZrh/AxLNzOGlSL7BlhVUcUKuzJ+UjWN3qDlTkEgroC6LiePCLHYcUjgcFn4k4vkeffVPsFyHAQjTCyEC9d+LtjfrsGtAPLqigOSfEdp15xk5brxwxJ8my2m3OATqYKxR2pqPorDBve05OjkfN6Ydfgs9LnpTUmST2imydmg+h1yLR37SdEFDyA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FUbrDCt87TUHqMcTARr8GSI0MmAW+dwPkwUTCiekhcKvVvlNzjbPzL8GEEZcHC2yqeabIej+LFXMMdN8jPEk1lh/LjwmOLeXRHM7KgUZ3Bfp6spLAShWqqEfFXEypXF1O44J2quuaYq5GUWI3os9zvJO6DrnNfrfnlhVckxb+GLK+YE2Q2vixGppDRyOxw5GglEiLcO8Jzi0gmVNJ2CWLMNB9Fm38sCe+jDBnTb9uahMBQd9EQEzxXi6OnThoNEDIDuFISQBakw79Ml53rB0PtFlyR/w7p6lIyLpAr1EjzhpUpwcPMv69vtJJAEgYaHXWIZnEWxZAfEgyEprtRujcg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Teddy Astie <teddy.astie@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • Delivery-date: Wed, 26 Aug 2026 07:26:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hypervisor leaf 5 is PV-specific, but is gated with !is_hvm_domain(),
which stays a runtime test in a build without PV support. Test for a
PV domain directly so the compiler can discard the leaf when
CONFIG_PV is disabled.

Suggested-by: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 6e9b15c9c3..a9aeb2d268 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -157,7 +157,7 @@ static void cpuid_hypervisor_leaves(const struct vcpu *v, 
uint32_t leaf,
         break;
 
     case 5: /* PV-specific parameters */
-        if ( is_hvm_domain(d) || subleaf != 0 )
+        if ( !is_pv_domain(d) || subleaf != 0 )
             break;
 
         res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
-- 
2.53.0




 


Rackspace

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