Skip to main content

cache_invalidate

Function cache_invalidate 

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

Invalidates (evicts) L1 cache lines in [addr, addr + len).

Issues evict_va for every covered line, then stalls via TensorWait(6) until all eviction traffic is complete. Subsequent loads to the range will fetch fresh data from DDR. Issue on the consumer side of a cross-hart or host-DMA coherence protocol after receiving the producer’s synchronisation signal and before reading the produced data.

Callers must issue crate::fence before this function (PRM Section 8.1.3).

Equivalent to cache_invalidate_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. Invalidating dirty lines without a prior writeback discards uncommitted data; use cache_flush when lines may be dirty.