@@ -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);
+ }
}
@@ -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
Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/i386/acpi-build.c | 36 ++++++++++++++++++++++++------------ include/hw/acpi/acpi-defs.h | 13 +++++++++++++ 2 files changed, 37 insertions(+), 12 deletions(-)