qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 11/27] s390: move css_migration_enabled from machine to css.c
Date: Sun, 12 May 2024 12:49:29 +0200	[thread overview]
Message-ID: <20240512104945.130198-12-pbonzini@redhat.com> (raw)
In-Reply-To: <20240512104945.130198-1-pbonzini@redhat.com>

The CSS subsystem uses global variables, just face the truth and use
a variable also for whether the CSS vmstate is in use; remove the
indirection of fetching it from the machine type, which makes the
TCG code depend unnecessarily on the virtio-ccw machine.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20240509170044.190795-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/s390x/css.h             |  6 ++++++
 include/hw/s390x/s390-virtio-ccw.h |  7 -------
 hw/s390x/css.c                     | 10 +++++++---
 hw/s390x/s390-virtio-ccw.c         | 15 +++------------
 4 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index ba72ee3dd20..8289e458370 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -333,4 +333,10 @@ static inline int ccw_dstream_read_buf(CcwDataStream *cds, void *buff, int len)
 #define ccw_dstream_read(cds, v) ccw_dstream_read_buf((cds), &(v), sizeof(v))
 #define ccw_dstream_write(cds, v) ccw_dstream_write_buf((cds), &(v), sizeof(v))
 
+/**
+ * true if (vmstate based) migration of the channel subsystem
+ * is enabled, false if it is disabled.
+ */
+extern bool css_migration_enabled;
+
 #endif
diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h
index 7605d06bff1..996864a34e2 100644
--- a/include/hw/s390x/s390-virtio-ccw.h
+++ b/include/hw/s390x/s390-virtio-ccw.h
@@ -46,7 +46,6 @@ struct S390CcwMachineClass {
     /*< public >*/
     bool ri_allowed;
     bool cpu_model_allowed;
-    bool css_migration_enabled;
     bool hpage_1m_allowed;
     int max_threads;
 };
@@ -58,10 +57,4 @@ bool cpu_model_allowed(void);
 /* 1M huge page mappings allowed by the machine */
 bool hpage_1m_allowed(void);
 
-/**
- * Returns true if (vmstate based) migration of the channel subsystem
- * is enabled, false if it is disabled.
- */
-bool css_migration_enabled(void);
-
 #endif
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 295530963a6..b2d5327dbf4 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -23,6 +23,8 @@
 #include "hw/s390x/s390-virtio-ccw.h"
 #include "hw/s390x/s390-ccw.h"
 
+bool css_migration_enabled = true;
+
 typedef struct CrwContainer {
     CRW crw;
     QTAILQ_ENTRY(CrwContainer) sibling;
@@ -180,7 +182,7 @@ static const VMStateDescription vmstate_orb = {
 
 static bool vmstate_schdev_orb_needed(void *opaque)
 {
-    return css_migration_enabled();
+    return css_migration_enabled;
 }
 
 static const VMStateDescription vmstate_schdev_orb = {
@@ -388,7 +390,7 @@ static int subch_dev_post_load(void *opaque, int version_id)
         css_subch_assign(s->cssid, s->ssid, s->schid, s->devno, s);
     }
 
-    if (css_migration_enabled()) {
+    if (css_migration_enabled) {
         /* No compat voodoo to do ;) */
         return 0;
     }
@@ -412,7 +414,9 @@ static int subch_dev_post_load(void *opaque, int version_id)
 
 void css_register_vmstate(void)
 {
-    vmstate_register(NULL, 0, &vmstate_css, &channel_subsys);
+    if (css_migration_enabled) {
+        vmstate_register(NULL, 0, &vmstate_css, &channel_subsys);
+    }
 }
 
 IndAddr *get_indicator(hwaddr ind_addr, int len)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 756b4f40aed..3d0bc3e7f2e 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -283,11 +283,9 @@ static void ccw_init(MachineState *machine)
     s390_enable_css_support(s390_cpu_addr2state(0));
 
     ret = css_create_css_image(VIRTUAL_CSSID, true);
-
     assert(ret == 0);
-    if (css_migration_enabled()) {
-        css_register_vmstate();
-    }
+
+    css_register_vmstate();
 
     /* Create VirtIO network adapters */
     s390_create_virtio_net(BUS(css_bus), mc->default_nic);
@@ -749,7 +747,6 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
 
     s390mc->ri_allowed = true;
     s390mc->cpu_model_allowed = true;
-    s390mc->css_migration_enabled = true;
     s390mc->hpage_1m_allowed = true;
     s390mc->max_threads = 1;
     mc->init = ccw_init;
@@ -819,11 +816,6 @@ static const TypeInfo ccw_machine_info = {
     },
 };
 
-bool css_migration_enabled(void)
-{
-    return get_machine_class()->css_migration_enabled;
-}
-
 #define DEFINE_CCW_MACHINE(suffix, verstr, latest)                            \
     static void ccw_machine_##suffix##_class_init(ObjectClass *oc,            \
                                                   void *data)                 \
@@ -1179,7 +1171,6 @@ static void ccw_machine_2_9_instance_options(MachineState *machine)
 
 static void ccw_machine_2_9_class_options(MachineClass *mc)
 {
-    S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc);
     static GlobalProperty compat[] = {
         { TYPE_S390_STATTRIB, "migration-enabled", "off", },
         { TYPE_S390_FLIC_COMMON, "migration-enabled", "off", },
@@ -1188,7 +1179,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)
     ccw_machine_2_10_class_options(mc);
     compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
     compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
-    s390mc->css_migration_enabled = false;
+    css_migration_enabled = false;
 }
 DEFINE_CCW_MACHINE(2_9, "2.9", false);
 
-- 
2.45.0



  parent reply	other threads:[~2024-05-12 10:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-12 10:49 [PULL 00/27] Build/arch cleanups, target/i386 fixes for 2024-05-10 Paolo Bonzini
2024-05-12 10:49 ` [PULL 01/27] target/i386: remove PCOMMIT from TCG, deprecate property Paolo Bonzini
2024-05-12 10:49 ` [PULL 02/27] target/i386: fix operand size for DATA16 REX.W POPCNT Paolo Bonzini
2024-05-12 10:49 ` [PULL 03/27] target/i386: rdpkru/wrpkru are no-prefix instructions Paolo Bonzini
2024-05-12 10:49 ` [PULL 04/27] target/i386: move prefetch and multi-byte UD/NOP to new decoder Paolo Bonzini
2024-05-12 10:49 ` [PULL 05/27] target/i386: fix feature dependency for WAITPKG Paolo Bonzini
2024-05-12 10:49 ` [PULL 06/27] tests/tcg: cover lzcnt/tzcnt/popcnt Paolo Bonzini
2024-05-12 10:49 ` [PULL 07/27] configure: quote -D options that are passed through to meson Paolo Bonzini
2024-05-12 10:49 ` [PULL 08/27] sh4: select correct components for no-board build Paolo Bonzini
2024-05-12 10:49 ` [PULL 09/27] s390x: move s390_cpu_addr2state to target/s390x/sigp.c Paolo Bonzini
2024-05-12 10:49 ` [PULL 10/27] s390_flic: add migration-enabled property Paolo Bonzini
2024-05-12 10:49 ` Paolo Bonzini [this message]
2024-05-12 10:49 ` [PULL 12/27] s390x: select correct components for no-board build Paolo Bonzini
2024-05-12 10:49 ` [PULL 13/27] tests/qtest: s390x: fix operation in a build without any boards or devices Paolo Bonzini
2024-05-12 10:49 ` [PULL 14/27] xen: initialize legacy backends from xen_bus_init() Paolo Bonzini
2024-05-12 10:49 ` [PULL 15/27] xen: register legacy backends via xen_backend_init Paolo Bonzini
2024-05-12 10:49 ` [PULL 16/27] i386: correctly select code in hw/i386 that depends on other components Paolo Bonzini
2024-05-12 10:49 ` [PULL 17/27] i386: pc: remove unnecessary MachineClass overrides Paolo Bonzini
2024-05-12 10:49 ` [PULL 18/27] hw/i386: split x86.c in multiple parts Paolo Bonzini
2024-05-12 10:49 ` [PULL 19/27] hw/i386: move rtc-reset-reinjection command out of hw/rtc Paolo Bonzini
2024-05-12 10:49 ` [PULL 20/27] i386: select correct components for no-board build Paolo Bonzini
2024-05-12 10:49 ` [PULL 21/27] tests/qtest: arm: fix operation in a build without any boards or devices Paolo Bonzini
2024-05-12 10:49 ` [PULL 22/27] meson: pick libfdt from common_ss when building target-specific files Paolo Bonzini
2024-05-12 10:49 ` [PULL 23/27] meson: move libfdt together with other dependencies Paolo Bonzini
2024-05-12 10:49 ` [PULL 24/27] kconfig: allow compiling out QEMU device tree code per target Paolo Bonzini
2024-05-12 10:49 ` [PULL 25/27] kconfig: express dependency of individual boards on libfdt Paolo Bonzini
2024-05-12 10:49 ` [PULL 26/27] hw/xtensa: require libfdt Paolo Bonzini
2024-05-12 10:49 ` [PULL 27/27] configs: disable emulators that require it if libfdt is not found Paolo Bonzini
2024-05-14  8:51 ` [PULL 00/27] Build/arch cleanups, target/i386 fixes for 2024-05-10 Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240512104945.130198-12-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).