kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: Prevent APIC base address from changing in test_enable_x2apic()
@ 2019-04-15 18:31 nadav.amit
  2019-04-15 19:00 ` Sean Christopherson
  0 siblings, 1 reply; 7+ messages in thread
From: nadav.amit @ 2019-04-15 18:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Nadav Amit

From: Nadav Amit <nadav.amit@gmail.com>

test_enable_x2apic() unintentionally changes the APIC base address to
zero and resets the BSP indication. This actually causes the local APIC
to overlap the IDT area, which is wrong. Prevent it from happening by
keeping the APIC base address and BSP-bit as it was before.

Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 x86/apic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/x86/apic.c b/x86/apic.c
index 51744cf..0849f87 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -90,11 +90,11 @@ static void test_enable_x2apic(void)
         report("disabled to x2apic enabled",
                test_write_apicbase_exception(APIC_EN | APIC_EXTD));
 
-        wrmsr(MSR_IA32_APICBASE, APIC_EN);
+        wrmsr(MSR_IA32_APICBASE, APIC_EN | APIC_DEFAULT_PHYS_BASE | APIC_BSP);
         report("apic enabled to invalid state",
                test_write_apicbase_exception(APIC_EXTD));
 
-        wrmsr(MSR_IA32_APICBASE, APIC_EN | APIC_EXTD);
+        wrmsr(MSR_IA32_APICBASE, APIC_EN | APIC_EXTD | APIC_DEFAULT_PHYS_BASE | APIC_BSP);
         apic_write(APIC_SPIV, 0x1ff);
     } else {
         printf("x2apic not detected\n");
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-15 19:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-15 18:31 [kvm-unit-tests PATCH] x86: Prevent APIC base address from changing in test_enable_x2apic() nadav.amit
2019-04-15 19:00 ` Sean Christopherson
2019-04-15 19:09   ` Nadav Amit
2019-04-15 19:12     ` Nadav Amit
2019-04-15 19:37       ` Sean Christopherson
2019-04-15 19:55         ` Nadav Amit
2019-04-15 19:59           ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).