Re: [PATCH v11 2/3] rust: add dma coherent allocator abstraction.

Abdiel Janulgue
2025-02-17T17:37:46Z

On 17/02/2025 15:52, Robin Murphy wrote:
> On 15/02/2025 9:40 pm, Daniel Almeida wrote:
>> Hi Abdiel
>>
>> I noticed that there’s no API to call `dma_set_mask/
>> dma_set_coherent_mask`.
>>
>> This should probably be included, i.e.:
>>
>> ```
>> By default, the kernel assumes that your device can address 32-bits of
>> DMA addressing.
>> For a 64-bit capable device, this needs to be increased, and for a
>> device with limitations,
>> it needs to be decreased.
>> ```
>
> Oh, good point (and I'm rather ashamed I missed that!)

Ok. Missed this part while working on the nova stub and hadn't had to
use this interface yet, but yes will add this for the next revision.

>
> FWIW we've been wanting to steer away from relying on the default mask
> in new code, so it would be quite neat to actually enforce that
> allocations fail if dma_coherent_mask hasn't been explicitly set
> (assuming it's sufficiently cheap to keep a flag in the Device handle or
> something like that - it's not the end of the world if it isn't practical).
>
Thanks for the heads-up on what this interface is expected to look like!

Regards,
Abdiel