[Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less

Markus Armbruster posted 29 patches 6 years, 6 months ago
Maintainers: Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Andrzej Zaborowski <balrogg@gmail.com>, Stafford Horne <shorne@gmail.com>, Xiao Guangrong <xiaoguangrong.eric@gmail.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Riku Voipio <riku.voipio@iki.fi>, Michael Walle <michael@walle.cc>, Juan Quintela <quintela@redhat.com>, Pierre Morel <pmorel@linux.ibm.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Markus Armbruster <armbru@redhat.com>, BALATON Zoltan <balaton@eik.bme.hu>, Stefan Weil <sw@weilnetz.de>, Corey Minyard <minyard@acm.org>, Leif Lindholm <leif.lindholm@linaro.org>, Beniamino Galvani <b.galvani@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Amit Shah <amit@kernel.org>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Collin Walling <walling@linux.ibm.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Yuval Shaia <yuval.shaia@oracle.com>, Liu Yuan <namei.unix@gmail.com>, Alex Williamson <alex.williamson@redhat.com>, Peter Chubb <peter.chubb@nicta.com.au>, Anthony Perard <anthony.perard@citrix.com>, Andrew Jeffery <andrew@aj.id.au>, Alistair Francis <Alistair.Francis@wdc.com>, Richard Henderson <rth@twiddle.net>, Luigi Rizzo <rizzo@iet.unipi.it>, Anthony Green <green@moxielogic.com>, Shannon Zhao <shannon.zhaosl@gmail.com>, Peter Lieven <pl@kamp.de>, Jason Wang <jasowang@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Corey Minyard <cminyard@mvista.com>, Vincenzo Maffione <v.maffione@gmail.com>, James Hogan <jhogan@kernel.org>, Gonglei <arei.gonglei@huawei.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Fabien Chouteau <chouteau@adacore.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Marek Vasut <marex@denx.de>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Alberto Garcia <berto@igalia.com>, Laurent Vivier <lvivier@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>, KONRAD Frederic <frederic.konrad@adacore.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Keith Busch <keith.busch@intel.com>, Stefano Stabellini <sstabellini@kernel.org>, zhanghailiang <zhang.zhanghailiang@huawei.com>, Eric Blake <eblake@redhat.com>, David Hildenbrand <david@redhat.com>, Paul Burton <pburton@wavecomp.com>, Jan Kiszka <jan.kiszka@web.de>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Joel Stanley <joel@jms.id.au>, Stefan Berger <stefanb@linux.ibm.com>, Peter Maydell <peter.maydell@linaro.org>, Jia Liu <proljc@gmail.com>, Igor Mammedov <imammedo@redhat.com>, Helge Deller <deller@gmx.de>, Fam Zheng <fam@euphon.net>, Jiri Pirko <jiri@resnulli.us>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Magnus Damm <magnus.damm@gmail.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Stefan Hajnoczi <stefanha@redhat.com>, Xie Changlong <xiechanglong.d@gmail.com>, Thomas Huth <huth@tuxfamily.org>, Marcelo Tosatti <mtosatti@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, John Snow <jsnow@redhat.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Palmer Dabbelt <palmer@sifive.com>, Gerd Hoffmann <kraxel@redhat.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Thomas Huth <thuth@redhat.com>, Hannes Reinecke <hare@suse.com>, Jiri Slaby <jslaby@suse.cz>, Kevin Wolf <kwolf@redhat.com>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Andrew Baumann <Andrew.Baumann@microsoft.com>, Alistair Francis <alistair@alistair23.me>, Rob Herring <robh@kernel.org>, Halil Pasic <pasic@linux.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Cornelia Huck <cohuck@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>, Eric Farman <farman@linux.ibm.com>, Wen Congyang <wencongyang2@huawei.com>, Max Reitz <mreitz@redhat.com>, Chris Wulff <crwulff@gmail.com>, Eric Auger <eric.auger@redhat.com>, Greg Kurz <groug@kaod.org>, Paul Durrant <paul.durrant@citrix.com>, Antony Pavlov <antonynpavlov@gmail.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Jean-Christophe Dubois <jcd@tribudubois.net>, Tony Krowiak <akrowiak@linux.ibm.com>, Ben Warren <ben@skyportsystems.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Aleksandar Rikalo <arikalo@wavecomp.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Laszlo Ersek <lersek@redhat.com>, Artyom Tarasenko <atar4qemu@gmail.com>
There is a newer version of this series
[Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Markus Armbruster 6 years, 6 months ago
hw/boards.h pulls in almost 60 headers.  The less we include it into
headers, the better.  As a first step, drop superfluous inclusions,
and downgrade some more to what's actually needed.  Gets rid of just
one inclusion into a header.

Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 backends/cryptodev-builtin.c    | 1 -
 backends/cryptodev-vhost-user.c | 1 -
 backends/cryptodev.c            | 1 -
 hw/acpi/ich9.c                  | 1 +
 hw/alpha/dp264.c                | 1 -
 hw/alpha/typhoon.c              | 1 +
 hw/arm/boot.c                   | 1 -
 hw/arm/exynos4210.c             | 2 +-
 hw/arm/fsl-imx25.c              | 1 -
 hw/arm/fsl-imx31.c              | 1 -
 hw/arm/msf2-soc.c               | 1 -
 hw/arm/nrf51_soc.c              | 1 -
 hw/arm/omap1.c                  | 1 +
 hw/arm/omap2.c                  | 1 +
 hw/arm/smmuv3.c                 | 1 -
 hw/arm/virt.c                   | 1 +
 hw/core/numa.c                  | 2 ++
 hw/i386/pc_piix.c               | 1 -
 hw/i386/pc_q35.c                | 1 -
 hw/i386/pc_sysfw.c              | 1 -
 hw/ppc/e500plat.c               | 1 -
 hw/ppc/mpc8544ds.c              | 1 -
 hw/ppc/pnv.c                    | 1 +
 hw/ppc/ppc405_uc.c              | 1 -
 hw/ppc/spapr_cpu_core.c         | 1 -
 hw/ppc/spapr_vio.c              | 1 -
 hw/riscv/boot.c                 | 2 +-
 hw/s390x/s390-stattrib.c        | 1 -
 hw/xtensa/xtensa_memory.c       | 1 -
 include/hw/mem/pc-dimm.h        | 1 -
 monitor/qmp-cmds.c              | 1 -
 target/alpha/machine.c          | 1 -
 target/arm/machine.c            | 1 -
 target/arm/monitor.c            | 1 -
 target/hppa/machine.c           | 1 -
 target/i386/hax-all.c           | 1 -
 target/i386/hvf/hvf.c           | 1 -
 target/i386/hvf/x86_task.c      | 1 -
 target/i386/machine.c           | 1 -
 target/i386/whpx-all.c          | 1 -
 target/lm32/machine.c           | 1 -
 target/moxie/machine.c          | 1 -
 target/openrisc/machine.c       | 1 -
 target/ppc/machine.c            | 1 -
 target/sparc/machine.c          | 1 -
 45 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 9fb0bd57a6..c8ae3b9742 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -23,7 +23,6 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/cryptodev.h"
-#include "hw/boards.h"
 #include "qapi/error.h"
 #include "standard-headers/linux/virtio_crypto.h"
 #include "crypto/cipher.h"
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 1052a5d0e9..b344283940 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -22,7 +22,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/boards.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
diff --git a/backends/cryptodev.c b/backends/cryptodev.c
index f35be377ef..3c071eab95 100644
--- a/backends/cryptodev.c
+++ b/backends/cryptodev.c
@@ -23,7 +23,6 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/cryptodev.h"
-#include "hw/boards.h"
 #include "qapi/error.h"
 #include "qapi/visitor.h"
 #include "qemu/config-file.h"
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 39649cbe6a..c1aaa07d43 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -31,6 +31,7 @@
 #include "hw/pci/pci.h"
 #include "migration/vmstate.h"
 #include "qemu/timer.h"
+#include "qom/cpu.h"
 #include "sysemu/reset.h"
 #include "sysemu/sysemu.h"
 #include "hw/acpi/acpi.h"
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 546b89bbcc..51feee8558 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -11,7 +11,6 @@
 #include "cpu.h"
 #include "elf.h"
 #include "hw/loader.h"
-#include "hw/boards.h"
 #include "alpha_sys.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index 5d7f8f3342..1c0565acc1 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -11,6 +11,7 @@
 #include "qemu/units.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "hw/boards.h"
 #include "hw/irq.h"
 #include "sysemu/sysemu.h"
 #include "alpha_sys.h"
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 8563672942..eff89ab80e 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -18,7 +18,6 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/numa.h"
 #include "sysemu/reset.h"
-#include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
 #include "sysemu/device_tree.h"
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index 0e403f3e78..a9f8a5c868 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -27,7 +27,7 @@
 #include "cpu.h"
 #include "hw/cpu/a9mpcore.h"
 #include "hw/irq.h"
-#include "hw/boards.h"
+#include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
 #include "hw/arm/boot.h"
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
index 098e84c84d..532d088298 100644
--- a/hw/arm/fsl-imx25.c
+++ b/hw/arm/fsl-imx25.c
@@ -28,7 +28,6 @@
 #include "hw/arm/fsl-imx25.h"
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
-#include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "chardev/char.h"
 
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
index 093ad40984..1a37a7b997 100644
--- a/hw/arm/fsl-imx31.c
+++ b/hw/arm/fsl-imx31.c
@@ -25,7 +25,6 @@
 #include "hw/arm/fsl-imx31.h"
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
-#include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "chardev/char.h"
 
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
index 4e5251c92e..8ae763f99f 100644
--- a/hw/arm/msf2-soc.c
+++ b/hw/arm/msf2-soc.c
@@ -28,7 +28,6 @@
 #include "exec/address-spaces.h"
 #include "hw/char/serial.h"
 #include "hw/irq.h"
-#include "hw/boards.h"
 #include "hw/arm/msf2-soc.h"
 #include "hw/misc/unimp.h"
 
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index fc067cd8ee..d9e54fefbb 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -12,7 +12,6 @@
 #include "qapi/error.h"
 #include "hw/arm/boot.h"
 #include "hw/sysbus.h"
-#include "hw/boards.h"
 #include "hw/misc/unimp.h"
 #include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 19fca4159a..d28ad2b9ff 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -29,6 +29,7 @@
 #include "hw/qdev-properties.h"
 #include "hw/arm/boot.h"
 #include "hw/arm/omap.h"
+#include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/soc_dma.h"
 #include "sysemu/qtest.h"
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index dccb5707f8..e0a9c2da83 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -22,6 +22,7 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "sysemu/blockdev.h"
 #include "sysemu/qtest.h"
 #include "sysemu/reset.h"
 #include "hw/boards.h"
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 0634a398d2..0ccc772390 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -17,7 +17,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/boards.h"
 #include "hw/irq.h"
 #include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e9fddec058..226e810d06 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -34,6 +34,7 @@
 #include "qemu/option.h"
 #include "qapi/error.h"
 #include "hw/sysbus.h"
+#include "hw/boards.h"
 #include "hw/arm/boot.h"
 #include "hw/arm/primecell.h"
 #include "hw/arm/virt.h"
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 67548064ee..d817f06ead 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -32,8 +32,10 @@
 #include "qapi/opts-visitor.h"
 #include "qapi/qapi-visit-machine.h"
 #include "sysemu/qtest.h"
+#include "qom/cpu.h"
 #include "hw/mem/pc-dimm.h"
 #include "migration/vmstate.h"
+#include "hw/boards.h"
 #include "hw/mem/memory-device.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 2fbb581c46..9e187f856a 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -35,7 +35,6 @@
 #include "hw/pci/pci_ids.h"
 #include "hw/usb.h"
 #include "net/net.h"
-#include "hw/boards.h"
 #include "hw/ide.h"
 #include "hw/irq.h"
 #include "sysemu/kvm.h"
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 8777c9618b..be3464f485 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -33,7 +33,6 @@
 #include "hw/loader.h"
 #include "sysemu/arch_init.h"
 #include "hw/i2c/smbus_eeprom.h"
-#include "hw/boards.h"
 #include "hw/timer/mc146818rtc.h"
 #include "hw/xen/xen.h"
 #include "sysemu/kvm.h"
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 235928452b..a9983f0bfb 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -32,7 +32,6 @@
 #include "qemu/units.h"
 #include "hw/sysbus.h"
 #include "hw/i386/pc.h"
-#include "hw/boards.h"
 #include "hw/loader.h"
 #include "hw/qdev-properties.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
index 2b82a58592..7078386300 100644
--- a/hw/ppc/e500plat.c
+++ b/hw/ppc/e500plat.c
@@ -13,7 +13,6 @@
 #include "qemu/units.h"
 #include "e500.h"
 #include "hw/net/fsl_etsec/etsec.h"
-#include "hw/boards.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/kvm.h"
 #include "hw/sysbus.h"
diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c
index 6a4657c3cd..c2c5e11fa1 100644
--- a/hw/ppc/mpc8544ds.c
+++ b/hw/ppc/mpc8544ds.c
@@ -11,7 +11,6 @@
 
 #include "qemu/osdep.h"
 #include "e500.h"
-#include "hw/boards.h"
 #include "sysemu/device_tree.h"
 #include "hw/ppc/openpic.h"
 #include "qemu/error-report.h"
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index cf31830655..fc7d24830a 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -45,6 +45,7 @@
 #include "hw/ppc/pnv_xscom.h"
 
 #include "hw/isa/isa.h"
+#include "hw/boards.h"
 #include "hw/char/serial.h"
 #include "hw/timer/mc146818rtc.h"
 
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index ba092f2931..381720aced 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -27,7 +27,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "hw/ppc/ppc.h"
-#include "hw/boards.h"
 #include "hw/i2c/ppc4xx_i2c.h"
 #include "hw/irq.h"
 #include "ppc405.h"
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 920bc365ef..bf47fbdf6f 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -14,7 +14,6 @@
 #include "migration/vmstate.h"
 #include "target/ppc/cpu.h"
 #include "hw/ppc/spapr.h"
-#include "hw/boards.h"
 #include "qapi/error.h"
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 31ff0be189..910c57fce5 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -26,7 +26,6 @@
 #include "hw/irq.h"
 #include "qemu/log.h"
 #include "sysemu/sysemu.h"
-#include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/sysbus.h"
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 6b7d322e85..4c63b5cf8a 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -22,9 +22,9 @@
 #include "qemu/units.h"
 #include "qemu/error-report.h"
 #include "exec/cpu-defs.h"
+#include "hw/boards.h"
 #include "hw/loader.h"
 #include "hw/riscv/boot.h"
-#include "hw/boards.h"
 #include "elf.h"
 #include "sysemu/qtest.h"
 
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index 766f2015a4..eda5ca3bb6 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -11,7 +11,6 @@
 
 #include "qemu/osdep.h"
 #include "qemu/units.h"
-#include "hw/boards.h"
 #include "cpu.h"
 #include "migration/qemu-file.h"
 #include "migration/register.h"
diff --git a/hw/xtensa/xtensa_memory.c b/hw/xtensa/xtensa_memory.c
index 394d0cf227..40334db441 100644
--- a/hw/xtensa/xtensa_memory.c
+++ b/hw/xtensa/xtensa_memory.c
@@ -29,7 +29,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
-#include "hw/boards.h"
 #include "exec/memory.h"
 #include "qemu/error-report.h"
 #include "xtensa_memory.h"
diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
index 66dee284ac..47b246f95c 100644
--- a/include/hw/mem/pc-dimm.h
+++ b/include/hw/mem/pc-dimm.h
@@ -19,7 +19,6 @@
 #include "exec/memory.h"
 #include "sysemu/hostmem.h"
 #include "hw/qdev-core.h"
-#include "hw/boards.h"
 
 #define TYPE_PC_DIMM "pc-dimm"
 #define PC_DIMM(obj) \
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index b9ae40eec7..330558f332 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -35,7 +35,6 @@
 #include "qapi/qapi-commands-misc.h"
 #include "qapi/qapi-commands-ui.h"
 #include "qapi/qmp/qerror.h"
-#include "hw/boards.h"
 #include "hw/mem/memory-device.h"
 #include "hw/acpi/acpi_dev_interface.h"
 
diff --git a/target/alpha/machine.c b/target/alpha/machine.c
index c288be89f7..a09d754bbf 100644
--- a/target/alpha/machine.c
+++ b/target/alpha/machine.c
@@ -1,6 +1,5 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/boards.h"
 #include "migration/cpu.h"
 #include "migration/vmstate.h"
 
diff --git a/target/arm/machine.c b/target/arm/machine.c
index 60e0627b89..ac28c0615a 100644
--- a/target/arm/machine.c
+++ b/target/arm/machine.c
@@ -1,6 +1,5 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/boards.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index 6ec6dd04ac..6457c3c87f 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -21,7 +21,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/boards.h"
 #include "kvm_arm.h"
 #include "qapi/qapi-commands-misc-target.h"
 
diff --git a/target/hppa/machine.c b/target/hppa/machine.c
index 092f8b5bfd..e3b6608cf2 100644
--- a/target/hppa/machine.c
+++ b/target/hppa/machine.c
@@ -19,7 +19,6 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/boards.h"
 #include "migration/cpu.h"
 #include "migration/vmstate.h"
 
diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
index bcacdd1d8f..34a9f6f7a9 100644
--- a/target/i386/hax-all.c
+++ b/target/i386/hax-all.c
@@ -33,7 +33,6 @@
 #include "sysemu/reset.h"
 #include "sysemu/sysemu.h"
 #include "qemu/main-loop.h"
-#include "hw/boards.h"
 
 #define DEBUG_HAX 0
 
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index dc4bb63536..6863cf2de4 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -66,7 +66,6 @@
 
 #include "exec/address-spaces.h"
 #include "hw/i386/apic_internal.h"
-#include "hw/boards.h"
 #include "qemu/main-loop.h"
 #include "sysemu/accel.h"
 #include "sysemu/sysemu.h"
diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c
index 7099335e89..73cd5d2817 100644
--- a/target/i386/hvf/x86_task.c
+++ b/target/i386/hvf/x86_task.c
@@ -27,7 +27,6 @@
 #include <Hypervisor/hv_vmx.h>
 
 #include "hw/i386/apic_internal.h"
-#include "hw/boards.h"
 #include "qemu/main-loop.h"
 #include "sysemu/accel.h"
 #include "sysemu/sysemu.h"
diff --git a/target/i386/machine.c b/target/i386/machine.c
index a2a031a17b..3aa54bc829 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -1,7 +1,6 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
-#include "hw/boards.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "migration/cpu.h"
diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c
index 2cf66f7804..b57d1c6683 100644
--- a/target/i386/whpx-all.c
+++ b/target/i386/whpx-all.c
@@ -18,7 +18,6 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/cpus.h"
 #include "qemu/main-loop.h"
-#include "hw/boards.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "migration/blocker.h"
diff --git a/target/lm32/machine.c b/target/lm32/machine.c
index 18a1820f22..c6d82a4cfe 100644
--- a/target/lm32/machine.c
+++ b/target/lm32/machine.c
@@ -1,6 +1,5 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/boards.h"
 #include "migration/cpu.h"
 #include "migration/vmstate.h"
 
diff --git a/target/moxie/machine.c b/target/moxie/machine.c
index e6f639ee97..37b15e6d60 100644
--- a/target/moxie/machine.c
+++ b/target/moxie/machine.c
@@ -1,6 +1,5 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/boards.h"
 #include "machine.h"
 #include "migration/cpu.h"
 #include "migration/vmstate.h"
diff --git a/target/openrisc/machine.c b/target/openrisc/machine.c
index a7bfbbe3b2..296dc70a92 100644
--- a/target/openrisc/machine.c
+++ b/target/openrisc/machine.c
@@ -19,7 +19,6 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/boards.h"
 #include "migration/cpu.h"
 #include "migration/vmstate.h"
 
diff --git a/target/ppc/machine.c b/target/ppc/machine.c
index 74e003cf46..7846c09e71 100644
--- a/target/ppc/machine.c
+++ b/target/ppc/machine.c
@@ -1,7 +1,6 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
-#include "hw/boards.h"
 #include "sysemu/kvm.h"
 #include "helper_regs.h"
 #include "mmu-hash64.h"
diff --git a/target/sparc/machine.c b/target/sparc/machine.c
index aeeca69a2d..bea694c973 100644
--- a/target/sparc/machine.c
+++ b/target/sparc/machine.c
@@ -1,7 +1,6 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
-#include "hw/boards.h"
 #include "qemu/timer.h"
 
 #include "migration/cpu.h"
-- 
2.21.0


Re: [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Alistair Francis 6 years, 6 months ago
On Tue, Aug 6, 2019 at 8:22 AM Markus Armbruster <armbru@redhat.com> wrote:
>
> hw/boards.h pulls in almost 60 headers.  The less we include it into
> headers, the better.  As a first step, drop superfluous inclusions,
> and downgrade some more to what's actually needed.  Gets rid of just
> one inclusion into a header.
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  backends/cryptodev-builtin.c    | 1 -
>  backends/cryptodev-vhost-user.c | 1 -
>  backends/cryptodev.c            | 1 -
>  hw/acpi/ich9.c                  | 1 +
>  hw/alpha/dp264.c                | 1 -
>  hw/alpha/typhoon.c              | 1 +
>  hw/arm/boot.c                   | 1 -
>  hw/arm/exynos4210.c             | 2 +-
>  hw/arm/fsl-imx25.c              | 1 -
>  hw/arm/fsl-imx31.c              | 1 -
>  hw/arm/msf2-soc.c               | 1 -
>  hw/arm/nrf51_soc.c              | 1 -
>  hw/arm/omap1.c                  | 1 +
>  hw/arm/omap2.c                  | 1 +
>  hw/arm/smmuv3.c                 | 1 -
>  hw/arm/virt.c                   | 1 +
>  hw/core/numa.c                  | 2 ++
>  hw/i386/pc_piix.c               | 1 -
>  hw/i386/pc_q35.c                | 1 -
>  hw/i386/pc_sysfw.c              | 1 -
>  hw/ppc/e500plat.c               | 1 -
>  hw/ppc/mpc8544ds.c              | 1 -
>  hw/ppc/pnv.c                    | 1 +
>  hw/ppc/ppc405_uc.c              | 1 -
>  hw/ppc/spapr_cpu_core.c         | 1 -
>  hw/ppc/spapr_vio.c              | 1 -
>  hw/riscv/boot.c                 | 2 +-
>  hw/s390x/s390-stattrib.c        | 1 -
>  hw/xtensa/xtensa_memory.c       | 1 -
>  include/hw/mem/pc-dimm.h        | 1 -
>  monitor/qmp-cmds.c              | 1 -
>  target/alpha/machine.c          | 1 -
>  target/arm/machine.c            | 1 -
>  target/arm/monitor.c            | 1 -
>  target/hppa/machine.c           | 1 -
>  target/i386/hax-all.c           | 1 -
>  target/i386/hvf/hvf.c           | 1 -
>  target/i386/hvf/x86_task.c      | 1 -
>  target/i386/machine.c           | 1 -
>  target/i386/whpx-all.c          | 1 -
>  target/lm32/machine.c           | 1 -
>  target/moxie/machine.c          | 1 -
>  target/openrisc/machine.c       | 1 -
>  target/ppc/machine.c            | 1 -
>  target/sparc/machine.c          | 1 -
>  45 files changed, 10 insertions(+), 38 deletions(-)
>
> diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
> index 9fb0bd57a6..c8ae3b9742 100644
> --- a/backends/cryptodev-builtin.c
> +++ b/backends/cryptodev-builtin.c
> @@ -23,7 +23,6 @@
>
>  #include "qemu/osdep.h"
>  #include "sysemu/cryptodev.h"
> -#include "hw/boards.h"
>  #include "qapi/error.h"
>  #include "standard-headers/linux/virtio_crypto.h"
>  #include "crypto/cipher.h"
> diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
> index 1052a5d0e9..b344283940 100644
> --- a/backends/cryptodev-vhost-user.c
> +++ b/backends/cryptodev-vhost-user.c
> @@ -22,7 +22,6 @@
>   */
>
>  #include "qemu/osdep.h"
> -#include "hw/boards.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qerror.h"
>  #include "qemu/error-report.h"
> diff --git a/backends/cryptodev.c b/backends/cryptodev.c
> index f35be377ef..3c071eab95 100644
> --- a/backends/cryptodev.c
> +++ b/backends/cryptodev.c
> @@ -23,7 +23,6 @@
>
>  #include "qemu/osdep.h"
>  #include "sysemu/cryptodev.h"
> -#include "hw/boards.h"
>  #include "qapi/error.h"
>  #include "qapi/visitor.h"
>  #include "qemu/config-file.h"
> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
> index 39649cbe6a..c1aaa07d43 100644
> --- a/hw/acpi/ich9.c
> +++ b/hw/acpi/ich9.c
> @@ -31,6 +31,7 @@
>  #include "hw/pci/pci.h"
>  #include "migration/vmstate.h"
>  #include "qemu/timer.h"
> +#include "qom/cpu.h"
>  #include "sysemu/reset.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/acpi/acpi.h"
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index 546b89bbcc..51feee8558 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -11,7 +11,6 @@
>  #include "cpu.h"
>  #include "elf.h"
>  #include "hw/loader.h"
> -#include "hw/boards.h"
>  #include "alpha_sys.h"
>  #include "qemu/error-report.h"
>  #include "sysemu/sysemu.h"
> diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
> index 5d7f8f3342..1c0565acc1 100644
> --- a/hw/alpha/typhoon.c
> +++ b/hw/alpha/typhoon.c
> @@ -11,6 +11,7 @@
>  #include "qemu/units.h"
>  #include "qapi/error.h"
>  #include "cpu.h"
> +#include "hw/boards.h"
>  #include "hw/irq.h"
>  #include "sysemu/sysemu.h"
>  #include "alpha_sys.h"
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index 8563672942..eff89ab80e 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -18,7 +18,6 @@
>  #include "sysemu/sysemu.h"
>  #include "sysemu/numa.h"
>  #include "sysemu/reset.h"
> -#include "hw/boards.h"
>  #include "hw/loader.h"
>  #include "elf.h"
>  #include "sysemu/device_tree.h"
> diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
> index 0e403f3e78..a9f8a5c868 100644
> --- a/hw/arm/exynos4210.c
> +++ b/hw/arm/exynos4210.c
> @@ -27,7 +27,7 @@
>  #include "cpu.h"
>  #include "hw/cpu/a9mpcore.h"
>  #include "hw/irq.h"
> -#include "hw/boards.h"
> +#include "sysemu/blockdev.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
> diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
> index 098e84c84d..532d088298 100644
> --- a/hw/arm/fsl-imx25.c
> +++ b/hw/arm/fsl-imx25.c
> @@ -28,7 +28,6 @@
>  #include "hw/arm/fsl-imx25.h"
>  #include "sysemu/sysemu.h"
>  #include "exec/address-spaces.h"
> -#include "hw/boards.h"
>  #include "hw/qdev-properties.h"
>  #include "chardev/char.h"
>
> diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
> index 093ad40984..1a37a7b997 100644
> --- a/hw/arm/fsl-imx31.c
> +++ b/hw/arm/fsl-imx31.c
> @@ -25,7 +25,6 @@
>  #include "hw/arm/fsl-imx31.h"
>  #include "sysemu/sysemu.h"
>  #include "exec/address-spaces.h"
> -#include "hw/boards.h"
>  #include "hw/qdev-properties.h"
>  #include "chardev/char.h"
>
> diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
> index 4e5251c92e..8ae763f99f 100644
> --- a/hw/arm/msf2-soc.c
> +++ b/hw/arm/msf2-soc.c
> @@ -28,7 +28,6 @@
>  #include "exec/address-spaces.h"
>  #include "hw/char/serial.h"
>  #include "hw/irq.h"
> -#include "hw/boards.h"
>  #include "hw/arm/msf2-soc.h"
>  #include "hw/misc/unimp.h"
>
> diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
> index fc067cd8ee..d9e54fefbb 100644
> --- a/hw/arm/nrf51_soc.c
> +++ b/hw/arm/nrf51_soc.c
> @@ -12,7 +12,6 @@
>  #include "qapi/error.h"
>  #include "hw/arm/boot.h"
>  #include "hw/sysbus.h"
> -#include "hw/boards.h"
>  #include "hw/misc/unimp.h"
>  #include "exec/address-spaces.h"
>  #include "sysemu/sysemu.h"
> diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
> index 19fca4159a..d28ad2b9ff 100644
> --- a/hw/arm/omap1.c
> +++ b/hw/arm/omap1.c
> @@ -29,6 +29,7 @@
>  #include "hw/qdev-properties.h"
>  #include "hw/arm/boot.h"
>  #include "hw/arm/omap.h"
> +#include "sysemu/blockdev.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/arm/soc_dma.h"
>  #include "sysemu/qtest.h"
> diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
> index dccb5707f8..e0a9c2da83 100644
> --- a/hw/arm/omap2.c
> +++ b/hw/arm/omap2.c
> @@ -22,6 +22,7 @@
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "cpu.h"
> +#include "sysemu/blockdev.h"
>  #include "sysemu/qtest.h"
>  #include "sysemu/reset.h"
>  #include "hw/boards.h"
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index 0634a398d2..0ccc772390 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -17,7 +17,6 @@
>   */
>
>  #include "qemu/osdep.h"
> -#include "hw/boards.h"
>  #include "hw/irq.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/sysbus.h"
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index e9fddec058..226e810d06 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -34,6 +34,7 @@
>  #include "qemu/option.h"
>  #include "qapi/error.h"
>  #include "hw/sysbus.h"
> +#include "hw/boards.h"
>  #include "hw/arm/boot.h"
>  #include "hw/arm/primecell.h"
>  #include "hw/arm/virt.h"
> diff --git a/hw/core/numa.c b/hw/core/numa.c
> index 67548064ee..d817f06ead 100644
> --- a/hw/core/numa.c
> +++ b/hw/core/numa.c
> @@ -32,8 +32,10 @@
>  #include "qapi/opts-visitor.h"
>  #include "qapi/qapi-visit-machine.h"
>  #include "sysemu/qtest.h"
> +#include "qom/cpu.h"
>  #include "hw/mem/pc-dimm.h"
>  #include "migration/vmstate.h"
> +#include "hw/boards.h"
>  #include "hw/mem/memory-device.h"
>  #include "qemu/option.h"
>  #include "qemu/config-file.h"
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 2fbb581c46..9e187f856a 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -35,7 +35,6 @@
>  #include "hw/pci/pci_ids.h"
>  #include "hw/usb.h"
>  #include "net/net.h"
> -#include "hw/boards.h"
>  #include "hw/ide.h"
>  #include "hw/irq.h"
>  #include "sysemu/kvm.h"
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 8777c9618b..be3464f485 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -33,7 +33,6 @@
>  #include "hw/loader.h"
>  #include "sysemu/arch_init.h"
>  #include "hw/i2c/smbus_eeprom.h"
> -#include "hw/boards.h"
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/xen/xen.h"
>  #include "sysemu/kvm.h"
> diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
> index 235928452b..a9983f0bfb 100644
> --- a/hw/i386/pc_sysfw.c
> +++ b/hw/i386/pc_sysfw.c
> @@ -32,7 +32,6 @@
>  #include "qemu/units.h"
>  #include "hw/sysbus.h"
>  #include "hw/i386/pc.h"
> -#include "hw/boards.h"
>  #include "hw/loader.h"
>  #include "hw/qdev-properties.h"
>  #include "sysemu/sysemu.h"
> diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
> index 2b82a58592..7078386300 100644
> --- a/hw/ppc/e500plat.c
> +++ b/hw/ppc/e500plat.c
> @@ -13,7 +13,6 @@
>  #include "qemu/units.h"
>  #include "e500.h"
>  #include "hw/net/fsl_etsec/etsec.h"
> -#include "hw/boards.h"
>  #include "sysemu/device_tree.h"
>  #include "sysemu/kvm.h"
>  #include "hw/sysbus.h"
> diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c
> index 6a4657c3cd..c2c5e11fa1 100644
> --- a/hw/ppc/mpc8544ds.c
> +++ b/hw/ppc/mpc8544ds.c
> @@ -11,7 +11,6 @@
>
>  #include "qemu/osdep.h"
>  #include "e500.h"
> -#include "hw/boards.h"
>  #include "sysemu/device_tree.h"
>  #include "hw/ppc/openpic.h"
>  #include "qemu/error-report.h"
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index cf31830655..fc7d24830a 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -45,6 +45,7 @@
>  #include "hw/ppc/pnv_xscom.h"
>
>  #include "hw/isa/isa.h"
> +#include "hw/boards.h"
>  #include "hw/char/serial.h"
>  #include "hw/timer/mc146818rtc.h"
>
> diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
> index ba092f2931..381720aced 100644
> --- a/hw/ppc/ppc405_uc.c
> +++ b/hw/ppc/ppc405_uc.c
> @@ -27,7 +27,6 @@
>  #include "qapi/error.h"
>  #include "cpu.h"
>  #include "hw/ppc/ppc.h"
> -#include "hw/boards.h"
>  #include "hw/i2c/ppc4xx_i2c.h"
>  #include "hw/irq.h"
>  #include "ppc405.h"
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index 920bc365ef..bf47fbdf6f 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -14,7 +14,6 @@
>  #include "migration/vmstate.h"
>  #include "target/ppc/cpu.h"
>  #include "hw/ppc/spapr.h"
> -#include "hw/boards.h"
>  #include "qapi/error.h"
>  #include "sysemu/cpus.h"
>  #include "sysemu/kvm.h"
> diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
> index 31ff0be189..910c57fce5 100644
> --- a/hw/ppc/spapr_vio.c
> +++ b/hw/ppc/spapr_vio.c
> @@ -26,7 +26,6 @@
>  #include "hw/irq.h"
>  #include "qemu/log.h"
>  #include "sysemu/sysemu.h"
> -#include "hw/boards.h"
>  #include "hw/loader.h"
>  #include "elf.h"
>  #include "hw/sysbus.h"
> diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
> index 6b7d322e85..4c63b5cf8a 100644
> --- a/hw/riscv/boot.c
> +++ b/hw/riscv/boot.c
> @@ -22,9 +22,9 @@
>  #include "qemu/units.h"
>  #include "qemu/error-report.h"
>  #include "exec/cpu-defs.h"
> +#include "hw/boards.h"
>  #include "hw/loader.h"
>  #include "hw/riscv/boot.h"
> -#include "hw/boards.h"
>  #include "elf.h"
>  #include "sysemu/qtest.h"
>
> diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> index 766f2015a4..eda5ca3bb6 100644
> --- a/hw/s390x/s390-stattrib.c
> +++ b/hw/s390x/s390-stattrib.c
> @@ -11,7 +11,6 @@
>
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
> -#include "hw/boards.h"
>  #include "cpu.h"
>  #include "migration/qemu-file.h"
>  #include "migration/register.h"
> diff --git a/hw/xtensa/xtensa_memory.c b/hw/xtensa/xtensa_memory.c
> index 394d0cf227..40334db441 100644
> --- a/hw/xtensa/xtensa_memory.c
> +++ b/hw/xtensa/xtensa_memory.c
> @@ -29,7 +29,6 @@
>  #include "qapi/error.h"
>  #include "cpu.h"
>  #include "sysemu/sysemu.h"
> -#include "hw/boards.h"
>  #include "exec/memory.h"
>  #include "qemu/error-report.h"
>  #include "xtensa_memory.h"
> diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
> index 66dee284ac..47b246f95c 100644
> --- a/include/hw/mem/pc-dimm.h
> +++ b/include/hw/mem/pc-dimm.h
> @@ -19,7 +19,6 @@
>  #include "exec/memory.h"
>  #include "sysemu/hostmem.h"
>  #include "hw/qdev-core.h"
> -#include "hw/boards.h"
>
>  #define TYPE_PC_DIMM "pc-dimm"
>  #define PC_DIMM(obj) \
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index b9ae40eec7..330558f332 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -35,7 +35,6 @@
>  #include "qapi/qapi-commands-misc.h"
>  #include "qapi/qapi-commands-ui.h"
>  #include "qapi/qmp/qerror.h"
> -#include "hw/boards.h"
>  #include "hw/mem/memory-device.h"
>  #include "hw/acpi/acpi_dev_interface.h"
>
> diff --git a/target/alpha/machine.c b/target/alpha/machine.c
> index c288be89f7..a09d754bbf 100644
> --- a/target/alpha/machine.c
> +++ b/target/alpha/machine.c
> @@ -1,6 +1,5 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> -#include "hw/boards.h"
>  #include "migration/cpu.h"
>  #include "migration/vmstate.h"
>
> diff --git a/target/arm/machine.c b/target/arm/machine.c
> index 60e0627b89..ac28c0615a 100644
> --- a/target/arm/machine.c
> +++ b/target/arm/machine.c
> @@ -1,6 +1,5 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> -#include "hw/boards.h"
>  #include "qemu/error-report.h"
>  #include "sysemu/kvm.h"
>  #include "kvm_arm.h"
> diff --git a/target/arm/monitor.c b/target/arm/monitor.c
> index 6ec6dd04ac..6457c3c87f 100644
> --- a/target/arm/monitor.c
> +++ b/target/arm/monitor.c
> @@ -21,7 +21,6 @@
>   */
>
>  #include "qemu/osdep.h"
> -#include "hw/boards.h"
>  #include "kvm_arm.h"
>  #include "qapi/qapi-commands-misc-target.h"
>
> diff --git a/target/hppa/machine.c b/target/hppa/machine.c
> index 092f8b5bfd..e3b6608cf2 100644
> --- a/target/hppa/machine.c
> +++ b/target/hppa/machine.c
> @@ -19,7 +19,6 @@
>
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> -#include "hw/boards.h"
>  #include "migration/cpu.h"
>  #include "migration/vmstate.h"
>
> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
> index bcacdd1d8f..34a9f6f7a9 100644
> --- a/target/i386/hax-all.c
> +++ b/target/i386/hax-all.c
> @@ -33,7 +33,6 @@
>  #include "sysemu/reset.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/main-loop.h"
> -#include "hw/boards.h"
>
>  #define DEBUG_HAX 0
>
> diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> index dc4bb63536..6863cf2de4 100644
> --- a/target/i386/hvf/hvf.c
> +++ b/target/i386/hvf/hvf.c
> @@ -66,7 +66,6 @@
>
>  #include "exec/address-spaces.h"
>  #include "hw/i386/apic_internal.h"
> -#include "hw/boards.h"
>  #include "qemu/main-loop.h"
>  #include "sysemu/accel.h"
>  #include "sysemu/sysemu.h"
> diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c
> index 7099335e89..73cd5d2817 100644
> --- a/target/i386/hvf/x86_task.c
> +++ b/target/i386/hvf/x86_task.c
> @@ -27,7 +27,6 @@
>  #include <Hypervisor/hv_vmx.h>
>
>  #include "hw/i386/apic_internal.h"
> -#include "hw/boards.h"
>  #include "qemu/main-loop.h"
>  #include "sysemu/accel.h"
>  #include "sysemu/sysemu.h"
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index a2a031a17b..3aa54bc829 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -1,7 +1,6 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> -#include "hw/boards.h"
>  #include "hw/i386/pc.h"
>  #include "hw/isa/isa.h"
>  #include "migration/cpu.h"
> diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c
> index 2cf66f7804..b57d1c6683 100644
> --- a/target/i386/whpx-all.c
> +++ b/target/i386/whpx-all.c
> @@ -18,7 +18,6 @@
>  #include "sysemu/sysemu.h"
>  #include "sysemu/cpus.h"
>  #include "qemu/main-loop.h"
> -#include "hw/boards.h"
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "migration/blocker.h"
> diff --git a/target/lm32/machine.c b/target/lm32/machine.c
> index 18a1820f22..c6d82a4cfe 100644
> --- a/target/lm32/machine.c
> +++ b/target/lm32/machine.c
> @@ -1,6 +1,5 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> -#include "hw/boards.h"
>  #include "migration/cpu.h"
>  #include "migration/vmstate.h"
>
> diff --git a/target/moxie/machine.c b/target/moxie/machine.c
> index e6f639ee97..37b15e6d60 100644
> --- a/target/moxie/machine.c
> +++ b/target/moxie/machine.c
> @@ -1,6 +1,5 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> -#include "hw/boards.h"
>  #include "machine.h"
>  #include "migration/cpu.h"
>  #include "migration/vmstate.h"
> diff --git a/target/openrisc/machine.c b/target/openrisc/machine.c
> index a7bfbbe3b2..296dc70a92 100644
> --- a/target/openrisc/machine.c
> +++ b/target/openrisc/machine.c
> @@ -19,7 +19,6 @@
>
>  #include "qemu/osdep.h"
>  #include "cpu.h"
> -#include "hw/boards.h"
>  #include "migration/cpu.h"
>  #include "migration/vmstate.h"
>
> diff --git a/target/ppc/machine.c b/target/ppc/machine.c
> index 74e003cf46..7846c09e71 100644
> --- a/target/ppc/machine.c
> +++ b/target/ppc/machine.c
> @@ -1,7 +1,6 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> -#include "hw/boards.h"
>  #include "sysemu/kvm.h"
>  #include "helper_regs.h"
>  #include "mmu-hash64.h"
> diff --git a/target/sparc/machine.c b/target/sparc/machine.c
> index aeeca69a2d..bea694c973 100644
> --- a/target/sparc/machine.c
> +++ b/target/sparc/machine.c
> @@ -1,7 +1,6 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> -#include "hw/boards.h"
>  #include "qemu/timer.h"
>
>  #include "migration/cpu.h"
> --
> 2.21.0
>
>

Re: [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Philippe Mathieu-Daudé 6 years, 6 months ago
On 8/6/19 5:14 PM, Markus Armbruster wrote:
> hw/boards.h pulls in almost 60 headers.  The less we include it into
> headers, the better.  As a first step, drop superfluous inclusions,
> and downgrade some more to what's actually needed.  Gets rid of just
> one inclusion into a header.
> 
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  backends/cryptodev-builtin.c    | 1 -
>  backends/cryptodev-vhost-user.c | 1 -
>  backends/cryptodev.c            | 1 -
>  hw/acpi/ich9.c                  | 1 +
>  hw/alpha/dp264.c                | 1 -
>  hw/alpha/typhoon.c              | 1 +
>  hw/arm/boot.c                   | 1 -
>  hw/arm/exynos4210.c             | 2 +-
>  hw/arm/fsl-imx25.c              | 1 -
>  hw/arm/fsl-imx31.c              | 1 -
>  hw/arm/msf2-soc.c               | 1 -
>  hw/arm/nrf51_soc.c              | 1 -
>  hw/arm/omap1.c                  | 1 +
>  hw/arm/omap2.c                  | 1 +
>  hw/arm/smmuv3.c                 | 1 -
>  hw/arm/virt.c                   | 1 +
>  hw/core/numa.c                  | 2 ++
>  hw/i386/pc_piix.c               | 1 -
>  hw/i386/pc_q35.c                | 1 -
>  hw/i386/pc_sysfw.c              | 1 -
>  hw/ppc/e500plat.c               | 1 -
>  hw/ppc/mpc8544ds.c              | 1 -
>  hw/ppc/pnv.c                    | 1 +
>  hw/ppc/ppc405_uc.c              | 1 -
>  hw/ppc/spapr_cpu_core.c         | 1 -
>  hw/ppc/spapr_vio.c              | 1 -
>  hw/riscv/boot.c                 | 2 +-
>  hw/s390x/s390-stattrib.c        | 1 -
>  hw/xtensa/xtensa_memory.c       | 1 -
>  include/hw/mem/pc-dimm.h        | 1 -
>  monitor/qmp-cmds.c              | 1 -
>  target/alpha/machine.c          | 1 -
>  target/arm/machine.c            | 1 -
>  target/arm/monitor.c            | 1 -
>  target/hppa/machine.c           | 1 -
>  target/i386/hax-all.c           | 1 -
>  target/i386/hvf/hvf.c           | 1 -
>  target/i386/hvf/x86_task.c      | 1 -
>  target/i386/machine.c           | 1 -
>  target/i386/whpx-all.c          | 1 -
>  target/lm32/machine.c           | 1 -
>  target/moxie/machine.c          | 1 -
>  target/openrisc/machine.c       | 1 -
>  target/ppc/machine.c            | 1 -
>  target/sparc/machine.c          | 1 -
>  45 files changed, 10 insertions(+), 38 deletions(-)
[...]
> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
> index bcacdd1d8f..34a9f6f7a9 100644
> --- a/target/i386/hax-all.c
> +++ b/target/i386/hax-all.c
> @@ -33,7 +33,6 @@
>  #include "sysemu/reset.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/main-loop.h"
> -#include "hw/boards.h"
>  
>  #define DEBUG_HAX 0

include/sysemu/hax.h misses to include "hw/boards.h":

target/i386/hax-all.c: In function 'hax_accel_init':
target/i386/hax-all.c:354:26: error: dereferencing pointer to incomplete
type 'MachineState {aka struct MachineState}'
     int ret = hax_init(ms->ram_size);
                          ^

Re: [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Eduardo Habkost 6 years, 6 months ago
On Wed, Aug 07, 2019 at 07:26:56PM +0200, Philippe Mathieu-Daudé wrote:
> On 8/6/19 5:14 PM, Markus Armbruster wrote:
> > hw/boards.h pulls in almost 60 headers.  The less we include it into
> > headers, the better.  As a first step, drop superfluous inclusions,
> > and downgrade some more to what's actually needed.  Gets rid of just
> > one inclusion into a header.
> > 
> > Cc: Eduardo Habkost <ehabkost@redhat.com>
> > Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
> > ---
[...]
> > diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
> > index bcacdd1d8f..34a9f6f7a9 100644
> > --- a/target/i386/hax-all.c
> > +++ b/target/i386/hax-all.c
> > @@ -33,7 +33,6 @@
> >  #include "sysemu/reset.h"
> >  #include "sysemu/sysemu.h"
> >  #include "qemu/main-loop.h"
> > -#include "hw/boards.h"
> >  
> >  #define DEBUG_HAX 0
> 
> include/sysemu/hax.h misses to include "hw/boards.h":

I don't understand.  I don't see any reason for the sysemu/hax.h
header to include hw/boards.h.

> 
> target/i386/hax-all.c: In function 'hax_accel_init':
> target/i386/hax-all.c:354:26: error: dereferencing pointer to incomplete
> type 'MachineState {aka struct MachineState}'
>      int ret = hax_init(ms->ram_size);
>                           ^

-- 
Eduardo

Re: [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Philippe Mathieu-Daudé 6 years, 6 months ago
On 8/7/19 7:57 PM, Eduardo Habkost wrote:
> On Wed, Aug 07, 2019 at 07:26:56PM +0200, Philippe Mathieu-Daudé wrote:
>> On 8/6/19 5:14 PM, Markus Armbruster wrote:
>>> hw/boards.h pulls in almost 60 headers.  The less we include it into
>>> headers, the better.  As a first step, drop superfluous inclusions,
>>> and downgrade some more to what's actually needed.  Gets rid of just
>>> one inclusion into a header.
>>>
>>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> ---
> [...]
>>> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
>>> index bcacdd1d8f..34a9f6f7a9 100644
>>> --- a/target/i386/hax-all.c
>>> +++ b/target/i386/hax-all.c
>>> @@ -33,7 +33,6 @@
>>>  #include "sysemu/reset.h"
>>>  #include "sysemu/sysemu.h"
>>>  #include "qemu/main-loop.h"
>>> -#include "hw/boards.h"
>>>  
>>>  #define DEBUG_HAX 0
>>
>> include/sysemu/hax.h misses to include "hw/boards.h":
> 
> I don't understand.  I don't see any reason for the sysemu/hax.h
> header to include hw/boards.h.

Ah, you are right, the AccelClass is defined in include/sysemu/accel.h:

typedef struct AccelClass {
    /*< private >*/
    ObjectClass parent_class;
    /*< public >*/

    const char *name;
    int (*init_machine)(MachineState *ms);
    ...

So this is where "hw/boards.h" has to be included (it is where
MachineState is defined).

>>
>> target/i386/hax-all.c: In function 'hax_accel_init':
>> target/i386/hax-all.c:354:26: error: dereferencing pointer to incomplete
>> type 'MachineState {aka struct MachineState}'
>>      int ret = hax_init(ms->ram_size);
>>                           ^
> 

Re: [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Eduardo Habkost 6 years, 6 months ago
On Wed, Aug 07, 2019 at 08:05:50PM +0200, Philippe Mathieu-Daudé wrote:
> On 8/7/19 7:57 PM, Eduardo Habkost wrote:
> > On Wed, Aug 07, 2019 at 07:26:56PM +0200, Philippe Mathieu-Daudé wrote:
> >> On 8/6/19 5:14 PM, Markus Armbruster wrote:
> >>> hw/boards.h pulls in almost 60 headers.  The less we include it into
> >>> headers, the better.  As a first step, drop superfluous inclusions,
> >>> and downgrade some more to what's actually needed.  Gets rid of just
> >>> one inclusion into a header.
> >>>
> >>> Cc: Eduardo Habkost <ehabkost@redhat.com>
> >>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> >>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> >>> ---
> > [...]
> >>> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
> >>> index bcacdd1d8f..34a9f6f7a9 100644
> >>> --- a/target/i386/hax-all.c
> >>> +++ b/target/i386/hax-all.c
> >>> @@ -33,7 +33,6 @@
> >>>  #include "sysemu/reset.h"
> >>>  #include "sysemu/sysemu.h"
> >>>  #include "qemu/main-loop.h"
> >>> -#include "hw/boards.h"
> >>>  
> >>>  #define DEBUG_HAX 0
> >>
> >> include/sysemu/hax.h misses to include "hw/boards.h":
> > 
> > I don't understand.  I don't see any reason for the sysemu/hax.h
> > header to include hw/boards.h.
> 
> Ah, you are right, the AccelClass is defined in include/sysemu/accel.h:
> 
> typedef struct AccelClass {
>     /*< private >*/
>     ObjectClass parent_class;
>     /*< public >*/
> 
>     const char *name;
>     int (*init_machine)(MachineState *ms);
>     ...
> 
> So this is where "hw/boards.h" has to be included (it is where
> MachineState is defined).

As far as I can see, accel.h doesn't need the full MachineState
struct definition and doesn't need boards.h.  It just needs the
MachineState typedef, which is defined at typedefs.h.

hax-all.c, on the other hand, needs the full MachineState struct
definition and is expected to include hw/boards.h.

> 
> >>
> >> target/i386/hax-all.c: In function 'hax_accel_init':
> >> target/i386/hax-all.c:354:26: error: dereferencing pointer to incomplete
> >> type 'MachineState {aka struct MachineState}'
> >>      int ret = hax_init(ms->ram_size);
> >>                           ^
> > 

-- 
Eduardo

Re: [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less
Posted by Markus Armbruster 6 years, 6 months ago
Eduardo Habkost <ehabkost@redhat.com> writes:

> On Wed, Aug 07, 2019 at 08:05:50PM +0200, Philippe Mathieu-Daudé wrote:
>> On 8/7/19 7:57 PM, Eduardo Habkost wrote:
>> > On Wed, Aug 07, 2019 at 07:26:56PM +0200, Philippe Mathieu-Daudé wrote:
>> >> On 8/6/19 5:14 PM, Markus Armbruster wrote:
>> >>> hw/boards.h pulls in almost 60 headers.  The less we include it into
>> >>> headers, the better.  As a first step, drop superfluous inclusions,
>> >>> and downgrade some more to what's actually needed.  Gets rid of just
>> >>> one inclusion into a header.
>> >>>
>> >>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> >>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> >>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> >>> ---
>> > [...]
>> >>> diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
>> >>> index bcacdd1d8f..34a9f6f7a9 100644
>> >>> --- a/target/i386/hax-all.c
>> >>> +++ b/target/i386/hax-all.c
>> >>> @@ -33,7 +33,6 @@
>> >>>  #include "sysemu/reset.h"
>> >>>  #include "sysemu/sysemu.h"
>> >>>  #include "qemu/main-loop.h"
>> >>> -#include "hw/boards.h"
>> >>>  
>> >>>  #define DEBUG_HAX 0
>> >>
>> >> include/sysemu/hax.h misses to include "hw/boards.h":
>> > 
>> > I don't understand.  I don't see any reason for the sysemu/hax.h
>> > header to include hw/boards.h.
>> 
>> Ah, you are right, the AccelClass is defined in include/sysemu/accel.h:
>> 
>> typedef struct AccelClass {
>>     /*< private >*/
>>     ObjectClass parent_class;
>>     /*< public >*/
>> 
>>     const char *name;
>>     int (*init_machine)(MachineState *ms);
>>     ...
>> 
>> So this is where "hw/boards.h" has to be included (it is where
>> MachineState is defined).
>
> As far as I can see, accel.h doesn't need the full MachineState
> struct definition and doesn't need boards.h.  It just needs the
> MachineState typedef, which is defined at typedefs.h.
>
> hax-all.c, on the other hand, needs the full MachineState struct
> definition and is expected to include hw/boards.h.

Yes, and I'll fix it.  Thanks!

>> >> target/i386/hax-all.c: In function 'hax_accel_init':
>> >> target/i386/hax-all.c:354:26: error: dereferencing pointer to incomplete
>> >> type 'MachineState {aka struct MachineState}'
>> >>      int ret = hax_init(ms->ram_size);