linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] dma::Device trait and DMA mask
@ 2025-07-16 15:02 Danilo Krummrich
  2025-07-16 15:02 ` [PATCH v2 1/5] rust: dma: implement `dma::Device` trait Danilo Krummrich
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Danilo Krummrich @ 2025-07-16 15:02 UTC (permalink / raw)
  To: abdiel.janulgue, daniel.almeida, robin.murphy, a.hindborg, ojeda,
	alex.gaynor, boqun.feng, gary, bjorn3_gh, lossin, aliceryhl,
	tmgross, bhelgaas, kwilczynski, gregkh, rafael
  Cc: rust-for-linux, linux-pci, linux-kernel, Danilo Krummrich

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@kernel.org/ [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

Danilo Krummrich (5):
  rust: dma: implement `dma::Device` trait
  rust: dma: add DMA addressing capabilities
  rust: pci: implement the `dma::Device` trait
  rust: platform: implement the `dma::Device` trait
  rust: samples: dma: set DMA mask

 rust/helpers/dma.c       |   5 ++
 rust/kernel/dma.rs       | 125 ++++++++++++++++++++++++++++++++++++---
 rust/kernel/pci.rs       |   2 +
 rust/kernel/platform.rs  |   2 +
 samples/rust/rust_dma.rs |  14 ++++-
 5 files changed, 140 insertions(+), 8 deletions(-)


base-commit: d49ac7744f578bcc8708a845cce24d3b91f86260
-- 
2.50.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-07-20 14:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 15:02 [PATCH v2 0/5] dma::Device trait and DMA mask Danilo Krummrich
2025-07-16 15:02 ` [PATCH v2 1/5] rust: dma: implement `dma::Device` trait Danilo Krummrich
2025-07-16 15:02 ` [PATCH v2 2/5] rust: dma: add DMA addressing capabilities Danilo Krummrich
2025-07-16 17:32   ` Daniel Almeida
2025-07-16 17:41     ` Daniel Almeida
2025-07-16 17:55     ` Danilo Krummrich
2025-07-16 18:32       ` Danilo Krummrich
2025-07-16 21:13         ` Danilo Krummrich
2025-07-16 22:19           ` Daniel Almeida
2025-07-16 22:32             ` Danilo Krummrich
2025-07-16 15:02 ` [PATCH v2 3/5] rust: pci: implement the `dma::Device` trait Danilo Krummrich
2025-07-16 15:02 ` [PATCH v2 4/5] rust: platform: " Danilo Krummrich
2025-07-16 15:02 ` [PATCH v2 5/5] rust: samples: dma: set DMA mask Danilo Krummrich
2025-07-16 17:28 ` [PATCH v2 0/5] dma::Device trait and " Greg KH
2025-07-16 17:34 ` Daniel Almeida
2025-07-20 14:33 ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).