@@ -15,6 +15,11 @@ static bool is_apic_hw_enabled(void)
return rdmsr(MSR_IA32_APICBASE) & APIC_EN;
}
+static bool is_apic_sw_enabled(void)
+{
+ return apic_read(APIC_SPIV) & APIC_SPIV_APIC_ENABLED;
+}
+
static bool is_x2apic_enabled(void)
{
return (rdmsr(MSR_IA32_APICBASE) & (APIC_EN | APIC_EXTD)) == (APIC_EN | APIC_EXTD);
@@ -691,6 +696,9 @@ static void test_pv_ipi(void)
int main(void)
{
+ assert_msg(is_apic_hw_enabled() && is_apic_sw_enabled(),
+ "APIC should be fully enabled by startup code.");
+
setup_vm();
test_lapic_existence();
Assert that vCPU's APIC is fully enabled at the start of the apic test. The boot code is supposed to do that, but nothing ever actually verifies the APIC got setup correctly. Signed-off-by: Sean Christopherson <seanjc@google.com> --- x86/apic.c | 8 ++++++++ 1 file changed, 8 insertions(+)