summary refs log tree commit diff stats
path: root/hw/virtio/virtio-qmp.c
diff options
context:
space:
mode:
authorJuraj Marcin <jmarcin@redhat.com>2024-09-04 12:37:15 +0200
committerDavid Hildenbrand <david@redhat.com>2024-09-24 11:33:35 +0200
commit1f5f49056d0f140568805d66f33396ed5cd90369 (patch)
treeaac0aa83cbe297e381c8e96ac4d3c46b14f73011 /hw/virtio/virtio-qmp.c
parentc009a311e93963860cfba917605a4bf903a06bce (diff)
downloadfocaccia-qemu-1f5f49056d0f140568805d66f33396ed5cd90369.tar.gz
focaccia-qemu-1f5f49056d0f140568805d66f33396ed5cd90369.zip
virtio-mem: Add support for suspend+wake-up with plugged memory
Before, the virtio-mem device would unplug all the memory with any reset
of the device, including during the wake-up of the guest from a
suspended state. Due to this, the virtio-mem driver in the Linux kernel
disallowed suspend-to-ram requests in the guest when the
VIRTIO_MEM_F_PERSISTENT_SUSPEND feature is not exposed by QEMU.

This patch adds the code to skip the reset on wake-up and exposes
theVIRTIO_MEM_F_PERSISTENT_SUSPEND feature to the guest kernel driver
when suspending is possible in QEMU (currently only x86).

Message-ID: <20240904103722.946194-5-jmarcin@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'hw/virtio/virtio-qmp.c')
-rw-r--r--hw/virtio/virtio-qmp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c
index 1dd96ed20f..cccc6fe761 100644
--- a/hw/virtio/virtio-qmp.c
+++ b/hw/virtio/virtio-qmp.c
@@ -450,6 +450,9 @@ static const qmp_virtio_feature_map_t virtio_mem_feature_map[] = {
     FEATURE_ENTRY(VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, \
             "VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE: Unplugged memory cannot be "
             "accessed"),
+    FEATURE_ENTRY(VIRTIO_MEM_F_PERSISTENT_SUSPEND, \
+            "VIRTIO_MEM_F_PERSISTENT_SUSPND: Plugged memory will remain "
+            "plugged when suspending+resuming"),
     { -1, "" }
 };
 #endif