hw/s390x/s390-skeys: Don't call register_savevm_live() during instance_init()
commit2fb40d1b949a98c1742a9277e716da9bc502ffe4
authorThomas Huth <thuth@redhat.com>
Fri, 20 Oct 2023 15:05:52 +0000 (20 17:05 +0200)
committerJuan Quintela <quintela@redhat.com>
Wed, 1 Nov 2023 15:13:58 +0000 (1 16:13 +0100)
tree34430d32043dd8255544e9b996f1e2077a5cad03
parent6436db5a609c16c57e50e525e45e2b88cf925fff
hw/s390x/s390-skeys: Don't call register_savevm_live() during instance_init()

Since the instance_init() function immediately tries to set the
property to "true", the s390_skeys_set_migration_enabled() tries
to register a savevm handler during instance_init(). However,
instance_init() functions can be called multiple times, e.g. for
introspection of devices. That means multiple instances of devices
can be created during runtime (which is fine as long as they all
don't get realized, too), so the "Prevent double registration of
savevm handler" check in the s390_skeys_set_migration_enabled()
function does not work at all as expected (since there could be
more than one instance).

Thus we must not call register_savevm_live() from an instance_init()
function at all. Move this to the realize() function instead. This
way we can also get rid of the property getter and setter functions
completely, simplifying the code along the way quite a bit.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231020150554.664422-2-thuth@redhat.com>
hw/s390x/s390-skeys.c