[PATCH] VMX: no open-coding in vmx_get_cpl()

Jan Beulich posted 1 patch 1 week, 3 days ago
Failed in applying to current master (apply log)
[PATCH] VMX: no open-coding in vmx_get_cpl()
Posted by Jan Beulich 1 week, 3 days ago
Neither X86_SEG_AR_DPL nor MASK_EXTR() should really be avoided here,
using literal number instead.

No difference in generated code (with gcc13 at least).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1192,7 +1192,7 @@ unsigned int vmx_get_cpl(void)
 
     __vmread(GUEST_SS_AR_BYTES, &attr);
 
-    return (attr >> 5) & 3;
+    return MASK_EXTR(attr, X86_SEG_AR_DPL);
 }
 
 static unsigned int cf_check _vmx_get_cpl(struct vcpu *v)
Re: [PATCH] VMX: no open-coding in vmx_get_cpl()
Posted by Andrew Cooper 1 week, 3 days ago
On 25/04/2024 2:27 pm, Jan Beulich wrote:
> Neither X86_SEG_AR_DPL nor MASK_EXTR() should really be avoided here,
> using literal number instead.
>
> No difference in generated code (with gcc13 at least).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooepr <andrew.cooper3@citrix.com>