From 37e53db38bdbeb58732e36d1efcdf58f6ce3a138 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Wed, 29 Mar 2023 22:24:59 +0800 Subject: virtio: Allocate bounce buffers for devices with VIRTIO_F_IOMMU_PLATFORM In preparation for bouncing virtio data for devices advertising the VIRTIO_F_IOMMU_PLATFORM feature, allocate an array of bounce buffer structures in the vring, one per descriptor. Signed-off-by: Will Deacon [ Paul: pick from the Android tree. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Bin Meng Link: https://android.googlesource.com/platform/external/u-boot/+/3e052749e7c50c4c1a6014e645ae3b9be3710c07 Reviewed-by: Simon Glass --- include/virtio_ring.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/virtio_ring.h') diff --git a/include/virtio_ring.h b/include/virtio_ring.h index 8f8a55c7bd3..e8e91044a27 100644 --- a/include/virtio_ring.h +++ b/include/virtio_ring.h @@ -87,6 +87,7 @@ struct vring_used { struct vring { unsigned int num; size_t size; + struct bounce_buffer *bouncebufs; struct vring_desc *desc; struct vring_avail *avail; struct vring_used *used; @@ -146,10 +147,12 @@ static inline unsigned int vring_size(unsigned int num, unsigned long align) } static inline void vring_init(struct vring *vr, unsigned int num, void *p, - unsigned long align) + unsigned long align, + struct bounce_buffer *bouncebufs) { vr->num = num; vr->size = vring_size(num, align); + vr->bouncebufs = bouncebufs; vr->desc = p; vr->avail = p + num * sizeof(struct vring_desc); vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + -- cgit v1.2.3