Michael S. Tsirkin
2020-Apr-07 01:07 UTC
[PATCH v7 12/19] virtio_ring: switch to virtio_legacy_init/size
These are used for legacy ring format, switch to APIs that make this explicit. Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/virtio/virtio_ring.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 58b96baa8d48..2a2b12449bac 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -867,8 +867,10 @@ static struct virtqueue *vring_create_virtqueue_split( } /* TODO: allocate each queue chunk individually */ - for (; num && vring_size(num, vring_align) > PAGE_SIZE; num /= 2) { - queue = vring_alloc_queue(vdev, vring_size(num, vring_align), + for (; num && vring_legacy_size(num, vring_align) > PAGE_SIZE; + num /= 2) { + queue = vring_alloc_queue(vdev, + vring_legacy_size(num, vring_align), &dma_addr, GFP_KERNEL|__GFP_NOWARN|__GFP_ZERO); if (queue) @@ -882,14 +884,15 @@ static struct virtqueue *vring_create_virtqueue_split( if (!queue) { /* Try to get a single page. You are my only hope! */ - queue = vring_alloc_queue(vdev, vring_size(num, vring_align), + queue = vring_alloc_queue(vdev, + vring_legacy_size(num, vring_align), &dma_addr, GFP_KERNEL|__GFP_ZERO); } if (!queue) return NULL; - queue_size_in_bytes = vring_size(num, vring_align); - vring_init(&vring, num, queue, vring_align); + queue_size_in_bytes = vring_legacy_size(num, vring_align); + vring_legacy_init(&vring, num, queue, vring_align); vq = __vring_new_virtqueue(index, vring, vdev, weak_barriers, context, notify, callback, name); @@ -2169,7 +2172,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int index, if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED)) return NULL; - vring_init(&vring, num, pages, vring_align); + vring_legacy_init(&vring, num, pages, vring_align); return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context, notify, callback, name); } -- MST
Possibly Parallel Threads
- [PATCH v4 08/12] virtio_ring: switch to virtio_legacy_init/size
- [PATCH v5 08/12] virtio_ring: switch to virtio_legacy_init/size
- [PATCH v6 08/12] virtio_ring: switch to virtio_legacy_init/size
- [PATCH v8 12/19] virtio_ring: switch to virtio_legacy_init/size
- [PATCH v4 08/12] virtio_ring: switch to virtio_legacy_init/size