Skip to main content

cache_writeback

Function cache_writeback 

Source
pub unsafe fn cache_writeback(addr: usize, len: usize)
Expand description

Writes back dirty L1 cache lines in [addr, addr + len) to main memory.

Issues flush_va for every covered line, then stalls via TensorWait(6) until all writeback traffic has reached DDR. After this call, the flushed data is visible to host DMA and to other shires reading from DDR. The lines remain cached as clean.

Callers must issue crate::fence before this function to commit all prior CPU stores to L1 (PRM Section 8.1.3).

Equivalent to cache_writeback_to(CacheDest::Mem, addr, len).

ยงSafety

addr must be a valid virtual address; [addr, addr + len) must lie within device memory accessible to this hart.