From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>
Subject: [PULL 4/7] hw/display/vga-isa: Fix migration of the isa-vga device
Date: Mon, 30 Mar 2026 12:28:12 +0200 [thread overview]
Message-ID: <20260330102815.6759-5-thuth@redhat.com> (raw)
In-Reply-To: <20260330102815.6759-1-thuth@redhat.com>
From: Thomas Huth <thuth@redhat.com>
QEMU currently crashes when migrating a guest that uses the
isa-vga device as display. This happens because vga_isa_class_initfn()
registers a vmsd for vmstate_vga_common that operates on VGACommonState.
But the isa-vga device is derived from ISADevice, not from VGACommonState,
so the migration code tries to fill in the data for VGACommonState to
the memory that is a ISADevice instead, which is of cause causing trouble.
We need an indirection here as it's also e.g. done in vga-pci.c, so
that the migration data gets filled into the right location.
While we're at it, also drop the "global_vmstate = true" here. Since
migration was broken for this device during the last 15 years (!) anyway,
we don't have to worry about maintaining backward compatibility with this
switch for older versions of QEMU anymore.
Fixes: 7435b791ca9 ("vga-isa: convert to qdev")
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260326113457.159065-1-thuth@redhat.com>
---
hw/display/vga-isa.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
index 95d85ff69a5..5f55c884a1b 100644
--- a/hw/display/vga-isa.c
+++ b/hw/display/vga-isa.c
@@ -32,6 +32,7 @@
#include "qemu/timer.h"
#include "hw/core/loader.h"
#include "hw/core/qdev-properties.h"
+#include "migration/vmstate.h"
#include "ui/console.h"
#include "qom/object.h"
@@ -62,7 +63,6 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
MemoryRegion *vga_io_memory;
const MemoryRegionPortio *vga_ports, *vbe_ports;
- s->global_vmstate = true;
if (!vga_common_init(s, OBJECT(dev), errp)) {
return;
}
@@ -88,6 +88,15 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
rom_add_vga(VGABIOS_FILENAME);
}
+static const VMStateDescription vmstate_vga_isa = {
+ .name = "vga-isa",
+ .version_id = 1,
+ .fields = (const VMStateField[]) {
+ VMSTATE_STRUCT(state, ISAVGAState, 0, vmstate_vga_common, VGACommonState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static const Property vga_isa_properties[] = {
DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
};
@@ -98,7 +107,7 @@ static void vga_isa_class_initfn(ObjectClass *klass, const void *data)
dc->realize = vga_isa_realizefn;
device_class_set_legacy_reset(dc, vga_isa_reset);
- dc->vmsd = &vmstate_vga_common;
+ dc->vmsd = &vmstate_vga_isa;
device_class_set_props(dc, vga_isa_properties);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
}
--
2.53.0
next prev parent reply other threads:[~2026-03-30 10:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 10:28 [PULL 0/7] Fixes for QEMU v11.0-rc2 Thomas Huth
2026-03-30 10:28 ` [PULL 1/7] tests/functional/qemu_test: Silence (most) warnings from pylint in asset.py Thomas Huth
2026-03-30 10:28 ` [PULL 2/7] tests/functional/qemu_test: Split huge fetch() function " Thomas Huth
2026-03-30 10:28 ` [PULL 3/7] tests/functional/qemu_test: Silence warnings from pylint in config.py Thomas Huth
2026-03-30 10:28 ` Thomas Huth [this message]
2026-03-30 10:28 ` [PULL 5/7] hw/display/cirrus_vga_isa: Disable global_vmstate by default for new machines Thomas Huth
2026-03-30 10:28 ` [PULL 6/7] pc-bios: remove obsolete linuxboot.bin prebuilt blob Thomas Huth
2026-03-30 10:28 ` [PULL 7/7] tests/functional/migration.py: Skip migration_with_exec() if socat is not available Thomas Huth
2026-03-30 12:54 ` [PULL 0/7] Fixes for QEMU v11.0-rc2 Peter Maydell
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=20260330102815.6759-5-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=farosas@suse.de \
--cc=peter.maydell@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.