Skip to contentSkip to conversation

x86: apic: Add test config to allow running apic tests against SVM's AVIC

PATCH New Sean Christopherson 1 participant 1 message Feb 4, 2022 KVM

lore
Share & tools
lore

Sean Christopherson

author reviewer
#0 lore raw

PATCH 1/1 x86: apic: Add test config to allow running apic tests against SVM's AVIC

Add a curated "xapic" test configuration that hides x2APIC from the guest and does not expose a PIT/8254 timer to the guest so that KVM won't disable AVIC due to incompatibilities.

Caveat emptor: actually running the test with AVIC enabled will fail miserably. KVM botches xAPIC ID changes[*], and then fails for reasons unknown after fixing the ID goof in the "write everything" case:

  memset((void *)APIC_DEFAULT_PHYS_BASE, 0xff, PAGE_SIZE);

But, AVIC is off by default and requires disabling nested support, i.e. only people doing actual AVIC work will be affected because it's highly unlikely to be enabled by accident.

[*] https://lore.kernel.org/all/[email protected]

---
 x86/unittests.cfg | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
x86/unittests.cfg +14 -1
index 9a70ba3b..f46fb715 100644
@@ -30,18 +30,31 @@ file = apic.flat
 smp = 2
 extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine kernel_irqchip=split
 arch = x86_64
+groups = apic
 
 [ioapic-split]
 file = ioapic.flat
 extra_params = -cpu qemu64 -machine kernel_irqchip=split
 arch = x86_64
+groups = apic
 
-[apic]
+[x2apic]
 file = apic.flat
 smp = 2
 extra_params = -cpu qemu64,+x2apic,+tsc-deadline
 arch = x86_64
 timeout = 30
+groups = apic
+
+# Hide x2APIC and don't create a Programmable Interval Timer (PIT, a.k.a 8254)
+# to allow testing SVM's AVIC, which is disabled if either is exposed to the guest.
+[xapic]
+file = apic.flat
+smp = 2
+extra_params = -cpu qemu64,-x2apic,+tsc-deadline -machine pit=off
+arch = x86_64
+timeout = 30
+groups = apic
 
 [ioapic]
 file = ioapic.flat

base-commit: dbf4a3c3b469a2d92366a58f481d13c98a78eecc

Signature · 1 line
2.35.0.263.gb82422642f-goog