On Thu, Jan 23, 2025 at 3:32 PM Eugenio Perez Martin
<[email protected]> wrote:
>
> On Thu, Jan 23, 2025 at 2:51 AM Jason Wang <[email protected]> wrote:
> >
> > On Thu, Jan 23, 2025 at 12:32 AM Eugenio Pérez <[email protected]> wrote:
> > >
> > > From: Jason Wang <[email protected]>
> > >
> > > 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 <[email protected]>
> > > Signed-off-by: Eugenio Pérez <[email protected]>
> > > --
> > > 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?

Nope, there are devices that can't do DMA.

Basically, the virtio core should

1) provide mapping helpers then we should use
2) transport specific method to do the mapping, e.g PCI knows it can
do DMA so it can use DMA API

only 1) is implemented now, in the future we need to implement 2) (we
still have dirty hacks for vdpa_sim etc now).

So it's better not to go back to calling dma_map_sg() directly.

>
> > 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?

Yes, this explains 1) above.

Thanks

>
> Thanks!
>


Reply via email to