All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c
@ 2021-07-30 10:59 Peter Maydell
  2021-07-30 10:59 ` [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available() Peter Maydell
                   ` (8 more replies)
  0 siblings, 9 replies; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

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

-- 
2.20.1



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available()
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 18:41   ` Richard Henderson
  2021-07-30 10:59 ` [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available() Peter Maydell
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/sysemu/arch_init.h | 1 -
 softmmu/arch_init.c        | 9 ---------
 softmmu/vl.c               | 6 +++---
 3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index e723c467eb2..7acfc62418f 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -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 | \
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
index 6ff9f30badd..3f4d7c1b1cd 100644
--- a/softmmu/arch_init.c
+++ b/softmmu/arch_init.c
@@ -96,12 +96,3 @@ int kvm_available(void)
     return 0;
 #endif
 }
-
-int xen_available(void)
-{
-#ifdef CONFIG_XEN
-    return 1;
-#else
-    return 0;
-#endif
-}
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 4dee472c794..a32d15b6a1f 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -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);
                 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available()
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
  2021-07-30 10:59 ` [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available() Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 18:41   ` Richard Henderson
  2021-07-30 10:59 ` [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list Peter Maydell
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

The 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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/sysemu/arch_init.h | 2 --
 monitor/qmp-cmds.c         | 2 +-
 softmmu/arch_init.c        | 9 ---------
 3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 7acfc62418f..57caad1c675 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -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 | \
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index f7d64a64577..9ddb9352e65 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -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;
 }
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
index 3f4d7c1b1cd..9011af74e4a 100644
--- a/softmmu/arch_init.c
+++ b/softmmu/arch_init.c
@@ -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
-}
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
  2021-07-30 10:59 ` [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available() Peter Maydell
  2021-07-30 10:59 ` [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available() Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 18:42   ` Richard Henderson
  2021-07-30 10:59 ` [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h Peter Maydell
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

arch_init.c does very little but has a long list of #include lines.
Remove all the unnecessary ones.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 softmmu/arch_init.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
index 9011af74e4a..91cbf883e28 100644
--- a/softmmu/arch_init.c
+++ b/softmmu/arch_init.c
@@ -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;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
                   ` (2 preceding siblings ...)
  2021-07-30 10:59 ` [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 13:19   ` Philippe Mathieu-Daudé
  2021-07-30 18:43   ` Richard Henderson
  2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

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 "#define QEMU_ARCH QEMU_ARCH_FOO"
in the config-target.h file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 meson.build         |  2 ++
 softmmu/arch_init.c | 41 -----------------------------------------
 2 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/meson.build b/meson.build
index f2e148eaf98..861965c286b 100644
--- a/meson.build
+++ b/meson.build
@@ -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)}
 
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
index 91cbf883e28..8919405c7b2 100644
--- a/softmmu/arch_init.c
+++ b/softmmu/arch_init.c
@@ -38,45 +38,4 @@ int graphic_height = 600;
 int graphic_depth = 32;
 #endif
 
-
-#if defined(TARGET_ALPHA)
-#define QEMU_ARCH QEMU_ARCH_ALPHA
-#elif defined(TARGET_ARM)
-#define QEMU_ARCH QEMU_ARCH_ARM
-#elif defined(TARGET_CRIS)
-#define QEMU_ARCH QEMU_ARCH_CRIS
-#elif defined(TARGET_HPPA)
-#define QEMU_ARCH QEMU_ARCH_HPPA
-#elif defined(TARGET_I386)
-#define QEMU_ARCH QEMU_ARCH_I386
-#elif defined(TARGET_M68K)
-#define QEMU_ARCH QEMU_ARCH_M68K
-#elif defined(TARGET_MICROBLAZE)
-#define QEMU_ARCH QEMU_ARCH_MICROBLAZE
-#elif defined(TARGET_MIPS)
-#define QEMU_ARCH QEMU_ARCH_MIPS
-#elif defined(TARGET_NIOS2)
-#define QEMU_ARCH QEMU_ARCH_NIOS2
-#elif defined(TARGET_OPENRISC)
-#define QEMU_ARCH QEMU_ARCH_OPENRISC
-#elif defined(TARGET_PPC)
-#define QEMU_ARCH QEMU_ARCH_PPC
-#elif defined(TARGET_RISCV)
-#define QEMU_ARCH QEMU_ARCH_RISCV
-#elif defined(TARGET_RX)
-#define QEMU_ARCH QEMU_ARCH_RX
-#elif defined(TARGET_S390X)
-#define QEMU_ARCH QEMU_ARCH_S390X
-#elif defined(TARGET_SH4)
-#define QEMU_ARCH QEMU_ARCH_SH4
-#elif defined(TARGET_SPARC)
-#define QEMU_ARCH QEMU_ARCH_SPARC
-#elif defined(TARGET_TRICORE)
-#define QEMU_ARCH QEMU_ARCH_TRICORE
-#elif defined(TARGET_XTENSA)
-#define QEMU_ARCH QEMU_ARCH_XTENSA
-#elif defined(TARGET_AVR)
-#define QEMU_ARCH QEMU_ARCH_AVR
-#endif
-
 const uint32_t arch_type = QEMU_ARCH;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
                   ` (3 preceding siblings ...)
  2021-07-30 10:59 ` [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 13:20   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2021-07-30 10:59 ` [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c Peter Maydell
                   ` (3 subsequent siblings)
  8 siblings, 3 replies; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

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 <peter.maydell@linaro.org>
---
 include/sysemu/arch_init.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 57caad1c675..60270c5ad15 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -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),
 };
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
                   ` (4 preceding siblings ...)
  2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 18:46   ` Richard Henderson
  2021-08-26 14:41   ` Markus Armbruster
  2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

The QEMU_ARCH_VIRTIO_* defines are used only in one file,
qdev-monitor.c. Move them to that file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/sysemu/arch_init.h | 9 ---------
 softmmu/qdev-monitor.c     | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 60270c5ad15..e7789399508 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -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
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 721dec2d820..a304754ab91 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -52,6 +52,15 @@ typedef struct QDevAlias
     uint32_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 */
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
                   ` (5 preceding siblings ...)
  2021-07-30 10:59 ` [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 13:21   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2021-07-30 10:59 ` [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub Peter Maydell
  2021-08-26 14:33 ` [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
  8 siblings, 3 replies; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

arch_init.h only defines the QEMU_ARCH_* enumeration and the
arch_type global. Don't include it in files that don't use those.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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(-)

diff --git a/blockdev.c b/blockdev.c
index 3d8ac368a19..e79c5f3b5e8 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a358..102b2239468 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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"
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 30b8bd6ea92..1bc30167acc 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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"
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04b4a4788d7..eeb0b185b11 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -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"
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index d6183e18821..f5a26e174d5 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -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"
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 7dcf175d726..b770b8d3671 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -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"
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index acfc2a91d8e..25a2e86b421 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -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"
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index ddc658c8d68..5b7b245e1f3 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -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[] = {
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 87bbd10b211..6cc1a62b0f7 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -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"
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index fead77f0c48..aae36f2cb4d 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -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"
 
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4a3cd2599a5..0e55411045a 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -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"
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 9ddb9352e65..5c0d5e116b9 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -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"
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 505a0ed6ac0..319a272d4c9 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -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"
diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c
index df2c6bf6941..5471e01ee82 100644
--- a/target/s390x/cpu-sysemu.c
+++ b/target/s390x/cpu-sysemu.c
@@ -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



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
                   ` (6 preceding siblings ...)
  2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
@ 2021-07-30 10:59 ` Peter Maydell
  2021-07-30 13:23   ` Philippe Mathieu-Daudé
  2021-07-30 18:46   ` Richard Henderson
  2021-08-26 14:33 ` [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
  8 siblings, 2 replies; 25+ messages in thread
From: Peter Maydell @ 2021-07-30 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

We 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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index e7789399508..70c579560ad 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -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;
diff --git a/stubs/arch_type.c b/stubs/arch_type.c
deleted file mode 100644
index fc5423bc98a..00000000000
--- a/stubs/arch_type.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "qemu/osdep.h"
-#include "sysemu/arch_init.h"
-
-const uint32_t arch_type = QEMU_ARCH_NONE;
diff --git a/stubs/meson.build b/stubs/meson.build
index d3fa8646b38..717bfa9a999 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -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'))
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h
  2021-07-30 10:59 ` [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h Peter Maydell
@ 2021-07-30 13:19   ` Philippe Mathieu-Daudé
  2021-07-30 18:43   ` Richard Henderson
  1 sibling, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-30 13:19 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 PM, Peter Maydell wrote:
> 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 "#define QEMU_ARCH QEMU_ARCH_FOO"
> in the config-target.h file.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  meson.build         |  2 ++
>  softmmu/arch_init.c | 41 -----------------------------------------
>  2 files changed, 2 insertions(+), 41 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
  2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
@ 2021-07-30 13:20   ` Philippe Mathieu-Daudé
  2021-07-30 18:44   ` Richard Henderson
  2021-07-30 19:36   ` Taylor Simpson
  2 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-30 13:20 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Taylor Simpson, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 PM, Peter Maydell wrote:
> 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 <peter.maydell@linaro.org>
> ---
>  include/sysemu/arch_init.h | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
  2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
@ 2021-07-30 13:21   ` Philippe Mathieu-Daudé
  2021-07-30 18:45   ` Richard Henderson
  2021-08-01  0:54   ` Alistair Francis
  2 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-30 13:21 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 PM, Peter Maydell wrote:
> arch_init.h only defines the QEMU_ARCH_* enumeration and the
> arch_type global. Don't include it in files that don't use those.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  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(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub
  2021-07-30 10:59 ` [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub Peter Maydell
@ 2021-07-30 13:23   ` Philippe Mathieu-Daudé
  2021-07-30 18:46   ` Richard Henderson
  1 sibling, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-30 13:23 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 PM, Peter Maydell wrote:
> We 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  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

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available()
  2021-07-30 10:59 ` [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available() Peter Maydell
@ 2021-07-30 18:41   ` Richard Henderson
  0 siblings, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:41 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> 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.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/sysemu/arch_init.h | 1 -
>   softmmu/arch_init.c        | 9 ---------
>   softmmu/vl.c               | 6 +++---
>   3 files changed, 3 insertions(+), 13 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available()
  2021-07-30 10:59 ` [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available() Peter Maydell
@ 2021-07-30 18:41   ` Richard Henderson
  0 siblings, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:41 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> The 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.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/sysemu/arch_init.h | 2 --
>   monitor/qmp-cmds.c         | 2 +-
>   softmmu/arch_init.c        | 9 ---------
>   3 files changed, 1 insertion(+), 12 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list
  2021-07-30 10:59 ` [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list Peter Maydell
@ 2021-07-30 18:42   ` Richard Henderson
  0 siblings, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:42 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> arch_init.c does very little but has a long list of #include lines.
> Remove all the unnecessary ones.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   softmmu/arch_init.c | 7 -------
>   1 file changed, 7 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h
  2021-07-30 10:59 ` [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h Peter Maydell
  2021-07-30 13:19   ` Philippe Mathieu-Daudé
@ 2021-07-30 18:43   ` Richard Henderson
  1 sibling, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:43 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> 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 "#define QEMU_ARCH QEMU_ARCH_FOO"
> in the config-target.h file.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   meson.build         |  2 ++
>   softmmu/arch_init.c | 41 -----------------------------------------
>   2 files changed, 2 insertions(+), 41 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
  2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
  2021-07-30 13:20   ` Philippe Mathieu-Daudé
@ 2021-07-30 18:44   ` Richard Henderson
  2021-07-30 19:36   ` Taylor Simpson
  2 siblings, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:44 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> 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<peter.maydell@linaro.org>
> ---
>   include/sysemu/arch_init.h | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
  2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
  2021-07-30 13:21   ` Philippe Mathieu-Daudé
@ 2021-07-30 18:45   ` Richard Henderson
  2021-08-01  0:54   ` Alistair Francis
  2 siblings, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:45 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> arch_init.h only defines the QEMU_ARCH_* enumeration and the
> arch_type global. Don't include it in files that don't use those.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub
  2021-07-30 10:59 ` [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub Peter Maydell
  2021-07-30 13:23   ` Philippe Mathieu-Daudé
@ 2021-07-30 18:46   ` Richard Henderson
  1 sibling, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:46 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> We 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.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
  2021-07-30 10:59 ` [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c Peter Maydell
@ 2021-07-30 18:46   ` Richard Henderson
  2021-08-26 14:41   ` Markus Armbruster
  1 sibling, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2021-07-30 18:46 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On 7/30/21 12:59 AM, Peter Maydell wrote:
> The QEMU_ARCH_VIRTIO_* defines are used only in one file,
> qdev-monitor.c. Move them to that file.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/sysemu/arch_init.h | 9 ---------
>   softmmu/qdev-monitor.c     | 9 +++++++++
>   2 files changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
  2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
  2021-07-30 13:20   ` Philippe Mathieu-Daudé
  2021-07-30 18:44   ` Richard Henderson
@ 2021-07-30 19:36   ` Taylor Simpson
  2 siblings, 0 replies; 25+ messages in thread
From: Taylor Simpson @ 2021-07-30 19:36 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost



> -----Original Message-----
> From: Qemu-devel <qemu-devel-
> bounces+tsimpson=quicinc.com@nongnu.org> On Behalf Of Peter Maydell
> Sent: Friday, July 30, 2021 5:00 AM
> To: qemu-devel@nongnu.org
> Cc: Paolo Bonzini <pbonzini@redhat.com>; Markus Armbruster
> <armbru@redhat.com>; Eduardo Habkost <ehabkost@redhat.com>
> Subject: [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON
> 
> 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 <peter.maydell@linaro.org>


> +    QEMU_ARCH_HEXAGON = (1 << 22),

Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily
  2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
  2021-07-30 13:21   ` Philippe Mathieu-Daudé
  2021-07-30 18:45   ` Richard Henderson
@ 2021-08-01  0:54   ` Alistair Francis
  2 siblings, 0 replies; 25+ messages in thread
From: Alistair Francis @ 2021-08-01  0:54 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers, Eduardo Habkost,
	Markus Armbruster

On Fri, Jul 30, 2021 at 9:04 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> arch_init.h only defines the QEMU_ARCH_* enumeration and the
> arch_type global. Don't include it in files that don't use those.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

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

Alistair

> ---
>  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(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 3d8ac368a19..e79c5f3b5e8 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -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"
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index c2b9d62a358..102b2239468 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -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"
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 30b8bd6ea92..1bc30167acc 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -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"
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 04b4a4788d7..eeb0b185b11 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -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"
> diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
> index d6183e18821..f5a26e174d5 100644
> --- a/hw/mips/jazz.c
> +++ b/hw/mips/jazz.c
> @@ -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"
> diff --git a/hw/mips/malta.c b/hw/mips/malta.c
> index 7dcf175d726..b770b8d3671 100644
> --- a/hw/mips/malta.c
> +++ b/hw/mips/malta.c
> @@ -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"
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index acfc2a91d8e..25a2e86b421 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -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"
> diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
> index ddc658c8d68..5b7b245e1f3 100644
> --- a/hw/riscv/sifive_e.c
> +++ b/hw/riscv/sifive_e.c
> @@ -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[] = {
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 87bbd10b211..6cc1a62b0f7 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -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"
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index fead77f0c48..aae36f2cb4d 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -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"
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 4a3cd2599a5..0e55411045a 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -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"
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index 9ddb9352e65..5c0d5e116b9 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -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"
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index 505a0ed6ac0..319a272d4c9 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -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"
> diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c
> index df2c6bf6941..5471e01ee82 100644
> --- a/target/s390x/cpu-sysemu.c
> +++ b/target/s390x/cpu-sysemu.c
> @@ -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
>
>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c
  2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
                   ` (7 preceding siblings ...)
  2021-07-30 10:59 ` [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub Peter Maydell
@ 2021-08-26 14:33 ` Peter Maydell
  8 siblings, 0 replies; 25+ messages in thread
From: Peter Maydell @ 2021-08-26 14:33 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Paolo Bonzini, Markus Armbruster, Eduardo Habkost

On Fri, 30 Jul 2021 at 11:59, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> 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 :-)

I'll take this via target-arm.next unless anybody objects.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
  2021-07-30 10:59 ` [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c Peter Maydell
  2021-07-30 18:46   ` Richard Henderson
@ 2021-08-26 14:41   ` Markus Armbruster
  1 sibling, 0 replies; 25+ messages in thread
From: Markus Armbruster @ 2021-08-26 14:41 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, Eduardo Habkost

Peter Maydell <peter.maydell@linaro.org> writes:

> The QEMU_ARCH_VIRTIO_* defines are used only in one file,
> qdev-monitor.c. Move them to that file.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  include/sysemu/arch_init.h | 9 ---------
>  softmmu/qdev-monitor.c     | 9 +++++++++
>  2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
> index 60270c5ad15..e7789399508 100644
> --- a/include/sysemu/arch_init.h
> +++ b/include/sysemu/arch_init.h
> @@ -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
> diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
> index 721dec2d820..a304754ab91 100644
> --- a/softmmu/qdev-monitor.c
> +++ b/softmmu/qdev-monitor.c
> @@ -52,6 +52,15 @@ typedef struct QDevAlias
>      uint32_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 */

qdev-monitor.c is perhaps less than ideal.  It's better than
arch_init.h, though.

Reviewed-by: Markus Armbruster <armbru@redhat.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2021-08-26 14:43 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
2021-07-30 10:59 ` [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available() Peter Maydell
2021-07-30 18:41   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available() Peter Maydell
2021-07-30 18:41   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list Peter Maydell
2021-07-30 18:42   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h Peter Maydell
2021-07-30 13:19   ` Philippe Mathieu-Daudé
2021-07-30 18:43   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
2021-07-30 13:20   ` Philippe Mathieu-Daudé
2021-07-30 18:44   ` Richard Henderson
2021-07-30 19:36   ` Taylor Simpson
2021-07-30 10:59 ` [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c Peter Maydell
2021-07-30 18:46   ` Richard Henderson
2021-08-26 14:41   ` Markus Armbruster
2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
2021-07-30 13:21   ` Philippe Mathieu-Daudé
2021-07-30 18:45   ` Richard Henderson
2021-08-01  0:54   ` Alistair Francis
2021-07-30 10:59 ` [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub Peter Maydell
2021-07-30 13:23   ` Philippe Mathieu-Daudé
2021-07-30 18:46   ` Richard Henderson
2021-08-26 14:33 ` [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.