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

[PATCH 5/5] x86/svm: Cleanup ns_hostflags type


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Mon, 28 Sep 2026 15:02:48 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=yMJzt6L6bcJSEggHxrbpuzZCx1VItw2tCO771R6djyQ=; b=rRKYkyKNY6rPbppV7ZwQHnGMStuR0OO1bXljDPURcVp/4V/VeAcLGJUkc46kz7sBDHhlzypaep/NDUBHZGSpV2bPG09/0O+EU0u4WJMhatjKLRwBtXJDFvN1OP8+V3Yz9ESdmF8RhCarDLFV31m0Jh5oKcAq5lxz5pfe+ICx6OYG6/r3c1ZHj7cmT28/WLUcJnQ9GRQIcxQmdtlXfDwwpl6mfLSsAjXunCIjnR/uaPYG+Z/nQz1FSozeF7RyLReQ+TVjfrl/bg3Ook7Avpia5Q8VeckmvZLBaZj3Y2OPGbisG33NZQIUg9fsRbqMv6xuj+m2ZjyVQfgmPRZXmFURHQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tfc2OJ3c+ARAowpApO4EIaXK9kBs9OQZyd1z9STN3CKKYjdbVW7V8nMkUpYjCbHpUd2ivY5UhbEWzSlhXuA+PUXIJaHj97NjO8kLL/1CUVYgTfHIPf3p6F0bUca/ubn4etGfwn9b4ERcM9Jf+hk1yybHRiur9xmYToKJQopEtq3tgeD7w/3mCCa2BqTElP/NNzGYOWzCtMflZ9nWM3VmTzVCn0hTVUY45fd21tXKGZdh15eCxUzq0M4d5/QKIQvZzWi2TOHZL6uQBKHS2V2fb/EJJr50XOHPFrUPnQyjs6fJOWt3eV+8RU3D51gHWspnk/FwRGDZVlrq112Sr3CNPA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Mon, 28 Sep 2026 14:03:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Rearrange the union to drop the .fields infix, rename bytes to the more
common raw, and adjust types where appropriate. Adjust the users
accordingly.

No functional change intended.

Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/nestedsvm.c         | 12 ++++++------
 xen/arch/x86/include/asm/hvm/svm-types.h |  9 ++++-----
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 1ef4c5c83f16..47704d8ded80 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -151,7 +151,7 @@ int cf_check nsvm_vcpu_reset(struct vcpu *v)
     svm->ns_vmcb_guestcr3 = 0;
     svm->ns_vmcb_hostcr3 = 0;
     svm->ns_asid = 0;
-    svm->ns_hostflags.bytes = 0;
+    svm->ns_hostflags.raw = 0;
     svm->ns_vmexit.exitinfo1 = 0;
     svm->ns_vmexit.exitinfo2 = 0;
 
@@ -182,7 +182,7 @@ static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int 
inst_len)
     n1vmcb->_cr4 = v->arch.hvm.guest_cr[4];
 
     /* Remember the host interrupt flag */
-    svm->ns_hostflags.fields.rflagsif = !!(n1vmcb->rflags & X86_EFLAGS_IF);
+    svm->ns_hostflags.rflagsif = !!(n1vmcb->rflags & X86_EFLAGS_IF);
 
     return 0;
 }
@@ -651,7 +651,7 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct cpu_user_regs 
*regs,
     svm->ns_hap_enabled = vmcb_get_np(ns_vmcb);
 
     /* Remember the V_INTR_MASK in hostflags */
-    svm->ns_hostflags.fields.vintrmask = !!ns_vmcb->_vintr.intr_masking;
+    svm->ns_hostflags.vintrmask = !!ns_vmcb->_vintr.intr_masking;
 
     /* Save l1 guest state (= host state) */
     ret = nsvm_vcpu_hostsave(v, inst_len);
@@ -993,7 +993,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct 
cpu_user_regs *regs)
 
     /* Virtual Interrupts */
     ns_vmcb->_vintr = n2vmcb->_vintr;
-    if ( !svm->ns_hostflags.fields.vintrmask )
+    if ( !svm->ns_hostflags.vintrmask )
         ns_vmcb->_vintr.intr_masking = 0;
 
     /* Interrupt state */
@@ -1174,8 +1174,8 @@ enum hvm_intblk cf_check nsvm_intr_blocked(struct vcpu *v)
     {
         struct vmcb_struct *n2vmcb = nv->nv_n2vmcx;
 
-        if ( svm->ns_hostflags.fields.vintrmask &&
-             !svm->ns_hostflags.fields.rflagsif )
+        if ( svm->ns_hostflags.vintrmask &&
+             !svm->ns_hostflags.rflagsif )
             return hvm_intblk_rflags_ie;
 
         /* when l1 guest passes its devices through to the l2 guest
diff --git a/xen/arch/x86/include/asm/hvm/svm-types.h 
b/xen/arch/x86/include/asm/hvm/svm-types.h
index beab9a3af203..71427b3c11d1 100644
--- a/xen/arch/x86/include/asm/hvm/svm-types.h
+++ b/xen/arch/x86/include/asm/hvm/svm-types.h
@@ -77,12 +77,11 @@ struct nestedsvm {
     } ns_vmexit;
 
     union {
-        uint32_t bytes;
         struct {
-            uint32_t rflagsif:1;
-            uint32_t vintrmask:1;
-            uint32_t reserved:30;
-        } fields;
+            bool rflagsif:1;
+            bool vintrmask:1;
+        };
+        uint32_t raw;
     } ns_hostflags;
 };
 
-- 
2.55.0




 


Rackspace

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