[PATCH v2 1/5] vmx: Refactor vpid_sync_vcpu_gva()

Teddy Astie <[email protected]> Fri, 31 Jul 2026 16:46:19 +0200
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <1785509305.8631fc262581453bbf619ec5b2062170.19fb8a5db67000e099@vates.tech>
Reorganize the logic to drop the use of goto.

Signed-off-by: Teddy Astie <[email protected]>
---
v2: Introduced

 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index da04752e17..fe2cb4be0e 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -460,19 +460,16 @@ static inline void vpid_sync_vcpu_gva(struct vcpu *v, unsigned long gva)
      * If individual address invalidation is not supported, we escalate to
      * use single context invalidation.
      */
-    if ( likely(cpu_has_vmx_vpid_invvpid_individual_addr) )
-        goto execute_invvpid;
-
-    type = INVVPID_SINGLE_CONTEXT;
+    if ( unlikely(!cpu_has_vmx_vpid_invvpid_individual_addr) )
+        type = INVVPID_SINGLE_CONTEXT;
 
     /*
      * If single context invalidation is not supported, we escalate to
      * use all context invalidation.
      */
-    if ( !cpu_has_vmx_vpid_invvpid_single_context )
+    if ( unlikely(!cpu_has_vmx_vpid_invvpid_single_context) )
         type = INVVPID_ALL_CONTEXT;
 
-execute_invvpid:
     __invvpid(type, v->arch.hvm.n1asid.asid, (u64)gva);
 }
 
-- 
2.54.0



-- 
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech