On Tue Mar 17, 2026 at 7:52 AM CET, Alice Ryhl wrote: > On Tue, Mar 03, 2026 at 05:22:55PM +0100, Danilo Krummrich wrote: >> Currently, dma::Coherent cannot safely provide (mutable) access to its >> underlying memory because the memory might be concurrently accessed by a >> DMA device. This makes it difficult to safely initialize the memory >> before handing it over to the hardware. >> >> Introduce dma::CoherentInit, a type that encapsulates a dma::Coherent >> before its DMA address is exposed to the device. dma::CoherentInit can >> guarantee exclusive access to the inner dma::Coherent and implement >> Deref and DerefMut. >> >> Once the memory is properly initialized, dma::CoherentInit can be >> converted into a regular dma::Coherent. >> >> Signed-off-by: Danilo Krummrich <[email protected]> > > overall LGTM > > Reviewed-by: Alice Ryhl <[email protected]>
Gary and me concluded that dma::CoherentBox would probably be a better name for what this structure represents. I.e. you can carry it around and use it similar to a "real" Box until it is converted to dma::Coherent in order to make it available to the device. Is your RB still valid with this rename? >> + let ptr = core::ptr::from_mut(&mut self[i]); > > &raw mut self[i]. > > Alice
