Skip to contentSkip to conversation

x86/cpuid: Fix APIC bit clearing

PATCH In review [email protected] 3 participants 3 messages Jul 29, 2020 – Jul 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuid: Fix APIC bit clearing

From: Fam Zheng <[email protected]>

The bug is obvious here, other places in this function used "cpufeat_mask" correctly.

Fixes 46df8a65 ("x86/cpuid: Effectively remove pv_cpuid() and hvm_cpuid()")
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/cpuid.c +1 -1
index 6a4a787b68..63a03ef1e5 100644
@@ -1057,7 +1057,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         {
             /* Fast-forward MSR_APIC_BASE.EN. */
             if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
-                res->d &= ~cpufeat_bit(X86_FEATURE_APIC);
+                res->d &= ~cpufeat_mask(X86_FEATURE_APIC);
 
             /*
              * PSE36 is not supported in shadow mode.  This bit should be
Signature · 1 line
2.17.1
#2 lore raw
In reply to [email protected]
Quoted 16 lines · On 29/07/2020 17:33, [email protected] wrote:

From: Fam Zheng <[email protected]>

The bug is obvious here, other places in this function used "cpufeat_mask" correctly.

Fixes 46df8a65 ("x86/cpuid: Effectively remove pv_cpuid() and hvm_cpuid()")
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/cpuid.c +0 -0
index 6a4a787b68..63a03ef1e5 100644

xen/arch/x86/cpuid.c void guest_cpuid(const struct vcpu *v, uint32_t leaf, · line 1063

Quoted 8 lines
xen/arch/x86/cpuid.c +1 -1
@@ -1057,7 +1057,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         {
             /* Fast-forward MSR_APIC_BASE.EN. */
             if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
-                res->d &= ~cpufeat_bit(X86_FEATURE_APIC);
+                res->d &= ~cpufeat_mask(X86_FEATURE_APIC);
 
             /*
              * PSE36 is not supported in shadow mode.  This bit should be

Oops.  Good spot.

However, the Fixes you identify was just code movement.  The bug was actually introduced in b648feff8ea2c9bff250b4b262704fb100b1f9cf two years earlier.

I've tweaked the Fixes line and committed.

~Andrew