[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/16] acpi: Use PCMachineClass fields directly
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 14/16] acpi: Use PCMachineClass fields directly |
Date: |
Tue, 1 Dec 2015 23:47:09 -0200 |
Remove the fields: legacy_acpi_table_size, has_acpi_build,
has_reserved_memory, and rsdp_in_ram from PcGuestInfo, and let
the ACPI code use the PCMachineClass fields directly.
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/i386/acpi-build.c | 11 ++++++-----
hw/i386/pc.c | 6 +++---
hw/i386/pc_piix.c | 9 +--------
hw/i386/pc_q35.c | 11 +----------
include/hw/i386/pc.h | 4 ----
5 files changed, 11 insertions(+), 30 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index efc4151..7771be7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1686,6 +1686,7 @@ static
void acpi_build(PCMachineState *pcms, AcpiBuildTables *tables)
{
PcGuestInfo *guest_info = &pcms->acpi_guest_info;
+ PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
GArray *table_offsets;
unsigned facs, ssdt, dsdt, rsdt;
AcpiCpuInfo cpu;
@@ -1799,12 +1800,12 @@ void acpi_build(PCMachineState *pcms, AcpiBuildTables
*tables)
*
* All this is for PIIX4, since QEMU 2.0 didn't support Q35 migration.
*/
- if (guest_info->legacy_acpi_table_size) {
+ if (pcmc->legacy_acpi_table_size) {
/* Subtracting aml_len gives the size of fixed tables. Then add the
* size of the PIIX4 DSDT/SSDT in QEMU 2.0.
*/
int legacy_aml_len =
- guest_info->legacy_acpi_table_size +
+ pcmc->legacy_acpi_table_size +
ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus;
int legacy_table_size =
ROUND_UP(tables_blob->len - aml_len + legacy_aml_len,
@@ -1896,7 +1897,7 @@ static const VMStateDescription vmstate_acpi_build = {
void acpi_setup(PCMachineState *pcms)
{
- PcGuestInfo *guest_info = &pcms->acpi_guest_info;
+ PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
AcpiBuildTables tables;
AcpiBuildState *build_state;
@@ -1905,7 +1906,7 @@ void acpi_setup(PCMachineState *pcms)
return;
}
- if (!guest_info->has_acpi_build) {
+ if (!pcmc->has_acpi_build) {
ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
return;
}
@@ -1936,7 +1937,7 @@ void acpi_setup(PCMachineState *pcms)
fw_cfg_add_file(pcms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
- if (!guest_info->rsdp_in_ram) {
+ if (!pcmc->rsdp_in_ram) {
/*
* Keep for compatibility with old machine types.
* Though RSDP is small, its contents isn't immutable, so
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 82025e2..cdfdd52 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1313,7 +1313,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
e820_add_entry(0x100000000ULL, pcms->above_4g_mem_size, E820_RAM);
}
- if (!guest_info->has_reserved_memory &&
+ if (!pcmc->has_reserved_memory &&
(machine->ram_slots ||
(machine->maxram_size > machine->ram_size))) {
MachineClass *mc = MACHINE_GET_CLASS(machine);
@@ -1324,7 +1324,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
}
/* initialize hotplug memory address space */
- if (guest_info->has_reserved_memory &&
+ if (pcmc->has_reserved_memory &&
(machine->ram_size < machine->maxram_size)) {
ram_addr_t hotplug_mem_size =
machine->maxram_size - machine->ram_size;
@@ -1379,7 +1379,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
rom_set_fw(fw_cfg);
- if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) {
+ if (pcmc->has_reserved_memory && pcms->hotplug_memory.base) {
uint64_t *val = g_malloc(sizeof(*val));
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
uint64_t res_mem_end = pcms->hotplug_memory.base;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 1828cf8..f0c2dc8 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -83,7 +83,6 @@ static void pc_init1(MachineState *machine,
MemoryRegion *ram_memory;
MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
- PcGuestInfo *guest_info;
ram_addr_t lowmem;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
@@ -140,13 +139,7 @@ static void pc_init1(MachineState *machine,
rom_memory = system_memory;
}
- guest_info = pc_guest_info_init(pcms);
-
- guest_info->has_acpi_build = pcmc->has_acpi_build;
- guest_info->legacy_acpi_table_size = pcmc->legacy_acpi_table_size;
-
- guest_info->has_reserved_memory = pcmc->has_reserved_memory;
- guest_info->rsdp_in_ram = pcmc->rsdp_in_ram;
+ pc_guest_info_init(pcms);
if (pcmc->smbios_defaults) {
MachineClass *mc = MACHINE_GET_CLASS(machine);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index ad7a51e..0907746 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -70,7 +70,6 @@ static void pc_q35_init(MachineState *machine)
int i;
ICH9LPCState *ich9_lpc;
PCIDevice *ahci;
- PcGuestInfo *guest_info;
ram_addr_t lowmem;
DriveInfo *hd[MAX_SATA_PORTS];
MachineClass *mc = MACHINE_GET_CLASS(machine);
@@ -131,15 +130,7 @@ static void pc_q35_init(MachineState *machine)
rom_memory = get_system_memory();
}
- guest_info = pc_guest_info_init(pcms);
- guest_info->has_acpi_build = pcmc->has_acpi_build;
- guest_info->has_reserved_memory = pcmc->has_reserved_memory;
- guest_info->rsdp_in_ram = pcmc->rsdp_in_ram;
-
- /* Migration was not supported in 2.0 for Q35, so do not bother
- * with this hack (see hw/i386/acpi-build.c).
- */
- guest_info->legacy_acpi_table_size = 0;
+ pc_guest_info_init(pcms);
if (pcmc->smbios_defaults) {
/* These values are guest ABI, do not change */
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 64f2b4b..a175131 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -27,10 +27,6 @@ struct PcGuestInfo {
uint64_t numa_nodes;
uint64_t *node_mem;
uint64_t *node_cpu;
- int legacy_acpi_table_size;
- bool has_acpi_build;
- bool has_reserved_memory;
- bool rsdp_in_ram;
};
/**
--
2.1.0
- Re: [Qemu-devel] [PATCH 06/16] acpi: Save PCMachineState on AcpiBuildState, (continued)
[Qemu-devel] [PATCH 07/16] acpi: Make acpi_build() get PCMachineState as argument, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 09/16] acpi: Remove ram size fields fron PcGuestInfo, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 08/16] acpi: Make build_srat() get PCMachineState as argument, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 10/16] pc: Move PcGuestInfo.fw_cfg field to PCMachineState, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 11/16] pc: Simplify signature of xen_load_linux(), Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 12/16] pc: Remove PcGuestInfo.isapc_ram_fw field, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 13/16] q35: Remove MCHPCIState.guest_info field, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 14/16] acpi: Use PCMachineClass fields directly,
Eduardo Habkost <=
[Qemu-devel] [PATCH 15/16] pc: Move PcGuestInfo.apic_xrupt_override field to PCMachineState, Eduardo Habkost, 2015/12/01
[Qemu-devel] [PATCH 16/16] pc: Move APIC and NUMA data from PcGuestInfo to PCMachineState, Eduardo Habkost, 2015/12/01
Re: [Qemu-devel] [PATCH 00/16] pc: Eliminate struct PcGuestInfo, Marcel Apfelbaum, 2015/12/07