From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>,
Marcel Apfelbaum <marcel.a@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v2 13/14] pc: Move APIC and NUMA data from PcGuestInfo to PCMachineState
Date: Fri, 11 Dec 2015 16:42:32 -0200 [thread overview]
Message-ID: <1449859353-1574-14-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1449859353-1574-1-git-send-email-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/i386/acpi-build.c | 22 +++++++++-------------
hw/i386/pc.c | 20 ++++++++++----------
include/hw/i386/pc.h | 14 +++++++++-----
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 43d8166..a1f7ea0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -368,7 +368,6 @@ static void
build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu)
{
PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
- PcGuestInfo *guest_info = &pcms->acpi_guest_info;
int madt_start = table_data->len;
AcpiMultipleApicTable *madt;
@@ -381,7 +380,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu)
madt->local_apic_address = cpu_to_le32(APIC_DEFAULT_ADDRESS);
madt->flags = cpu_to_le32(1);
- for (i = 0; i < guest_info->apic_id_limit; i++) {
+ for (i = 0; i < pcms->apic_id_limit; i++) {
AcpiMadtProcessorApic *apic = acpi_data_push(table_data, sizeof *apic);
apic->type = ACPI_APIC_PROCESSOR;
apic->length = sizeof(*apic);
@@ -401,7 +400,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu)
io_apic->address = cpu_to_le32(IO_APIC_DEFAULT_ADDRESS);
io_apic->interrupt = cpu_to_le32(0);
- if (guest_info->apic_xrupt_override) {
+ if (pcms->apic_xrupt_override) {
intsrcovr = acpi_data_push(table_data, sizeof *intsrcovr);
intsrcovr->type = ACPI_APIC_XRUPT_OVERRIDE;
intsrcovr->length = sizeof(*intsrcovr);
@@ -933,9 +932,8 @@ build_ssdt(GArray *table_data, GArray *linker,
{
MachineState *machine = MACHINE(qdev_get_machine());
PCMachineState *pcms = PC_MACHINE(machine);
- PcGuestInfo *guest_info = &pcms->acpi_guest_info;
uint32_t nr_mem = machine->ram_slots;
- unsigned acpi_cpus = guest_info->apic_id_limit;
+ unsigned acpi_cpus = pcms->apic_id_limit;
Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx;
PCIBus *bus = NULL;
GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free);
@@ -1467,7 +1465,6 @@ build_srat(GArray *table_data, GArray *linker)
int srat_start, numa_start, slots;
uint64_t mem_len, mem_base, next_base;
PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
- PcGuestInfo *guest_info = &pcms->acpi_guest_info;
ram_addr_t hotplugabble_address_space_size =
object_property_get_int(OBJECT(pcms), PC_MACHINE_MEMHP_REGION_SIZE,
NULL);
@@ -1478,12 +1475,12 @@ build_srat(GArray *table_data, GArray *linker)
srat->reserved1 = cpu_to_le32(1);
core = (void *)(srat + 1);
- for (i = 0; i < guest_info->apic_id_limit; ++i) {
+ for (i = 0; i < pcms->apic_id_limit; ++i) {
core = acpi_data_push(table_data, sizeof *core);
core->type = ACPI_SRAT_PROCESSOR;
core->length = sizeof(*core);
core->local_apic_id = i;
- curnode = guest_info->node_cpu[i];
+ curnode = pcms->node_cpu[i];
core->proximity_lo = curnode;
memset(core->proximity_hi, 0, 3);
core->local_sapic_eid = 0;
@@ -1500,9 +1497,9 @@ build_srat(GArray *table_data, GArray *linker)
numamem = acpi_data_push(table_data, sizeof *numamem);
acpi_build_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED);
next_base = 1024 * 1024;
- for (i = 1; i < guest_info->numa_nodes + 1; ++i) {
+ for (i = 1; i < pcms->numa_nodes + 1; ++i) {
mem_base = next_base;
- mem_len = guest_info->node_mem[i - 1];
+ mem_len = pcms->node_mem[i - 1];
if (i == 1) {
mem_len -= 1024 * 1024;
}
@@ -1526,7 +1523,7 @@ build_srat(GArray *table_data, GArray *linker)
MEM_AFFINITY_ENABLED);
}
slots = (table_data->len - numa_start) / sizeof *numamem;
- for (; slots < guest_info->numa_nodes + 2; slots++) {
+ for (; slots < pcms->numa_nodes + 2; slots++) {
numamem = acpi_data_push(table_data, sizeof *numamem);
acpi_build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
}
@@ -1690,7 +1687,6 @@ void acpi_build(AcpiBuildTables *tables)
{
PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
- PcGuestInfo *guest_info = &pcms->acpi_guest_info;
GArray *table_offsets;
unsigned facs, ssdt, dsdt, rsdt;
AcpiCpuInfo cpu;
@@ -1758,7 +1754,7 @@ void acpi_build(AcpiBuildTables *tables)
build_tpm2(tables_blob, tables->linker);
}
}
- if (guest_info->numa_nodes) {
+ if (pcms->numa_nodes) {
acpi_add_table(table_offsets, tables_blob);
build_srat(tables_blob, tables->linker);
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 6d8ea76..43a25a0 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1187,24 +1187,24 @@ PcGuestInfo *pc_guest_info_init(PCMachineState *pcms)
PcGuestInfo *guest_info = &pcms->acpi_guest_info;
int i, j;
- guest_info->apic_id_limit = pc_apic_id_limit(max_cpus);
- guest_info->apic_xrupt_override = kvm_allows_irq0_override();
- guest_info->numa_nodes = nb_numa_nodes;
- guest_info->node_mem = g_malloc0(guest_info->numa_nodes *
- sizeof *guest_info->node_mem);
+ pcms->apic_id_limit = pc_apic_id_limit(max_cpus);
+ pcms->apic_xrupt_override = kvm_allows_irq0_override();
+ pcms->numa_nodes = nb_numa_nodes;
+ pcms->node_mem = g_malloc0(pcms->numa_nodes *
+ sizeof *pcms->node_mem);
for (i = 0; i < nb_numa_nodes; i++) {
- guest_info->node_mem[i] = numa_info[i].node_mem;
+ pcms->node_mem[i] = numa_info[i].node_mem;
}
- guest_info->node_cpu = g_malloc0(guest_info->apic_id_limit *
- sizeof *guest_info->node_cpu);
+ pcms->node_cpu = g_malloc0(pcms->apic_id_limit *
+ sizeof *pcms->node_cpu);
for (i = 0; i < max_cpus; i++) {
unsigned int apic_id = x86_cpu_apic_id_from_index(i);
- assert(apic_id < guest_info->apic_id_limit);
+ assert(apic_id < pcms->apic_id_limit);
for (j = 0; j < nb_numa_nodes; j++) {
if (test_bit(i, numa_info[j].node_cpu)) {
- guest_info->node_cpu[apic_id] = j;
+ pcms->node_cpu[apic_id] = j;
break;
}
}
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index a80adc6..4b7f8f9 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -22,11 +22,6 @@
/* Machine info for ACPI build: */
struct PcGuestInfo {
- unsigned apic_id_limit;
- bool apic_xrupt_override;
- uint64_t numa_nodes;
- uint64_t *node_mem;
- uint64_t *node_cpu;
};
/**
@@ -57,6 +52,15 @@ struct PCMachineState {
/* RAM information (sizes, addresses, configuration): */
ram_addr_t below_4g_mem_size, above_4g_mem_size;
+
+ /* CPU and apic information: */
+ bool apic_xrupt_override;
+ unsigned apic_id_limit;
+
+ /* NUMA information: */
+ uint64_t numa_nodes;
+ uint64_t *node_mem;
+ uint64_t *node_cpu;
};
#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
--
2.1.0
next prev parent reply other threads:[~2015-12-11 18:43 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-11 18:42 [Qemu-devel] [PATCH v2 00/14] pc: Eliminate struct PcGuestInfo Eduardo Habkost
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 01/14] q35: Remove MCHPCIState.guest_info field Eduardo Habkost
2015-12-15 11:10 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 02/14] pc: Group and document related PCMachineState/PCMachineclass fields Eduardo Habkost
2015-12-15 11:14 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 03/14] pc: Move PcGuestInfo declaration to top of file Eduardo Habkost
2015-12-15 11:19 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 04/14] pc: Eliminate struct PcGuestInfoState Eduardo Habkost
2015-12-15 11:37 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 05/14] pc: Simplify pc_memory_init() signature Eduardo Habkost
2015-12-15 11:39 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 06/14] pc: Simplify xen_load_linux() signature Eduardo Habkost
2015-12-15 11:45 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 07/14] acpi: Remove guest_info parameters from functions Eduardo Habkost
2015-12-15 12:36 ` Marcel Apfelbaum
2015-12-18 18:08 ` Eduardo Habkost
2015-12-18 18:51 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 08/14] acpi: Don't save PcGuestInfo on AcpiBuildState Eduardo Habkost
2015-12-15 13:06 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 09/14] pc: Remove compat fields from PcGuestInfo Eduardo Habkost
2015-12-15 14:03 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 10/14] pc: Remove RAM size " Eduardo Habkost
2015-12-15 14:15 ` Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 11/14] pc: Remove PcGuestInfo.isapc_ram_fw field Eduardo Habkost
2015-12-15 14:27 ` Marcel Apfelbaum
2015-12-16 19:48 ` Eduardo Habkost
2015-12-17 9:40 ` Marcel Apfelbaum
2015-12-17 16:04 ` Eduardo Habkost
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 12/14] pc: Move PcGuestInfo.fw_cfg to PCMachineState Eduardo Habkost
2015-12-15 14:28 ` Marcel Apfelbaum
2015-12-11 18:42 ` Eduardo Habkost [this message]
2015-12-15 14:33 ` [Qemu-devel] [PATCH v2 13/14] pc: Move APIC and NUMA data from PcGuestInfo " Marcel Apfelbaum
2015-12-11 18:42 ` [Qemu-devel] [PATCH v2 14/14] pc: Eliminate PcGuestInfo struct Eduardo Habkost
2015-12-15 14:37 ` Marcel Apfelbaum
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=1449859353-1574-14-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel.a@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).