Skip to content

Commit 0cb26ec

Browse files
committed
KVM: selftests: Verify the guest can read back the x2APIC ICR it wrote
Now that the BUSY bit mess is gone (for x2APIC), verify that the *guest* can read back the ICR value that it wrote. Due to the divergent behavior between AMD and Intel with respect to the backing storage of the ICR in the vAPIC page, emulating a seemingly simple MSR write is quite complex. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 3426cb4 commit 0cb26ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/testing/selftests/kvm/x86_64/xapic_state_test.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ static void x2apic_guest_code(void)
4545
uint64_t val = x2apic_read_reg(APIC_IRR) |
4646
x2apic_read_reg(APIC_IRR + 0x10) << 32;
4747

48-
if (val & X2APIC_RSVD_BITS_MASK)
48+
if (val & X2APIC_RSVD_BITS_MASK) {
4949
x2apic_write_reg_fault(APIC_ICR, val);
50-
else
50+
} else {
5151
x2apic_write_reg(APIC_ICR, val);
52+
GUEST_ASSERT_EQ(x2apic_read_reg(APIC_ICR), val);
53+
}
5254
GUEST_SYNC(val);
5355
} while (1);
5456
}

0 commit comments

Comments
 (0)