hw/i386: Cleanups around 'hw/i386/pc.h'
cover hw/i386: Cleanups around 'hw/i386/pc.h'
Trivial patches removing uses of "hw/i386/pc.h".
Philippe Mathieu-Daudé (7):
target/i386/monitor: Remove unused 'hw/i386/pc.h' header hw/timer: Move HPET_INTCAP definition to "hpet.h" hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h' hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h' hw/i386/port92: Add missing 'hw/isa/isa.h' header hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h' hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'
hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 6 ------ include/hw/timer/hpet.h | 2 ++ hw/acpi/cpu_hotplug.c | 4 ++-- hw/i386/acpi-common.c | 1 - hw/i386/port92.c | 1 + hw/isa/lpc_ich9.c | 1 - hw/timer/hpet.c | 1 - target/i386/monitor.c | 1 - 9 files changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/7 target/i386/monitor: Remove unused 'hw/i386/pc.h' header
--- target/i386/monitor.c | 1 - 1 file changed, 1 deletion(-)
target/i386/monitor.c +0 -1
@@ -33,7 +33,6 @@#include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" -#include "hw/i386/pc.h" /* Perform linear address sign extension */ static hwaddr addr_canonical (CPUArchState *env,hwaddr addr)
Signature · 1 line
2.41.0
PATCH 2/7 hw/timer: Move HPET_INTCAP definition to "hpet.h"
In reply to Philippe Mathieu-DaudéHPET_INTCAP is specific to TYPE_HPET, so define it there. hpet.c doesn't need to include "hw/i386/pc.h" anymore.
--- include/hw/i386/pc.h | 2 -- include/hw/timer/hpet.h | 2 ++ hw/timer/hpet.c | 1 - 3 files changed, 2 insertions(+), 3 deletions(-)
include/hw/i386/pc.h +0 -2
@@ -15,8 +15,6 @@#include "hw/firmware/smbios.h" #include "hw/cxl/cxl.h" -#define HPET_INTCAP "hpet-intcap" -/** * PCMachineState: * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
include/hw/timer/hpet.h +2 -0
@@ -78,6 +78,8 @@ extern struct hpet_fw_config hpet_cfg;#define TYPE_HPET "hpet" +#define HPET_INTCAP "hpet-intcap" +static inline bool hpet_find (void ) {return object_resolve_path_type ("" ,TYPE_HPET ,NULL );
hw/timer/hpet.c +0 -1
@@ -25,7 +25,6 @@*/ #include "qemu/osdep.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "qapi/error.h" #include "qemu/error-report.h"
Signature · 1 line
2.41.0
PATCH 3/7 hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h'
In reply to Philippe Mathieu-DaudéCommit c461f3e382 ("hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method") removed the need for "hw/i386/pc.h".
--- hw/isa/lpc_ich9.c | 1 - 1 file changed, 1 deletion(-)
hw/isa/lpc_ich9.c +0 -1
@@ -41,7 +41,6 @@#include "hw/isa/apm.h" #include "hw/pci/pci.h" #include "hw/southbridge/ich9.h" -#include "hw/i386/pc.h" #include "hw/acpi/acpi.h" #include "hw/acpi/ich9.h" #include "hw/pci/pci_bus.h"
Signature · 1 line
2.41.0
PATCH 4/7 hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h'
In reply to Philippe Mathieu-DaudéSince pc_madt_cpu_entry() is only used by:
- hw/i386/acpi-build.c // single call
- hw/i386/acpi-common.c // definition
there is no need to expose it outside of hw/i386/. Declare it in "acpi-common.h". acpi-build.c doesn't need "hw/i386/pc.h" anymore.
--- hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 4 ---- hw/i386/acpi-common.c | 1 - 3 files changed, 3 insertions(+), 5 deletions(-)
hw/i386/acpi-common.h +3 -0
@@ -1,12 +1,15 @@#ifndef HW_I386_ACPI_COMMON_H #define HW_I386_ACPI_COMMON_H +#include "hw/boards.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/i386/x86.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,const char *oem_id,const char *oem_table_id);
include/hw/i386/pc.h +0 -4
@@ -199,10 +199,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/i386/acpi-common.c +0 -1
@@ -27,7 +27,6 @@#include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/utils.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "acpi-build.h"
Signature · 1 line
2.41.0
Re: [PATCH 4/7] hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h'
Am 13. Februar 2024 12:01:49 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:
Quoted 20 lines
Since
pc_madt_cpu_entry()is only used by:
-hw/i386/acpi-build.c// single call
-hw/i386/acpi-common.c// definition there is no need to expose it outside of hw/i386/. Declare it in "acpi-common.h".acpi-build.cdoesn't need "hw/i386/pc.h" anymore.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 4 ---- hw/i386/acpi-common.c | 1 - 3 files changed, 3 insertions(+), 5 deletions(-)hw/i386/acpi-common.h +0
-0@@ -1,12 +1,15 @@#ifndef HW_I386_ACPI_COMMON_H
hw/i386/acpi-common.h line 11
Quoted 10 lines
hw/i386/acpi-common.h +2
-0#define HW_I386_ACPI_COMMON_H +#include "hw/boards.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/i386/x86.h" /* Default IOAPIC ID */ #define ACPI_BUILD_IOAPIC_ID 0x0 +void pc_madt_cpu_entry(int uid, const CPUArchIdList *apic_ids,
Since the function is apparently not pc but rather x86-specific: Does it make sense to rename the function as well, e.g. to x86_madt_cpu_entry()?
Best regards,
Bernhard
Quoted 31 lines
hw/i386/acpi-common.h +1
-0+ GArray *entry, bool force_enabled);void acpi_build_madt (GArray *table_data,BIOSLinker *linker,X86MachineState *x86ms,const char *oem_id,const char *oem_table_id);include/hw/i386/pc.h +0
-4@@ -199,10 +199,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/i386/acpi-common.c +0
-1@@ -27,7 +27,6 @@#include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/utils.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "acpi-build.h"
Re: [PATCH 4/7] hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h'
Quoted 29 lines · Bernhard Beschow
Am 13. Februar 2024 12:01:49 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:
Quoted 26 lines
Since
pc_madt_cpu_entry()is only used by:
-hw/i386/acpi-build.c// single call
-hw/i386/acpi-common.c// definition there is no need to expose it outside of hw/i386/. Declare it in "acpi-common.h".acpi-build.cdoesn't need "hw/i386/pc.h" anymore.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 4 ---- hw/i386/acpi-common.c | 1 - 3 files changed, 3 insertions(+), 5 deletions(-)hw/i386/acpi-common.h +1
-0@@ -1,12 +1,15 @@#ifndef HW_I386_ACPI_COMMON_H #define HW_I386_ACPI_COMMON_H +#include "hw/boards.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/i386/x86.h"
Quoted 6 lines
hw/i386/acpi-common.h line 11
Quoted 4 lines
hw/i386/acpi-common.h +1
-0/* Default IOAPIC ID */ #define ACPI_BUILD_IOAPIC_ID 0x0 +void pc_madt_cpu_entry(int uid, const CPUArchIdList *apic_ids,Since the function is apparently not pc but rather x86-specific: Does it make sense to rename the function as well, e.g. to
x86_madt_cpu_entry()?
I don't know much about ACPI tables. Is it?
Ani, can you confirm and do you mind posting a cleanup patch on top? :)
Regards,
Phil.
PATCH 5/7 hw/i386/port92: Add missing 'hw/isa/isa.h' header
In reply to Philippe Mathieu-DaudéTYPE_PORT92 inherits TYPE_ISA_DEVICE, so need to include "hw/isa/isa.h" to get its declarations (currently we indirectly include this header via "hw/i386/pc.h").
--- hw/i386/port92.c | 1 + 1 file changed, 1 insertion(+)
hw/i386/port92.c +1 -0
@@ -10,6 +10,7 @@#include "sysemu/runstate.h" #include "migration/vmstate.h" #include "hw/irq.h" +#include "hw/isa/isa.h" #include "hw/i386/pc.h" #include "trace.h" #include "qom/object.h"
Signature · 1 line
2.41.0
PATCH 6/7 hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h'
In reply to Philippe Mathieu-Daudécpu_hotplug.c only needs the PCI *device* definitions.
--- hw/acpi/cpu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/cpu_hotplug.c +1 -1
@@ -14,7 +14,7 @@#include "qapi/error.h" #include "hw/core/cpu.h" #include "hw/i386/pc.h" -#include "hw/pci/pci.h" +#include "hw/pci/pci_device.h" #include "qemu/error-report.h" #define CPU_EJECT_METHOD "CPEJ"
Signature · 1 line
2.41.0
PATCH 7/7 hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'
In reply to Philippe Mathieu-DaudéX86 CPU hotplug isn't specific to PC machines.
--- hw/acpi/cpu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/cpu_hotplug.c +1 -1
@@ -13,7 +13,7 @@#include "hw/acpi/cpu_hotplug.h" #include "qapi/error.h" #include "hw/core/cpu.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/pci/pci_device.h" #include "qemu/error-report.h"
Signature · 1 line
2.41.0
Quoted 22 lines · Philippe Mathieu-Daudé
Trivial patches removing uses of "
hw/i386/pc.h".Philippe Mathieu-Daudé (7):
target/i386/monitor: Remove unused 'hw/i386/pc.h' header hw/timer: MoveHPET_INTCAPdefinition to "hpet.h" hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h' hw/i386/acpi: Declarepc_madt_cpu_entry()in 'acpi-common.h' hw/i386/port92: Add missing 'hw/isa/isa.h' header hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h' hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 6 ------ include/hw/timer/hpet.h | 2 ++ hw/acpi/cpu_hotplug.c | 4 ++-- hw/i386/acpi-common.c | 1 - hw/i386/port92.c | 1 + hw/isa/lpc_ich9.c | 1 - hw/timer/hpet.c | 1 - target/i386/monitor.c | 1 - 9 files changed, 8 insertions(+), 12 deletions(-)
Quoted 4 lines
--
2.41.0
For the series:
Quoted 1 line · Philippe Mathieu-Daudé
Trivial patches removing uses of "
hw/i386/pc.h".
How did you test that it's indeed unused?
Quoted 22 lines
Philippe Mathieu-Daudé (7):
target/i386/monitor: Remove unused 'hw/i386/pc.h' header hw/timer: MoveHPET_INTCAPdefinition to "hpet.h" hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h' hw/i386/acpi: Declarepc_madt_cpu_entry()in 'acpi-common.h' hw/i386/port92: Add missing 'hw/isa/isa.h' header hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h' hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 6 ------ include/hw/timer/hpet.h | 2 ++ hw/acpi/cpu_hotplug.c | 4 ++-- hw/i386/acpi-common.c | 1 - hw/i386/port92.c | 1 + hw/isa/lpc_ich9.c | 1 - hw/timer/hpet.c | 1 - target/i386/monitor.c | 1 - 9 files changed, 8 insertions(+), 12 deletions(-)Signature · 1 line
2.41.0
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line · Philippe Mathieu-Daudé
Trivial patches removing uses of "
hw/i386/pc.h".How did you test that it's indeed unused?
I put and #error in hw/i386/pc.h and built :)
(I'm trying to remove the PC dependency on generic devices.)
The few generic devices left are not as trivial.
Quoted 23 lines
Quoted 22 lines
Philippe Mathieu-Daudé (7):
target/i386/monitor: Remove unused 'hw/i386/pc.h' header hw/timer: MoveHPET_INTCAPdefinition to "hpet.h" hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h' hw/i386/acpi: Declarepc_madt_cpu_entry()in 'acpi-common.h' hw/i386/port92: Add missing 'hw/isa/isa.h' header hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h' hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 6 ------ include/hw/timer/hpet.h | 2 ++ hw/acpi/cpu_hotplug.c | 4 ++-- hw/i386/acpi-common.c | 1 - hw/i386/port92.c | 1 + hw/isa/lpc_ich9.c | 1 - hw/timer/hpet.c | 1 - target/i386/monitor.c | 1 - 9 files changed, 8 insertions(+), 12 deletions(-)Signature · 1 line
2.41.0
Am 13. Februar 2024 16:00:26 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:
Quoted 26 lines · Michael S. Tsirkin
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 1 line
Trivial patches removing uses of "
hw/i386/pc.h".How did you test that it's indeed unused?
I put and #error in
hw/i386/pc.hand built :)
(I'm trying to remove the PC dependency on generic devices.)The few generic devices left are not as trivial.
Quoted 15 lines
Quoted 15 lines
Philippe Mathieu-Daudé (7):
target/i386/monitor: Remove unused 'hw/i386/pc.h' header hw/timer: MoveHPET_INTCAPdefinition to "hpet.h" hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h' hw/i386/acpi: Declarepc_madt_cpu_entry()in 'acpi-common.h' hw/i386/port92: Add missing 'hw/isa/isa.h' header hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h' hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 6 ------ include/hw/timer/hpet.h | 2 ++ hw/acpi/cpu_hotplug.c | 4 ++-- hw/i386/acpi-common.c | 1 - hw/i386/port92.c | 1 +
I'd take care of port92 and make it part of all our three south bridge families (which models the real hardware more closely).
Best regards,
Bernhard
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
hw/isa/lpc_ich9.c | 1 - hw/timer/hpet.c | 1 - target/i386/monitor.c | 1 - 9 files changed, 8 insertions(+), 12 deletions(-)Signature · 1 line
2.41.0
Quoted 11 lines · Philippe Mathieu-Daudé
Trivial patches removing uses of "
hw/i386/pc.h".Philippe Mathieu-Daudé (7):
target/i386/monitor: Remove unused 'hw/i386/pc.h' header hw/timer: MoveHPET_INTCAPdefinition to "hpet.h" hw/isa/lpc_ich9: Remove unused 'hw/i386/pc.h' hw/i386/acpi: Declarepc_madt_cpu_entry()in 'acpi-common.h' hw/i386/port92: Add missing 'hw/isa/isa.h' header hw/acpi/cpu_hotplug: Include 'pci_device.h' instead of 'pci.h' hw/acpi/cpu_hotplug: Include 'x86.h' instead of 'pc.h'
Quoted 10 lines
hw/i386/acpi-common.h | 3 +++ include/hw/i386/pc.h | 6 ------ include/hw/timer/hpet.h | 2 ++ hw/acpi/cpu_hotplug.c | 4 ++-- hw/i386/acpi-common.c | 1 - hw/i386/port92.c | 1 + hw/isa/lpc_ich9.c | 1 - hw/timer/hpet.c | 1 - target/i386/monitor.c | 1 - 9 files changed, 8 insertions(+), 12 deletions(-)
For the series:
and picked up for trivial-patches.
Thanks,
/mjt