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

[XEN][PATCH] x86/hvm: move hvm_shadow_handle_cd() under CONFIG_INTEL_VMX ifdef


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Thu, 23 Oct 2025 15:19:04 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • 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=lf4vObzCaBm4wdgjFD62T5/q8tMdWMcoYac2NfD3EFM=; b=aS/Es6m5L4fHjD60HQC1L8ohzHPEMRrA6TcrsZRYCFLvVN0wHiof+WP93KiHJJw/ojrGS6gy37k68cm9Qbx6ydp9i95+3YIVjra5+/VA7vqUMbNVWRj4dkapCxSiiljP6d6p/A4QaJHpS2Cn8pneY9RGaXcdm4pIQt5cYgU0xGzU4ih+YdcjYh7jN5a4gIB13G8iWWnllYXXLHvX7TRut/jcRqlqSrDeNKOEngQKmp2Uu3BHHyxDwiYpPiWrPDXyRE2NCcqK+PxIsZbndhgc12AAGpyAJDHs0eRxY/0e1WvxFbu8SjafGiIYF4kSM5pnrGSj1btVZBgOx4uP6agnYQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Np3/vy5mZPiLFmy3hQcdffICSiS57VGjxPUsy/a76mhXW1KDxt/ABoo90b7jcGGo1Qw9REW7BSn502HmXCa9M+mjUqtPrZSJrlyD0mYAVCul2kLv6Xop/QSJ/RuA8cD76lJScui/FLahmeRIaay4vFNQF8EpL88Cua6nTDqVP0oBNwAyJ9Mf35QMb+BO4Irve2K22Qd0RTCz5KZOE00LrU4/QpNOqnBUQYhUTmwwl1uW0uhRpSYgZVPeAYxWmHkP5fggdZrx+rZbk+ij3kubRoncLbSiLLEtJegJaeBZ5kO98XFoJcGrMHRtDJEUCZvDZlmOc6R4zTlIhEpA4I37aQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Grygorii Strashko <grygorii_strashko@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 23 Oct 2025 15:19:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcRDBecqTU/OGuGUKeptIGBfYF6g==
  • Thread-topic: [XEN][PATCH] x86/hvm: move hvm_shadow_handle_cd() under CONFIG_INTEL_VMX ifdef

From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>

Functions:
 hvm_shadow_handle_cd()
 hvm_set_uc_mode()
 domain_exit_uc_mode()
are used only by Intel VMX code, so move them under CONFIG_INTEL_VMX ifdef.

Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c | 50 ++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f1035fc9f645..3a30404d9940 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2168,30 +2168,6 @@ int hvm_set_efer(uint64_t value)
     return X86EMUL_OKAY;
 }
 
-/* Exit UC mode only if all VCPUs agree on MTRR/PAT and are not in no_fill. */
-static bool domain_exit_uc_mode(struct vcpu *v)
-{
-    struct domain *d = v->domain;
-    struct vcpu *vs;
-
-    for_each_vcpu ( d, vs )
-    {
-        if ( (vs == v) || !vs->is_initialised )
-            continue;
-        if ( (vs->arch.hvm.cache_mode == NO_FILL_CACHE_MODE) ||
-             mtrr_pat_not_equal(vs, v) )
-            return 0;
-    }
-
-    return 1;
-}
-
-static void hvm_set_uc_mode(struct vcpu *v, bool is_in_uc_mode)
-{
-    v->domain->arch.hvm.is_in_uc_mode = is_in_uc_mode;
-    shadow_blow_tables_per_domain(v->domain);
-}
-
 int hvm_mov_to_cr(unsigned int cr, unsigned int gpr)
 {
     struct vcpu *curr = current;
@@ -2273,6 +2249,31 @@ int hvm_mov_from_cr(unsigned int cr, unsigned int gpr)
     return X86EMUL_UNHANDLEABLE;
 }
 
+#ifdef CONFIG_INTEL_VMX
+/* Exit UC mode only if all VCPUs agree on MTRR/PAT and are not in no_fill. */
+static bool domain_exit_uc_mode(struct vcpu *v)
+{
+    struct domain *d = v->domain;
+    struct vcpu *vs;
+
+    for_each_vcpu ( d, vs )
+    {
+        if ( (vs == v) || !vs->is_initialised )
+            continue;
+        if ( (vs->arch.hvm.cache_mode == NO_FILL_CACHE_MODE) ||
+             mtrr_pat_not_equal(vs, v) )
+            return 0;
+    }
+
+    return 1;
+}
+
+static void hvm_set_uc_mode(struct vcpu *v, bool is_in_uc_mode)
+{
+    v->domain->arch.hvm.is_in_uc_mode = is_in_uc_mode;
+    shadow_blow_tables_per_domain(v->domain);
+}
+
 void hvm_shadow_handle_cd(struct vcpu *v, unsigned long value)
 {
     if ( value & X86_CR0_CD )
@@ -2306,6 +2307,7 @@ void hvm_shadow_handle_cd(struct vcpu *v, unsigned long 
value)
         spin_unlock(&v->domain->arch.hvm.uc_lock);
     }
 }
+#endif
 
 static void hvm_update_cr(struct vcpu *v, unsigned int cr, unsigned long value)
 {
-- 
2.34.1



 


Rackspace

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