public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] rust: add pointer projection infrastructure and convert DMA
@ 2026-02-14  5:33 Gary Guo
  2026-02-14  5:33 ` [PATCH 1/4] rust: add projection infrastructure Gary Guo
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Gary Guo @ 2026-02-14  5:33 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: Alexandre Courbot, rust-for-linux

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.

Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Soundness.20of.20.60dma_read!.28.29.60/with/573645610 [1]
Link: https://lore.kernel.org/rust-for-linux/DGE9DBH7X8CO.2EES6EX8UA5ZF@kernel.org/T/#mc17b9c0309ac10346b3d6c6bd8461488e7c73161 [2]

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
-- 
2.51.2


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

end of thread, other threads:[~2026-02-22 10:53 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-14  5:33 [PATCH 0/4] rust: add pointer projection infrastructure and convert DMA Gary Guo
2026-02-14  5:33 ` [PATCH 1/4] rust: add projection infrastructure Gary Guo
2026-02-14  9:53   ` Benno Lossin
2026-02-14 10:36     ` Gary Guo
2026-02-14 14:48       ` Benno Lossin
2026-02-14 10:27   ` Danilo Krummrich
2026-02-22  0:57   ` Benno Lossin
2026-02-22 10:52     ` Gary Guo
2026-02-14  5:33 ` [PATCH 2/4] rust: dma: generalize `dma_{read,write}` macro Gary Guo
2026-02-14 10:04   ` Benno Lossin
2026-02-14 10:46     ` Gary Guo
2026-02-14 14:53       ` Benno Lossin
2026-02-14  5:33 ` [PATCH 3/4] gpu: nova-core: convert to use new `dma_write!` syntax Gary Guo
2026-02-14 10:06   ` Benno Lossin
2026-02-14  5:33 ` [PATCH 4/4] rust: dma: remove old dma_{read,write} macro compatibility syntax Gary Guo
2026-02-14 10:05   ` Benno Lossin
2026-02-14 10:33 ` [PATCH 0/4] rust: add pointer projection infrastructure and convert DMA Danilo Krummrich
2026-02-14 10:50   ` Gary Guo
2026-02-14 11:00     ` Danilo Krummrich
2026-02-15  0:47   ` Miguel Ojeda
2026-02-15 11:06     ` Danilo Krummrich
2026-02-15 12:06       ` Miguel Ojeda
2026-02-15 12:56         ` Danilo Krummrich
2026-02-15 15:16           ` Miguel Ojeda
2026-02-15 17:02             ` Danilo Krummrich
2026-02-18 10:49               ` Miguel Ojeda
2026-02-18 18:25                 ` Danilo Krummrich
2026-02-15 14:39     ` Benno Lossin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox