[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 7/8] libacpi: build madt/srat according cpu topology
Callers pass an APIC_ID array to libacpi and libacpi will use this array to fill the APIC_ID field of MADT and SRAT. Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx> --- tools/firmware/hvmloader/util.c | 8 ++++++-- tools/libacpi/build.c | 4 ++-- tools/libacpi/libacpi.h | 5 ++++- tools/libxl/libxl_x86_acpi.c | 6 ++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index 0c3f2d2..e4c7eb3 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -22,6 +22,7 @@ #include "hypercall.h" #include "ctype.h" #include "vnuma.h" +#include "topology.h" #include <acpi2_0.h> #include <libacpi.h> #include <stdint.h> @@ -883,9 +884,9 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt, /* ACPI builder currently doesn't free memory so this is just a stub */ } -static uint32_t acpi_lapic_id(unsigned cpu) +static uint32_t acpi_lapic_id(unsigned cpu, const struct acpi_config *config) { - return LAPIC_ID(cpu); + return config->topology_id[cpu]; } void hvmloader_acpi_build_tables(struct acpi_config *config, @@ -981,6 +982,9 @@ void hvmloader_acpi_build_tables(struct acpi_config *config, config->numa.vdistance = vdistance; config->numa.vmemrange = vmemrange; + config->topology_id = topology_id; + config->topology_id_size = topology_id_size; + config->hvminfo = hvm_info; config->rsdp = physical; diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c index f9881c9..3cd5eb9 100644 --- a/tools/libacpi/build.c +++ b/tools/libacpi/build.c @@ -156,7 +156,7 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, lapic->length = sizeof(*lapic); /* Processor ID must match processor-object IDs in the DSDT. */ lapic->acpi_processor_id = i; - lapic->apic_id = config->lapic_id(i); + lapic->apic_id = config->lapic_id(i, config); lapic->flags = (test_bit(i, hvminfo->vcpu_online) ? ACPI_LOCAL_APIC_ENABLED : 0); lapic++; @@ -244,7 +244,7 @@ static struct acpi_20_srat *construct_srat(struct acpi_ctxt *ctxt, processor->type = ACPI_PROCESSOR_AFFINITY; processor->length = sizeof(*processor); processor->domain = config->numa.vcpu_to_vnode[i]; - processor->apic_id = config->lapic_id(i); + processor->apic_id = config->lapic_id(i, config); processor->flags = ACPI_LOCAL_APIC_AFFIN_ENABLED; processor++; } diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h index a2efd23..981ad10 100644 --- a/tools/libacpi/libacpi.h +++ b/tools/libacpi/libacpi.h @@ -91,11 +91,14 @@ struct acpi_config { unsigned long rsdp; /* x86-specific parameters */ - uint32_t (*lapic_id)(unsigned cpu); + uint32_t (*lapic_id)(unsigned cpu, const struct acpi_config *config); uint32_t lapic_base_address; uint32_t ioapic_base_address; uint16_t pci_isa_irq_mask; uint8_t ioapic_id; + /* CPU topology info */ + uint32_t *topology_id; + uint32_t topology_id_size; }; int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config); diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c index 9a7c904..1a227f6 100644 --- a/tools/libxl/libxl_x86_acpi.c +++ b/tools/libxl/libxl_x86_acpi.c @@ -84,9 +84,9 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt, { } -static uint32_t acpi_lapic_id(unsigned cpu) +static uint32_t acpi_lapic_id(unsigned cpu, const struct acpi_config *config) { - return cpu * 2; + return config->topology_id[cpu]; } static int init_acpi_config(libxl__gc *gc, @@ -155,6 +155,8 @@ static int init_acpi_config(libxl__gc *gc, config->lapic_base_address = LAPIC_BASE_ADDRESS; config->lapic_id = acpi_lapic_id; config->acpi_revision = 5; + config->topology_id = b_info->u.hvm.cpu_topology.tid; + config->topology_id_size = b_info->u.hvm.cpu_topology.tid_size; rc = 0; out: -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |