All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: nVMX: CPUID.01H:EDX.APIC[bit 9] should mirror IA32_APIC_BASE[11]
@ 2016-11-04 22:00 Jim Mattson
  2016-11-08 16:33 ` Radim Krčmář
  0 siblings, 1 reply; 17+ messages in thread
From: Jim Mattson @ 2016-11-04 22:00 UTC (permalink / raw)
  To: kvm; +Cc: Jim Mattson

>From the Intel SDM, volume 3, section 10.4.3, "Enabling or Disabling the
Local APIC,"

  When IA32_APIC_BASE[11] is 0, the processor is functionally equivalent
  to an IA-32 processor without an on-chip APIC. The CPUID feature flag
  for the APIC (see Section 10.4.2, "Presence of the Local APIC") is
  also set to 0.

Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Ben Serebrin <serebrin@google.com>
Reviewed-by: David Matlack <dmatlack@google.com>
---
 arch/x86/kvm/cpuid.c | 3 +++
 arch/x86/kvm/lapic.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index afa7bbb..0a49fd2 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -81,7 +81,10 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)
 			best->ecx |= F(OSXSAVE);
 	}
 
+	best->edx &= ~F(APIC);
 	if (apic) {
+		if (vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE)
+			best->edx |= F(APIC);
 		if (best->ecx & F(TSC_DEADLINE_TIMER))
 			apic->lapic_timer.timer_mode_mask = 3 << 17;
 		else
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 23b99f3..eda4284e 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1758,6 +1758,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
 
 	/* update jump label if enable bit changes */
 	if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
+		kvm_update_cpuid(vcpu);
 		if (value & MSR_IA32_APICBASE_ENABLE) {
 			kvm_apic_set_xapic_id(apic, vcpu->vcpu_id);
 			static_key_slow_dec_deferred(&apic_hw_disabled);
-- 
2.8.0.rc3.226.g39d4020


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

end of thread, other threads:[~2016-11-22 13:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04 22:00 [PATCH] kvm: nVMX: CPUID.01H:EDX.APIC[bit 9] should mirror IA32_APIC_BASE[11] Jim Mattson
2016-11-08 16:33 ` Radim Krčmář
2016-11-09 16:53   ` Jim Mattson
2016-11-09 17:04     ` [PATCH v2] " Jim Mattson
2016-11-09 17:14       ` Paolo Bonzini
2016-11-09 17:28         ` Jim Mattson
2016-11-09 17:37           ` Paolo Bonzini
2016-11-09 17:41             ` Jim Mattson
2016-11-09 17:43               ` Paolo Bonzini
     [not found]                 ` <CALMp9eRek+NYZJYfT5TwCR+w=1hdS6e-O+Hm_RzF5MCykOHtWA@mail.gmail.com>
2016-11-10 17:18                   ` Paolo Bonzini
2016-11-14 18:14                     ` [kvm-unit-tests PATCH] x86: Test disabled local APIC Jim Mattson
2016-11-22 13:55                       ` Radim Krčmář
2016-11-09 17:50               ` [PATCH v3] kvm: nVMX: CPUID.01H:EDX.APIC[bit 9] should mirror IA32_APIC_BASE[11] Jim Mattson
2016-11-22 13:53                 ` Radim Krčmář
2016-11-09 17:15       ` [PATCH v2] " Igor Mammedov
2016-11-09 17:37         ` Eduardo Habkost
2016-11-09 17:42         ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.