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

Robin Murphy
2025-02-17T13:52:56Z

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!)

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,
Robin.