Received: from eggs.gnu.org ([2001:4830:134:3::10]:38736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhTJ-0001WF-4y for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azhTH-0006cU-Jx for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhTH-0006cP-ET for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:23 -0400 From: Igor Mammedov Date: Mon, 9 May 2016 11:26:54 +0200 Message-Id: <1462786020-144172-9-git-send-email-imammedo@redhat.com> In-Reply-To: <1462786020-144172-1-git-send-email-imammedo@redhat.com> References: <1462786020-144172-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH RFC 08/14] 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: ehabkost@redhat.com, david@gibson.dropbear.id.au, mst@redhat.com, peter.maydell@linaro.org, rkrcmar@redhat.com, peterx@redhat.com, jan.kiszka@web.de, pbonzini@redhat.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 --- 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 e17b92c..eefb57d 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -37,6 +37,11 @@ void cpu_set_apic_base(DeviceState *dev, uint64_t val) if (dev) { APICCommonState *s = APIC_COMMON(dev); APICCommonClass *info = 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 = s->initial_apic_id; + } info->set_base(s, val); } } -- 1.8.3.1