From: Laszlo Ersek <lersek@redhat.com>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Cc: "Cédric Le Goater" <clg@redhat.com>, kraxel@redhat.com
Subject: Re: [PATCH v4 1/3] ramfb: add migration support
Date: Thu, 5 Oct 2023 17:03:35 +0200 [thread overview]
Message-ID: <901cd817-536f-cd9d-1f48-b1269cd30667@redhat.com> (raw)
In-Reply-To: <20231005113027.1827078-2-marcandre.lureau@redhat.com>
On 10/5/23 13:30, marcandre.lureau@redhat.com wrote:
> 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>
> ---
> 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 b33a2c467b..a7e0019144 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 c2b002d534..477ef7272a 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();
Identical to v3, which I reviewed, so:
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
next prev parent reply other threads:[~2023-10-05 15:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 11:30 [PATCH v4 0/3] WIP: ramfb: migration support marcandre.lureau
2023-10-05 11:30 ` [PATCH v4 1/3] ramfb: add " marcandre.lureau
2023-10-05 15:03 ` Laszlo Ersek [this message]
2023-10-05 11:30 ` [PATCH v4 2/3] ramfb-standalone: " marcandre.lureau
2023-10-05 15:03 ` Laszlo Ersek
2023-10-05 11:30 ` [PATCH v4 3/3] hw/vfio: add ramfb " marcandre.lureau
2023-10-05 15:10 ` Cédric Le Goater
2023-10-05 15:13 ` Laszlo Ersek
2023-10-05 16:34 ` Cédric Le Goater
2023-10-06 4:03 ` Laszlo Ersek
2023-10-05 12:01 ` [PATCH v4 0/3] WIP: ramfb: " Cédric Le Goater
2023-10-05 14:16 ` Laszlo Ersek
2023-10-05 14:16 ` Laszlo Ersek
2023-10-05 15:44 ` Cédric Le Goater
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=901cd817-536f-cd9d-1f48-b1269cd30667@redhat.com \
--to=lersek@redhat.com \
--cc=clg@redhat.com \
--cc=kraxel@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).