Page MenuHomeFreeBSD

virtio_net: Use bus_dma for command/ack buffers
Needs ReviewPublic

Authored by sarah.walker2_arm.com on Fri, Feb 27, 4:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 17, 3:02 AM
Unknown Object (File)
Sat, Mar 14, 10:27 PM
Unknown Object (File)
Fri, Mar 13, 5:40 PM
Unknown Object (File)
Tue, Mar 10, 3:25 PM
Unknown Object (File)
Tue, Mar 10, 3:25 PM
Unknown Object (File)
Sat, Mar 7, 9:26 PM
Unknown Object (File)
Fri, Mar 6, 3:58 PM
Unknown Object (File)
Fri, Mar 6, 6:09 AM
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 71130
Build 68013: arc lint + arc unit

Event Timeline

br added inline comments.
sys/dev/virtio/network/if_vtnet.c
536

is not it too large alignment? it panics somewhere in IOMMU code

Should the dma sync operations be BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE given virtio may read from & write to the buffer.

Change header tag alignment size.

I get this

panic: alignment failed: ctx 0xffffffd0010d0e80 start 0x20c000 offset 3ca align 0x4
cpuid = 0
time = 1772453498
KDB: stack backtrace:
db_trace_self() at db_trace_self
db_fetch_ksymtab() at db_fetch_ksymtab+0x142
kdb_backtrace() at kdb_backtrace+0x2c
vpanic() at vpanic+0x16e
panic() at panic+0x26
iommu_domain_fini() at iommu_domain_fini+0x36a
iommu_is_buswide_ctx() at iommu_is_buswide_ctx+0x806
bus_dmamap_load() at bus_dmamap_load+0x6e
vtmmio_attach() at vtmmio_attach+0x779c
vtmmio_attach() at vtmmio_attach+0x739a
vtmmio_attach() at vtmmio_attach+0x65b2
vtmmio_attach() at vtmmio_attach+0x574a
ether_ioctl() at ether_ioctl+0x1a0
vtmmio_attach() at vtmmio_attach+0x593a
in_control_ioctl() at in_control_ioctl+0x9ac
rtnl_ifaces_destroy() at rtnl_ifaces_destroy+0x1a1e
rtnl_register_messages() at rtnl_register_messages+0x2a0
nl_send() at nl_send+0x3ca
nl_taskqueue_handler() at nl_taskqueue_handler+0x34e
taskqueue_run() at taskqueue_run+0x1f0
taskqueue_thread_loop() at taskqueue_thread_loop+0xd4
fork_exit() at fork_exit+0x68
fork_trampoline() at fork_trampoline+0xa
KDB: enter: panic
[ thread pid 0 tid 100062 ]
Stopped at      kdb_enter+0x3a: sd      zero,-948(s1)
db>