summary refs log tree commit diff stats
path: root/hw/vfio/display.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-10-09 10:32:47 +0400
committerCédric Le Goater <clg@redhat.com>2023-10-18 10:10:49 +0200
commit8741781157f09a9f79bb652f8a0210d40f814cd0 (patch)
treea240a40b2055287e3110615b7719edce00723983 /hw/vfio/display.c
parenta1e88d2d2b89ad6371036aa07f7e96947786c873 (diff)
downloadfocaccia-qemu-8741781157f09a9f79bb652f8a0210d40f814cd0.tar.gz
focaccia-qemu-8741781157f09a9f79bb652f8a0210d40f814cd0.zip
hw/vfio: add ramfb migration support
Add a "VFIODisplay" subsection whenever "x-ramfb-migrate" is turned on.

Turn it off by default on machines <= 8.1 for compatibility reasons.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
[ clg:  - checkpatch fixes
  	- improved warn_report() in vfio_realize() ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/display.c')
-rw-r--r--hw/vfio/display.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index 837d9e6a30..7a10fa8604 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -544,3 +544,24 @@ void vfio_display_finalize(VFIOPCIDevice *vdev)
     vfio_display_edid_exit(vdev->dpy);
     g_free(vdev->dpy);
 }
+
+static bool migrate_needed(void *opaque)
+{
+    VFIODisplay *dpy = opaque;
+    bool ramfb_exists = dpy->ramfb != NULL;
+
+    /* see vfio_display_migration_needed() */
+    assert(ramfb_exists);
+    return ramfb_exists;
+}
+
+const VMStateDescription vfio_display_vmstate = {
+    .name = "VFIODisplay",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = migrate_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_STRUCT_POINTER(ramfb, VFIODisplay, ramfb_vmstate, RAMFBState),
+        VMSTATE_END_OF_LIST(),
+    }
+};