AML Housekeeping
v2 cover AML Housekeeping
This series resolves the AcpiDeviceIfClass::madt_cpu function pointer. It turns out that it isn't needed and it even frees the ACPI controllers from assigning it an x86 specific function. This is especially interesting for the PIIX4 PM which is also used in MIPS only contexts.
Furthermore, the series introduces qbus_build_aml() which then gets used to resolve isa_build_aml().
v2:
- Don't inline qbus_build_aml() (Phil)
- Add 'hw/acpi/piix4: No need to #include "hw/southbridge/piix.h"'
Testing done:
* make check
* make check-avocado
* qemu-system-x86_64 -M pc -m 2G -cdrom manjaro-kde-21.2.6-220416-linux515.iso
* `qemu-system-x86_64 -M q35 -m 2G -cdrom \
manjaro-kde-21.2.6-220416-linux515.iso`
Bernhard Beschow (8):
hw/acpi: Add missing includes hw/acpi/acpi_dev_interface: Remove unused parameter from
AcpiDeviceIfClass::madt_cpu
hw/acpi/acpi_dev_interface: Resolve AcpiDeviceIfClass::madt_cpu hw/acpi/piix4: No need to #include "hw/southbridge/piix.h" hw/i386/acpi-build: Remove unused attributes hw/acpi/acpi_aml_interface: Extract qbus_build_aml() hw/i386/acpi-microvm: Reuse qbus_build_aml() hw/isa/isa-bus: Remove now unused isa_build_aml()
hw/acpi/hmat.h | 3 ++- hw/i386/acpi-common.h | 7 +++++-- include/hw/acpi/acpi_aml_interface.h | 3 +++ include/hw/acpi/acpi_dev_interface.h | 4 ---- include/hw/acpi/cpu.h | 6 +++++- include/hw/i386/pc.h | 6 ------ include/hw/isa/isa.h | 1 - hw/acpi/acpi-x86-stub.c | 7 ------- hw/acpi/acpi_interface.c | 10 ++++++++++ hw/acpi/cpu.c | 12 +++++------- hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 3 --- hw/i2c/smbus_ich9.c | 5 +---- hw/i386/acpi-build.c | 7 ++----- hw/i386/acpi-common.c | 10 ++++------ hw/i386/acpi-microvm.c | 6 +++--- hw/i386/generic_event_device_x86.c | 9 --------- hw/isa/isa-bus.c | 10 ---------- hw/isa/lpc_ich9.c | 6 +----- hw/isa/piix3.c | 5 +---- monitor/qmp-cmds.c | 1 + 22 files changed, 45 insertions(+), 78 deletions(-)
Signature · 1 line
2.39.0
PATCH v2 1/8 hw/acpi: Add missing includes
When removing the "hw/boards.h" include in hw/acpi/acpi_dev_interface.h, these include directives must be added to make the code compile again.
--- hw/acpi/hmat.h | 3 ++- hw/acpi/cpu.c | 2 ++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + monitor/qmp-cmds.c | 1 + 5 files changed, 7 insertions(+), 1 deletion(-)
hw/acpi/hmat.h +2 -1
@@ -27,7 +27,8 @@#ifndef HMAT_H #define HMAT_H -#include "hw/acpi/aml-build.h" +#include "hw/acpi/bios-linker-loader.h" +#include "sysemu/numa.h" /* * ACPI 6.3: 5.2.27.3 Memory Proximity Domain Attributes Structure,
hw/acpi/cpu.c +2 -0
@@ -1,6 +1,8 @@#include "qemu/osdep.h" #include "migration/vmstate.h" #include "hw/acpi/cpu.h" +#include "hw/core/cpu.h" +#include "hw/boards.h" #include "qapi/error.h" #include "qapi/qapi-events-acpi.h" #include "trace.h"
hw/acpi/hmat.c +1 -0
@@ -27,6 +27,7 @@#include "qemu/osdep.h" #include "qemu/units.h" #include "sysemu/numa.h" +#include "hw/acpi/aml-build.h" #include "hw/acpi/hmat.h" /*
hw/acpi/memory_hotplug.c +1 -0
@@ -1,6 +1,7 @@#include "qemu/osdep.h" #include "hw/acpi/memory_hotplug.h" #include "hw/mem/pc-dimm.h" +#include "hw/boards.h" #include "hw/qdev-core.h" #include "migration/vmstate.h" #include "trace.h"
monitor/qmp-cmds.c +1 -0
@@ -44,6 +44,7 @@#include "hw/acpi/acpi_dev_interface.h" #include "hw/intc/intc.h" #include "hw/rdma/rdma.h" +#include "hw/boards.h" #include "monitor/stats.h" NameInfo *qmp_query_name (Error **errp)
Signature · 1 line
2.39.0
PATCH v2 2/8 hw/acpi/acpi_dev_interface: Remove unused parameter from AcpiDeviceIfClass::madt_cpu
In reply to Bernhard BeschowThe only function ever assigned to AcpiDeviceIfClass::madt_cpu is pc_madt_cpu_entry() which doesn't use the AcpiDeviceIf parameter.
--- include/hw/acpi/acpi_dev_interface.h | 3 +-- include/hw/i386/pc.h | 6 ++---- hw/acpi/acpi-x86-stub.c | 5 ++--- hw/acpi/cpu.c | 3 +-- hw/i386/acpi-common.c | 7 +++---- 5 files changed, 9 insertions(+), 15 deletions(-)
include/hw/acpi/acpi_dev_interface.h +1 -2
@@ -52,8 +52,7 @@ struct AcpiDeviceIfClass {/* <public> */ void (*ospm_status)(AcpiDeviceIf *adev,ACPIOSTInfoList ***list);void (*send_event)(AcpiDeviceIf *adev,AcpiEventStatusBits ev); -void (*madt_cpu)(AcpiDeviceIf *adev,int uid, -const CPUArchIdList *apic_ids,GArray *entry, +void (*madt_cpu)(int uid,const CPUArchIdList *apic_ids,GArray *entry, bool force_enabled); };#endif
include/hw/i386/pc.h +2 -4
@@ -9,7 +9,6 @@#include "hw/block/flash.h" #include "hw/i386/x86.h" -#include "hw/acpi/acpi_dev_interface.h" #include "hw/hotplug.h" #include "qom/object.h" #include "hw/i386/sgx-epc.h"
@@ -193,9 +192,8 @@ bool pc_system_ovmf_table_find(const char *entry, uint8_t **data,void pc_system_parse_ovmf_flash (uint8_t *flash_ptr,size_t flash_size);/* hw/i386/acpi-common.c */ -void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, -const CPUArchIdList *apic_ids,GArray *entry, -bool force_enabled); +void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids, +GArray *entry,bool force_enabled);/* sgx.c */ void pc_machine_init_sgx_epc (PCMachineState *pcms);
hw/acpi/acpi-x86-stub.c +2 -3
@@ -2,9 +2,8 @@#include "hw/i386/pc.h" #include "hw/i386/acpi-build.h" -void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, -const CPUArchIdList *apic_ids,GArray *entry, -bool force_enabled) +void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids, +GArray *entry,bool force_enabled) { }
hw/acpi/cpu.c +1 -2
@@ -357,7 +357,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,char *cphp_res_path =g_strdup_printf ("%s." CPUHP_RES_DEVICE , res_root);Object *obj =object_resolve_path_type ("" ,TYPE_ACPI_DEVICE_IF ,NULL );AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (obj); -AcpiDeviceIf *adev =ACPI_DEVICE_IF (obj); cpu_ctrl_dev =aml_device ("%s" , cphp_res_path); {
@@ -668,7 +667,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build _MAT object */ assert (adevc && adevc->madt_cpu); - adevc->madt_cpu (adev, i, arch_ids, madt_buf, + adevc->madt_cpu (i, arch_ids, madt_buf, true);/* set enabled flag */ aml_append (dev,aml_name_decl ("_MAT" ,aml_buffer (madt_buf->len, (uint8_t *)madt_buf->data)));
hw/i386/acpi-common.c +3 -4
@@ -33,9 +33,8 @@#include "acpi-build.h" #include "acpi-common.h" -void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, -const CPUArchIdList *apic_ids,GArray *entry, -bool force_enabled) +void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids, +GArray *entry,bool force_enabled) {uint32_t apic_id = apic_ids->cpus[uid].arch_id;/* Flags – Local APIC Flags */
@@ -112,7 +111,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,build_append_int_noprefix (table_data,1 /* PCAT_COMPAT */ ,4 );/* Flags */ for (i =0 ; i < apic_ids->len; i++) { - adevc->madt_cpu (adev, i, apic_ids, table_data, false); + adevc->madt_cpu (i, apic_ids, table_data, false);if (apic_ids->cpus[i].arch_id >254 ) { x2apic_mode = true; }
Signature · 1 line
2.39.0
PATCH v2 3/8 hw/acpi/acpi_dev_interface: Resolve AcpiDeviceIfClass::madt_cpu
In reply to Bernhard BeschowThis class attribute was always set to pc_madt_cpu_entry(). pc_madt_cpu_entry() is architecture dependent and was assigned to the attribute even in architecture agnostic code such as in hw/acpi/piix4.c and hw/isa/lpc_ich9. Not having to set madt_cpu there resolves the assumption that these device models are only ever used with ACPI on x86 targets.
The only target independent location where madt_cpu was called was hw/ acpi/cpu.c. Here a function pointer can be passed via an argument instead. The other locations where it was called was in x86 specific code where pc_madt_cpu_entry() can be used directly.
--- hw/i386/acpi-common.h | 7 +++++-- include/hw/acpi/acpi_dev_interface.h | 3 --- include/hw/acpi/cpu.h | 6 +++++- include/hw/i386/pc.h | 4 ---- hw/acpi/acpi-x86-stub.c | 6 ------ hw/acpi/cpu.c | 11 ++++------- hw/acpi/piix4.c | 2 -- hw/i386/acpi-build.c | 5 ++--- hw/i386/acpi-common.c | 5 ++--- hw/i386/acpi-microvm.c | 3 +-- hw/i386/generic_event_device_x86.c | 9 --------- hw/isa/lpc_ich9.c | 1 - 12 files changed, 19 insertions(+), 43 deletions(-)
hw/i386/acpi-common.h +5 -2
@@ -1,15 +1,18 @@#ifndef HW_I386_ACPI_COMMON_H #define HW_I386_ACPI_COMMON_H -#include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/i386/x86.h" +#include "hw/boards.h" /* Default IOAPIC ID */ #define ACPI_BUILD_IOAPIC_ID 0x0 +void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids,GArray *entry, +bool force_enabled); +void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev, +X86MachineState *x86ms,const char *oem_id,const char *oem_table_id);#endif
include/hw/acpi/acpi_dev_interface.h +0 -3
@@ -3,7 +3,6 @@#include "qapi/qapi-types-acpi.h" #include "qom/object.h" -#include "hw/boards.h" #include "hw/qdev-core.h" /* These values are part of guest ABI, and can not be changed */
@@ -52,7 +51,5 @@ struct AcpiDeviceIfClass {/* <public> */ void (*ospm_status)(AcpiDeviceIf *adev,ACPIOSTInfoList ***list); void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev); -void (*madt_cpu)(int uid,const CPUArchIdList *apic_ids,GArray *entry, - bool force_enabled); };#endif
include/hw/acpi/cpu.h +5 -1
@@ -15,6 +15,7 @@#include "hw/qdev-core.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" +#include "hw/boards.h" #include "hw/hotplug.h" typedef struct AcpiCpuStatus {
@@ -55,8 +56,11 @@ typedef struct CPUHotplugFeatures {const char *smi_path; } CPUHotplugFeatures; +typedef void (*madt_cpu_fn )(int uid,const CPUArchIdList *apic_ids, +GArray *entry,bool force_enabled); +void build_cpus_aml (Aml *table,MachineState *machine,CPUHotplugFeatures opts, -hwaddr io_base, +hwaddr io_base,madt_cpu_fn madt_cpu,const char *res_root,const char *event_handler_method);
include/hw/i386/pc.h +0 -4
@@ -191,10 +191,6 @@ bool pc_system_ovmf_table_find(const char *entry, uint8_t **data, int *data_len);void pc_system_parse_ovmf_flash (uint8_t *flash_ptr,size_t flash_size); -/* hw/i386/acpi-common.c */ -void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids, -GArray *entry,bool force_enabled); -/* sgx.c */ void pc_machine_init_sgx_epc (PCMachineState *pcms);
hw/acpi/acpi-x86-stub.c +0 -6
@@ -1,12 +1,6 @@#include "qemu/osdep.h" -#include "hw/i386/pc.h" #include "hw/i386/acpi-build.h" -void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids, -GArray *entry,bool force_enabled) -{ -} -Object *acpi_get_i386_pci_host (void ) {return NULL ;
hw/acpi/cpu.c +4 -7
@@ -2,7 +2,6 @@#include "migration/vmstate.h" #include "hw/acpi/cpu.h" #include "hw/core/cpu.h" -#include "hw/boards.h" #include "qapi/error.h" #include "qapi/qapi-events-acpi.h" #include "trace.h"
@@ -340,7 +339,7 @@ const VMStateDescription vmstate_cpu_hotplug = {#define CPU_FW_EJECT_EVENT "CEJF"void build_cpus_aml (Aml *table,MachineState *machine,CPUHotplugFeatures opts, -hwaddr io_base, +hwaddr io_base,madt_cpu_fn madt_cpu,const char *res_root,const char *event_handler_method) {
@@ -355,8 +354,8 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,MachineClass *mc =MACHINE_GET_CLASS (machine);const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids (machine);char *cphp_res_path =g_strdup_printf ("%s." CPUHP_RES_DEVICE , res_root); -Object *obj =object_resolve_path_type ("" ,TYPE_ACPI_DEVICE_IF ,NULL ); -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (obj); + +assert (madt_cpu); cpu_ctrl_dev =aml_device ("%s" , cphp_res_path); {
@@ -666,9 +665,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,aml_append (dev, method);/* build _MAT object */ -assert (adevc && adevc->madt_cpu); - adevc->madt_cpu (i, arch_ids, madt_buf, - true);/* set enabled flag */ +madt_cpu (i, arch_ids, madt_buf, true/* set enabled flag */ );aml_append (dev,aml_name_decl ("_MAT" ,aml_buffer (madt_buf->len, (uint8_t *)madt_buf->data)));g_array_free (madt_buf, true);
hw/acpi/piix4.c +0 -2
@@ -20,7 +20,6 @@*/ #include "qemu/osdep.h" -#include "hw/i386/pc.h" #include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/isa/apm.h"
@@ -643,7 +642,6 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) hc->unplug = piix4_device_unplug_cb; adevc->ospm_status = piix4_ospm_status; adevc->send_event = piix4_send_gpe; - adevc->madt_cpu = pc_madt_cpu_entry; }static const TypeInfo piix4_pm_info = {
hw/i386/acpi-build.c +2 -3
@@ -1440,7 +1440,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, .fw_unplugs_cpu = pm->smi_on_cpu_unplug, };build_cpus_aml (dsdt, machine, opts, pm->cpu_hp_io_base, -"\\_SB.PCI0" ,"\\_GPE._E02" ); + pc_madt_cpu_entry,"\\_SB.PCI0" ,"\\_GPE._E02" ); }if (pcms->memhp_io_base && nr_mem) {
@@ -2424,8 +2424,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker, x86ms, -ACPI_DEVICE_IF (x86ms->acpi_dev), x86ms->oem_id, - x86ms->oem_table_id); + x86ms->oem_id, x86ms->oem_table_id);#ifdef CONFIG_ACPI_ERST {
hw/i386/acpi-common.c +2 -3
@@ -94,14 +94,13 @@ build_xrupt_override(GArray *entry, uint8_t src, uint32_t gsi, uint16_t flags)* 5.2.8 Multiple APIC Description Table */ void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev, +X86MachineState *x86ms,const char *oem_id,const char *oem_table_id) {int i;bool x2apic_mode = false;MachineClass *mc =MACHINE_GET_CLASS (x86ms);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (MACHINE (x86ms)); -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (adev);AcpiTable table = { .sig ="APIC" , .rev =1 , .oem_id = oem_id, .oem_table_id = oem_table_id };
@@ -111,7 +110,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,build_append_int_noprefix (table_data,1 /* PCAT_COMPAT */ ,4 );/* Flags */ for (i =0 ; i < apic_ids->len; i++) { - adevc->madt_cpu (i, apic_ids, table_data, false); +pc_madt_cpu_entry (i, apic_ids, table_data, false);if (apic_ids->cpus[i].arch_id >254 ) { x2apic_mode = true; }
hw/i386/acpi-microvm.c +1 -2
@@ -213,8 +213,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker,X86_MACHINE (machine), -ACPI_DEVICE_IF (x86ms->acpi_dev), x86ms->oem_id, - x86ms->oem_table_id); + x86ms->oem_id, x86ms->oem_table_id);#ifdef CONFIG_ACPI_ERST {
hw/i386/generic_event_device_x86.c +0 -9
@@ -8,19 +8,10 @@#include "qemu/osdep.h" #include "hw/acpi/generic_event_device.h" -#include "hw/i386/pc.h" - -static void acpi_ged_x86_class_init (ObjectClass *class,void *data) -{ -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_CLASS (class); - - adevc->madt_cpu = pc_madt_cpu_entry; -}static const TypeInfo acpi_ged_x86_info = { .name =TYPE_ACPI_GED_X86 , .parent =TYPE_ACPI_GED , - .class_init = acpi_ged_x86_class_init, .interfaces = (InterfaceInfo []) { {TYPE_HOTPLUG_HANDLER }, {TYPE_ACPI_DEVICE_IF },
hw/isa/lpc_ich9.c +0 -1
@@ -870,7 +870,6 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) hc->unplug = ich9_pm_device_unplug_cb; adevc->ospm_status = ich9_pm_ospm_status; adevc->send_event = ich9_send_gpe; - adevc->madt_cpu = pc_madt_cpu_entry; amldevc->build_dev_aml = build_ich9_isa_aml; }
Signature · 1 line
2.39.0
PATCH v2 4/8 hw/acpi/piix4: No need to #include "hw/southbridge/piix.h"
In reply to Bernhard Beschowhw/acpi/piix4 has its own header with its structure definition etc.
--- hw/acpi/piix4.c | 1 - 1 file changed, 1 deletion(-)
hw/acpi/piix4.c +0 -1
@@ -20,7 +20,6 @@*/ #include "qemu/osdep.h" -#include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/isa/apm.h" #include "hw/i2c/pm_smbus.h"
Signature · 1 line
2.39.0
Re: [PATCH v2 4/8] hw/acpi/piix4: No need to #include "hw/southbridge/piix.h"
Quoted 6 lines · Bernhard Beschow
hw/acpi/piix4 has its own header with its structure definition etc.
Signed-off-by Bernhard Beschow <[email protected]>--- hw/acpi/piix4.c | 1 - 1 file changed, 1 deletion(-)
Indeed, since 2bfd0845f0 ("hw/acpi/piix4: move PIIX4PMState into separate piix4.h header").
PATCH v2 5/8 hw/i386/acpi-build: Remove unused attributes
In reply to Bernhard BeschowAmmends commit 3db119da7915 'pc: acpi: switch to AML API composed DSDT'.
--- hw/i386/acpi-build.c | 2 -- 1 file changed, 2 deletions(-)
hw/i386/acpi-build.c +0 -2
@@ -117,8 +117,6 @@ typedef struct AcpiMiscInfo {#ifdef CONFIG_TPM TPMVersion tpm_version;#endif -const unsigned char *dsdt_code; -unsigned dsdt_size; } AcpiMiscInfo; typedef struct FwCfgTPMConfig {
Signature · 1 line
2.39.0
PATCH v2 6/8 hw/acpi/acpi_aml_interface: Extract qbus_build_aml()
In reply to Bernhard Beschow--- include/hw/acpi/acpi_aml_interface.h | 3 +++ hw/acpi/acpi_interface.c | 10 ++++++++++ hw/i2c/smbus_ich9.c | 5 +---- hw/isa/lpc_ich9.c | 5 +---- hw/isa/piix3.c | 5 +---- 5 files changed, 16 insertions(+), 12 deletions(-)
include/hw/acpi/acpi_aml_interface.h +3 -0
@@ -3,6 +3,7 @@#include "qom/object.h" #include "hw/acpi/aml-build.h" +#include "hw/qdev-core.h" #define TYPE_ACPI_DEV_AML_IF "acpi-dev-aml-interface"typedef struct AcpiDevAmlIfClass AcpiDevAmlIfClass ;
@@ -46,4 +47,6 @@ static inline void call_dev_aml_func(DeviceState *dev, Aml *scope) } } +void qbus_build_aml (BusState *bus,Aml *scope); +#endif
hw/acpi/acpi_interface.c +10 -0
@@ -2,6 +2,7 @@#include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/acpi_aml_interface.h" #include "qemu/module.h" +#include "qemu/queue.h" void acpi_send_event (DeviceState *dev,AcpiEventStatusBits event) {
@@ -12,6 +13,15 @@ void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event) } } +void qbus_build_aml (BusState *bus,Aml *scope) +{ +BusChild *kid; + + QTAILQ_FOREACH(kid, &bus->children, sibling) { +call_dev_aml_func (DEVICE (kid->child), scope); + } +} +static void register_types (void ) {static const TypeInfo acpi_dev_if_info = {
hw/i2c/smbus_ich9.c +1 -4
@@ -97,13 +97,10 @@ static void ich9_smbus_realize(PCIDevice *d, Error **errp)static void build_ich9_smb_aml (AcpiDevAmlIf *adev,Aml *scope) { -BusChild *kid;ICH9SMBState *s =ICH9_SMB_DEVICE (adev);BusState *bus =BUS (s->smb.smbus); - QTAILQ_FOREACH(kid, &bus->children, sibling) { -call_dev_aml_func (DEVICE (kid->child), scope); - } +qbus_build_aml (bus, scope); }static void ich9_smb_class_init (ObjectClass *klass,void *data)
hw/isa/lpc_ich9.c +1 -4
@@ -813,7 +813,6 @@ static void ich9_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)static void build_ich9_isa_aml (AcpiDevAmlIf *adev,Aml *scope) {Aml *field; -BusChild *kid;ICH9LPCState *s =ICH9_LPC_DEVICE (adev);BusState *bus =BUS (s->isa_bus);Aml *sb_scope =aml_scope ("\\_SB" );
@@ -835,9 +834,7 @@ static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)aml_append (sb_scope, field);aml_append (scope, sb_scope); - QTAILQ_FOREACH(kid, &bus->children, sibling) { -call_dev_aml_func (DEVICE (kid->child), scope); - } +qbus_build_aml (bus, scope); }static void ich9_lpc_class_init (ObjectClass *klass,void *data)
hw/isa/piix3.c +1 -4
@@ -317,7 +317,6 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp)static void build_pci_isa_aml (AcpiDevAmlIf *adev,Aml *scope) {Aml *field; -BusChild *kid;Aml *sb_scope =aml_scope ("\\_SB" );BusState *bus =qdev_get_child_bus (DEVICE (adev),"isa.0" );
@@ -333,9 +332,7 @@ static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)aml_append (sb_scope, field);aml_append (scope, sb_scope); - QTAILQ_FOREACH(kid, &bus->children, sibling) { -call_dev_aml_func (DEVICE (kid->child), scope); - } +qbus_build_aml (bus, scope); }static void pci_piix3_class_init (ObjectClass *klass,void *data)
Signature · 1 line
2.39.0
PATCH v2 7/8 hw/i386/acpi-microvm: Reuse qbus_build_aml()
In reply to Bernhard Beschow--- hw/i386/acpi-microvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/acpi-microvm.c +2 -1
@@ -26,6 +26,7 @@#include "exec/memory.h" #include "hw/acpi/acpi.h" +#include "hw/acpi/acpi_aml_interface.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/acpi/generic_event_device.h"
@@ -129,7 +130,7 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *linker, sb_scope =aml_scope ("_SB" );fw_cfg_add_acpi_dsdt (sb_scope, x86ms->fw_cfg); -isa_build_aml (ISA_BUS (isabus), sb_scope); +qbus_build_aml (BUS (isabus), sb_scope);build_ged_aml (sb_scope,GED_DEVICE , x86ms->acpi_dev,GED_MMIO_IRQ ,AML_SYSTEM_MEMORY ,GED_MMIO_BASE );acpi_dsdt_add_power_button (sb_scope);
Signature · 1 line
2.39.0
PATCH v2 8/8 hw/isa/isa-bus: Remove now unused isa_build_aml()
In reply to Bernhard Beschow--- include/hw/isa/isa.h | 1 - hw/isa/isa-bus.c | 10 ---------- 2 files changed, 11 deletions(-)
include/hw/isa/isa.h +0 -1
@@ -86,7 +86,6 @@ bool isa_realize_and_unref(ISADevice *dev, ISABus *bus, Error **errp);ISADevice *isa_create_simple (ISABus *bus,const char *name);ISADevice *isa_vga_init (ISABus *bus); -void isa_build_aml (ISABus *bus,Aml *scope);/** * isa_register_ioport: Install an I/O port region on the ISA bus.
hw/isa/isa-bus.c +0 -10
@@ -24,7 +24,6 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -#include "hw/acpi/acpi_aml_interface.h" static ISABus *isabus;
@@ -188,15 +187,6 @@ ISADevice *isa_vga_init(ISABus *bus) } } -void isa_build_aml (ISABus *bus,Aml *scope) -{ -BusChild *kid; - - QTAILQ_FOREACH(kid, &bus->parent_obj.children, sibling) { -call_dev_aml_func (DEVICE (kid->child), scope); - } -} -static void isabus_bridge_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
Signature · 1 line
2.39.0