s390x: Disable storage key migration on old machine type
This code disables storage key migration when an older machine type is specified. Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
186208fa1f
commit
9ef40173fb
|
@ -353,12 +353,39 @@ static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void s390_skeys_instance_init(Object *obj)
|
static inline bool s390_skeys_get_migration_enabled(Object *obj, Error **errp)
|
||||||
{
|
{
|
||||||
S390SKeysState *ss = S390_SKEYS(obj);
|
S390SKeysState *ss = S390_SKEYS(obj);
|
||||||
|
|
||||||
register_savevm(NULL, TYPE_S390_SKEYS, 0, 1, s390_storage_keys_save,
|
return ss->migration_enabled;
|
||||||
s390_storage_keys_load, ss);
|
}
|
||||||
|
|
||||||
|
static inline void s390_skeys_set_migration_enabled(Object *obj, bool value,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
S390SKeysState *ss = S390_SKEYS(obj);
|
||||||
|
|
||||||
|
/* Prevent double registration of savevm handler */
|
||||||
|
if (ss->migration_enabled == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ss->migration_enabled = value;
|
||||||
|
|
||||||
|
if (ss->migration_enabled) {
|
||||||
|
register_savevm(NULL, TYPE_S390_SKEYS, 0, 1, s390_storage_keys_save,
|
||||||
|
s390_storage_keys_load, ss);
|
||||||
|
} else {
|
||||||
|
unregister_savevm(DEVICE(ss), TYPE_S390_SKEYS, ss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void s390_skeys_instance_init(Object *obj)
|
||||||
|
{
|
||||||
|
object_property_add_bool(obj, "migration-enabled",
|
||||||
|
s390_skeys_get_migration_enabled,
|
||||||
|
s390_skeys_set_migration_enabled, NULL);
|
||||||
|
object_property_set_bool(obj, true, "migration-enabled", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void s390_skeys_class_init(ObjectClass *oc, void *data)
|
static void s390_skeys_class_init(ObjectClass *oc, void *data)
|
||||||
|
|
|
@ -282,12 +282,24 @@ static const TypeInfo ccw_machine_info = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CCW_COMPAT_2_4 \
|
||||||
|
{\
|
||||||
|
.driver = TYPE_S390_SKEYS,\
|
||||||
|
.property = "migration-enabled",\
|
||||||
|
.value = "off",\
|
||||||
|
},
|
||||||
|
|
||||||
static void ccw_machine_2_4_class_init(ObjectClass *oc, void *data)
|
static void ccw_machine_2_4_class_init(ObjectClass *oc, void *data)
|
||||||
{
|
{
|
||||||
MachineClass *mc = MACHINE_CLASS(oc);
|
MachineClass *mc = MACHINE_CLASS(oc);
|
||||||
|
static GlobalProperty compat_props[] = {
|
||||||
|
CCW_COMPAT_2_4
|
||||||
|
{ /* end of list */ }
|
||||||
|
};
|
||||||
|
|
||||||
mc->name = "s390-ccw-virtio-2.4";
|
mc->name = "s390-ccw-virtio-2.4";
|
||||||
mc->desc = "VirtIO-ccw based S390 machine v2.4";
|
mc->desc = "VirtIO-ccw based S390 machine v2.4";
|
||||||
|
mc->compat_props = compat_props;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo ccw_machine_2_4_info = {
|
static const TypeInfo ccw_machine_2_4_info = {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
typedef struct S390SKeysState {
|
typedef struct S390SKeysState {
|
||||||
DeviceState parent_obj;
|
DeviceState parent_obj;
|
||||||
|
bool migration_enabled;
|
||||||
|
|
||||||
} S390SKeysState;
|
} S390SKeysState;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue