Re: [Qemu-devel] [PATCH 22/28] Include hw/boards.h a bit less

2019-08-02 Thread Markus Armbruster
Markus Armbruster  writes:

> Eduardo Habkost  writes:
>
>> On Fri, Jul 26, 2019 at 02:05:36PM +0200, 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 
>>> Cc: Marcel Apfelbaum 
>>> Signed-off-by: Markus Armbruster 
>>> ---
>>
>> The following files use the MACHINE macro and require
>> hw/boards.h, but are touched by this patch:
>>
>> hw/acpi/cpu.c:MachineState *machine = MACHINE(qdev_get_machine());
>> hw/acpi/memory_hotplug.c:MachineState *machine = 
>> MACHINE(qdev_get_machine());
>> hw/i386/intel_iommu.c:MachineState *ms = MACHINE(qdev_get_machine());
>> hw/i386/x86-iommu.c:MachineState *ms = MACHINE(qdev_get_machine());
>> hw/ppc/spapr_rtas.c:MachineState *ms = MACHINE(qdev_get_machine());
>> hw/s390x/s390-stattrib-kvm.c:MachineState *machine = 
>> MACHINE(qdev_get_machine());
>> hw/s390x/s390-stattrib-kvm.c:MachineState *machine = 
>> MACHINE(qdev_get_machine());
>
> Since they still compile, they obviously still get it indirectly.  I'll
> drop these hunks.
>
>> Maybe there are other files touched by this patch that require
>> struct MachineClass or struct MachineState contents to be
>> defined, but this is a bit trickier to verify.
>
> I tried to exclude those, but I might have screwed it up, just like I
> screwed up for MACHINE().  I'll double-check.

None contain matches for /\bMachine(Class|State) *[^ *]/.



Re: [Qemu-devel] [PATCH 22/28] Include hw/boards.h a bit less

2019-07-30 Thread Markus Armbruster
Eduardo Habkost  writes:

> On Fri, Jul 26, 2019 at 02:05:36PM +0200, 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 
>> Cc: Marcel Apfelbaum 
>> Signed-off-by: Markus Armbruster 
>> ---
>
> The following files use the MACHINE macro and require
> hw/boards.h, but are touched by this patch:
>
> hw/acpi/cpu.c:MachineState *machine = MACHINE(qdev_get_machine());
> hw/acpi/memory_hotplug.c:MachineState *machine = 
> MACHINE(qdev_get_machine());
> hw/i386/intel_iommu.c:MachineState *ms = MACHINE(qdev_get_machine());
> hw/i386/x86-iommu.c:MachineState *ms = MACHINE(qdev_get_machine());
> hw/ppc/spapr_rtas.c:MachineState *ms = MACHINE(qdev_get_machine());
> hw/s390x/s390-stattrib-kvm.c:MachineState *machine = 
> MACHINE(qdev_get_machine());
> hw/s390x/s390-stattrib-kvm.c:MachineState *machine = 
> MACHINE(qdev_get_machine());

Since they still compile, they obviously still get it indirectly.  I'll
drop these hunks.

> Maybe there are other files touched by this patch that require
> struct MachineClass or struct MachineState contents to be
> defined, but this is a bit trickier to verify.

I tried to exclude those, but I might have screwed it up, just like I
screwed up for MACHINE().  I'll double-check.

Thanks!



Re: [Qemu-devel] [PATCH 22/28] Include hw/boards.h a bit less

2019-07-30 Thread Markus Armbruster
Eduardo Habkost  writes:

> On Fri, Jul 26, 2019 at 02:05:36PM +0200, 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 
>> Cc: Marcel Apfelbaum 
>> Signed-off-by: Markus Armbruster 
> [...]
>> diff --git a/hw/core/machine.c b/hw/core/machine.c
>> index c58a8e594e..2c9c93983a 100644
>> --- a/hw/core/machine.c
>> +++ b/hw/core/machine.c
>> @@ -15,7 +15,6 @@
>>  #include "qapi/qmp/qerror.h"
>>  #include "sysemu/replay.h"
>>  #include "qemu/units.h"
>> -#include "hw/boards.h"
>>  #include "qapi/error.h"
>>  #include "qapi/qapi-visit-common.h"
>>  #include "qapi/visitor.h"
>
> This doesn't look right.  hw/core/machine.c contains the
> implementation of most functions declared at hw/boards.h, and
> surely requires struct MachineClass and struct MachineState to be
> defined.

Editing accident, reverted in the next patch.  Harmless, because we
still get it indirectly.  Will drop the hunk from this patch.  Thanks!



Re: [Qemu-devel] [PATCH 22/28] Include hw/boards.h a bit less

2019-07-29 Thread Eduardo Habkost
On Fri, Jul 26, 2019 at 02:05:36PM +0200, 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 
> Cc: Marcel Apfelbaum 
> Signed-off-by: Markus Armbruster 
> ---

The following files use the MACHINE macro and require
hw/boards.h, but are touched by this patch:

hw/acpi/cpu.c:MachineState *machine = MACHINE(qdev_get_machine());
hw/acpi/memory_hotplug.c:MachineState *machine = 
MACHINE(qdev_get_machine());
hw/i386/intel_iommu.c:MachineState *ms = MACHINE(qdev_get_machine());
hw/i386/x86-iommu.c:MachineState *ms = MACHINE(qdev_get_machine());
hw/ppc/spapr_rtas.c:MachineState *ms = MACHINE(qdev_get_machine());
hw/s390x/s390-stattrib-kvm.c:MachineState *machine = 
MACHINE(qdev_get_machine());
hw/s390x/s390-stattrib-kvm.c:MachineState *machine = 
MACHINE(qdev_get_machine());

Maybe there are other files touched by this patch that require
struct MachineClass or struct MachineState contents to be
defined, but this is a bit trickier to verify.

-- 
Eduardo



Re: [Qemu-devel] [PATCH 22/28] Include hw/boards.h a bit less

2019-07-29 Thread Eduardo Habkost
On Fri, Jul 26, 2019 at 02:05:36PM +0200, 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 
> Cc: Marcel Apfelbaum 
> Signed-off-by: Markus Armbruster 
[...]
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index c58a8e594e..2c9c93983a 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -15,7 +15,6 @@
>  #include "qapi/qmp/qerror.h"
>  #include "sysemu/replay.h"
>  #include "qemu/units.h"
> -#include "hw/boards.h"
>  #include "qapi/error.h"
>  #include "qapi/qapi-visit-common.h"
>  #include "qapi/visitor.h"

This doesn't look right.  hw/core/machine.c contains the
implementation of most functions declared at hw/boards.h, and
surely requires struct MachineClass and struct MachineState to be
defined.

-- 
Eduardo



Re: [Qemu-devel] [PATCH 22/28] Include hw/boards.h a bit less

2019-07-26 Thread Alistair Francis
On Fri, Jul 26, 2019 at 5:10 AM 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 
> Cc: Marcel Apfelbaum 
> Signed-off-by: Markus Armbruster 

Reviewed-by: Alistair Francis 

Alistair

> ---
>  backends/cryptodev-builtin.c| 1 -
>  backends/cryptodev-vhost-user.c | 1 -
>  backends/cryptodev.c| 1 -
>  exec.c  | 1 -
>  hw/acpi/cpu.c   | 1 -
>  hw/acpi/ich9.c  | 1 +
>  hw/acpi/memory_hotplug.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/machine-qmp-cmds.c  | 1 -
>  hw/core/machine.c   | 1 -
>  hw/core/numa.c  | 2 ++
>  hw/i386/intel_iommu.c   | 1 -
>  hw/i386/pc_piix.c   | 1 -
>  hw/i386/pc_q35.c| 1 -
>  hw/i386/pc_sysfw.c  | 1 -
>  hw/i386/x86-iommu.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_rtas.c | 1 -
>  hw/ppc/spapr_vio.c  | 1 -
>  hw/riscv/boot.c | 2 +-
>  hw/s390x/s390-stattrib-kvm.c| 1 -
>  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/kvm.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 -
>  55 files changed, 10 insertions(+), 48 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/exec.c b/exec.c
> index 78f849de99..6d60fdfb1f 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -29,7 +29,6 @@
>  #include "hw/qdev-core.h"
>  #include "hw/qdev-properties.h"
>  #if !defined(CONFIG_USER_ONLY)
> -#include "hw/boards.h"
>  #include "hw/xen/xen.h"
>  #endif
>  #include "sysemu/kvm.h"
> diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
> index 87f30a31d7..d8e531ad64 100644
> --- a/hw/acpi/cpu.c
> +++ b/hw/acpi/cpu.c
> @@ -1,5 +1,4 @@
>  #include "qemu/osdep.h"
> -#include "hw/boards.h"
>  #include "migration/vmstate.h"
>  #include "hw/acpi/cpu.h"
>  #include "qapi/error.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/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index 9483d66e86..b413f491ee 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c

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

2019-07-26 Thread Markus Armbruster
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 
Cc: Marcel Apfelbaum 
Signed-off-by: Markus Armbruster 
---
 backends/cryptodev-builtin.c| 1 -
 backends/cryptodev-vhost-user.c | 1 -
 backends/cryptodev.c| 1 -
 exec.c  | 1 -
 hw/acpi/cpu.c   | 1 -
 hw/acpi/ich9.c  | 1 +
 hw/acpi/memory_hotplug.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/machine-qmp-cmds.c  | 1 -
 hw/core/machine.c   | 1 -
 hw/core/numa.c  | 2 ++
 hw/i386/intel_iommu.c   | 1 -
 hw/i386/pc_piix.c   | 1 -
 hw/i386/pc_q35.c| 1 -
 hw/i386/pc_sysfw.c  | 1 -
 hw/i386/x86-iommu.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_rtas.c | 1 -
 hw/ppc/spapr_vio.c  | 1 -
 hw/riscv/boot.c | 2 +-
 hw/s390x/s390-stattrib-kvm.c| 1 -
 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/kvm.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 -
 55 files changed, 10 insertions(+), 48 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/exec.c b/exec.c
index 78f849de99..6d60fdfb1f 100644
--- a/exec.c
+++ b/exec.c
@@ -29,7 +29,6 @@
 #include "hw/qdev-core.h"
 #include "hw/qdev-properties.h"
 #if !defined(CONFIG_USER_ONLY)
-#include "hw/boards.h"
 #include "hw/xen/xen.h"
 #endif
 #include "sysemu/kvm.h"
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 87f30a31d7..d8e531ad64 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -1,5 +1,4 @@
 #include "qemu/osdep.h"
-#include "hw/boards.h"
 #include "migration/vmstate.h"
 #include "hw/acpi/cpu.h"
 #include "qapi/error.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/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 9483d66e86..b413f491ee 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -2,7 +2,6 @@
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/pc-hotplug.h"
 #include "hw/mem/pc-dimm.h"
-#include "hw/boards.h"
 #include "hw/qdev-core.h"
 #include "migration/vmstate.h"
 #include "trace.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 @@