Re: Raspberry Pi 4

[email protected]
Newsgroups gmane.os.plan9.general
Message-ID <[email protected]>
> Your dmaflush code doesn't look to me like it will do the right
> thing if the dma buffer isn't cache aligned.  (Could this ever be
> the case in the 9front kernel?) Suppose dma starts, cpu prefetches
> some old data into the cache line overlapping the start of the dma
> buffer, then dma completes.

> Your dmaflush then calls cachedwbse which writes back the pre-fetched
> data, overwriting the new data which dma wrote to memory.

what? where? it should call dmaflush with the clean parameter set
to zero after the hardware has completed the dma:

dma.c:228: 		dmaflush(0, ctlr->flush, ctlr->len);

dmaflush() then calls cachedwbinvse() on the partial cache lines
which should just invalidate IFF the lines are clean. the write back should
only happen when the lines are dirty. in that case the damage has already
been done and the wb at least makes sure we wont loose the dirty data
from the cache.

so the underlying assumption here is that a cache clean operation
writes back only when the line is dirty. correct me if i'm wrong
here.

so yes, it will not work correctly for an invalidate when the buffer
is not cache line size aligned and the partial start or end gets
modified while the dma operation is in flight.

--
cinap
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.