From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwpdF-0007vz-Fp for qemu-devel@nongnu.org; Wed, 19 Oct 2016 08:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwpdE-0003HD-Jo for qemu-devel@nongnu.org; Wed, 19 Oct 2016 08:06:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42480) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwpdE-0003GV-EL for qemu-devel@nongnu.org; Wed, 19 Oct 2016 08:06:04 -0400 From: Igor Mammedov Date: Wed, 19 Oct 2016 14:05:37 +0200 Message-Id: <1476878743-144953-8-git-send-email-imammedo@redhat.com> In-Reply-To: <1476878743-144953-1-git-send-email-imammedo@redhat.com> References: <1476878743-144953-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 07/13] pc: apic_common: reset APIC ID to initial ID when switching into x2APIC mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, ehabkost@redhat.com, liuxiaojian6@huawei.com, mst@redhat.com, rkrcmar@redhat.com, peterx@redhat.com, kevin@koconnor.net, pbonzini@redhat.com, lersek@redhat.com, chao.gao@intel.com SDM: x2APIC State Transitions: State Changes From xAPIC Mode to x2APIC Mode " Any APIC ID value written to the memory-mapped local APIC ID register is not preserved " Signed-off-by: Igor Mammedov Reviewed-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- hw/intc/apic_common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index ea3c8ca..d78c885 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -40,6 +40,11 @@ void cpu_set_apic_base(DeviceState *dev, uint64_t val) if (dev) { APICCommonState *s =3D APIC_COMMON(dev); APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); + /* switching to x2APIC, reset possibly modified xAPIC ID */ + if (!(s->apicbase & MSR_IA32_APICBASE_EXTD) && + (val & MSR_IA32_APICBASE_EXTD)) { + s->id =3D s->initial_apic_id; + } info->set_base(s, val); } } --=20 2.7.4