[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 04/10] pc: acpi: cleanup qdev_get_machine() calls
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v2 04/10] pc: acpi: cleanup qdev_get_machine() calls |
Date: |
Fri, 5 Feb 2016 19:07:00 +0100 |
call qdev_get_machine() once at acpi_build() and
pass its result to child functions that need it.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
---
hw/i386/acpi-build.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index caa2e87..4756924 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1972,13 +1972,12 @@ static Aml *build_q35_osc_method(void)
static void
build_dsdt(GArray *table_data, GArray *linker,
AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
- PcPciInfo *pci)
+ PcPciInfo *pci, MachineState *machine)
{
CrsRangeEntry *entry;
Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free);
GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free);
- MachineState *machine = MACHINE(qdev_get_machine());
PCMachineState *pcms = PC_MACHINE(machine);
uint32_t nr_mem = machine->ram_slots;
int root_bus_limit = 0xFF;
@@ -2401,7 +2400,7 @@ acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem,
uint64_t base,
}
static void
-build_srat(GArray *table_data, GArray *linker)
+build_srat(GArray *table_data, GArray *linker, MachineState *machine)
{
AcpiSystemResourceAffinityTable *srat;
AcpiSratProcessorAffinity *core;
@@ -2411,7 +2410,7 @@ build_srat(GArray *table_data, GArray *linker)
uint64_t curnode;
int srat_start, numa_start, slots;
uint64_t mem_len, mem_base, next_base;
- PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
+ PCMachineState *pcms = PC_MACHINE(machine);
ram_addr_t hotplugabble_address_space_size =
object_property_get_int(OBJECT(pcms), PC_MACHINE_MEMHP_REGION_SIZE,
NULL);
@@ -2614,9 +2613,9 @@ static bool acpi_has_iommu(void)
return intel_iommu && !ambiguous;
}
-static bool acpi_has_nvdimm(void)
+static bool acpi_has_nvdimm(MachineState *machine)
{
- PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
+ PCMachineState *pcms = PC_MACHINE(machine);
return pcms->nvdimm;
}
@@ -2637,6 +2636,7 @@ void acpi_build(AcpiBuildTables *tables)
size_t aml_len = 0;
GArray *tables_blob = tables->table_data;
AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };
+ MachineState *machine = MACHINE(qdev_get_machine());
acpi_get_cpu_info(&cpu);
acpi_get_pm_info(&pm);
@@ -2662,7 +2662,7 @@ void acpi_build(AcpiBuildTables *tables)
/* DSDT is pointed to by FADT */
dsdt = tables_blob->len;
- build_dsdt(tables_blob, tables->linker, &cpu, &pm, &misc, &pci);
+ build_dsdt(tables_blob, tables->linker, &cpu, &pm, &misc, &pci, machine);
/* Count the size of the DSDT and SSDT, we will need it for legacy
* sizing of ACPI tables.
@@ -2694,7 +2694,7 @@ void acpi_build(AcpiBuildTables *tables)
}
if (pcms->numa_nodes) {
acpi_add_table(table_offsets, tables_blob);
- build_srat(tables_blob, tables->linker);
+ build_srat(tables_blob, tables->linker, machine);
}
if (acpi_get_mcfg(&mcfg)) {
acpi_add_table(table_offsets, tables_blob);
@@ -2705,7 +2705,7 @@ void acpi_build(AcpiBuildTables *tables)
build_dmar_q35(tables_blob, tables->linker);
}
- if (acpi_has_nvdimm()) {
+ if (acpi_has_nvdimm(machine)) {
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker);
}
--
1.8.3.1
- [Qemu-devel] [PATCH v2 00/10] pc: do not create invalid MADT.LAPIC/Processor entries, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 02/10] machine: introduce MachineClass.possible_cpu_arch_ids() hook, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 01/10] cpu: rename cpu_exists() to qemu_get_cpu_by_arch_id(), Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 03/10] pc: init pcms->apic_id_limit once and use it throughout pc.c, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 04/10] pc: acpi: cleanup qdev_get_machine() calls,
Igor Mammedov <=
- [Qemu-devel] [PATCH v2 05/10] pc: acpi: SRAT: create only valid processor lapic entries, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 06/10] pc: acpi: create Processor and Notify objects only for valid lapics, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 07/10] pc: acpi: create MADT.lapic entries only for valid lapics, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 10/10] pc: acpi: remove NOP assignment, Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 08/10] pc: acpi: move cpu->found_cpus bitmap to build_processor_devices(), Igor Mammedov, 2016/02/05
- [Qemu-devel] [PATCH v2 09/10] pc: acpi: clarify why possible LAPIC entries must be present in MADT, Igor Mammedov, 2016/02/05