hw/core: Cleanup and reorder headers
v2 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 manually checking if it is a direct inclusion.
Then reorder headers in alphabetical order.
In addition, update a file entry in MAINTAINERS file.
---
Changelog:
v1: Per Peter and Philippe's comments in v1, keep directly included
headers to avoid implicit header inclusions [1].
[1]: https://lore.kernel.org/qemu-devel/[email protected]/#t
---
Zhao Liu (9):
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 header in machine-qmp-cmds.c hw/core: Reorder included header in 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 | 2 +- hw/core/machine.c | 21 +++++++++++---------- hw/core/null-machine.c | 5 +++-- hw/core/numa.c | 22 ++++++++++------------ 7 files changed, 36 insertions(+), 37 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/9 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
PATCH v2 2/9 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
* exec/cpu-common.h
* qemu/error-report.h
* qemu/qemu-print.h
Tested by "./configure" and then "make".
--- hw/core/cpu-common.c | 4 ---- 1 file changed, 4 deletions(-)
hw/core/cpu-common.c +0 -4
@@ -22,13 +22,9 @@#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
PATCH v2 3/9 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
hw/core/cpu-common.c +7 -6
@@ -19,17 +19,18 @@*/ #include "qemu/osdep.h" -#include "qapi/error.h" + +#include "exec/log.h" +#include "hw/boards.h" #include "hw/core/cpu.h" -#include "sysemu/hw_accel.h" +#include "hw/qdev-properties.h" +#include "qapi/error.h" #include "qemu/log.h" #include "qemu/main-loop.h" -#include "exec/log.h" +#include "qemu/plugin.h" +#include "sysemu/hw_accel.h" #include "sysemu/tcg.h" -#include "hw/boards.h" -#include "hw/qdev-properties.h" #include "trace.h" -#include "qemu/plugin.h" CPUState *cpu_by_arch_id (int64_t id) {
Signature · 1 line
2.34.1
PATCH v2 4/9 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 v2 5/9 hw/core: Cleanup unused included header in machine-qmp-cmds.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove unused header (qemu/main-loop.h) in machine-qmp-cmds.c.
Tested by "./configure" and then "make".
--- hw/core/machine-qmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine-qmp-cmds.c +1 -1
@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "hw/acpi/vmgenid.h" #include "hw/boards.h" #include "hw/intc/intc.h"
@@ -19,7 +20,6 @@#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"
Signature · 1 line
2.34.1
PATCH v2 6/9 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 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
hw/core/machine.c +11 -10
@@ -11,26 +11,27 @@*/ #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/error.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 v2 7/9 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/core/null-machine.c +3 -2
@@ -12,10 +12,11 @@*/ #include "qemu/osdep.h" -#include "qemu/error-report.h" -#include "hw/boards.h" +#include "exec/address-spaces.h" +#include "hw/boards.h" #include "hw/core/cpu.h" +#include "qemu/error-report.h" static void machine_none_init (MachineState *mch) {
Signature · 1 line
2.34.1
PATCH v2 8/9 hw/core: Cleanup unused included headers in numa.c
In reply to Zhao LiuFrom: Zhao Liu <[email protected]>
Remove unused header in numa.c:
* qemu/bitmap.h
* hw/core/cpu.h
* migration/vmstate.h
Note: Though parse_numa_hmat_lb() has the variable named "bitmap_copy", it doesn't use the normal bitmap ops so that it's safe to exclude qemu/bitmap.h header.
Tested by "./configure" and then "make".
--- hw/core/numa.c | 3 --- 1 file changed, 3 deletions(-)
hw/core/numa.c +0 -3
@@ -28,15 +28,12 @@#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 v2 9/9 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 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
hw/core/numa.c +10 -9
@@ -23,22 +23,23 @@*/ #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/error-report.h" +#include "hw/boards.h" +#include "hw/mem/memory-device.h" +#include "hw/mem/pc-dimm.h" +#include "sysemu/hostmem.h" +#include "sysemu/numa.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/mem/pc-dimm.h" -#include "hw/boards.h" -#include "hw/mem/memory-device.h" -#include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" +#include "qemu/option.h" +#include "qemu/units.h" QemuOptsList qemu_numa_opts = { .name ="numa" ,
Signature · 1 line
2.34.1
Hi Philippe,
Thanks for picking the 1st patch. Could you take time for further review on other patches?
Thanks,
Zhao
Quoted 47 lines · Zhao Liu
Date: Tue, 16 Jan 2024 15:46:38 +0800
From: Zhao Liu <[email protected]>
Subject: [PATCH v2 0/9] hw/core: Cleanup and reorder headers
X-Mailer: git-send-email 2.34.1From: Zhao Liu <[email protected]>
Identify unused headers by full compilation (tested by "./configure" and then "make") and manually checking if it is a direct inclusion.
Then reorder headers in alphabetical order.
In addition, update a file entry in
MAINTAINERSfile.---
Changelog:v1: Per Peter and Philippe's comments in v1, keep directly included
headers to avoid implicit header inclusions [1].[1]: https://lore.kernel.org/qemu-devel/[email protected]/#t
---
Zhao Liu (9):
MAINTAINERS: Updatehw/core/cpu.centry
hw/core: Cleanup unused included headers incpu-common.chw/core: Reorder included headers incpu-common.chw/core: Reorder included headers incpu-sysemu.chw/core: Cleanup unused included header inmachine-qmp-cmds.chw/core: Reorder included header inmachine.chw/core: Reorder included headers innull-machine.chw/core: Cleanup unused included headers innuma.chw/core: Reorder included headers innuma.cMAINTAINERS | 3 ++- hw/core/cpu-common.c | 17 +++++++---------- hw/core/cpu-sysemu.c | 3 ++- hw/core/machine-qmp-cmds.c | 2 +- hw/core/machine.c | 21 +++++++++++---------- hw/core/null-machine.c | 5 +++-- hw/core/numa.c | 22 ++++++++++------------ 7 files changed, 36 insertions(+), 37 deletions(-)Signature · 1 line
2.34.1