[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 8/9] virtio: check for vring setup in virtio_queue_u
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 8/9] virtio: check for vring setup in virtio_queue_update_used_idx |
Date: |
Fri, 27 Jan 2017 16:40:19 +0100 |
If the vring has not been set up, it is not necessary for vring_used_idx
to do anything (as is already the case when the caller is virtio_load).
This is harmless for now, but it will be a problem when the
MemoryRegionCache has not been set up.
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/virtio/virtio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 32bf364..23fac1e 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2154,7 +2154,9 @@ void virtio_queue_set_last_avail_idx(VirtIODevice *vdev,
int n, uint16_t idx)
void virtio_queue_update_used_idx(VirtIODevice *vdev, int n)
{
- vdev->vq[n].used_idx = vring_used_idx(&vdev->vq[n]);
+ if (vdev->vq[n].vring.desc) {
+ vdev->vq[n].used_idx = vring_used_idx(&vdev->vq[n]);
+ }
}
void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n)
--
1.8.3.1
- [Qemu-devel] [PATCH v3 0/9] virtio: use MemoryRegionCache for descriptors and rings, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 1/9] memory: make memory_listener_unregister idempotent, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 2/9] virtio: add virtio_*_phys_cached, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 3/9] virtio: use address_space_map/unmap to access descriptors, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 5/9] virtio: use MemoryRegionCache to access descriptors, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 7/9] virtio: use VRingMemoryRegionCaches for descriptor ring, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 4/9] exec: make address_space_cache_destroy idempotent, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 6/9] virtio: add MemoryListener to cache ring translations, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PATCH 8/9] virtio: check for vring setup in virtio_queue_update_used_idx,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 9/9] virtio: use VRingMemoryRegionCaches for avail and used rings, Paolo Bonzini, 2017/01/27