mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
virtio_ring: introduce virtqueue_dma_dev()
Added virtqueue_dma_dev() to get DMA device for virtio. Then the caller can do dma operation in advance. The purpose is to keep memory mapped across multiple add/get buf operations. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20230810123057.43407-6-xuanzhuo@linux.alibaba.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
d7344a2f71
commit
2df6475907
@ -2265,6 +2265,23 @@ int virtqueue_add_inbuf_ctx(struct virtqueue *vq,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);
|
||||
|
||||
/**
|
||||
* virtqueue_dma_dev - get the dma dev
|
||||
* @_vq: the struct virtqueue we're talking about.
|
||||
*
|
||||
* Returns the dma dev. That can been used for dma api.
|
||||
*/
|
||||
struct device *virtqueue_dma_dev(struct virtqueue *_vq)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
|
||||
if (vq->use_dma_api)
|
||||
return vring_dma_dev(vq);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_dma_dev);
|
||||
|
||||
/**
|
||||
* virtqueue_kick_prepare - first half of split virtqueue_kick call.
|
||||
* @_vq: the struct virtqueue
|
||||
|
@ -61,6 +61,8 @@ int virtqueue_add_sgs(struct virtqueue *vq,
|
||||
void *data,
|
||||
gfp_t gfp);
|
||||
|
||||
struct device *virtqueue_dma_dev(struct virtqueue *vq);
|
||||
|
||||
bool virtqueue_kick(struct virtqueue *vq);
|
||||
|
||||
bool virtqueue_kick_prepare(struct virtqueue *vq);
|
||||
|
Loading…
Reference in New Issue
Block a user