From patchwork Mon May 9 09:26:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 9044001 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B869BF29F for ; Mon, 9 May 2016 09:29:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A84882011E for ; Mon, 9 May 2016 09:29:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4F5720108 for ; Mon, 9 May 2016 09:29:37 +0000 (UTC) Received: from localhost ([::1]:40184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhVQ-00062U-Tk for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 May 2016 05:29:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhTB-0001Ie-US for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azhT4-0006ZZ-MZ for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhT4-0006Yt-Es for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:10 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1931B85366; Mon, 9 May 2016 09:27:10 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u499R2fL014884; Mon, 9 May 2016 05:27:08 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 9 May 2016 11:26:48 +0200 Message-Id: <1462786020-144172-3-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 02/14] pc: acpi: x2APIC support for SRAT table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, rkrcmar@redhat.com, peterx@redhat.com, jan.kiszka@web.de, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 36 ++++++++++++++++++++++++------------ include/hw/acpi/acpi-defs.h | 13 +++++++++++++ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 668b6bc..e5ba704 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2366,7 +2366,6 @@ static void build_srat(GArray *table_data, GArray *linker, MachineState *machine) { AcpiSystemResourceAffinityTable *srat; - AcpiSratProcessorAffinity *core; AcpiSratMemoryAffinity *numamem; int i; @@ -2386,17 +2385,30 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine) srat->reserved1 = cpu_to_le32(1); for (i = 0; i < apic_ids->len; i++) { - int apic_id = apic_ids->cpus[i].arch_id; - - core = acpi_data_push(table_data, sizeof *core); - core->type = ACPI_SRAT_PROCESSOR; - core->length = sizeof(*core); - core->local_apic_id = apic_id; - curnode = pcms->node_cpu[i]; - core->proximity_lo = curnode; - memset(core->proximity_hi, 0, 3); - core->local_sapic_eid = 0; - core->flags = cpu_to_le32(1); + uint32_t apic_id = apic_ids->cpus[i].arch_id; + + if (apic_id < 255) { + AcpiSratProcessorAffinity *core; + + core = acpi_data_push(table_data, sizeof *core); + core->type = ACPI_SRAT_PROCESSOR; + core->length = sizeof(*core); + core->local_apic_id = apic_id; + curnode = pcms->node_cpu[i]; + core->proximity_lo = curnode; + memset(core->proximity_hi, 0, 3); + core->local_sapic_eid = 0; + core->flags = cpu_to_le32(1); + } else { + AcpiSratProcessorX2ApicAffinity *core; + + core = acpi_data_push(table_data, sizeof *core); + core->type = ACPI_SRAT_PROCESSOR_X2APIC; + core->length = sizeof(*core); + core->x2apic_id = apic_id; + core->proximity_domain = cpu_to_le32(pcms->node_cpu[i]); + core->flags = cpu_to_le32(1); + } } diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index a821248..9af349c 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -476,6 +476,7 @@ typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable; #define ACPI_SRAT_PROCESSOR 0 #define ACPI_SRAT_MEMORY 1 +#define ACPI_SRAT_PROCESSOR_X2APIC 2 struct AcpiSratProcessorAffinity { @@ -489,6 +490,18 @@ struct AcpiSratProcessorAffinity } QEMU_PACKED; typedef struct AcpiSratProcessorAffinity AcpiSratProcessorAffinity; +struct AcpiSratProcessorX2ApicAffinity +{ + ACPI_SUB_HEADER_DEF + uint16_t reserved; + uint32_t proximity_domain; + uint32_t x2apic_id; + uint32_t flags; + uint32_t clk_domain; + uint32_t reserved2; +} QEMU_PACKED; +typedef struct AcpiSratProcessorX2ApicAffinity AcpiSratProcessorX2ApicAffinity; + struct AcpiSratMemoryAffinity { ACPI_SUB_HEADER_DEF