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

From: Robin Murphy
Date: Tue Feb 18 2025 - 07:45:17 EST


On 18/02/2025 12:19 pm, Daniel Almeida wrote:
Hi Abdiel,

On 18 Feb 2025, at 06:58, Abdiel Janulgue <abdiel.janulgue@xxxxxxxxx> wrote:

Hi Robin,

On 17/02/2025 15:52, Robin Murphy wrote:
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).

I just had a quick look on how to possible approach this and indeed would refactor the Device binding a bit. If it is okay with you this could go in a follow-up patch? I was hoping to upstream the initial support first - at least with the dma_set_mask/dma_set_coherent_mask put in place already.

Thanks!
/Abdiel


FYI: I don’t mind a follow-up patch.

Agreed, as I say it's far from critical anyway - being able to make the correct dma_set_coherent_mask() call at all is the only thing we need for sure. I just see a slightly selfish opportunity here, that if the binding layer could make it impossible to call the API incorrectly then hopefully I should never have to review any of its users :D

Cheers,
Robin.