Page MenuHomeFreeBSD

Bounce in more cases in the arm64 busdma
ClosedPublic

Authored by andrew on Sep 20 2020, 3:37 PM.

Details

Summary

WE need to use a bounce buffer when the memory we are operating on is not
aligned to a cacheline, and not aligned to the maps alignment.

The former is to stop other threads from dirtying the cacheline while we
are performing DMA operations with it. The latter is to check memory
passed in by a driver is correctly aligned for the device.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mmel added inline comments.
sys/arm64/arm64/busdma_bounce.c
183 ↗(On Diff #77257)

this should be

	if ((map->flags & (DMAMAP_FROM_DMAMEM | DMAMAP_MBUF)) != 0 ||
	    (dmat ->bounce_flags & BF_COHERENT) != 0)

(and dmat must be passed as argument to this function)

but RockPro64 still have problem...

  • Use might_bounce/must_bounce in bounce_bus_dma_id_mapped
  • Always create the bounce zone in bounce_bus_dmamap_create
This revision is now accepted and ready to land.Sep 23 2020, 5:08 PM
sys/arm64/arm64/busdma_bounce.c
233 ↗(On Diff #77408)

Hmm, I forgot. The bus_dma_run_filter() is very probably wrong, or at least inconsistent. I thing that we should remove alignment condition from it.

This revision was automatically updated to reflect the committed changes.