Page MenuHomeFreeBSD

virtio: Use bus_dma for ring and indirect buffer allocations
ClosedPublic

Authored by sarah.walker2_arm.com on Jan 30 2026, 11:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 29, 5:05 AM
Unknown Object (File)
Mon, Mar 16, 11:28 AM
Unknown Object (File)
Wed, Mar 11, 11:56 AM
Unknown Object (File)
Wed, Mar 11, 11:40 AM
Unknown Object (File)
Mon, Mar 9, 8:25 PM
Unknown Object (File)
Mar 2 2026, 6:25 PM
Unknown Object (File)
Feb 28 2026, 10:21 PM
Unknown Object (File)
Feb 28 2026, 3:57 PM

Details

Summary

While the majority of virtio platforms will be fully coherent, some may
require cache maintenance or other specific device memory handling (eg for
secure partitioning). Using bus_dma allows for these usecases.

The virtio buffers are marked as coherent; this should ensure that sync
calls are no-ops in the common cases.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Do we still need the mb()s? I would expect bus_dmamap_sync to suffice.

virtio_blk calls bus_dma_tag_set_iommu on PowerPC; would that not be needed for these new tags?

virtio_blk calls bus_dma_tag_set_iommu on PowerPC; would that not be needed for these new tags?

It looks like that was added in D37891 by @cperciva. Based on the commit message we could add it here, but can't test.

This revision is now accepted and ready to land.Feb 24 2026, 5:05 PM