From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: preserve x2APIC LDR on INIT Date: Tue, 26 May 2015 12:38:10 +0200 Message-ID: <55644D12.6020301@redhat.com> References: <1432315330-20872-1-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org Return-path: In-Reply-To: <1432315330-20872-1-git-send-email-rkrcmar@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 22/05/2015 19:22, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > Logical x2APIC stops working if we rewrite it with zeros. > The best references are SDM April 2015: 10.12.10.1 Logical Destinatio= n > Mode in x2APIC Mode >=20 > [...], the LDR are initialized by hardware based on the value of > x2APIC ID upon x2APIC state transitions. >=20 > and SDM April 2015: 10.12.10.2 Deriving Logical x2APIC ID from the Lo= cal > x2APIC ID >=20 > The LDR initialization occurs whenever the x2APIC mode is enabled >=20 > Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > --- > arch/x86/kvm/lapic.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index c2a7d8a7a414..c789e00dfa8b 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -1594,7 +1594,8 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, boo= l init_event) > apic_set_reg(apic, APIC_DFR, 0xffffffffU); > apic_set_spiv(apic, 0xff); > apic_set_reg(apic, APIC_TASKPRI, 0); > - kvm_apic_set_ldr(apic, 0); > + if (!apic_x2apic_mode(apic)) > + kvm_apic_set_ldr(apic, 0); > apic_set_reg(apic, APIC_ESR, 0); > apic_set_reg(apic, APIC_ICR, 0); > apic_set_reg(apic, APIC_ICR2, 0); >=20 Applied, thanks. Paolo