Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vdpa_sim: split vdpasim_virtqueue's iov field in out_iov and in_iov

vringh_getdesc_iotlb() manages 2 iovs for writable and readable
descriptors. This is very useful for the block device, where for
each request we have both types of descriptor.

Let's split the vdpasim_virtqueue's iov field in out_iov and
in_iov to use them with vringh_getdesc_iotlb().

We are using VIRTIO terminology for "out" (readable by the device)
and "in" (writable by the device) descriptors.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-18-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Stefano Garzarella and committed by
Michael S. Tsirkin
275900df da7af696

+6 -5
+6 -5
drivers/vdpa/vdpa_sim/vdpa_sim.c
··· 44 44 45 45 struct vdpasim_virtqueue { 46 46 struct vringh vring; 47 - struct vringh_kiov iov; 47 + struct vringh_kiov in_iov; 48 + struct vringh_kiov out_iov; 48 49 unsigned short head; 49 50 bool ready; 50 51 u64 desc_addr; ··· 211 210 212 211 while (true) { 213 212 total_write = 0; 214 - err = vringh_getdesc_iotlb(&txq->vring, &txq->iov, NULL, 213 + err = vringh_getdesc_iotlb(&txq->vring, &txq->out_iov, NULL, 215 214 &txq->head, GFP_ATOMIC); 216 215 if (err <= 0) 217 216 break; 218 217 219 - err = vringh_getdesc_iotlb(&rxq->vring, NULL, &rxq->iov, 218 + err = vringh_getdesc_iotlb(&rxq->vring, NULL, &rxq->in_iov, 220 219 &rxq->head, GFP_ATOMIC); 221 220 if (err <= 0) { 222 221 vringh_complete_iotlb(&txq->vring, txq->head, 0); ··· 224 223 } 225 224 226 225 while (true) { 227 - read = vringh_iov_pull_iotlb(&txq->vring, &txq->iov, 226 + read = vringh_iov_pull_iotlb(&txq->vring, &txq->out_iov, 228 227 vdpasim->buffer, 229 228 PAGE_SIZE); 230 229 if (read <= 0) 231 230 break; 232 231 233 - write = vringh_iov_push_iotlb(&rxq->vring, &rxq->iov, 232 + write = vringh_iov_push_iotlb(&rxq->vring, &rxq->in_iov, 234 233 vdpasim->buffer, read); 235 234 if (write <= 0) 236 235 break;