[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250716150354.51081-1-dakr@kernel.org>
Date: Wed, 16 Jul 2025 17:02:45 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: abdiel.janulgue@...il.com,
daniel.almeida@...labora.com,
robin.murphy@....com,
a.hindborg@...nel.org,
ojeda@...nel.org,
alex.gaynor@...il.com,
boqun.feng@...il.com,
gary@...yguo.net,
bjorn3_gh@...tonmail.com,
lossin@...nel.org,
aliceryhl@...gle.com,
tmgross@...ch.edu,
bhelgaas@...gle.com,
kwilczynski@...nel.org,
gregkh@...uxfoundation.org,
rafael@...nel.org
Cc: rust-for-linux@...r.kernel.org,
linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>
Subject: [PATCH v2 0/5] dma::Device trait and DMA mask
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
Powered by blists - more mailing lists