Re: [PATCH v2 0/5] dma::Device trait and DMA mask
From: Greg KH
Date: Wed Jul 16 2025 - 13:28:23 EST
On Wed, Jul 16, 2025 at 05:02:45PM +0200, Danilo Krummrich wrote:
> This patch series adds the dma::Device trait to be implemented by bus devices on
> DMA capable busses.
>
> The dma::Device trait implements methods to set the DMA mask for for such
> devices.
>
> The first two bus devices implementing the trait are PCI and platform.
>
> Unfortunately, the DMA mask setters have to be unsafe for now, since, with
> reasonable effort, we can't prevent drivers from data races writing and reading
> the DMA mask fields concurrently (see also [1]).
>
> Link: https://lore.kernel.org/lkml/DB6YTN5P23X3.2S0NH4YECP1CP@xxxxxxxxxx/ [1]
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/dma-mask
>
> Changes in v2:
> - replace dma_bit_mask() with a new type DmaMask
> - mention that DmaMask is the Rust equivalent of the C macro DMA_BIT_MASK()
> - make DmaMask::new() fallible
> - inline DmaMask methods
I like the DmaMask stuff, nice!
Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>