On 1/8/26 10:50 PM, Michael S. Tsirkin wrote:
On Fri, Jan 09, 2026 at 11:16:39AM +0800, Jason Wang wrote:
My concern was that virtio has its own DMA abstraction
vdev->map->map_page() (used by VDUSE), and I wasn't sure if page_pool's
standard dma_map_page() would be compatible with all virtio backends.

You are right, DMA is unware about virtio mappings, so we can't use that.

Or maybe we could add an API saying whether virtio mappings are DMA ones
and then enable that conditionally? Because on some platforms, mapping
in the pool can save *a lot* of cycles.


I think virtqueue_dma_dev() alread serves this purpose? It returns the
DMA device when virtio uses standard DMA API and NULL when custom
mappings (VDUSE) or direct physical addressing.

This is the same check used by XDP in virtnet_xsk_pool_enable(), which
calls xsk_pool_dma_map(pool, dma_dev, 0) only when virtqueue_dma_dev()
returns non-NULL.

For v2, I'll use this to conditionally enable the PP_FLAG_DMA_MAP at probe to give us pool-managed DMA on most systems while falling back
to manual mapping for VDUSE.



Reply via email to