Xuan Zhuo
2023-Mar-08 06:44 UTC
[PATCH vhost v2 08/12] virtio_ring: update document for virtqueue_add_*
Update the document of virtqueue_add_* series API, allowing the callers to use sg->dma_address to pass the dma address to Virtio Core. Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio_ring.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index b23d301effb5..216ac8654982 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -2190,6 +2190,10 @@ static inline int virtqueue_add(struct virtqueue *_vq, * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted). * + * If the caller has done dma map then use sg->dma_address to pass dma address. + * If one sg->dma_address is used, then all sgs must use sg->dma_address; + * otherwise all sg->dma_address must be NULL. + * * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). */ int virtqueue_add_sgs(struct virtqueue *_vq, @@ -2224,6 +2228,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_sgs); * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted). * + * If the caller has done dma map then use sg->dma_address to pass dma address. + * If one sg->dma_address is used, then all sgs must use sg->dma_address; + * otherwise all sg->dma_address must be NULL. + * * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). */ int virtqueue_add_outbuf(struct virtqueue *vq, @@ -2246,6 +2254,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_outbuf); * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted). * + * If the caller has done dma map then use sg->dma_address to pass dma address. + * If one sg->dma_address is used, then all sgs must use sg->dma_address; + * otherwise all sg->dma_address must be NULL. + * * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). */ int virtqueue_add_inbuf(struct virtqueue *vq, @@ -2269,6 +2281,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_inbuf); * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted). * + * If the caller has done dma map then use sg->dma_address to pass dma address. + * If one sg->dma_address is used, then all sgs must use sg->dma_address; + * otherwise all sg->dma_address must be NULL. + * * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). */ int virtqueue_add_inbuf_ctx(struct virtqueue *vq, -- 2.32.0.3.g01195cf9f
Jason Wang
2023-Mar-14 07:58 UTC
[PATCH vhost v2 08/12] virtio_ring: update document for virtqueue_add_*
On Wed, Mar 8, 2023 at 2:44?PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote:> > Update the document of virtqueue_add_* series API, allowing the callers to > use sg->dma_address to pass the dma address to Virtio Core. > > Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> > --- > drivers/virtio/virtio_ring.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index b23d301effb5..216ac8654982 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -2190,6 +2190,10 @@ static inline int virtqueue_add(struct virtqueue *_vq, > * Caller must ensure we don't call this with other virtqueue operations > * at the same time (except where noted). > * > + * If the caller has done dma map then use sg->dma_address to pass dma address. > + * If one sg->dma_address is used, then all sgs must use sg->dma_address; > + * otherwise all sg->dma_address must be NULL.Is it worth adding checks for those requirements? Thanks> + * > * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). > */ > int virtqueue_add_sgs(struct virtqueue *_vq, > @@ -2224,6 +2228,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_sgs); > * Caller must ensure we don't call this with other virtqueue operations > * at the same time (except where noted). > * > + * If the caller has done dma map then use sg->dma_address to pass dma address. > + * If one sg->dma_address is used, then all sgs must use sg->dma_address; > + * otherwise all sg->dma_address must be NULL. > + * > * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). > */ > int virtqueue_add_outbuf(struct virtqueue *vq, > @@ -2246,6 +2254,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_outbuf); > * Caller must ensure we don't call this with other virtqueue operations > * at the same time (except where noted). > * > + * If the caller has done dma map then use sg->dma_address to pass dma address. > + * If one sg->dma_address is used, then all sgs must use sg->dma_address; > + * otherwise all sg->dma_address must be NULL. > + * > * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). > */ > int virtqueue_add_inbuf(struct virtqueue *vq, > @@ -2269,6 +2281,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_inbuf); > * Caller must ensure we don't call this with other virtqueue operations > * at the same time (except where noted). > * > + * If the caller has done dma map then use sg->dma_address to pass dma address. > + * If one sg->dma_address is used, then all sgs must use sg->dma_address; > + * otherwise all sg->dma_address must be NULL. > + * > * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). > */ > int virtqueue_add_inbuf_ctx(struct virtqueue *vq, > -- > 2.32.0.3.g01195cf9f >