Skip to contentSkip to conversation

hw: Clean up hw/i386 headers (and few alpha/hppa)

PATCH In review Philippe Mathieu-Daudé 4 participants 22 messages Feb 28, 2020 – Mar 9, 2020

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/18 vl: Add missing "hw/boards.h" include

In reply to Philippe Mathieu-Daudé

vl.c calls machine_usb() declared in "hw/boards.h". Include it.

This fixes (when modifying unrelated headers):

vl.c:1283:10: error: implicit declaration of function 'machine_usb' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

      if (!machine_usb(current_machine)) {
           ^
  vl.c:1283:10: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
  vl.c:1283:22: error: use of undeclared identifier 'current_machine'
      if (!machine_usb(current_machine)) {
                       ^
---
 softmmu/vl.c | 1 +
 1 file changed, 1 insertion(+)
softmmu/vl.c +1 -0
index 16ff5a16a3..20b7201451 100644
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/units.h"
+#include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
 #include "qemu-version.h"
Signature · 1 line
2.21.1
#2 lore raw

PATCH v2 2/18 hw/southbridge/ich9: Removed unused headers

In reply to Philippe Mathieu-Daudé

The ICH9 chipset is not X86/PC specific.

These files don't use anything declared by the "hw/i386/pc.h" or "hw/i386/ioapic.h" headers. Remove them.

---
 include/hw/i386/ich9.h | 1 -
 hw/acpi/ich9.c         | 1 -
 hw/isa/lpc_ich9.c      | 1 -
 3 files changed, 3 deletions(-)
include/hw/i386/ich9.h +0 -1
index 72e803f6e2..a98d10b252 100644
@@ -5,7 +5,6 @@
 #include "hw/sysbus.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/apm.h"
-#include "hw/i386/ioapic.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pcie_host.h"
 #include "hw/pci/pci_bridge.h"
hw/acpi/ich9.c +0 -1
index 2034dd749e..fdd0a6c79e 100644
@@ -27,7 +27,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qapi/visitor.h"
-#include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "migration/vmstate.h"
 #include "qemu/timer.h"
hw/isa/lpc_ich9.c +0 -1
index f85b484eac..cb79616ced 100644
@@ -37,7 +37,6 @@
 #include "migration/vmstate.h"
 #include "hw/irq.h"
 #include "hw/isa/apm.h"
-#include "hw/i386/ioapic.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_bridge.h"
 #include "hw/i386/ich9.h"
Signature · 1 line
2.21.1
#0 lore raw

v2 cover hw: Clean up hw/i386 headers (and few alpha/hppa)

[Rebased since v1]:
https://www.mail-archive.com/[email protected]/msg57485.html

This is a follow-up of Markus's cleanup series:
Tame a few "touch this, recompile the world"
https://www.mail-archive.com/[email protected]/msg635748.html

This part is mostly restricted to X86, but since some file from the Alpha/PA-RISC machines include "hw/i386/pc.h" I had to fix them too.

Eventually I'll succeed at removing hw/i386/ dependency on non-X86 platforms (Quest I started 2 years ago...).

Regards,

Phil.

Philippe Mathieu-Daudé (18):
vl: Add missing "hw/boards.h" include hw/southbridge/ich9: Removed unused headers hw/i386/ioapic_internal: Remove unused "hw/i386/ioapic.h" header hw/timer: Remove unused "ui/console.h" header hw/usb/dev-storage: Remove unused "ui/console.h" header hw/i386/intel_iommu: Remove unused includes hw/alpha/alpha_sys: Remove unused "hw/ide.h" header hw/alpha/dp264: Include "net/net.h"
hw/hppa/machine: Include "net/net.h" hw/acpi/cpu_hotplug: Include "hw/pci/pci.h" hw/timer/hpet: Include "exec/address-spaces.h" hw/pci-host/q35: Include "qemu/range.h" hw/i2c/smbus_ich9: Include "qemu/range.h" hw/pci-host/piix: Include "qemu/range.h"
hw/acpi: Include "hw/mem/nvdimm.h"
hw/i386: Include "hw/mem/nvdimm.h"
hw/pci-host/q35: Remove unused includes
hw/i386/pc: Clean up includes

 hw/alpha/alpha_sys.h              |  1 -
 include/hw/i386/ich9.h            |  1 -
 include/hw/i386/intel_iommu.h     |  4 ----
 include/hw/i386/ioapic_internal.h |  1 -
 include/hw/i386/pc.h              | 11 +++--------
 include/hw/pci-host/q35.h         |  8 +-------
 hw/acpi/cpu_hotplug.c             |  1 +
 hw/acpi/ich9.c                    |  2 +-
 hw/acpi/piix4.c                   |  1 +
 hw/alpha/dp264.c                  |  1 +
 hw/hppa/machine.c                 |  1 +
 hw/i2c/smbus_ich9.c               |  1 +
 hw/i386/acpi-build.c              |  1 +
 hw/i386/pc.c                      |  1 +
 hw/i386/pc_piix.c                 |  1 +
 hw/i386/pc_q35.c                  |  1 +
 hw/isa/lpc_ich9.c                 |  1 -
 hw/pci-host/i440fx.c              |  1 +
 hw/pci-host/q35.c                 |  1 +
 hw/rtc/twl92230.c                 |  1 -
 hw/timer/hpet.c                   |  2 +-
 hw/usb/dev-storage.c              |  1 -
 softmmu/vl.c                      |  1 +
 23 files changed, 18 insertions(+), 27 deletions(-)
Signature · 1 line
2.21.1
#3 lore raw

PATCH v2 3/18 hw/i386/ioapic_internal: Remove unused "hw/i386/ioapic.h" header

The "ioapic_internal.h" does not use anything from "hw/i386/ioapic.h", remove it.

---
 include/hw/i386/ioapic_internal.h | 1 -
 1 file changed, 1 deletion(-)
include/hw/i386/ioapic_internal.h +0 -1
index d46c87c510..fe06938bda 100644
@@ -23,7 +23,6 @@
 #define QEMU_IOAPIC_INTERNAL_H
 
 #include "exec/memory.h"
-#include "hw/i386/ioapic.h"
 #include "hw/sysbus.h"
 #include "qemu/notify.h"
 
Signature · 1 line
2.21.1
#4 lore raw

PATCH v2 4/18 hw/timer: Remove unused "ui/console.h" header

In reply to Philippe Mathieu-Daudé

The timer models don't need anything from "ui/console.h". Remove it.

---
 hw/rtc/twl92230.c | 1 -
 hw/timer/hpet.c   | 1 -
 2 files changed, 2 deletions(-)
hw/rtc/twl92230.c +0 -1
index 63bd13d2ca..d0011be89e 100644
@@ -27,7 +27,6 @@
 #include "migration/qemu-file-types.h"
 #include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
-#include "ui/console.h"
 #include "qemu/bcd.h"
 #include "qemu/module.h"
 
hw/timer/hpet.c +0 -1
index 8dbcbdca16..4f30dd50a4 100644
@@ -27,7 +27,6 @@
 #include "qemu/osdep.h"
 #include "hw/i386/pc.h"
 #include "hw/irq.h"
-#include "ui/console.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
Signature · 1 line
2.21.1
#5 lore raw

PATCH v2 5/18 hw/usb/dev-storage: Remove unused "ui/console.h" header

In reply to Philippe Mathieu-Daudé

The USB models related to storage don't need anything from "ui/console.h". Remove it.

---
 hw/usb/dev-storage.c | 1 -
 1 file changed, 1 deletion(-)
hw/usb/dev-storage.c +0 -1
index 90da008df1..4883c1d89e 100644
@@ -17,7 +17,6 @@
 #include "desc.h"
 #include "hw/qdev-properties.h"
 #include "hw/scsi/scsi.h"
-#include "ui/console.h"
 #include "migration/vmstate.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
Signature · 1 line
2.21.1
#7 lore raw

PATCH v2 6/18 hw/i386/intel_iommu: Remove unused includes

In reply to Philippe Mathieu-Daudé

intel_iommu.h does not use any of these includes, remove them.

---
 include/hw/i386/intel_iommu.h | 4 ----
 1 file changed, 4 deletions(-)
include/hw/i386/intel_iommu.h +0 -4
index 66b931e526..a1c4afcda5 100644
@@ -22,11 +22,7 @@
 #ifndef INTEL_IOMMU_H
 #define INTEL_IOMMU_H
 
-#include "sysemu/dma.h"
 #include "hw/i386/x86-iommu.h"
-#include "hw/i386/ioapic.h"
-#include "hw/pci/msi.h"
-#include "hw/sysbus.h"
 #include "qemu/iova-tree.h"
 
 #define TYPE_INTEL_IOMMU_DEVICE "intel-iommu"
Signature · 1 line
2.21.1
#8 lore raw

PATCH v2 7/18 hw/alpha/alpha_sys: Remove unused "hw/ide.h" header

In reply to Philippe Mathieu-Daudé

alpha_sys.h does not use anything from the "hw/ide.h" header. Remove it.

---
 hw/alpha/alpha_sys.h | 1 -
 1 file changed, 1 deletion(-)
hw/alpha/alpha_sys.h +0 -1
index bc0a286226..e2c02e2bbe 100644
@@ -6,7 +6,6 @@
 #include "target/alpha/cpu-qom.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
-#include "hw/ide.h"
 #include "hw/boards.h"
 #include "hw/intc/i8259.h"
 
Signature · 1 line
2.21.1
#9 lore raw

PATCH v2 8/18 hw/alpha/dp264: Include "net/net.h"

In reply to Philippe Mathieu-Daudé

hw/alpha/dp264.c uses NICInfo variables which are declared in "net/net.h". Include it.

This fixes (when modifying unrelated headers):

hw/alpha/dp264.c:89:21: error: use of undeclared identifier 'nb_nics'

      for (i = 0; i < nb_nics; i++) {
                      ^
  hw/alpha/dp264.c:90:30: error: use of undeclared identifier 'nd_table'
          pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL);
                               ^
---
 hw/alpha/dp264.c | 1 +
 1 file changed, 1 insertion(+)
hw/alpha/dp264.c +1 -0
index 8d71a30617..e264c783c1 100644
@@ -21,6 +21,7 @@
 #include "hw/dma/i8257.h"
 #include "net/net.h"
 #include "qemu/cutils.h"
+#include "net/net.h"
 
 #define MAX_IDE_BUS 2
 
Signature · 1 line
2.21.1
#12 lore raw

PATCH v2 11/18 hw/timer/hpet: Include "exec/address-spaces.h"

In reply to Philippe Mathieu-Daudé

hw/timer/hpet.c calls address_space_stl_le() declared in "exec/address-spaces.h". Include it.

This fixes (when modifying unrelated headers):

hw/timer/hpet.c:210:31: error: use of undeclared identifier 'address_space_memory'

          address_space_stl_le(&address_space_memory, timer->fsb >> 32,
                               ^~~~~~~~~~~~~~~~~~~~
---
 hw/timer/hpet.c | 1 +
 1 file changed, 1 insertion(+)
hw/timer/hpet.c +1 -0
index 4f30dd50a4..380acfa7c8 100644
@@ -36,6 +36,7 @@
 #include "hw/rtc/mc146818rtc_regs.h"
 #include "migration/vmstate.h"
 #include "hw/timer/i8254.h"
+#include "exec/address-spaces.h"
 
 //#define HPET_DEBUG
 #ifdef HPET_DEBUG
Signature · 1 line
2.21.1
#10 lore raw

PATCH v2 9/18 hw/hppa/machine: Include "net/net.h"

In reply to Philippe Mathieu-Daudé

hw/hppa/machine.c uses NICInfo variables which are declared in "net/net.h". Include it.

This fixes (when modifying unrelated headers):

hw/hppa/machine.c:126:21: error: use of undeclared identifier 'nb_nics'

      for (i = 0; i < nb_nics; i++) {
                      ^
  hw/hppa/machine.c:127:30: error: use of undeclared identifier 'nd_table'
          pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL);
                               ^
---
 hw/hppa/machine.c | 1 +
 1 file changed, 1 insertion(+)
hw/hppa/machine.c +1 -0
index 67181e75ba..d1e59a97f6 100644
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "net/net.h"
 #include "qemu/log.h"
+#include "net/net.h"
 
 #define MAX_IDE_BUS 2
 
Signature · 1 line
2.21.1
#11 lore raw

PATCH v2 10/18 hw/acpi/cpu_hotplug: Include "hw/pci/pci.h"

In reply to Philippe Mathieu-Daudé

hw/acpi/cpu_hotplug.c calls pci_address_space_io(). Include "hw/pci/pci.h" which declares it.

This fixes (when modifying unrelated headers):

hw/acpi/cpu_hotplug.c:103:28: error: implicit declaration of function 'pci_address_space_io' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

      MemoryRegion *parent = pci_address_space_io(PCI_DEVICE(gpe_cpu->device));
                             ^
---
 hw/acpi/cpu_hotplug.c | 1 +
 1 file changed, 1 insertion(+)
hw/acpi/cpu_hotplug.c +1 -0
index 9c3bcc84de..3e687d227a 100644
@@ -14,6 +14,7 @@
 #include "qapi/error.h"
 #include "hw/core/cpu.h"
 #include "hw/i386/pc.h"
+#include "hw/pci/pci.h"
 #include "qemu/error-report.h"
 
 #define CPU_EJECT_METHOD "CPEJ"
Signature · 1 line
2.21.1
#13 lore raw

PATCH v2 12/18 hw/pci-host/q35: Include "qemu/range.h"

In reply to Philippe Mathieu-Daudé

The MCHPCIState structure uses the Range type which is declared in "qemu/range.h". Include it.

This fixes (when modifying unrelated headers):

In file included from hw/pci-host/q35.c:32:
include/hw/pci-host/q35.h:57:11: error: field has incomplete type 'Range' (aka 'struct Range')

      Range pci_hole;
            ^
  include/qemu/typedefs.h:116:16: note: forward declaration of 'struct Range'
  typedef struct Range Range;
                 ^
---
 include/hw/pci-host/q35.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/pci-host/q35.h +1 -0
index 976fbae599..47086c645e 100644
@@ -33,6 +33,7 @@
 #include "hw/pci-host/pam.h"
 #include "hw/i386/intel_iommu.h"
 #include "qemu/units.h"
+#include "qemu/range.h"
 
 #define TYPE_Q35_HOST_DEVICE "q35-pcihost"
 #define Q35_HOST_DEVICE(obj) \
Signature · 1 line
2.21.1
#14 lore raw

PATCH v2 13/18 hw/i2c/smbus_ich9: Include "qemu/range.h"

In reply to Philippe Mathieu-Daudé

hw/i2c/smbus_ich9.c calls range_covers_byte(). Include "qemu/range.h" which declares it.

This fixes (when modifying unrelated headers):

hw/i2c/smbus_ich9.c:66:9: error: implicit declaration of function 'range_covers_byte' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

      if (range_covers_byte(address, len, ICH9_SMB_HOSTC)) {
          ^
---
 hw/i2c/smbus_ich9.c | 1 +
 1 file changed, 1 insertion(+)
hw/i2c/smbus_ich9.c +1 -0
index fd50fb851a..48f1ff4191 100644
@@ -21,6 +21,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/range.h"
 #include "hw/i2c/pm_smbus.h"
 #include "hw/pci/pci.h"
 #include "migration/vmstate.h"
Signature · 1 line
2.21.1
#16 lore raw

PATCH v2 15/18 hw/acpi: Include "hw/mem/nvdimm.h"

In reply to Philippe Mathieu-Daudé

Both ich9.c and piix4.c use methods/definitions declared in the NVDIMM device header. Include it.

This fixes (when modifying unrelated headers):

hw/acpi/ich9.c:507:46: error: use of undeclared identifier 'TYPE_NVDIMM'

        if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
                                             ^
  hw/acpi/ich9.c:508:13: error: implicit declaration of function 'nvdimm_acpi_plug_cb' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            nvdimm_acpi_plug_cb(hotplug_dev, dev);
            ^
  hw/acpi/piix4.c:403:46: error: use of undeclared identifier 'TYPE_NVDIMM'
        if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
                                             ^
  hw/acpi/piix4.c:404:13: error: implicit declaration of function 'nvdimm_acpi_plug_cb' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            nvdimm_acpi_plug_cb(hotplug_dev, dev);
            ^
---
 hw/acpi/ich9.c  | 1 +
 hw/acpi/piix4.c | 1 +
 2 files changed, 2 insertions(+)
hw/acpi/ich9.c +1 -0
index fdd0a6c79e..4e74284b65 100644
@@ -39,6 +39,7 @@
 
 #include "hw/i386/ich9.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 
 //#define DEBUG
 
hw/acpi/piix4.c +1 -0
index 6d621c31e7..b84dbba2c3 100644
@@ -38,6 +38,7 @@
 #include "hw/acpi/cpu.h"
 #include "hw/hotplug.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/xen/xen.h"
Signature · 1 line
2.21.1
#15 lore raw

PATCH v2 14/18 hw/pci-host/piix: Include "qemu/range.h"

In reply to Philippe Mathieu-Daudé

hw/pci-host/piix.c calls various functions from the Range API. Include "qemu/range.h" which declares them.

This fixes (when modifying unrelated headers):

hw/pci-host/i440fx.c:54:11: error: field has incomplete type 'Range' (aka 'struct Range')

      Range pci_hole;
           ^
  include/qemu/typedefs.h:116:16: note: forward declaration of 'struct Range'
  typedef struct Range Range;
                 ^
  hw/pci-host/i440fx.c:126:9: error: implicit declaration of function 'ranges_overlap' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
          ^
  hw/pci-host/i440fx.c:126:9: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
  hw/pci-host/i440fx.c:127:9: error: implicit declaration of function 'range_covers_byte' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          range_covers_byte(address, len, I440FX_SMRAM)) {
          ^
  hw/pci-host/i440fx.c:127:9: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
  hw/pci-host/i440fx.c:189:13: error: implicit declaration of function 'range_is_empty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      val64 = range_is_empty(&s->pci_hole) ? 0 : range_lob(&s->pci_hole);
              ^
---
 hw/pci-host/i440fx.c | 1 +
 1 file changed, 1 insertion(+)
hw/pci-host/i440fx.c +1 -0
index 11050a0f8b..d980c97049 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/range.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
Signature · 1 line
2.21.1
#17 lore raw

PATCH v2 16/18 hw/i386: Include "hw/mem/nvdimm.h"

In reply to Philippe Mathieu-Daudé

All this files use methods/definitions declared in the NVDIMM device header. Include it.

This fixes (when modifying unrelated headers):

hw/i386/acpi-build.c:2733:9: error: implicit declaration of function 'nvdimm_build_acpi' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

        nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
        ^
  hw/i386/pc.c:1996:61: error: use of undeclared identifier 'TYPE_NVDIMM'
    const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
                                                            ^
  hw/i386/pc.c:2032:55: error: use of undeclared identifier 'TYPE_NVDIMM'
    bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
                                                      ^
  hw/i386/pc.c:2040:9: error: implicit declaration of function 'nvdimm_plug' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        nvdimm_plug(ms->nvdimms_state);
        ^
  hw/i386/pc.c:2040:9: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
        nvdimm_plug(ms->nvdimms_state);
        ^
  hw/i386/pc.c:2065:42: error: use of undeclared identifier 'TYPE_NVDIMM'
    if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
                                         ^
  hw/i386/pc_i440fx.c:307:9: error: implicit declaration of function 'nvdimm_init_acpi_state' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        nvdimm_init_acpi_state(machine->nvdimms_state, system_io,
        ^
  hw/i386/pc_q35.c:332:9: error: implicit declaration of function 'nvdimm_init_acpi_state' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        nvdimm_init_acpi_state(machine->nvdimms_state, system_io,
        ^
---
 hw/i386/acpi-build.c | 1 +
 hw/i386/pc.c         | 1 +
 hw/i386/pc_piix.c    | 1 +
 hw/i386/pc_q35.c     | 1 +
 4 files changed, 4 insertions(+)
hw/i386/acpi-build.c +1 -0
index 9c4e46fa74..9335a82e9f 100644
@@ -47,6 +47,7 @@
 #include "hw/rtc/mc146818rtc_regs.h"
 #include "migration/vmstate.h"
 #include "hw/mem/memory-device.h"
+#include "hw/mem/nvdimm.h"
 #include "sysemu/numa.h"
 #include "sysemu/reset.h"
 
hw/i386/pc.c +1 -0
index 6ab4acb0c6..362eb2a180 100644
@@ -76,6 +76,7 @@
 #include "hw/boards.h"
 #include "acpi-build.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 #include "qapi/error.h"
 #include "qapi/qapi-visit-common.h"
 #include "qapi/visitor.h"
hw/i386/pc_piix.c +1 -0
index fa12203079..82f1693901 100644
@@ -60,6 +60,7 @@
 #include "migration/global_state.h"
 #include "migration/misc.h"
 #include "sysemu/numa.h"
+#include "hw/mem/nvdimm.h"
 
 #define MAX_IDE_BUS 2
 
hw/i386/pc_q35.c +1 -0
index 84cf925cf4..d37c425e22 100644
@@ -53,6 +53,7 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "sysemu/numa.h"
+#include "hw/mem/nvdimm.h"
 
 /* ICH9 AHCI has 6 ports */
 #define MAX_SATA_PORTS     6
Signature · 1 line
2.21.1
#18 lore raw

PATCH v2 17/18 hw/pci-host/q35: Remove unused includes

In reply to Philippe Mathieu-Daudé

Only q35.c requires declarations from "hw/i386/pc.h", move it there. Remove all the includes not used by "q35.h".

---
 include/hw/pci-host/q35.h | 7 -------
 hw/pci-host/q35.c         | 1 +
 2 files changed, 1 insertion(+), 7 deletions(-)
include/hw/pci-host/q35.h +0 -7
index 47086c645e..070305f83d 100644
@@ -22,16 +22,9 @@
 #ifndef HW_Q35_H
 #define HW_Q35_H
 
-#include "hw/isa/isa.h"
-#include "hw/sysbus.h"
-#include "hw/i386/pc.h"
-#include "hw/isa/apm.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pcie_host.h"
-#include "hw/acpi/acpi.h"
-#include "hw/acpi/ich9.h"
 #include "hw/pci-host/pam.h"
-#include "hw/i386/intel_iommu.h"
 #include "qemu/units.h"
 #include "qemu/range.h"
 
hw/pci-host/q35.c +1 -0
index a9b9ccc876..993f467668 100644
@@ -29,6 +29,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/i386/pc.h"
 #include "hw/pci-host/q35.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
Signature · 1 line
2.21.1
#19 lore raw

PATCH v2 18/18 hw/i386/pc: Clean up includes

In reply to Philippe Mathieu-Daudé

Various headers are not required by hw/i386/pc.h:

- "qemu/range.h"
- "qemu/bitmap.h"
- "qemu/module.h"
- "exec/memory.h"
- "hw/pci/pci.h"
- "hw/mem/pc-dimm.h"
- "hw/mem/nvdimm.h"
- "net/net.h"

Remove them.

Add 3 headers that were missing:

- "hw/hotplug.h"

PCMachineState::acpi_dev is of type HotplugHandler

- "qemu/notify.h"

PCMachineState::machine_done is of type Notifier

- "qapi/qapi-types-common.h"

PCMachineState::vmport/smm is of type OnOffAuto

---
 include/hw/i386/pc.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
include/hw/i386/pc.h +3 -8
index d5ac76d54e..6ab6eda046 100644
@@ -1,20 +1,15 @@
 #ifndef HW_PC_H
 #define HW_PC_H
 
-#include "exec/memory.h"
+#include "qemu/notify.h"
+#include "qapi/qapi-types-common.h"
 #include "hw/boards.h"
 #include "hw/block/fdc.h"
 #include "hw/block/flash.h"
-#include "net/net.h"
 #include "hw/i386/x86.h"
 
-#include "qemu/range.h"
-#include "qemu/bitmap.h"
-#include "qemu/module.h"
-#include "hw/pci/pci.h"
-#include "hw/mem/pc-dimm.h"
-#include "hw/mem/nvdimm.h"
 #include "hw/acpi/acpi_dev_interface.h"
+#include "hw/hotplug.h"
 
 #define HPET_INTCAP "hpet-intcap"
 
Signature · 1 line
2.21.1
Reviewed-by on the v2 series
#20 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Philippe Mathieu-Daudé (18):
vl: Add missing "hw/boards.h" include hw/southbridge/ich9: Removed unused headers hw/i386/ioapic_internal: Remove unused "hw/i386/ioapic.h" header hw/timer: Remove unused "ui/console.h" header hw/usb/dev-storage: Remove unused "ui/console.h" header hw/i386/intel_iommu: Remove unused includes hw/alpha/alpha_sys: Remove unused "hw/ide.h" header hw/alpha/dp264: Include "net/net.h"
hw/hppa/machine: Include "net/net.h"

Quoted 8 lines

hw/acpi/cpu_hotplug: Include "hw/pci/pci.h"
hw/timer/hpet: Include "exec/address-spaces.h"
hw/pci-host/q35: Include "qemu/range.h"
hw/i2c/smbus_ich9: Include "qemu/range.h"
hw/pci-host/piix: Include "qemu/range.h"
hw/acpi: Include "hw/mem/nvdimm.h"
hw/i386: Include "hw/mem/nvdimm.h"
hw/pci-host/q35: Remove unused includes

r~

#21 lore raw
In reply to Philippe Mathieu-Daudé

Le 28/02/2020 à 12:46, Philippe Mathieu-Daudé a écrit :

Quoted 54 lines

[Rebased since v1]:
https://www.mail-archive.com/[email protected]/msg57485.html

This is a follow-up of Markus's cleanup series:
Tame a few "touch this, recompile the world"
https://www.mail-archive.com/[email protected]/msg635748.html

This part is mostly restricted to X86, but since some file from the Alpha/PA-RISC machines include "hw/i386/pc.h" I had to fix them too.

Eventually I'll succeed at removing hw/i386/ dependency on non-X86 platforms (Quest I started 2 years ago...).

Regards,

Phil.

Philippe Mathieu-Daudé (18):
vl: Add missing "hw/boards.h" include hw/southbridge/ich9: Removed unused headers hw/i386/ioapic_internal: Remove unused "hw/i386/ioapic.h" header hw/timer: Remove unused "ui/console.h" header hw/usb/dev-storage: Remove unused "ui/console.h" header hw/i386/intel_iommu: Remove unused includes hw/alpha/alpha_sys: Remove unused "hw/ide.h" header hw/alpha/dp264: Include "net/net.h"
hw/hppa/machine: Include "net/net.h" hw/acpi/cpu_hotplug: Include "hw/pci/pci.h" hw/timer/hpet: Include "exec/address-spaces.h" hw/pci-host/q35: Include "qemu/range.h" hw/i2c/smbus_ich9: Include "qemu/range.h" hw/pci-host/piix: Include "qemu/range.h"
hw/acpi: Include "hw/mem/nvdimm.h"
hw/i386: Include "hw/mem/nvdimm.h"
hw/pci-host/q35: Remove unused includes
hw/i386/pc: Clean up includes

 hw/alpha/alpha_sys.h              |  1 -
 include/hw/i386/ich9.h            |  1 -
 include/hw/i386/intel_iommu.h     |  4 ----
 include/hw/i386/ioapic_internal.h |  1 -
 include/hw/i386/pc.h              | 11 +++--------
 include/hw/pci-host/q35.h         |  8 +-------
 hw/acpi/cpu_hotplug.c             |  1 +
 hw/acpi/ich9.c                    |  2 +-
 hw/acpi/piix4.c                   |  1 +
 hw/alpha/dp264.c                  |  1 +
 hw/hppa/machine.c                 |  1 +
 hw/i2c/smbus_ich9.c               |  1 +
 hw/i386/acpi-build.c              |  1 +
 hw/i386/pc.c                      |  1 +
 hw/i386/pc_piix.c                 |  1 +
 hw/i386/pc_q35.c                  |  1 +
Quoted 9 lines
 hw/isa/lpc_ich9.c                 |  1 -
 hw/pci-host/i440fx.c              |  1 +
 hw/pci-host/q35.c                 |  1 +
 hw/rtc/twl92230.c                 |  1 -
 hw/timer/hpet.c                   |  2 +-
 hw/usb/dev-storage.c              |  1 -
 softmmu/vl.c                      |  1 +
 23 files changed, 18 insertions(+), 27 deletions(-)

Series applied to my trivial-patches branch.

Thanks,
Laurent