On 08.08.24 14:25, Peter Maydell wrote:
On Tue, 6 Aug 2024 at 17:08, Juraj Marcin <jmar...@redhat.com> wrote:
LegacyReset does not pass ResetType to the reset callback method, which
the new Resettable interface uses. Due to this, virtio-mem cannot use
the new RESET_TYPE_WAKEUP to skip reset during wake-up from a suspended
state.
This patch adds the Resettable interface to the VirtioMemClass interface
list, implements the necessary methods and replaces
qemu_[un]register_reset() calls with qemu_[un]register_resettable().
@@ -1887,6 +1897,7 @@ static const TypeInfo virtio_mem_info = {
.class_size = sizeof(VirtIOMEMClass),
.interfaces = (InterfaceInfo[]) {
{ TYPE_RAM_DISCARD_MANAGER },
+ { TYPE_RESETTABLE_INTERFACE },
{ }
},
};
TYPE_VIRTIO_MEM is-a TYPE_VIRTIO_DEVICE, which is-a TYPE_DEVICE,
which implements the TYPE_RESETTABLE_INTERFACE. In other words,
as a device this is already Resettable. Re-implementing the
interface doesn't seem like the right thing here (it probably
breaks the general reset implementation in the base class).
Maybe what you want to do here is implement the Resettable
methods that you already have?
TYPE_DEVICE indeed is TYPE_RESETTABLE_INTERFACE.
And there, we implement a single "dc->reset", within which we
unconditionally use "RESET_TYPE_COLD".
Looks like more plumbing might be required to get the actual reset type
to the device that way, unless I am missing the easy way out.
--
Cheers,
David / dhildenb