[PATCH 0/4] rust: dma: tie DMA allocations to the device's bound lifetime

Danilo Krummrich posted 4 patches 3 weeks, 5 days ago
drivers/gpu/nova-core/falcon.rs               |   2 +-
drivers/gpu/nova-core/fb.rs                   |   4 +-
drivers/gpu/nova-core/firmware/booter.rs      |   2 +-
drivers/gpu/nova-core/firmware/fsp.rs         |   8 +-
.../nova-core/firmware/fwsec/bootloader.rs    |  12 +-
drivers/gpu/nova-core/firmware/gsp.rs         |  14 +-
drivers/gpu/nova-core/firmware/riscv.rs       |   8 +-
drivers/gpu/nova-core/fsp.rs                  |  20 +--
drivers/gpu/nova-core/gpu.rs                  |   4 +-
drivers/gpu/nova-core/gsp.rs                  |  30 ++--
drivers/gpu/nova-core/gsp/boot.rs             |  10 +-
drivers/gpu/nova-core/gsp/cmdq.rs             |  35 +++--
drivers/gpu/nova-core/gsp/commands.rs         |   2 +-
drivers/gpu/nova-core/gsp/fw.rs               |  12 +-
drivers/gpu/nova-core/gsp/hal.rs              |  14 +-
drivers/gpu/nova-core/gsp/hal/gh100.rs        |  16 +-
drivers/gpu/nova-core/gsp/hal/tu102.rs        |  34 ++---
drivers/gpu/nova-core/gsp/sequencer.rs        |   6 +-
rust/kernel/debugfs.rs                        |  26 +---
rust/kernel/debugfs/entry.rs                  |   4 +-
rust/kernel/debugfs/file_ops.rs               |  52 ++++---
rust/kernel/dma.rs                            | 141 +++++++++---------
rust/kernel/uaccess.rs                        |   4 +-
samples/rust/rust_dma.rs                      |  30 ++--
24 files changed, 241 insertions(+), 249 deletions(-)
[PATCH 0/4] rust: dma: tie DMA allocations to the device's bound lifetime
Posted by Danilo Krummrich 3 weeks, 5 days ago
DMA allocations carry device resources (e.g. IOMMU mappings) that must not
outlive the device's bound lifetime. Add lifetime parameters to the DMA
allocation types (Coherent, CoherentBox, CoherentHandle) to enforce at compile
time that they are freed before the device is unbound.

Since DMA types with lifetime parameters are exposed through debugfs in the
nova-core driver, first drop the unnecessary T: 'static bound from the debugfs
ScopedDir file creation methods by formalizing a type invariant on FileOps.

Danilo Krummrich (4):
  rust: debugfs: drop 'static bound from ScopedDir file creation methods
  rust: dma: tie CoherentHandle to the device's bound lifetime
  samples: rust_dma: separate driver type from driver data
  rust: dma: tie Coherent and CoherentBox to the device's bound lifetime

 drivers/gpu/nova-core/falcon.rs               |   2 +-
 drivers/gpu/nova-core/fb.rs                   |   4 +-
 drivers/gpu/nova-core/firmware/booter.rs      |   2 +-
 drivers/gpu/nova-core/firmware/fsp.rs         |   8 +-
 .../nova-core/firmware/fwsec/bootloader.rs    |  12 +-
 drivers/gpu/nova-core/firmware/gsp.rs         |  14 +-
 drivers/gpu/nova-core/firmware/riscv.rs       |   8 +-
 drivers/gpu/nova-core/fsp.rs                  |  20 +--
 drivers/gpu/nova-core/gpu.rs                  |   4 +-
 drivers/gpu/nova-core/gsp.rs                  |  30 ++--
 drivers/gpu/nova-core/gsp/boot.rs             |  10 +-
 drivers/gpu/nova-core/gsp/cmdq.rs             |  35 +++--
 drivers/gpu/nova-core/gsp/commands.rs         |   2 +-
 drivers/gpu/nova-core/gsp/fw.rs               |  12 +-
 drivers/gpu/nova-core/gsp/hal.rs              |  14 +-
 drivers/gpu/nova-core/gsp/hal/gh100.rs        |  16 +-
 drivers/gpu/nova-core/gsp/hal/tu102.rs        |  34 ++---
 drivers/gpu/nova-core/gsp/sequencer.rs        |   6 +-
 rust/kernel/debugfs.rs                        |  26 +---
 rust/kernel/debugfs/entry.rs                  |   4 +-
 rust/kernel/debugfs/file_ops.rs               |  52 ++++---
 rust/kernel/dma.rs                            | 141 +++++++++---------
 rust/kernel/uaccess.rs                        |   4 +-
 samples/rust/rust_dma.rs                      |  30 ++--
 24 files changed, 241 insertions(+), 249 deletions(-)


base-commit: 45c13f3f9e3bb15fd89ff2864c6f627a3b4b4229
-- 
2.55.0
Re: [PATCH 0/4] rust: dma: tie DMA allocations to the device's bound lifetime
Posted by Danilo Krummrich 2 weeks, 6 days ago
On Sun, 30 Aug 2026 21:37:12 +0200, Danilo Krummrich wrote:
> [PATCH 0/4] rust: dma: tie DMA allocations to the device's bound lifetime

Applied, thanks!

  Branch: topic/rust-dma
  Tree:   git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/4] rust: debugfs: drop 'static bound from ScopedDir file creation methods
      commit: 9dc6cedcd971

      [ Remove unrelated change from Self to T. - Danilo ]

[2/4] rust: dma: tie CoherentHandle to the device's bound lifetime
      commit: f6b56da8e1b8
[3/4] samples: rust_dma: separate driver type from driver data
      commit: c3d4fd0e9d27
[4/4] rust: dma: tie Coherent and CoherentBox to the device's bound lifetime
      commit: bed87375f90f

The patches are in the topic/rust-dma topic branch and will be merged into the
corresponding target branch soon.
Re: [PATCH 0/4] rust: dma: tie DMA allocations to the device's bound lifetime
Posted by Danilo Krummrich 2 weeks, 4 days ago
On Sun Sep 6, 2026 at 5:37 PM CEST, Danilo Krummrich wrote:
> On Sun, 30 Aug 2026 21:37:12 +0200, Danilo Krummrich wrote:
>> [PATCH 0/4] rust: dma: tie DMA allocations to the device's bound lifetime
>
> Applied, thanks!
>
>   Branch: topic/rust-dma
>   Tree:   git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
>
> [1/4] rust: debugfs: drop 'static bound from ScopedDir file creation methods
>       commit: 9dc6cedcd971
>
>       [ Remove unrelated change from Self to T. - Danilo ]
>
> [2/4] rust: dma: tie CoherentHandle to the device's bound lifetime
>       commit: f6b56da8e1b8
> [3/4] samples: rust_dma: separate driver type from driver data
>       commit: c3d4fd0e9d27
> [4/4] rust: dma: tie Coherent and CoherentBox to the device's bound lifetime
>       commit: bed87375f90f
>
> The patches are in the topic/rust-dma topic branch and will be merged into the
> corresponding target branch soon.

Merged into driver-core-next and drm-rust-next, thanks!