Re: [PATCH v5 15/20] rust: io: implement a view type for `Coherent`
From: Alexandre Courbot
Date: Fri Jul 03 2026 - 10:47:25 EST
On Fri Jul 3, 2026 at 10:50 PM JST, Gary Guo wrote:
> On Fri Jul 3, 2026 at 2:14 PM BST, Alexandre Courbot wrote:
>> On Fri Jun 26, 2026 at 11:45 PM JST, Gary Guo wrote:
>>> Implement a `CoherentView` type which is a view of `Coherent`. To be able
>>> to give out DMA handles, the view type contains both CPU and DMA pointers,
>>> and the projection method projects both at once.
>>>
>>> Delegate most of the `Io` implementation to `SysMemBackend`. Provide a
>>> method to erase the DMA handle and give out a `SysMem` view, if the user
>>> does not need the `dma_handle`.
>>>
>>> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
>>
>> Of the Sashiko comments, the second one (adding exclusivity requirement
>> to the safety comment) looks actionable; with that:
>
> Most of the text is taken from existing `as_mut` method on the full `Coherent`.
> I think these can be addressed, but I'd prefer to leave it to a further patch
> (perhaps as a good first issue).
For this an acceptable fix would be to add a sentence to the safety
comment of `as_mut` saying that the caller is responsible for ensuring
there is no concurrent access - I suspect you are talking about
something different for a good first issue.