hw/core: Cleanup and reorder headers
cover hw/core: Cleanup and reorder headers
From: Zhao Liu <[email protected]>
Identify unused headers by full compilation (tested by "./configure" and then "make") and reorder headers in alphabetical order.
In addition, update a file entry in MAINTAINERS file.
Zhao Liu (11):
MAINTAINERS: Update hw/core/cpu.c entry
hw/core: Cleanup unused included headers in cpu-common.c hw/core: Reorder included headers in cpu-common.c hw/core: Reorder included headers in cpu-sysemu.c hw/core: Cleanup unused included headers in machine-qmp-cmds.c hw/core: Cleanup unused included header in machine.c hw/core: Reorder included header in machine.c hw/core: Cleanup unnecessary included header in null-machine.c hw/core: Reorder included headers in null-machine.c hw/core: Cleanup unused included headers in numa.c hw/core: Reorder included headers in numa.c
MAINTAINERS | 3 ++- hw/core/cpu-common.c | 17 ++++++----------- hw/core/cpu-sysemu.c | 3 ++- hw/core/machine-qmp-cmds.c | 4 +--- hw/core/machine.c | 22 +++++++++++----------- hw/core/null-machine.c | 6 +++--- hw/core/numa.c | 20 +++++++------------- 7 files changed, 32 insertions(+), 43 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/11 MAINTAINERS: Update hw/core/cpu.c entry
From: Zhao Liu <[email protected]>
The hw/core/cpu.c was split as hw/core/cpu-common.c and hw/core/cpu-sysemu.c in the commit df4fd7d5c8a3 ("cpu: Split as cpu-common / cpu-sysemu").
Update the related entry.
--- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
MAINTAINERS +2 -1
@@ -1867,7 +1867,8 @@ M: Marcel Apfelbaum <[email protected]> R: Philippe Mathieu-Daudé <[email protected]> R: Yanan Wang <[email protected]> S: Supported -F: hw/core/cpu.c +F: hw/core/cpu-common.c +F: hw/core/cpu-sysemu.c F: hw/core/machine-qmp-cmds.c F: hw/core/machine.c F: hw/core/machine-smp.c
Signature · 1 line
2.34.1
Re: [PATCH 01/11] MAINTAINERS: Update hw/core/cpu.c entry
Quoted 6 lines · Zhao Liu
From: Zhao Liu <[email protected]>
The
hw/core/cpu.cwas split ashw/core/cpu-common.candhw/core/cpu-sysemu.cin the commitdf4fd7d5c8a3("cpu: Split as cpu-common / cpu-sysemu").
Quoted 6 lines
Update the related entry.
Signed-off-by Zhao Liu <[email protected]>--- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Oops, thanks!
PATCH 2/11 hw/core: Cleanup unused included headers in cpu-common.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove unused headers in cpu-common.c:
* qemu/notify.h
* qemu/log.h
* qemu/main-loop.h
* exec/cpu-common.h
* qemu/error-report.h
* qemu/qemu-print.h
Though hw/core/cpu.h has been included by sysemu/hw_accel.h, to keep the dependency clear, still directly include hw/core/cpu.h in this file.
Tested by "./configure" and then "make".
--- hw/core/cpu-common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
hw/core/cpu-common.c +1 -6
@@ -19,16 +19,11 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/core/cpu.h" #include "sysemu/hw_accel.h" -#include "qemu/notify.h" -#include "qemu/log.h" -#include "qemu/main-loop.h" #include "exec/log.h" -#include "exec/cpu-common.h" -#include "qemu/error-report.h" -#include "qemu/qemu-print.h" #include "sysemu/tcg.h" #include "hw/boards.h" #include "hw/qdev-properties.h"
Signature · 1 line
2.34.1
Re: [PATCH 02/11] hw/core: Cleanup unused included headers in cpu-common.c
Quoted 14 lines · Zhao Liu
From: Zhao Liu <[email protected]>
Remove unused headers in
cpu-common.c:
*qemu/notify.h
*qemu/log.h
*qemu/main-loop.h
*exec/cpu-common.h
*qemu/error-report.h
*qemu/qemu-print.hThough
hw/core/cpu.hhas been included bysysemu/hw_accel.h, to keep the dependency clear, still directly includehw/core/cpu.hin this file.
Quoted 6 lines
Tested by "./configure" and then "make".
Signed-off-by Zhao Liu <[email protected]>--- hw/core/cpu-common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Something seems to be wrong with your analysis of what includes it is OK to drop. For instance, this file uses the function qemu_log(), which is why it includes qemu/log.h.
thanks
-- PMM
Re: [PATCH 02/11] hw/core: Cleanup unused included headers in cpu-common.c
Hi Peter,
Quoted 27 lines · Peter Maydell
Date: Mon, 15 Jan 2024 10:41:48 +0000
From: Peter Maydell <[email protected]>
Subject: Re: [PATCH 02/11] hw/core: Cleanup unused included headers in
cpu-common.cQuoted 14 lines · Zhao Liu
From: Zhao Liu <[email protected]>
Remove unused headers in
cpu-common.c:
*qemu/notify.h
*qemu/log.h
*qemu/main-loop.h
*exec/cpu-common.h
*qemu/error-report.h
*qemu/qemu-print.hThough
hw/core/cpu.hhas been included bysysemu/hw_accel.h, to keep the dependency clear, still directly includehw/core/cpu.hin this file.Quoted 6 lines
Tested by "./configure" and then "make".
Signed-off-by Zhao Liu <[email protected]>--- hw/core/cpu-common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Quoted 5 lines
Something seems to be wrong with your analysis of what includes it is OK to drop. For instance, this file uses the function
qemu_log(), which is why it includesqemu/log.h.
I'm not sure about this, since qemu/log.h has been included by exec/log.h, so could we just include exec/log.h and omit qemu/log.h in this file?
It seems enough for the compilation to omit qemu/log.h and only include exec/log.h.
Regards,
Zhao
Re: [PATCH 02/11] hw/core: Cleanup unused included headers in cpu-common.c
Quoted 30 lines · Zhao Liu
Hi Peter,
Quoted 27 lines · Peter Maydell
Date: Mon, 15 Jan 2024 10:41:48 +0000
From: Peter Maydell <[email protected]>
Subject: Re: [PATCH 02/11] hw/core: Cleanup unused included headers in
cpu-common.cQuoted 20 lines · Zhao Liu
From: Zhao Liu <[email protected]>
Remove unused headers in
cpu-common.c:
*qemu/notify.h
*qemu/log.h
*qemu/main-loop.h
*exec/cpu-common.h
*qemu/error-report.h
*qemu/qemu-print.hThough
hw/core/cpu.hhas been included bysysemu/hw_accel.h, to keep the dependency clear, still directly includehw/core/cpu.hin this file.Tested by "./configure" and then "make".
Signed-off-by Zhao Liu <[email protected]>--- hw/core/cpu-common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Quoted 8 lines
Quoted 5 lines
Something seems to be wrong with your analysis of what includes it is OK to drop. For instance, this file uses the function
qemu_log(), which is why it includesqemu/log.h.I'm not sure about this, since
qemu/log.hhas been included byexec/log.h, so could we just includeexec/log.hand omitqemu/log.hin this file?
We try to avoid implicit header inclusions, because if "exec/log.h" is reworked and "qemu/log.h" removed, then files using declarations implicitly declared start to fail building, and we need to clean unrelated files.
Quoted 6 lines
It seems enough for the compilation to omit
qemu/log.hand only includeexec/log.h.Regards,
Zhao
Re: [PATCH 02/11] hw/core: Cleanup unused included headers in cpu-common.c
Quoted 42 lines · Philippe Mathieu-Daudé
Date: Mon, 15 Jan 2024 17:07:52 +0100
From: Philippe Mathieu-Daudé <[email protected]>
Subject: Re: [PATCH 02/11] hw/core: Cleanup unused included headers in
cpu-common.cQuoted 36 lines · Zhao Liu
Hi Peter,
Quoted 32 lines · Peter Maydell
Date: Mon, 15 Jan 2024 10:41:48 +0000
From: Peter Maydell <[email protected]>
Subject: Re: [PATCH 02/11] hw/core: Cleanup unused included headers in
cpu-common.cQuoted 14 lines · Zhao Liu
From: Zhao Liu <[email protected]>
Remove unused headers in
cpu-common.c:
*qemu/notify.h
*qemu/log.h
*qemu/main-loop.h
*exec/cpu-common.h
*qemu/error-report.h
*qemu/qemu-print.hThough
hw/core/cpu.hhas been included bysysemu/hw_accel.h, to keep the dependency clear, still directly includehw/core/cpu.hin this file.Quoted 6 lines
Tested by "./configure" and then "make".
Signed-off-by Zhao Liu <[email protected]>--- hw/core/cpu-common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)Something seems to be wrong with your analysis of what includes it is OK to drop. For instance, this file uses the function
qemu_log(), which is why it includesqemu/log.h.
Quoted 7 lines
Quoted 2 lines
I'm not sure about this, since
qemu/log.hhas been included byexec/log.h, so could we just includeexec/log.hand omitqemu/log.hin this file?We try to avoid implicit header inclusions, because if "
exec/log.h" is reworked and "qemu/log.h" removed, then files using declarations implicitly declared start to fail building, and we need to clean unrelated files.
Thanks! I see. Let me rework this series.
Regards,
Zhao
PATCH 3/11 hw/core: Reorder included headers in cpu-common.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Reorder the header files (except qemu/osdep.h) in alphabetical order.
Tested by "./configure" and then "make".
--- hw/core/cpu-common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hw/core/cpu-common.c +5 -5
@@ -20,15 +20,15 @@#include "qemu/osdep.h" -#include "qapi/error.h" -#include "hw/core/cpu.h" -#include "sysemu/hw_accel.h" #include "exec/log.h" -#include "sysemu/tcg.h" #include "hw/boards.h" +#include "hw/core/cpu.h" #include "hw/qdev-properties.h" -#include "trace.h" +#include "qapi/error.h" #include "qemu/plugin.h" +#include "sysemu/hw_accel.h" +#include "sysemu/tcg.h" +#include "trace.h" CPUState *cpu_by_arch_id (int64_t id) {
Signature · 1 line
2.34.1
PATCH 4/11 hw/core: Reorder included headers in cpu-sysemu.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Reorder the header files (except qemu/osdep.h) in alphabetical order.
Tested by "./configure" and then "make".
--- hw/core/cpu-sysemu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/cpu-sysemu.c +2 -1
@@ -19,9 +19,10 @@*/ #include "qemu/osdep.h" -#include "qapi/error.h" +#include "hw/core/cpu.h" #include "hw/core/sysemu-cpu-ops.h" +#include "qapi/error.h" bool cpu_paging_enabled (const CPUState *cpu) {
Signature · 1 line
2.34.1
PATCH 5/11 hw/core: Cleanup unused included headers in machine-qmp-cmds.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove unused headers in machine-qmp-cmds.c:
* qemu/main-loop.h
* qemu/uuid.h
* sysemu/hostmem.h
Tested by "./configure" and then "make".
--- hw/core/machine-qmp-cmds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/core/machine-qmp-cmds.c +1 -3
@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "hw/acpi/vmgenid.h" #include "hw/boards.h" #include "hw/intc/intc.h"
@@ -19,10 +20,7 @@#include "qapi/qmp/qobject.h" #include "qapi/qobject-input-visitor.h" #include "qapi/type-helpers.h" -#include "qemu/main-loop.h" -#include "qemu/uuid.h" #include "qom/qom-qobject.h" -#include "sysemu/hostmem.h" #include "sysemu/hw_accel.h" #include "sysemu/numa.h" #include "sysemu/runstate.h"
Signature · 1 line
2.34.1
PATCH 6/11 hw/core: Cleanup unused included header in machine.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove unused header in cpu-common.c:
* qapi/error.h
Tested by "./configure" and then "make".
--- hw/core/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
@@ -11,11 +11,11 @@*/ #include "qemu/osdep.h" +#include "qemu/accel.h" #include "sysemu/replay.h" #include "hw/boards.h" #include "hw/loader.h" -#include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qom/object_interfaces.h" #include "sysemu/cpus.h"
Signature · 1 line
2.34.1
PATCH 7/11 hw/core: Reorder included header in machine.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Reorder the header files (except qemu/osdep.h) in alphabetical order.
Tested by "./configure" and then "make".
--- hw/core/machine.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
hw/core/machine.c +10 -10
@@ -12,25 +12,25 @@#include "qemu/osdep.h" -#include "qemu/accel.h" -#include "sysemu/replay.h" +#include "audio/audio.h" +#include "exec/confidential-guest-support.h" #include "hw/boards.h" #include "hw/loader.h" +#include "hw/mem/nvdimm.h" +#include "hw/pci/pci_bridge.h" +#include "hw/virtio/virtio-net.h" +#include "hw/virtio/virtio-pci.h" +#include "migration/global_state.h" #include "qapi/qapi-visit-machine.h" +#include "qemu/accel.h" #include "qom/object_interfaces.h" #include "sysemu/cpus.h" +#include "sysemu/qtest.h" #include "sysemu/sysemu.h" +#include "sysemu/replay.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" #include "sysemu/xen.h" -#include "sysemu/qtest.h" -#include "hw/pci/pci_bridge.h" -#include "hw/mem/nvdimm.h" -#include "migration/global_state.h" -#include "exec/confidential-guest-support.h" -#include "hw/virtio/virtio-pci.h" -#include "hw/virtio/virtio-net.h" -#include "audio/audio.h" GlobalProperty hw_compat_8_2[] = {};const size_t hw_compat_8_2_len =G_N_ELEMENTS (hw_compat_8_2);
Signature · 1 line
2.34.1
PATCH 8/11 hw/core: Cleanup unnecessary included header in null-machine.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove the unnecessary header (hw/core/cpu.h) since the hw/boards.h has already included that header.
--- hw/core/null-machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/null-machine.c +1 -1
@@ -12,10 +12,10 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/boards.h" #include "exec/address-spaces.h" -#include "hw/core/cpu.h" static void machine_none_init (MachineState *mch) {
Signature · 1 line
2.34.1
PATCH 9/11 hw/core: Reorder included headers in null-machine.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Reorder the header files (except qemu/osdep.h) in alphabetical order.
Tested by "./configure" and then "make".
--- hw/core/null-machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/core/null-machine.c +2 -2
@@ -13,9 +13,9 @@#include "qemu/osdep.h" -#include "qemu/error-report.h" -#include "hw/boards.h" #include "exec/address-spaces.h" +#include "hw/boards.h" +#include "qemu/error-report.h" static void machine_none_init (MachineState *mch) {
Signature · 1 line
2.34.1
PATCH 10/11 hw/core: Cleanup unused included headers in numa.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove unused header in numa.c:
* sysemu/hostmem.h
* exec/cpu-common.h
* exec/ramlist.h
* qemu/bitmap.h
* hw/core/cpu.h
* hw/mem/pc-dimm.h
* migration/vmstate.h
Though sysemu/numa.h has been included by sysemu/hostmem.h which is included by hw/boards.h, to keep the dependency clear, still directly include sysemu/numa.h in this file.
Tested by "./configure" and then "make".
--- hw/core/numa.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
hw/core/numa.c +1 -7
@@ -23,20 +23,14 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" -#include "sysemu/hostmem.h" #include "sysemu/numa.h" -#include "exec/cpu-common.h" -#include "exec/ramlist.h" -#include "qemu/bitmap.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" #include "qapi/qapi-visit-machine.h" #include "sysemu/qtest.h" -#include "hw/core/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"
Signature · 1 line
2.34.1
PATCH 11/11 hw/core: Reorder included headers in numa.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Reorder the header files (except qemu/osdep.h) in alphabetical order.
Tested by "./configure" and then "make".
--- hw/core/numa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
hw/core/numa.c +6 -6
@@ -24,18 +24,18 @@#include "qemu/osdep.h" -#include "qemu/units.h" +#include "hw/boards.h" +#include "hw/mem/memory-device.h" #include "sysemu/numa.h" -#include "qemu/error-report.h" +#include "sysemu/qtest.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" #include "qapi/qapi-visit-machine.h" -#include "sysemu/qtest.h" -#include "hw/boards.h" -#include "hw/mem/memory-device.h" -#include "qemu/option.h" +#include "qemu/error-report.h" #include "qemu/config-file.h" #include "qemu/cutils.h" +#include "qemu/option.h" +#include "qemu/units.h" QemuOptsList qemu_numa_opts = { .name ="numa" ,
Signature · 1 line
2.34.1