Re: [PATCH v5 15/20] rust: io: implement a view type for `Coherent`

"Gary Guo" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.linux-pwm,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Fri Jul 3, 2026 at 3:39 PM BST, Alexandre Courbot wrote:
> 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 <[email protected]>
>>>
>>> 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.

I was referring to the existing `Coherent::as_mut`.
https://rust.docs.kernel.org/next/kernel/dma/struct.Coherent.html#method.as_mut

Best,
Gary
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.