qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL 02/17] pc: acpi: x2APIC support for SRAT table
Date: Mon, 24 Oct 2016 12:31:30 -0200	[thread overview]
Message-ID: <1477319505-20181-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1477319505-20181-1-git-send-email-ehabkost@redhat.com>

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/acpi-build.c        | 34 ++++++++++++++++++++++++----------
 include/hw/acpi/acpi-defs.h | 11 +++++++++++
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 385f9fc..93be96f 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2421,7 +2421,6 @@ static void
 build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
 {
     AcpiSystemResourceAffinityTable *srat;
-    AcpiSratProcessorAffinity *core;
     AcpiSratMemoryAffinity *numamem;
 
     int i;
@@ -2441,18 +2440,33 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
 
     for (i = 0; i < apic_ids->len; i++) {
         int j = numa_get_node_for_cpu(i);
-        int apic_id = apic_ids->cpus[i].arch_id;
+        uint32_t apic_id = apic_ids->cpus[i].arch_id;
 
-        core = acpi_data_push(table_data, sizeof *core);
-        core->type = ACPI_SRAT_PROCESSOR_APIC;
-        core->length = sizeof(*core);
-        core->local_apic_id = apic_id;
-        if (j < nb_numa_nodes) {
+        if (apic_id < 255) {
+            AcpiSratProcessorAffinity *core;
+
+            core = acpi_data_push(table_data, sizeof *core);
+            core->type = ACPI_SRAT_PROCESSOR_APIC;
+            core->length = sizeof(*core);
+            core->local_apic_id = apic_id;
+            if (j < nb_numa_nodes) {
                 core->proximity_lo = j;
+            }
+            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 = cpu_to_le32(apic_id);
+            if (j < nb_numa_nodes) {
+                core->proximity_domain = cpu_to_le32(j);
+            }
+            core->flags = cpu_to_le32(1);
         }
-        memset(core->proximity_hi, 0, 3);
-        core->local_sapic_eid = 0;
-        core->flags = cpu_to_le32(1);
     }
 
 
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index e94123c..fa89abc 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -503,6 +503,17 @@ 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
-- 
2.7.4

  parent reply	other threads:[~2016-10-24 14:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 14:31 [Qemu-devel] [PULL 00/17] x86 and CPU queue, 2016-10-24 Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 01/17] pc: acpi: x2APIC support for MADT table and _MAT method Eduardo Habkost
2016-10-24 14:31 ` Eduardo Habkost [this message]
2016-10-24 14:31 ` [Qemu-devel] [PULL 03/17] acpi: cphp: Force switch to modern cpu hotplug if APIC ID > 254 Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 04/17] pc: Leave max apic_id_limit only in legacy cpu hotplug code Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 05/17] pc: apic_common: Extend APIC ID property to 32bit Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 06/17] pc: apic_common: Restore APIC ID to initial ID on reset Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 07/17] pc: apic_common: Reset APIC ID to initial ID when switching into x2APIC mode Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 08/17] pc: kvm_apic: Pass APIC ID depending on xAPIC/x2APIC mode Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 09/17] pc: Clarify FW_CFG_MAX_CPUS usage comment Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 10/17] Increase MAX_CPUMASK_BITS from 255 to 288 Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 11/17] pc: Add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 12/17] pc: Require IRQ remapping and EIM if there could be x2APIC CPUs Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 13/17] pc: q35: Bump max_cpus to 288 Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 14/17] exec: split cpu_exec_init() Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 15/17] exec: move cpu_exec_init() calls to realize functions Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 16/17] exec: call cpu_exec_exit() from a CPU unrealize common function Eduardo Habkost
2016-10-24 14:31 ` [Qemu-devel] [PULL 17/17] target-i386: Print warning when mixing [+-]foo and foo=(on|off) Eduardo Habkost
2016-10-24 16:20 ` [Qemu-devel] [PULL 00/17] x86 and CPU queue, 2016-10-24 Peter Maydell
2016-10-24 16:34   ` Eduardo Habkost
2016-10-24 17:26     ` Peter Maydell
2016-10-24 19:09       ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477319505-20181-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).