diff mbox series

[01/13] acpi: make build_madt() more generic.

Message ID 20200319080117.7725-2-kraxel@redhat.com
State New, archived
Headers show
Series microvm: add acpi support | expand

Commit Message

Gerd Hoffmann March 19, 2020, 8:01 a.m. UTC
Remove PCMachineState dependency from build_madt().
Pass AcpiDeviceIf as separate argument instead of
depending on PCMachineState->acpi_dev.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/acpi-build.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Philippe Mathieu-Daudé March 19, 2020, 9:34 a.m. UTC | #1
On 3/19/20 9:01 AM, Gerd Hoffmann wrote:
> Remove PCMachineState dependency from build_madt().
> Pass AcpiDeviceIf as separate argument instead of
> depending on PCMachineState->acpi_dev.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   hw/i386/acpi-build.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9a19c14e661b..1b0684c433e3 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -360,14 +360,13 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
>   }
>   
>   static void
> -build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
> +build_madt(GArray *table_data, BIOSLinker *linker,
> +           X86MachineState *x86ms, AcpiDeviceIf *adev)
>   {
> -    MachineClass *mc = MACHINE_GET_CLASS(pcms);
> -    X86MachineState *x86ms = X86_MACHINE(pcms);
> -    const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(pcms));
> +    MachineClass *mc = MACHINE_GET_CLASS(x86ms);
> +    const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
>       int madt_start = table_data->len;
> -    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(pcms->acpi_dev);
> -    AcpiDeviceIf *adev = ACPI_DEVICE_IF(pcms->acpi_dev);
> +    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(adev);
>       bool x2apic_mode = false;
>   
>       AcpiMultipleApicTable *madt;
> @@ -2807,7 +2806,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
>       aml_len += tables_blob->len - fadt;
>   
>       acpi_add_table(table_offsets, tables_blob);
> -    build_madt(tables_blob, tables->linker, pcms);
> +    build_madt(tables_blob, tables->linker, x86ms,
> +               ACPI_DEVICE_IF(pcms->acpi_dev));
>   
>       vmgenid_dev = find_vmgenid_dev();
>       if (vmgenid_dev) {
>
diff mbox series

Patch

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9a19c14e661b..1b0684c433e3 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -360,14 +360,13 @@  void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
 }
 
 static void
-build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
+build_madt(GArray *table_data, BIOSLinker *linker,
+           X86MachineState *x86ms, AcpiDeviceIf *adev)
 {
-    MachineClass *mc = MACHINE_GET_CLASS(pcms);
-    X86MachineState *x86ms = X86_MACHINE(pcms);
-    const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(pcms));
+    MachineClass *mc = MACHINE_GET_CLASS(x86ms);
+    const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
     int madt_start = table_data->len;
-    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(pcms->acpi_dev);
-    AcpiDeviceIf *adev = ACPI_DEVICE_IF(pcms->acpi_dev);
+    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(adev);
     bool x2apic_mode = false;
 
     AcpiMultipleApicTable *madt;
@@ -2807,7 +2806,8 @@  void acpi_build(AcpiBuildTables *tables, MachineState *machine)
     aml_len += tables_blob->len - fadt;
 
     acpi_add_table(table_offsets, tables_blob);
-    build_madt(tables_blob, tables->linker, pcms);
+    build_madt(tables_blob, tables->linker, x86ms,
+               ACPI_DEVICE_IF(pcms->acpi_dev));
 
     vmgenid_dev = find_vmgenid_dev();
     if (vmgenid_dev) {