aboutsummaryrefslogtreecommitdiff
path: root/hw/s390x/s390-skeys.c
diff options
context:
space:
mode:
authorJason J. Herne <jjherne@linux.vnet.ibm.com>2015-07-09 13:56:44 -0400
committerCornelia Huck <cornelia.huck@de.ibm.com>2015-09-03 12:17:54 +0200
commit9ef40173fbe99c0562d227980779a73613788782 (patch)
tree03c78971dcd08a52ff21a92a5bd4e104195780bf /hw/s390x/s390-skeys.c
parent186208fa1fa1b4fa1fe0b77c0fa61b9c0de6d66d (diff)
downloadqemu-9ef40173fbe99c0562d227980779a73613788782.zip
qemu-9ef40173fbe99c0562d227980779a73613788782.tar.gz
qemu-9ef40173fbe99c0562d227980779a73613788782.tar.bz2
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>
Diffstat (limited to 'hw/s390x/s390-skeys.c')
-rw-r--r--hw/s390x/s390-skeys.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index dea3042..539ef6d 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -353,12 +353,39 @@ static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
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);
+
+ return ss->migration_enabled;
+}
+
+static inline void s390_skeys_set_migration_enabled(Object *obj, bool value,
+ Error **errp)
{
S390SKeysState *ss = S390_SKEYS(obj);
- register_savevm(NULL, TYPE_S390_SKEYS, 0, 1, s390_storage_keys_save,
- s390_storage_keys_load, ss);
+ /* 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)