[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH-for-8.0 06/10] hw/virtio: Cache access_is_big_endian value in
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH-for-8.0 06/10] hw/virtio: Cache access_is_big_endian value in VirtIODevice state |
Date: |
Tue, 13 Dec 2022 00:05:13 +0100 |
The device endianness doesn't change during runtime.
Cache it in the VirtIODevice state.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
RFC: I'm not sure virtio_init() is the correct place to add this
check. We want to initialize this field once the features are
negociated.
---
hw/virtio/virtio.c | 1 +
include/hw/virtio/virtio.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 09b1a0e3d9..dbb1fe33f7 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3193,6 +3193,7 @@ void virtio_init(VirtIODevice *vdev, uint16_t device_id,
size_t config_size)
vdev->vmstate = qdev_add_vm_change_state_handler(DEVICE(vdev),
virtio_vmstate_change, vdev);
vdev->device_endian = virtio_default_endian();
+ vdev->access_is_big_endian = virtio_access_is_big_endian(vdev);
vdev->use_guest_notifier_mask = true;
}
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index acfd4df125..5f28e51e93 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -130,6 +130,7 @@ struct VirtIODevice
bool vhost_started;
VMChangeStateEntry *vmstate;
char *bus_name;
+ bool access_is_big_endian;
uint8_t device_endian;
bool use_guest_notifier_mask;
AddressSpace *dma_as;
--
2.38.1
- [RFC PATCH-for-8.0 00/10] hw/virtio: Build most objects as target independent units, Philippe Mathieu-Daudé, 2022/12/12
- [PATCH-for-8.0 01/10] hw/virtio: Add missing "hw/core/cpu.h" include, Philippe Mathieu-Daudé, 2022/12/12
- [PATCH-for-8.0 02/10] hw/virtio: Rename virtio_ss[] -> specific_virtio_ss[], Philippe Mathieu-Daudé, 2022/12/12
- [PATCH-for-8.0 03/10] hw/virtio: Constify qmp_virtio_feature_map_t[], Philippe Mathieu-Daudé, 2022/12/12
- [PATCH-for-8.0 04/10] hw/virtio: Extract config read/write accessors to virtio-config.c, Philippe Mathieu-Daudé, 2022/12/12
- [PATCH-for-8.0 05/10] hw/virtio: Extract QMP related code virtio-qmp.c, Philippe Mathieu-Daudé, 2022/12/12
- [RFC PATCH-for-8.0 06/10] hw/virtio: Cache access_is_big_endian value in VirtIODevice state,
Philippe Mathieu-Daudé <=
- Re: [RFC PATCH-for-8.0 06/10] hw/virtio: Cache access_is_big_endian value in VirtIODevice state, Philippe Mathieu-Daudé, 2022/12/13
- Re: [RFC PATCH-for-8.0 06/10] hw/virtio: Cache access_is_big_endian value in VirtIODevice state, Richard Henderson, 2022/12/13
[RFC PATCH-for-8.0 07/10] hw/virtio: Directly access cached VirtIODevice::access_is_big_endian, Philippe Mathieu-Daudé, 2022/12/12
[PATCH-for-8.0 08/10] hw/virtio: Un-inline virtio_access_is_big_endian(), Philippe Mathieu-Daudé, 2022/12/12