Re: [RFC 2/5] virtio_ring: introduce virtqueue_map/unmap_sgs()

From: Eugenio Perez Martin
Date: Thu Jan 23 2025 - 02:32:41 EST


On Thu, Jan 23, 2025 at 2:51 AM Jason Wang <jasowang@xxxxxxxxxx> wrote:
>
> On Thu, Jan 23, 2025 at 12:32 AM Eugenio Pérez <eperezma@xxxxxxxxxx> wrote:
> >
> > From: Jason Wang <jasowang@xxxxxxxxxx>
> >
> > Introduce new virtqueue DMA operations which allows the drivers that
> > want to make use of the premapping API but operate at the sg level.
> >
> > Note that we still follow the assumtions if virtqueue_add() so
> > dma_map_sg() is not used. This could be optimized in the future.
> > Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
> > Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
> > --
> > Eugenio's changes: Remove blank
> > TODO: Should we call directly dma_map instead of this? XDP do the direct
> > call.
>
> Note that we should have an indirection layer as the device is not
> necessarily DMA capable.
>

Can you expand on this? virtqueue_map_sgs calls directly to
dma_map_page for each entry in the sg. This indirection layer should
be in the device's callback for DMA, isn't it?

> And we probably need to rename the virtqueue_dma_map_XXX() to
> virtqueue_map_XXX()
>

Ok so maybe these functions are already enough without using
dma_map_sgs. I"m ok with renaming these, but that should be done in a
separate series, isn't it?

Thanks!