softmmu: Clean up arch_init.c
Subsystems (3)
cover softmmu: Clean up arch_init.c
This patchset does some cleanups of arch_init.c. The bit I started out caring about was getting rid of the TARGET_* ifdef ladder (in patch 4 we make meson.build define QEMU_ARCH in config-target.h instead) -- this kind of ifdef ladder is nasty because it's always another place in the code that needs updating when we add or remove a target. I think this was one of the last remaining "every single arch touches this" ones. The rest of the patchset is stuff I noticed when I started looking at what else arch_init.c was doing.
The graphic_width/height/depth target-specific defaults that arch_init.c does also look like they could use cleanup. My guess is that we should instead have a per-machine default graphics width/height/depth. But that's a separate thing and more work than I felt like doing this morning :-)
-- PMM
Peter Maydell (8):
softmmu: Use accel_find("xen") instead of xen_available()
monitor: Use accel_find("kvm") instead of kvm_available() softmmu/arch_init.c: Trim down include list meson.build: Define QEMU_ARCH in config-target.h arch_init.h: Add QEMU_ARCH_HEXAGON
arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c arch_init.h: Don't include arch_init.h unnecessarily
stubs: Remove unused arch_type.c stub
meson.build | 2 ++ include/sysemu/arch_init.h | 15 +-------- blockdev.c | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/mips/jazz.c | 1 - hw/mips/malta.c | 1 - hw/ppc/prep.c | 1 - hw/riscv/sifive_e.c | 1 - hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c | 1 - hw/riscv/virt.c | 1 - monitor/qmp-cmds.c | 3 +- softmmu/arch_init.c | 66 -------------------------------------- softmmu/qdev-monitor.c | 9 ++++++ softmmu/vl.c | 6 ++-- stubs/arch_type.c | 4 --- target/ppc/cpu_init.c | 1 - target/s390x/cpu-sysemu.c | 1 - stubs/meson.build | 1 - 21 files changed, 16 insertions(+), 103 deletions(-) delete mode 100644 stubs/arch_type.c
Signature · 1 line
2.20.1
PATCH 1/8 softmmu: Use accel_find("xen") instead of xen_available()
The xen_available() function is used only to produce an error for some Xen-specific command line options in QEMU binaries where Xen support was not compiled in: it just returns the value of the CONFIG_XEN define.
Now that accelerators are QOM classes, we can check for "does this binary have Xen compiled in" with accel_find("xen"), and drop the xen_available() function.
--- include/sysemu/arch_init.h | 1 - softmmu/arch_init.c | 9 --------- softmmu/vl.c | 6 +++--- 3 files changed, 3 insertions(+), 13 deletions(-)
include/sysemu/arch_init.h +0 -1
@@ -30,7 +30,6 @@ enum {extern const uint32_t arch_type;int kvm_available (void ); -int xen_available (void );/* default virtio transport per architecture */ #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
softmmu/arch_init.c +0 -9
@@ -96,12 +96,3 @@ int kvm_available(void)return 0 ;#endif } - -int xen_available (void ) -{ -#ifdef CONFIG_XEN -return 1 ; -#else -return 0 ; -#endif -}
softmmu/vl.c +3 -3
@@ -3429,21 +3429,21 @@ void qemu_init(int argc, char **argv, char **envp) has_defaults =0 ;break ;case QEMU_OPTION_xen_domid: -if (!(xen_available ())) { +if (!(accel_find ("xen" ))) {error_report ("Option not supported for this target" );exit (1 ); } xen_domid =atoi (optarg);break ;case QEMU_OPTION_xen_attach: -if (!(xen_available ())) { +if (!(accel_find ("xen" ))) {error_report ("Option not supported for this target" );exit (1 ); } xen_mode =XEN_ATTACH ;break ;case QEMU_OPTION_xen_domid_restrict: -if (!(xen_available ())) { +if (!(accel_find ("xen" ))) {error_report ("Option not supported for this target" );exit (1 ); }
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available()
Quoted 9 lines · Peter Maydell
The
xen_available()function is used only to produce an error for some Xen-specific command line options in QEMU binaries where Xen support was not compiled in: it just returns the value of theCONFIG_XENdefine.Now that accelerators are QOM classes, we can check for "does this binary have Xen compiled in" with
accel_find("xen"), and drop thexen_available()function.
Quoted 6 lines
Signed-off-by Peter Maydell<[email protected]>--- include/sysemu/arch_init.h | 1 - softmmu/arch_init.c | 9 --------- softmmu/vl.c | 6 +++--- 3 files changed, 3 insertions(+), 13 deletions(-)
r~
PATCH 2/8 monitor: Use accel_find("kvm") instead of kvm_available()
In reply to Peter MaydellThe kvm_available() function reports whether KVM support was compiled into the QEMU binary; it returns the value of the CONFIG_KVM define.
The only place in the codebase where we use this function is in qmp_query_kvm(). Now that accelerators are based on QOM classes we can instead use accel_find("kvm") and remove the kvm_available() function.
--- include/sysemu/arch_init.h | 2 -- monitor/qmp-cmds.c | 2 +- softmmu/arch_init.c | 9 --------- 3 files changed, 1 insertion(+), 12 deletions(-)
include/sysemu/arch_init.h +0 -2
@@ -29,8 +29,6 @@ enum {extern const uint32_t arch_type; -int kvm_available (void ); -/* default virtio transport per architecture */ #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
monitor/qmp-cmds.c +1 -1
@@ -58,7 +58,7 @@ KvmInfo *qmp_query_kvm(Error **errp)KvmInfo *info =g_malloc0 (sizeof (*info)); info->enabled =kvm_enabled (); - info->present =kvm_available (); + info->present =accel_find ("kvm" );return info; }
softmmu/arch_init.c +0 -9
@@ -87,12 +87,3 @@ int graphic_depth = 32;#endif const uint32_t arch_type =QEMU_ARCH ; - -int kvm_available (void ) -{ -#ifdef CONFIG_KVM -return 1 ; -#else -return 0 ; -#endif -}
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available()
Quoted 9 lines · Peter Maydell
The
kvm_available()function reports whether KVM support was compiled into the QEMU binary; it returns the value of theCONFIG_KVMdefine.The only place in the codebase where we use this function is in
qmp_query_kvm(). Now that accelerators are based on QOM classes we can instead useaccel_find("kvm")and remove thekvm_available()function.
Quoted 6 lines
Signed-off-by Peter Maydell<[email protected]>--- include/sysemu/arch_init.h | 2 -- monitor/qmp-cmds.c | 2 +- softmmu/arch_init.c | 9 --------- 3 files changed, 1 insertion(+), 12 deletions(-)
r~
PATCH 3/8 softmmu/arch_init.c: Trim down include list
In reply to Peter Maydellarch_init.c does very little but has a long list of #include lines. Remove all the unnecessary ones.
--- softmmu/arch_init.c | 7 ------- 1 file changed, 7 deletions(-)
softmmu/arch_init.c +0 -7
@@ -23,13 +23,6 @@*/ #include "qemu/osdep.h" #include "sysemu/arch_init.h" -#include "hw/pci/pci.h" -#include "hw/audio/soundhw.h" -#include "qapi/error.h" -#include "qemu/config-file.h" -#include "qemu/error-report.h" -#include "hw/acpi/acpi.h" -#include "qemu/help_option.h" #ifdef TARGET_SPARC int graphic_width =1024 ;
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list
Quoted 7 lines · Peter Maydell
arch_init.cdoes very little but has a long list of #include lines. Remove all the unnecessary ones.Signed-off-by Peter Maydell<[email protected]>--- softmmu/arch_init.c | 7 ------- 1 file changed, 7 deletions(-)
r~
PATCH 4/8 meson.build: Define QEMU_ARCH in config-target.h
In reply to Peter MaydellInstead of using an ifdef ladder in arch_init.c (which we then have to manually update every time we add or remove a target architecture), have meson.build put "#define QEMU_ARCH QEMU_ARCH_FOO" in the config-target.h file.
--- meson.build | 2 ++ softmmu/arch_init.c | 41 ----------------------------------------- 2 files changed, 2 insertions(+), 41 deletions(-)
meson.build +2 -0
@@ -1625,6 +1625,8 @@ foreach target : target_dirs config_target_data.set(k, v) endif endforeach + config_target_data.set('QEMU_ARCH', + 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper()) config_target_h += {target: configure_file(output: target + '-config-target.h', configuration: config_target_data)}
softmmu/arch_init.c +0 -41
45 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h
Quoted 10 lines · Peter Maydell
Instead of using an ifdef ladder in
arch_init.c(which we then have to manually update every time we add or remove a target architecture), have meson.build put "#defineQEMU_ARCHQEMU_ARCH_FOO" in theconfig-target.hfile.Signed-off-by Peter Maydell <[email protected]>--- meson.build | 2 ++ softmmu/arch_init.c | 41 ----------------------------------------- 2 files changed, 2 insertions(+), 41 deletions(-)
Re: [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h
In reply to Peter MaydellQuoted 10 lines · Peter Maydell
Instead of using an ifdef ladder in
arch_init.c(which we then have to manually update every time we add or remove a target architecture), have meson.build put "#defineQEMU_ARCHQEMU_ARCH_FOO" in theconfig-target.hfile.Signed-off-by Peter Maydell<[email protected]>--- meson.build | 2 ++ softmmu/arch_init.c | 41 ----------------------------------------- 2 files changed, 2 insertions(+), 41 deletions(-)
r~
PATCH 5/8 arch_init.h: Add QEMU_ARCH_HEXAGON
In reply to Peter MaydellWhen Hexagon was added we forgot to add it to the QEMU_ARCH_* enumeration. This doesn't cause a visible effect because at the moment Hexagon is linux-user only and the QEMU_ARCH_* constants are only used in softmmu, but we might as well add it in, since it's the only architecture currently missing from the list.
--- include/sysemu/arch_init.h | 1 + 1 file changed, 1 insertion(+)
include/sysemu/arch_init.h +1 -0
@@ -23,6 +23,7 @@ enum {QEMU_ARCH_RISCV = (1 <<19 ),QEMU_ARCH_RX = (1 <<20 ),QEMU_ARCH_AVR = (1 <<21 ), +QEMU_ARCH_HEXAGON = (1 <<22 ), QEMU_ARCH_NONE = (1 << 31), };
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
Quoted 10 lines · Peter Maydell
When Hexagon was added we forgot to add it to the QEMU_ARCH_* enumeration. This doesn't cause a visible effect because at the moment Hexagon is linux-user only and the QEMU_ARCH_* constants are only used in softmmu, but we might as well add it in, since it's the only architecture currently missing from the list.
Signed-off-by Peter Maydell <[email protected]>--- include/sysemu/arch_init.h | 1 + 1 file changed, 1 insertion(+)
Re: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
In reply to Peter MaydellQuoted 10 lines · Peter Maydell
When Hexagon was added we forgot to add it to the QEMU_ARCH_* enumeration. This doesn't cause a visible effect because at the moment Hexagon is linux-user only and the QEMU_ARCH_* constants are only used in softmmu, but we might as well add it in, since it's the only architecture currently missing from the list.
Signed-off-by Peter Maydell<[email protected]>--- include/sysemu/arch_init.h | 1 + 1 file changed, 1 insertion(+)
r~
RE: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
In reply to Peter MaydellQuoted 17 lines
-----Original Message-----
From: Qemu-devel <qemu-devel- [email protected]> On Behalf Of Peter Maydell
Sent: Friday, July 30, 2021 5:00 AM
To: [email protected]
Cc: Paolo Bonzini <[email protected]>; Markus Armbruster <[email protected]>; Eduardo Habkost <[email protected]>
Subject: [PATCH for-6.2 5/8]arch_init.h: AddQEMU_ARCH_HEXAGONWhen Hexagon was added we forgot to add it to the QEMU_ARCH_* enumeration. This doesn't cause a visible effect because at the moment Hexagon is linux-user only and the QEMU_ARCH_* constants are only used in softmmu, but we might as well add it in, since it's the only architecture currently missing from the list.
Quoted 4 lines
Signed-off-by Peter Maydell <[email protected]>+
QEMU_ARCH_HEXAGON= (1 << 22),
PATCH 6/8 arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
In reply to Peter MaydellThe QEMU_ARCH_VIRTIO_* defines are used only in one file, qdev-monitor.c. Move them to that file.
--- include/sysemu/arch_init.h | 9 --------- softmmu/qdev-monitor.c | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-)
include/sysemu/arch_init.h +0 -9
@@ -30,13 +30,4 @@ enum {extern const uint32_t arch_type; -/* default virtio transport per architecture */ -#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ - QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ - QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ - QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ - QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) -#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) -#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) -#endif
softmmu/qdev-monitor.c +9 -0
@@ -52,6 +52,15 @@ typedef struct QDevAliasuint32_t arch_mask; } QDevAlias; +/* default virtio transport per architecture */ +#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ + QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ + QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ + QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ + QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) +#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) +#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) +/* Please keep this table sorted by typename. */ static const QDevAlias qdev_alias_table[] = { {"AC97" ,"ac97" },/* -soundhw name */
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
Quoted 8 lines · Peter Maydell
The QEMU_ARCH_VIRTIO_* defines are used only in one file,
qdev-monitor.c. Move them to that file.Signed-off-by Peter Maydell<[email protected]>--- include/sysemu/arch_init.h | 9 --------- softmmu/qdev-monitor.c | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-)
r~
Re: [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
In reply to Peter MaydellQuoted 37 lines · Peter Maydell
The QEMU_ARCH_VIRTIO_* defines are used only in one file,
qdev-monitor.c. Move them to that file.Signed-off-by Peter Maydell <[email protected]>--- include/sysemu/arch_init.h | 9 --------- softmmu/qdev-monitor.c | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-)include/sysemu/arch_init.h +0
-9@@ -30,13 +30,4 @@ enum {extern const uint32_t arch_type; -/* default virtio transport per architecture */ -#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ - QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ - QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ - QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ - QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) -#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) -#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) -#endif softmmu/qdev-monitor.c +2
-0@@ -52,6 +52,15 @@ typedef struct QDevAliasuint32_t arch_mask; } QDevAlias; +/* default virtio transport per architecture */ +#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
softmmu/qdev-monitor.c typedef struct QDevAlias · line 66
Quoted 10 lines
softmmu/qdev-monitor.c +7
-0+ QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ + QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ + QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ + QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) +#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) +#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) +/* Please keep this table sorted by typename. */ static const QDevAlias qdev_alias_table[] = { {"AC97" ,"ac97" },/* -soundhw name */
qdev-monitor.c is perhaps less than ideal. It's better than arch_init.h, though.
PATCH 7/8 arch_init.h: Don't include arch_init.h unnecessarily
In reply to Peter Maydellarch_init.h only defines the QEMU_ARCH_* enumeration and the arch_type global. Don't include it in files that don't use those.
--- blockdev.c | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/mips/jazz.c | 1 - hw/mips/malta.c | 1 - hw/ppc/prep.c | 1 - hw/riscv/sifive_e.c | 1 - hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c | 1 - hw/riscv/virt.c | 1 - monitor/qmp-cmds.c | 1 - target/ppc/cpu_init.c | 1 - target/s390x/cpu-sysemu.c | 1 - 14 files changed, 14 deletions(-)
blockdev.c +0 -1
@@ -56,7 +56,6 @@#include "sysemu/iothread.h" #include "block/block_int.h" #include "block/trace.h" -#include "sysemu/arch_init.h" #include "sysemu/runstate.h" #include "sysemu/replay.h" #include "qemu/cutils.h"
hw/i386/pc.c +0 -1
@@ -65,7 +65,6 @@#include "hw/xen/start_info.h" #include "ui/qemu-spice.h" #include "exec/memory.h" -#include "sysemu/arch_init.h" #include "qemu/bitmap.h" #include "qemu/config-file.h" #include "qemu/error-report.h"
hw/i386/pc_piix.c +0 -1
@@ -43,7 +43,6 @@#include "sysemu/kvm.h" #include "hw/kvm/clock.h" #include "hw/sysbus.h" -#include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/xen/xen-x86.h" #include "exec/memory.h"
hw/i386/pc_q35.c +0 -1
@@ -31,7 +31,6 @@#include "qemu/osdep.h" #include "qemu/units.h" #include "hw/loader.h" -#include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/mc146818rtc.h" #include "sysemu/kvm.h"
hw/mips/jazz.c +0 -1
@@ -35,7 +35,6 @@#include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "sysemu/sysemu.h" -#include "sysemu/arch_init.h" #include "hw/boards.h" #include "net/net.h" #include "hw/scsi/esp.h"
hw/mips/malta.c +0 -1
@@ -38,7 +38,6 @@#include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "sysemu/arch_init.h" #include "qemu/log.h" #include "hw/mips/bios.h" #include "hw/ide.h"
hw/ppc/prep.c +0 -1
@@ -40,7 +40,6 @@#include "hw/rtc/mc146818rtc.h" #include "hw/isa/pc87312.h" #include "hw/qdev-properties.h" -#include "sysemu/arch_init.h" #include "sysemu/kvm.h" #include "sysemu/reset.h" #include "trace.h"
hw/riscv/sifive_e.c +0 -1
@@ -45,7 +45,6 @@#include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_e_prci.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" static const MemMapEntry sifive_e_memmap[] = {
hw/riscv/sifive_u.c +0 -1
@@ -55,7 +55,6 @@#include "hw/intc/sifive_plic.h" #include "chardev/char.h" #include "net/eth.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h"
hw/riscv/spike.c +0 -1
@@ -37,7 +37,6 @@#include "hw/char/riscv_htif.h" #include "hw/intc/sifive_clint.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h"
hw/riscv/virt.c +0 -1
@@ -36,7 +36,6 @@#include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_test.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h"
monitor/qmp-cmds.c +0 -1
@@ -27,7 +27,6 @@#include "sysemu/kvm.h" #include "sysemu/runstate.h" #include "sysemu/runstate-action.h" -#include "sysemu/arch_init.h" #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" #include "qapi/error.h"
target/ppc/cpu_init.c +0 -1
@@ -22,7 +22,6 @@#include "disas/dis-asm.h" #include "exec/gdbstub.h" #include "kvm_ppc.h" -#include "sysemu/arch_init.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "sysemu/tcg.h"
target/s390x/cpu-sysemu.c +0 -1
@@ -34,7 +34,6 @@#include "hw/s390x/pv.h" #include "hw/boards.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" #include "sysemu/tcg.h" #include "hw/core/sysemu-cpu-ops.h"
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
Quoted 4 lines · Peter Maydell
arch_init.honly defines the QEMU_ARCH_* enumeration and thearch_typeglobal. Don't include it in files that don't use those.Signed-off-by Peter Maydell <[email protected]>
Quoted 16 lines
--- blockdev.c | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/mips/jazz.c | 1 - hw/mips/malta.c | 1 - hw/ppc/prep.c | 1 - hw/riscv/sifive_e.c | 1 - hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c | 1 - hw/riscv/virt.c | 1 - monitor/qmp-cmds.c | 1 - target/ppc/cpu_init.c | 1 - target/s390x/cpu-sysemu.c | 1 - 14 files changed, 14 deletions(-)
Re: [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
In reply to Peter MaydellQuoted 5 lines · Peter Maydell
arch_init.honly defines the QEMU_ARCH_* enumeration and thearch_typeglobal. Don't include it in files that don't use those.Signed-off-by Peter Maydell<[email protected]>---
r~
Re: [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
In reply to Peter MaydellQuoted 5 lines · Peter Maydell
arch_init.honly defines the QEMU_ARCH_* enumeration and thearch_typeglobal. Don't include it in files that don't use those.Signed-off-by Peter Maydell <[email protected]>
Alistair
Quoted 189 lines
--- blockdev.c | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/mips/jazz.c | 1 - hw/mips/malta.c | 1 - hw/ppc/prep.c | 1 - hw/riscv/sifive_e.c | 1 - hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c | 1 - hw/riscv/virt.c | 1 - monitor/qmp-cmds.c | 1 - target/ppc/cpu_init.c | 1 - target/s390x/cpu-sysemu.c | 1 - 14 files changed, 14 deletions(-)blockdev.c +0
-1@@ -56,7 +56,6 @@#include "sysemu/iothread.h" #include "block/block_int.h" #include "block/trace.h" -#include "sysemu/arch_init.h" #include "sysemu/runstate.h" #include "sysemu/replay.h" #include "qemu/cutils.h" hw/i386/pc.c +0
-1@@ -65,7 +65,6 @@#include "hw/xen/start_info.h" #include "ui/qemu-spice.h" #include "exec/memory.h" -#include "sysemu/arch_init.h" #include "qemu/bitmap.h" #include "qemu/config-file.h" #include "qemu/error-report.h" hw/i386/pc_piix.c +0
-1@@ -43,7 +43,6 @@#include "sysemu/kvm.h" #include "hw/kvm/clock.h" #include "hw/sysbus.h" -#include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/xen/xen-x86.h" #include "exec/memory.h" hw/i386/pc_q35.c +0
-1@@ -31,7 +31,6 @@#include "qemu/osdep.h" #include "qemu/units.h" #include "hw/loader.h" -#include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/mc146818rtc.h" #include "sysemu/kvm.h" hw/mips/jazz.c +0
-1@@ -35,7 +35,6 @@#include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "sysemu/sysemu.h" -#include "sysemu/arch_init.h" #include "hw/boards.h" #include "net/net.h" #include "hw/scsi/esp.h" hw/mips/malta.c +0
-1@@ -38,7 +38,6 @@#include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "sysemu/arch_init.h" #include "qemu/log.h" #include "hw/mips/bios.h" #include "hw/ide.h" hw/ppc/prep.c +0
-1@@ -40,7 +40,6 @@#include "hw/rtc/mc146818rtc.h" #include "hw/isa/pc87312.h" #include "hw/qdev-properties.h" -#include "sysemu/arch_init.h" #include "sysemu/kvm.h" #include "sysemu/reset.h" #include "trace.h" hw/riscv/sifive_e.c +0
-1@@ -45,7 +45,6 @@#include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_e_prci.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" static const MemMapEntry sifive_e_memmap[] = {hw/riscv/sifive_u.c +0
-1@@ -55,7 +55,6 @@#include "hw/intc/sifive_plic.h" #include "chardev/char.h" #include "net/eth.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" hw/riscv/spike.c +0
-1@@ -37,7 +37,6 @@#include "hw/char/riscv_htif.h" #include "hw/intc/sifive_clint.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" hw/riscv/virt.c +0
-1@@ -36,7 +36,6 @@#include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_test.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" monitor/qmp-cmds.c +0
-1@@ -27,7 +27,6 @@#include "sysemu/kvm.h" #include "sysemu/runstate.h" #include "sysemu/runstate-action.h" -#include "sysemu/arch_init.h" #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" #include "qapi/error.h" target/ppc/cpu_init.c +0
-1@@ -22,7 +22,6 @@#include "disas/dis-asm.h" #include "exec/gdbstub.h" #include "kvm_ppc.h" -#include "sysemu/arch_init.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "sysemu/tcg.h" target/s390x/cpu-sysemu.c +0
-2@@ -34,7 +34,6 @@#include "hw/s390x/pv.h" #include "hw/boards.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" #include "sysemu/tcg.h" #include "hw/core/sysemu-cpu-ops.h" --2.20.1
PATCH 8/8 stubs: Remove unused arch_type.c stub
In reply to Peter MaydellWe added a stub for the arch_type global in commit 5964ed56d9a1 so that we could compile blockdev.c into the tools. However, in commit 9db1d3a2be9bf we removed the only use of arch_type from blockdev.c. The stub is therefore no longer needed, and we can delete it again, together with the QEMU_ARCH_NONE value that only the stub was using.
--- include/sysemu/arch_init.h | 2 -- stubs/arch_type.c | 4 ---- stubs/meson.build | 1 - 3 files changed, 7 deletions(-) delete mode 100644 stubs/arch_type.c
include/sysemu/arch_init.h +0 -2
@@ -24,8 +24,6 @@ enum {QEMU_ARCH_RX = (1 <<20 ),QEMU_ARCH_AVR = (1 <<21 ), QEMU_ARCH_HEXAGON = (1 << 22), - - QEMU_ARCH_NONE = (1 << 31), };extern const uint32_t arch_type;
stubs/arch_type.c deleted +0 -4
@@ -1,4 +0,0 @@ -#include "qemu/osdep.h" -#include "sysemu/arch_init.h" - -const uint32_t arch_type =QEMU_ARCH_NONE ;
stubs/meson.build +0 -1
@@ -1,4 +1,3 @@ -stub_ss.add(files('arch_type.c')) stub_ss.add(files('bdrv-next-monitor-owned.c')) stub_ss.add(files('blk-commit-all.c')) stub_ss.add(files('blk-exp-close-all.c'))
Signature · 1 line
2.20.1
Re: [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub
Quoted 6 lines · Peter Maydell
We added a stub for the
arch_typeglobal in commit5964ed56d9a1so that we could compileblockdev.cinto the tools. However, in commit9db1d3a2be9bfwe removed the only use ofarch_typefromblockdev.c. The stub is therefore no longer needed, and we can delete it again, together with theQEMU_ARCH_NONEvalue that only the stub was using.
Quoted 7 lines
Signed-off-by Peter Maydell <[email protected]>--- include/sysemu/arch_init.h | 2 -- stubs/arch_type.c | 4 ---- stubs/meson.build | 1 - 3 files changed, 7 deletions(-) delete mode 100644 stubs/arch_type.c
Re: [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub
In reply to Peter MaydellQuoted 8 lines · Peter Maydell
We added a stub for the
arch_typeglobal in commit5964ed56d9a1so that we could compileblockdev.cinto the tools. However, in commit9db1d3a2be9bfwe removed the only use ofarch_typefromblockdev.c. The stub is therefore no longer needed, and we can delete it again, together with theQEMU_ARCH_NONEvalue that only the stub was using.Signed-off-by Peter Maydell<[email protected]>---
r~
Quoted 10 lines · Peter Maydell
This patchset does some cleanups of
arch_init.c. The bit I started out caring about was getting rid of the TARGET_* ifdef ladder (in patch 4 we make meson.build defineQEMU_ARCHinconfig-target.hinstead) -- this kind of ifdef ladder is nasty because it's always another place in the code that needs updating when we add or remove a target. I think this was one of the last remaining "every single arch touches this" ones. The rest of the patchset is stuff I noticed when I started looking at what elsearch_init.cwas doing.
Quoted 5 lines
The graphic_width/height/depth target-specific defaults that
arch_init.cdoes also look like they could use cleanup. My guess is that we should instead have a per-machine default graphics width/height/depth. But that's a separate thing and more work than I felt like doing this morning :-)
I'll take this via target-arm.next unless anybody objects.
thanks
-- PMM