[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/6] virtio: make endian_needed() work during loading
From: |
marcandre . lureau |
Subject: |
[PATCH v3 2/6] virtio: make endian_needed() work during loading |
Date: |
Mon, 6 Nov 2023 15:35:56 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
There is no simple way to distinguish when the callback is used for load
or save, AFAICT.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/virtio/virtio.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index e5105571cf..22aeb88235 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2517,7 +2517,11 @@ static bool virtio_device_endian_needed(void *opaque)
{
VirtIODevice *vdev = opaque;
- assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);
+ /* On load, endian is UNKNOWN. The section might be loaded as required. */
+ if (vdev->device_endian == VIRTIO_DEVICE_ENDIAN_UNKNOWN) {
+ return false;
+ }
+
if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
return vdev->device_endian != virtio_default_endian();
}
--
2.41.0
- [PATCH v3 0/6] migration: check required entries and sections are loaded, marcandre . lureau, 2023/11/06
- [PATCH v3 1/6] block/fdc: 'phase' is not needed on load, marcandre . lureau, 2023/11/06
- [PATCH v3 2/6] virtio: make endian_needed() work during loading,
marcandre . lureau <=
- [PATCH v3 4/6] migration: check required entries are loaded, once, marcandre . lureau, 2023/11/06
- [PATCH v3 5/6] test-vmstate: add some subsection tests, marcandre . lureau, 2023/11/06
- [PATCH v3 3/6] migration: check required subsections are loaded, once, marcandre . lureau, 2023/11/06
- [PATCH v3 6/6] docs/migration: reflect the changes about needed subsections, marcandre . lureau, 2023/11/06
- Re: [PATCH v3 0/6] migration: check required entries and sections are loaded, Michael S. Tsirkin, 2023/11/06