Skip to content

rust: add pointer projection infrastructure and convert DMA

Gary Guo dri-devel driver-core linux-kbuild lkml nouveau rust-for-linux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 23 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4rust: add projection infrastructurerust/kernel/lib.rs rust/kernel/projection.rs scripts/Makefile.build+277 -16 replies
2/4rust: dma: generalize `dma_{read,write}` macrorust/kernel/dma.rs samples/rust/rust_dma.rs+73 -523 replies
3/4gpu: nova-core: convert to use new `dma_write!` syntaxdrivers/gpu/nova-core/gsp.rs drivers/gpu/nova-core/gsp/boot.rs drivers/gpu/nova-core/gsp/cmdq.rs+15 -111 reply
4/4rust: dma: remove old dma_{read,write} macro compatibility syntaxrust/kernel/dma.rs+0 -201 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchBenno Lossin
1/4R-b
2/4
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] rust: add pointer projection infrastructure and convert DMA

This adds a general pointer projection infrastructure which is intended to serve as the basis for generic I/O projections. The idea is that we will have a unified way of reading/writing MMIO or DMA allocation, creating typed subviews into them, and able to read/write subfields safely.

This is the first step towards that direction, where an infra for projecting arbitrary pointers are added. This takes care to not assume pointers are part of a valid allocation, so it can be used to project I/O pointers, too. dma_read! and dma_write! is converted to use this infra, as they currently have soundness issues [1] and users have already encountered limitation of it [2].

To aid the logistics, patch 2 retains a compatibility layer where the existing syntax and behaviour is still supported. Patch 3 converts Nova which is currently the only in-tree user of the API, and patch 4 removes this compatibility layer.

I have more patches in works which will further simplify Nova side, however the overall dma_{read,write} syntax would remain the same.

Gary Guo (4):
rust: add projection infrastructure
rust: dma: generalize dma_{read,write} macro
gpu: nova-core: convert to use new dma_write! syntax
rust: dma: remove old dma_{read,write} macro compatibility syntax

 drivers/gpu/nova-core/gsp.rs      |  14 +-
 drivers/gpu/nova-core/gsp/boot.rs |   2 +-
 drivers/gpu/nova-core/gsp/cmdq.rs |  10 +-
 rust/kernel/dma.rs                |  97 +++++------
 rust/kernel/lib.rs                |   5 +
 rust/kernel/projection.rs         | 269 ++++++++++++++++++++++++++++++
 samples/rust/rust_dma.rs          |  18 +-
 scripts/Makefile.build            |   4 +-
 8 files changed, 350 insertions(+), 69 deletions(-)
 create mode 100644 rust/kernel/projection.rs

base-commit: 9152bc8cebcb14dc16b03ec81f2377ee8ce12268

Signature · 1 line
2.51.2