[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/8] virtio: use address_space_map/unmap to acce
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 3/8] virtio: use address_space_map/unmap to access descriptors |
Date: |
Wed, 25 Jan 2017 15:04:43 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 25/01/2017 14:22, Stefan Hajnoczi wrote:
> On Tue, Jan 24, 2017 at 07:04:15PM +0100, Paolo Bonzini wrote:
>> @@ -689,18 +714,34 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)
>> }
>>
>> i = head;
>> - vring_desc_read(vdev, &desc, desc_pa, i);
>> +
>> + len = max * sizeof(VRingDesc);
>> + vring_desc_ptr = address_space_map(vdev->dma_as, vq->vring.desc, &len,
>> false);
>> + if (len < max * sizeof(VRingDesc)) {
>> + virtio_error(vdev, "Cannot map descriptor ring");
>> + return NULL;
>
> Missing address_space_unmap() if vring_desc_ptr is non-NULL.
>
Will send v3 with just
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 1b421cb..7517f7c 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -719,7 +719,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)
vring_desc_ptr = address_space_map(vdev->dma_as, vq->vring.desc, &len,
false);
if (len < max * sizeof(VRingDesc)) {
virtio_error(vdev, "Cannot map descriptor ring");
- return NULL;
+ goto done;
}
desc_ptr = vring_desc_ptr;
Paolo
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 0/8] virtio: use MemoryRegionCache for descriptors and rings, Paolo Bonzini, 2017/01/24
- [Qemu-devel] [PATCH 5/8] virtio: use MemoryRegionCache to access descriptors, Paolo Bonzini, 2017/01/24
- [Qemu-devel] [PATCH 2/8] virtio: add virtio_*_phys_cached, Paolo Bonzini, 2017/01/24
- [Qemu-devel] [PATCH 6/8] virtio: add MemoryListener to cache ring translations, Paolo Bonzini, 2017/01/24
- [Qemu-devel] [PATCH 7/8] virtio: use VRingMemoryRegionCaches for descriptor ring, Paolo Bonzini, 2017/01/24
- [Qemu-devel] [PATCH 8/8] virtio: use VRingMemoryRegionCaches for avail and used rings, Paolo Bonzini, 2017/01/24