From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Laszlo Ersek" <lersek@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 20/22] ramfb: add migration support
Date: Wed, 18 Oct 2023 11:45:29 +0200 [thread overview]
Message-ID: <20231018094531.733211-21-clg@redhat.com> (raw)
In-Reply-To: <20231018094531.733211-1-clg@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Implementing RAMFB migration is quite straightforward. One caveat is to
treat the whole RAMFBCfg as a blob, since that's what is exposed to the
guest directly. This avoid having to fiddle with endianness issues if we
were to migrate fields individually as integers.
The devices using RAMFB will have to include ramfb_vmstate in their
migration description.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/display/ramfb.h | 4 ++++
hw/display/ramfb.c | 19 +++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/include/hw/display/ramfb.h b/include/hw/display/ramfb.h
index b33a2c467b28824dd4aa392b9e3d76b8cdaa7673..a7e00191445e17522e978c50e135ad2c722dafc7 100644
--- a/include/hw/display/ramfb.h
+++ b/include/hw/display/ramfb.h
@@ -1,11 +1,15 @@
#ifndef RAMFB_H
#define RAMFB_H
+#include "migration/vmstate.h"
+
/* ramfb.c */
typedef struct RAMFBState RAMFBState;
void ramfb_display_update(QemuConsole *con, RAMFBState *s);
RAMFBState *ramfb_setup(Error **errp);
+extern const VMStateDescription ramfb_vmstate;
+
/* ramfb-standalone.c */
#define TYPE_RAMFB_DEVICE "ramfb"
diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c
index c2b002d53480c14e48a07880d3c20969dccb52ed..477ef7272ab71a279ad8ed8a6dc59e1f66b778f9 100644
--- a/hw/display/ramfb.c
+++ b/hw/display/ramfb.c
@@ -28,6 +28,8 @@ struct QEMU_PACKED RAMFBCfg {
uint32_t stride;
};
+typedef struct RAMFBCfg RAMFBCfg;
+
struct RAMFBState {
DisplaySurface *ds;
uint32_t width, height;
@@ -116,6 +118,23 @@ void ramfb_display_update(QemuConsole *con, RAMFBState *s)
dpy_gfx_update_full(con);
}
+static int ramfb_post_load(void *opaque, int version_id)
+{
+ ramfb_fw_cfg_write(opaque, 0, 0);
+ return 0;
+}
+
+const VMStateDescription ramfb_vmstate = {
+ .name = "ramfb",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .post_load = ramfb_post_load,
+ .fields = (VMStateField[]) {
+ VMSTATE_BUFFER_UNSAFE(cfg, RAMFBState, 0, sizeof(RAMFBCfg)),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
RAMFBState *ramfb_setup(Error **errp)
{
FWCfgState *fw_cfg = fw_cfg_find();
--
2.41.0
next prev parent reply other threads:[~2023-10-18 9:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 9:45 [PULL 00/22] vfio queue Cédric Le Goater
2023-10-18 9:45 ` [PULL 01/22] scripts/update-linux-headers: Add iommufd.h Cédric Le Goater
2023-10-18 9:45 ` [PULL 02/22] linux-headers: " Cédric Le Goater
2023-10-18 9:45 ` [PULL 03/22] vfio/common: Move IOMMU agnostic helpers to a separate file Cédric Le Goater
2023-10-18 9:45 ` [PULL 04/22] vfio/common: Propagate KVM_SET_DEVICE_ATTR error if any Cédric Le Goater
2023-10-18 9:45 ` [PULL 05/22] vfio/common: Introduce vfio_container_add|del_section_window() Cédric Le Goater
2023-10-18 9:45 ` [PULL 06/22] vfio/common: Extract out vfio_kvm_device_[add/del]_fd Cédric Le Goater
2023-10-18 9:45 ` [PULL 07/22] vfio/pci: Introduce vfio_[attach/detach]_device Cédric Le Goater
2023-10-18 9:45 ` [PULL 08/22] vfio/platform: Use vfio_[attach/detach]_device Cédric Le Goater
2023-10-18 9:45 ` [PULL 09/22] vfio/ap: " Cédric Le Goater
2023-10-18 9:45 ` [PULL 10/22] vfio/ccw: " Cédric Le Goater
2023-10-18 9:45 ` [PULL 11/22] vfio/common: Move VFIO reset handler registration to a group agnostic function Cédric Le Goater
2023-10-18 9:45 ` [PULL 12/22] vfio/common: Introduce a per container device list Cédric Le Goater
2023-10-18 9:45 ` [PULL 13/22] vfio/common: Store the parent container in VFIODevice Cédric Le Goater
2023-10-18 9:45 ` [PULL 14/22] vfio/common: Introduce a global VFIODevice list Cédric Le Goater
2023-10-18 9:45 ` [PULL 15/22] vfio/common: Move legacy VFIO backend code into separate container.c Cédric Le Goater
2023-10-18 9:45 ` [PULL 16/22] vfio/pci: Fix a potential memory leak in vfio_listener_region_add Cédric Le Goater
2023-10-18 9:45 ` [PULL 17/22] vfio/ap: Remove pointless apdev variable Cédric Le Goater
2023-10-18 9:45 ` [PULL 18/22] vfio/ccw: Remove redundant definition of TYPE_VFIO_CCW Cédric Le Goater
2023-10-18 9:45 ` [PULL 19/22] vfio/pci: Remove vfio_detach_device from vfio_realize error path Cédric Le Goater
2023-10-18 9:45 ` Cédric Le Goater [this message]
2023-10-18 9:45 ` [PULL 21/22] ramfb-standalone: add migration support Cédric Le Goater
2023-10-18 9:45 ` [PULL 22/22] hw/vfio: add ramfb " Cédric Le Goater
2023-10-18 22:32 ` [PULL 00/22] vfio queue Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231018094531.733211-21-clg@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).