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/s390-virtio-ccw.h"
#include "hw/s390x/s390-ccw.h"
+bool css_migration_enabled = true;
+
typedef struct CrwContainer {
CRW crw;
QTAILQ_ENTRY(CrwContainer) sibling;
static bool vmstate_schdev_orb_needed(void *opaque)
{
- return css_migration_enabled();
+ return css_migration_enabled;
}
static const VMStateDescription vmstate_schdev_orb = {
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;
}
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)
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);
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;
},
};
-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) \
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", },
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);
#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
/*< public >*/
bool ri_allowed;
bool cpu_model_allowed;
- bool css_migration_enabled;
bool hpage_1m_allowed;
int max_threads;
};
/* 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