Skip to contentSkip to conversation

x86: Fix APIC version register test

PATCH Applied [email protected] 2 participants 2 messages Apr 30, 2019 – May 20, 2019 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Fix APIC version register test

From: Nadav Amit <[email protected]>

The local APIC existance test considers reserved bits (bits [8:15]), which is not good. In addition, it is best to consider every integrated APIC version as valid.

Cc Sean Christopherson <[email protected]>
---
 x86/apic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
x86/apic.c +4 -4
index cfdbef2..21041ec 100644
@@ -11,11 +11,11 @@
 
 static void test_lapic_existence(void)
 {
-    u32 lvr;
+    u8 version;
 
-    lvr = apic_read(APIC_LVR);
-    printf("apic version: %x\n", lvr);
-    report("apic existence", (u16)lvr == 0x14);
+    version = (u8)apic_read(APIC_LVR);
+    printf("apic version: %x\n", version);
+    report("apic existence", version >= 0x10 && version <= 0x15);
 }
 
 #define TSC_DEADLINE_TIMER_VECTOR 0xef
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 23 lines · On 30/04/19 16:32, [email protected] wrote:

From: Nadav Amit <[email protected]>

The local APIC existance test considers reserved bits (bits [8:15]), which is not good. In addition, it is best to consider every integrated APIC version as valid.

Cc Sean Christopherson <[email protected]>
---
 x86/apic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
x86/apic.c +1 -1
index cfdbef2..21041ec 100644
@@ -11,11 +11,11 @@
 
 static void test_lapic_existence(void)
 {
-    u32 lvr;
+    u8 version;

x86/apic.c line 21

Quoted 10 lines
x86/apic.c +3 -3
 
-    lvr = apic_read(APIC_LVR);
-    printf("apic version: %x\n", lvr);
-    report("apic existence", (u16)lvr == 0x14);
+    version = (u8)apic_read(APIC_LVR);
+    printf("apic version: %x\n", version);
+    report("apic existence", version >= 0x10 && version <= 0x15);
 }
 
 #define TSC_DEADLINE_TIMER_VECTOR 0xef

Queued, thanks.

Paolo