qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>, qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: Re: [PATCH v2 3/5] ramfb: implement migration support
Date: Mon, 2 Oct 2023 16:20:48 +0200	[thread overview]
Message-ID: <a79e8798-f7e7-4af4-16d1-8cf468822a2a@redhat.com> (raw)
In-Reply-To: <CAJ+F1CKzPOAPGc+cp=ytqARUWPq2bhi3vWE_b3MiZXebVTwJxg@mail.gmail.com>

On 10/2/23 14:01, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Oct 2, 2023 at 3:12 PM <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 following patches turns the migration only on machine >= 8.2.
>>
>> Fixes:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1859424
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>  hw/display/ramfb.c | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c
>> index 79b9754a58..4aaaa7d653 100644
>> --- a/hw/display/ramfb.c
>> +++ b/hw/display/ramfb.c
>> @@ -12,6 +12,7 @@
>>   */
>>
>>  #include "qemu/osdep.h"
>> +#include "migration/vmstate.h"
>>  #include "qapi/error.h"
>>  #include "hw/loader.h"
>>  #include "hw/display/ramfb.h"
>> @@ -28,6 +29,8 @@ struct QEMU_PACKED RAMFBCfg {
>>      uint32_t stride;
>>  };
>>
>> +typedef struct RAMFBCfg RAMFBCfg;
>> +
>>  struct RAMFBState {
>>      DisplaySurface *ds;
>>      uint32_t width, height;
>> @@ -115,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;
>> +}
>> +
>> +static const VMStateDescription vmstate_ramfb = {
>> +    .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();
>> @@ -127,6 +147,7 @@ RAMFBState *ramfb_setup(Error **errp)
>>
>>      s = g_new0(RAMFBState, 1);
>>
>> +    vmstate_register(NULL, 0, &vmstate_ramfb, s);
> 
> wip:
> I am going to make it attached to the actual device.

I'm really curious about that -- I think it's going to be better, and
it'll teach me stuff about migration!

Laszlo



  reply	other threads:[~2023-10-02 14:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 11:11 [PATCH v2 0/5] ramfb: migration support marcandre.lureau
2023-10-02 11:11 ` [PATCH v2 1/5] hw: remove needless includes marcandre.lureau
2023-10-02 14:41   ` Laszlo Ersek
2023-10-02 11:11 ` [PATCH v2 2/5] pc: " marcandre.lureau
2023-10-02 14:41   ` Laszlo Ersek
2023-10-02 11:11 ` [PATCH v2 3/5] ramfb: implement migration support marcandre.lureau
2023-10-02 12:01   ` Marc-André Lureau
2023-10-02 14:20     ` Laszlo Ersek [this message]
2023-10-02 14:34   ` Laszlo Ersek
2023-10-02 11:11 ` [PATCH v2 4/5] ramfb: make migration conditional marcandre.lureau
2023-10-02 13:38   ` Cédric Le Goater
2023-10-02 14:41     ` Alex Williamson
2023-10-02 18:24       ` Laszlo Ersek
2023-10-02 19:26         ` Alex Williamson
2023-10-02 19:41           ` Laszlo Ersek
2023-10-02 20:38             ` Alex Williamson
2023-10-02 20:46               ` Laszlo Ersek
2023-10-03  7:41               ` Cédric Le Goater
2023-10-03  8:23                 ` Marc-André Lureau
2023-10-03  8:28                   ` Cédric Le Goater
2023-10-02 14:40   ` Laszlo Ersek
2023-10-02 11:11 ` [PATCH v2 5/5] hw: turn off ramfb migration for machines <= 8.1 marcandre.lureau
2023-10-02 14:41   ` Laszlo Ersek
2023-10-03  9:07     ` Marc-André Lureau

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=a79e8798-f7e7-4af4-16d1-8cf468822a2a@redhat.com \
    --to=lersek@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@gmail.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).