diff options
| author | Zishun Yi <zishun.yi.dev@gmail.com> | 2026-09-04 19:11:35 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-09-04 22:52:24 +0000 |
| commit | 6e1436d748273be52fb155914db3efae075a8619 (patch) | |
| tree | 4e2bd29010e336b22a5838a18f3e33dbacd712ca /sys/tools/makesyscalls.lua | |
| parent | b551cb063c5efe66a634b5afded901a0323bcee2 (diff) | |
In dma_sync_single_for_cpu(), the DMA_BIDIRECTIONAL direction currently
performs BUS_DMASYNC_POSTREAD followed by BUS_DMASYNC_PREREAD. This
patch corrects the mapping to use BUS_DMASYNC_POSTREAD |
BUS_DMASYNC_POSTWRITE.
When ownership of the DMA area is transferred to the CPU, we must assume
the previous device access was bidirectional. Both POST operations are
necessary to ensure the CPU sees a consistent view of memory after
potential device reads and writes. A PREREAD is unnecessary here because
the device will no longer access the memory since ownership has been
transferred to the CPU.
Conversely, for dma_sync_single_for_device(), ownership is being
transferred back to the hardware. The buffer must be prepared for
potential bidirectional access by the device, requiring
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE.
PR: 293381, 297155
Reported by: Zishun Yi <zishun.yi.dev@gmail.com>
Reported by: Kim Shrier (fbsdbugs westryn.net)
Fixes: 95edb10b47fc ("LinuxKPI: implement dma_sync_single_for_*, apply to (un)map single/sg")
Signed-off-by: Zishun Yi <zishun.yi.dev@gmail.com>
Reviewed by: aokblast, bz
Differential Revision: https://reviews.freebsd.org/D55497
Diffstat (limited to 'sys/tools/makesyscalls.lua')
0 files changed, 0 insertions, 0 deletions
