f06b222ece
Most importantly, fix forwards and backwards migration with VirtIO-GPU display. Other fixes are for a regression in pflash device (introduced in 8.2) and some fixes for x86(_64) TCG emulation. One of the patches needed to be adapted, because it removed a helper that is still in use in 9.0.0. There also is a revert for a fix in VirtIO PCI devices that turned out to cause some issues, see the revert itself for more details. Lastly, there is a change to move compatibility flags for a new VirtIO-net feature to the correct machine type. The feature was introduced in QEMU 8.2, but the compatibility flags got added to machine version 8.0 instead of 8.1. This breaks backwards migration with machine version 8.1 from a 8.2/9.0 binary to an 8.1 binary, in cases where the guest kernel enables the feature (e.g. Ubuntu 23.10). While that breaks migration with machine version 8.1 from an unpatched to a patched binary, Proxmox VE only ever had 8.2 on the test repository and 9.0 not yet in any public repository. An upstream developer suggested it is the proper fix [0]. Upstream submission [1]. [0]: https://lore.kernel.org/qemu-devel/CACGkMEtZrJuhof+hUGVRvLLQE+8nQE5XmSHpT0NAQ1EpnqfmsA@mail.gmail.com/T/#u [1]: https://lore.kernel.org/qemu-devel/20240517075336.104091-1-f.ebner@proxmox.com/T/#u Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
99 lines
4.4 KiB
Diff
99 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
Date: Thu, 16 May 2024 12:40:22 +0400
|
|
Subject: [PATCH] virtio-gpu: fix v2 migration
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Commit dfcf74fa ("virtio-gpu: fix scanout migration post-load") broke
|
|
forward/backward version migration. Versioning of nested VMSD structures
|
|
is not straightforward, as the wire format doesn't have nested
|
|
structures versions. Introduce x-scanout-vmstate-version and a field
|
|
test to save/load appropriately according to the machine version.
|
|
|
|
Fixes: dfcf74fa ("virtio-gpu: fix scanout migration post-load")
|
|
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
---
|
|
hw/core/machine.c | 1 +
|
|
hw/display/virtio-gpu.c | 24 ++++++++++++++++--------
|
|
include/hw/virtio/virtio-gpu.h | 1 +
|
|
3 files changed, 18 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
|
index 37ede0e7d4..d33a37a6f6 100644
|
|
--- a/hw/core/machine.c
|
|
+++ b/hw/core/machine.c
|
|
@@ -37,6 +37,7 @@ GlobalProperty hw_compat_8_2[] = {
|
|
{ "migration", "zero-page-detection", "legacy"},
|
|
{ TYPE_VIRTIO_IOMMU_PCI, "granule", "4k" },
|
|
{ TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "64" },
|
|
+ { "virtio-gpu-device", "x-scanout-vmstate-version", "1" },
|
|
};
|
|
const size_t hw_compat_8_2_len = G_N_ELEMENTS(hw_compat_8_2);
|
|
|
|
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
|
|
index ae831b6b3e..85323daf99 100644
|
|
--- a/hw/display/virtio-gpu.c
|
|
+++ b/hw/display/virtio-gpu.c
|
|
@@ -1166,10 +1166,17 @@ static void virtio_gpu_cursor_bh(void *opaque)
|
|
virtio_gpu_handle_cursor(&g->parent_obj.parent_obj, g->cursor_vq);
|
|
}
|
|
|
|
+static bool scanout_vmstate_after_v2(void *opaque, int version)
|
|
+{
|
|
+ struct VirtIOGPUBase *base = container_of(opaque, VirtIOGPUBase, scanout);
|
|
+ struct VirtIOGPU *gpu = container_of(base, VirtIOGPU, parent_obj);
|
|
+
|
|
+ return gpu->scanout_vmstate_version >= 2;
|
|
+}
|
|
+
|
|
static const VMStateDescription vmstate_virtio_gpu_scanout = {
|
|
.name = "virtio-gpu-one-scanout",
|
|
- .version_id = 2,
|
|
- .minimum_version_id = 1,
|
|
+ .version_id = 1,
|
|
.fields = (const VMStateField[]) {
|
|
VMSTATE_UINT32(resource_id, struct virtio_gpu_scanout),
|
|
VMSTATE_UINT32(width, struct virtio_gpu_scanout),
|
|
@@ -1181,12 +1188,12 @@ static const VMStateDescription vmstate_virtio_gpu_scanout = {
|
|
VMSTATE_UINT32(cursor.hot_y, struct virtio_gpu_scanout),
|
|
VMSTATE_UINT32(cursor.pos.x, struct virtio_gpu_scanout),
|
|
VMSTATE_UINT32(cursor.pos.y, struct virtio_gpu_scanout),
|
|
- VMSTATE_UINT32_V(fb.format, struct virtio_gpu_scanout, 2),
|
|
- VMSTATE_UINT32_V(fb.bytes_pp, struct virtio_gpu_scanout, 2),
|
|
- VMSTATE_UINT32_V(fb.width, struct virtio_gpu_scanout, 2),
|
|
- VMSTATE_UINT32_V(fb.height, struct virtio_gpu_scanout, 2),
|
|
- VMSTATE_UINT32_V(fb.stride, struct virtio_gpu_scanout, 2),
|
|
- VMSTATE_UINT32_V(fb.offset, struct virtio_gpu_scanout, 2),
|
|
+ VMSTATE_UINT32_TEST(fb.format, struct virtio_gpu_scanout, scanout_vmstate_after_v2),
|
|
+ VMSTATE_UINT32_TEST(fb.bytes_pp, struct virtio_gpu_scanout, scanout_vmstate_after_v2),
|
|
+ VMSTATE_UINT32_TEST(fb.width, struct virtio_gpu_scanout, scanout_vmstate_after_v2),
|
|
+ VMSTATE_UINT32_TEST(fb.height, struct virtio_gpu_scanout, scanout_vmstate_after_v2),
|
|
+ VMSTATE_UINT32_TEST(fb.stride, struct virtio_gpu_scanout, scanout_vmstate_after_v2),
|
|
+ VMSTATE_UINT32_TEST(fb.offset, struct virtio_gpu_scanout, scanout_vmstate_after_v2),
|
|
VMSTATE_END_OF_LIST()
|
|
},
|
|
};
|
|
@@ -1659,6 +1666,7 @@ static Property virtio_gpu_properties[] = {
|
|
DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
|
|
VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
|
|
DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
|
|
+ DEFINE_PROP_UINT8("x-scanout-vmstate-version", VirtIOGPU, scanout_vmstate_version, 2),
|
|
DEFINE_PROP_END_OF_LIST(),
|
|
};
|
|
|
|
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
|
|
index ed44cdad6b..842315d51d 100644
|
|
--- a/include/hw/virtio/virtio-gpu.h
|
|
+++ b/include/hw/virtio/virtio-gpu.h
|
|
@@ -177,6 +177,7 @@ typedef struct VGPUDMABuf {
|
|
struct VirtIOGPU {
|
|
VirtIOGPUBase parent_obj;
|
|
|
|
+ uint8_t scanout_vmstate_version;
|
|
uint64_t conf_max_hostmem;
|
|
|
|
VirtQueue *ctrl_vq;
|