diff mbox series

[kvm-unit-tests,7/9] x86/apic: Run tests that modify APIC ID and/or APIC_BASE after other tests

Message ID 20221001011301.2077437-8-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series x86/apic: Cleanups and new tests | expand

Commit Message

Sean Christopherson Oct. 1, 2022, 1:12 a.m. UTC
Run the sub-tests that modify the APIC ID and/or APIC base address after
all other sub-tests.  KVM disables APICv/AVIC if the ID or base is
changed, and keeps APICv/AVIC disabled even if the original value is
restored.  I.e. run as many tests as possible with an APICv/AVIC friendly
setup.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/apic.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/x86/apic.c b/x86/apic.c
index 3c00137..5be44b8 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -676,10 +676,8 @@  int main(void)
 	const apic_test_fn tests[] = {
 		test_lapic_existence,
 
-		test_apic_id,
 		test_apic_disable,
 		test_enable_x2apic,
-		test_apicbase,
 
 		test_self_ipi_xapic,
 		test_self_ipi_x2apic,
@@ -694,6 +692,14 @@  int main(void)
 		test_apic_timer_one_shot,
 		test_apic_change_mode,
 		test_tsc_deadline_timer,
+
+		/*
+		 * KVM may disable APICv if the APIC ID and/or APIC_BASE is
+		 * modified, keep these tests at the end so that the test as a
+		 * whole provides coverage for APICv (when it's enabled).
+		 */
+		test_apic_id,
+		test_apicbase,
 	};
 
 	assert_msg(is_apic_hw_enabled() && is_apic_sw_enabled(),