[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/22] ramfb-standalone: add migration support
|
From: |
Cédric Le Goater |
|
Subject: |
[PULL 21/22] ramfb-standalone: add migration support |
|
Date: |
Wed, 18 Oct 2023 11:45:30 +0200 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Add a "ramfb-dev" section whenever "x-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>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/core/machine.c | 1 +
hw/display/ramfb-standalone.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index
cfd1edfe20b53f2a2e5a7963f63a285fea6fef56..6305f2d7a4bbe25e0c132737bc8ebda83f7fd3a2
100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -34,6 +34,7 @@
GlobalProperty hw_compat_8_1[] = {
{ TYPE_PCI_BRIDGE, "x-pci-express-writeable-slt-bug", "true" },
+ { "ramfb", "x-migrate", "off" },
};
const size_t hw_compat_8_1_len = G_N_ELEMENTS(hw_compat_8_1);
diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c
index
8c0094397f5b384df94cafa87cc854d4353e19f4..a96e7ebcd9fa57989475e25b75599990acbe884f
100644
--- a/hw/display/ramfb-standalone.c
+++ b/hw/display/ramfb-standalone.c
@@ -1,4 +1,5 @@
#include "qemu/osdep.h"
+#include "migration/vmstate.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "hw/loader.h"
@@ -15,6 +16,7 @@ struct RAMFBStandaloneState {
SysBusDevice parent_obj;
QemuConsole *con;
RAMFBState *state;
+ bool migrate;
};
static void display_update_wrapper(void *dev)
@@ -40,14 +42,39 @@ static void ramfb_realizefn(DeviceState *dev, Error **errp)
ramfb->state = ramfb_setup(errp);
}
+static bool migrate_needed(void *opaque)
+{
+ RAMFBStandaloneState *ramfb = RAMFB(opaque);
+
+ return ramfb->migrate;
+}
+
+static const VMStateDescription ramfb_dev_vmstate = {
+ .name = "ramfb-dev",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = migrate_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_STRUCT_POINTER(state, RAMFBStandaloneState, ramfb_vmstate,
RAMFBState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static Property ramfb_properties[] = {
+ DEFINE_PROP_BOOL("x-migrate", RAMFBStandaloneState, migrate, true),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void ramfb_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
+ dc->vmsd = &ramfb_dev_vmstate;
dc->realize = ramfb_realizefn;
dc->desc = "ram framebuffer standalone device";
dc->user_creatable = true;
+ device_class_set_props(dc, ramfb_properties);
}
static const TypeInfo ramfb_info = {
--
2.41.0
- [PULL 11/22] vfio/common: Move VFIO reset handler registration to a group agnostic function, (continued)
- [PULL 11/22] vfio/common: Move VFIO reset handler registration to a group agnostic function, Cédric Le Goater, 2023/10/18
- [PULL 14/22] vfio/common: Introduce a global VFIODevice list, Cédric Le Goater, 2023/10/18
- [PULL 08/22] vfio/platform: Use vfio_[attach/detach]_device, Cédric Le Goater, 2023/10/18
- [PULL 09/22] vfio/ap: Use vfio_[attach/detach]_device, Cédric Le Goater, 2023/10/18
- [PULL 10/22] vfio/ccw: Use vfio_[attach/detach]_device, Cédric Le Goater, 2023/10/18
- [PULL 18/22] vfio/ccw: Remove redundant definition of TYPE_VFIO_CCW, Cédric Le Goater, 2023/10/18
- [PULL 19/22] vfio/pci: Remove vfio_detach_device from vfio_realize error path, Cédric Le Goater, 2023/10/18
- [PULL 20/22] ramfb: add migration support, Cédric Le Goater, 2023/10/18
- [PULL 15/22] vfio/common: Move legacy VFIO backend code into separate container.c, Cédric Le Goater, 2023/10/18
- [PULL 22/22] hw/vfio: add ramfb migration support, Cédric Le Goater, 2023/10/18
- [PULL 21/22] ramfb-standalone: add migration support,
Cédric Le Goater <=
- Re: [PULL 00/22] vfio queue, Stefan Hajnoczi, 2023/10/18