public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: x86: Complain about an attempt to change the APIC base address
@ 2024-06-25 23:53 Jim Mattson
  2024-07-24 18:05 ` Jim Mattson
  0 siblings, 1 reply; 7+ messages in thread
From: Jim Mattson @ 2024-06-25 23:53 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Maxim Levitsky, kvm; +Cc: Jim Mattson

KVM does not support changing the APIC's base address. Prior to commit
3743c2f02517 ("KVM: x86: inhibit APICv/AVIC on changes to APIC ID or
APIC base"), it emitted a rate-limited warning about this. Now, it's
just silently broken.

Use vcpu_unimpl() to complain about this unsupported operation. Even a
rate-limited error message is better than complete silence.

Fixes: 3743c2f02517 ("KVM: x86: inhibit APICv/AVIC on changes to APIC ID or APIC base")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 Changes in v2:
  * Changed format specifiers from "%#llx" to "%#x"
  * Cast apic->base_address to unsigned int for printing
 
 arch/x86/kvm/lapic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index acd7d48100a1..43ac05d10b2e 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2583,6 +2583,9 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
 
 	if ((value & MSR_IA32_APICBASE_ENABLE) &&
 	     apic->base_address != APIC_DEFAULT_PHYS_BASE) {
+		vcpu_unimpl(vcpu, "APIC base %#x is not %#x",
+			    (unsigned int)apic->base_address,
+			    APIC_DEFAULT_PHYS_BASE);
 		kvm_set_apicv_inhibit(apic->vcpu->kvm,
 				      APICV_INHIBIT_REASON_APIC_BASE_MODIFIED);
 	}
-- 
2.45.2.741.gdbec12cfda-goog


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

end of thread, other threads:[~2024-07-24 22:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 23:53 [PATCH v2] KVM: x86: Complain about an attempt to change the APIC base address Jim Mattson
2024-07-24 18:05 ` Jim Mattson
2024-07-24 18:13   ` Maxim Levitsky
2024-07-24 18:34     ` Jim Mattson
2024-07-24 19:38       ` Sean Christopherson
2024-07-24 21:22         ` Jim Mattson
2024-07-24 22:22           ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox