All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gary Guo <gary@kernel.org>
To: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: rust-for-linux@vger.kernel.org
Subject: [PATCH 0/8] I/O type generalization and projection
Date: Mon, 23 Mar 2026 15:37:52 +0000	[thread overview]
Message-ID: <20260323153807.1360705-1-gary@kernel.org> (raw)

From: Gary Guo <gary@garyguo.net>

This series generalize `Mmio`/`MmioRaw` type from just an untyped region
to typed representations (so `MmioRaw<T>` is `__iomem *T`). This allows
us to remove the `IoKnownSize` trait; the information is sourced from
just the pointer from the `KnownSize` trait instead.

This enables us to implement `Io` trait for `Coherent<T>`, enabling
unified handling of MMIO and DMA coherent memory. It also paves the way
to uniformly support shared system memory, which Tyr will likely need
[1].

Built on this generalization, this series also add a `io::View` type
which represents a subview of a bigger I/O region, and a `io_project!()`
macro that provides a safe way to perform this. Some Nova code has been
converted in this series to demonstrate cleanups possible with this
addition.

This series depend on the Coherent API rework series [2].

Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/near/572377073 [1]
Link: https://lore.kernel.org/rust-for-linux/DH87CCNRR5EC.2SK3IT6N6Q8V5@nvidia.com/ [2]

Gary Guo (8):
  rust: io: generalize `MmioRaw` to pointer to arbitrary type
  rust: io: generalize `Mmio` to arbitrary type
  rust: io: use pointer types instead of address
  rust: io: add view type
  rust: dma: add methods to unsafely create reference from subview
  rust: io: add `read_val` and `write_val` function on I/O view
  gpu: nova-core: use I/O projection for cleaner encapsulation
  rust: dma: drop `dma_read!` and `dma_write!` API

 drivers/gpu/nova-core/gsp.rs      |  42 ++-
 drivers/gpu/nova-core/gsp/cmdq.rs |  69 +++--
 drivers/gpu/nova-core/gsp/fw.rs   |  84 ++---
 rust/kernel/devres.rs             |  11 +-
 rust/kernel/dma.rs                | 217 ++++++-------
 rust/kernel/io.rs                 | 498 +++++++++++++++++++++++-------
 rust/kernel/io/mem.rs             |  10 +-
 rust/kernel/io/poll.rs            |   6 +-
 rust/kernel/io/register.rs        |  19 +-
 rust/kernel/pci/io.rs             |  88 ++++--
 rust/kernel/ptr.rs                |   7 +
 samples/rust/rust_dma.rs          |  21 +-
 12 files changed, 681 insertions(+), 391 deletions(-)


base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
prerequisite-patch-id: 07a5643b01ce7f63ca42f1a322dcbdb5fc7fa9c2
prerequisite-patch-id: abae47bddac0d45e32dd54ce2f935b0675a6ebdf
prerequisite-patch-id: 7779e87914e4be91f0ced6760299ddf603943baf
prerequisite-patch-id: 31c43ae681611b92f24cbd369fac5af5834dd80f
prerequisite-patch-id: 60d56698d6bf30f31bed11375d5dc7eaeb359a0f
prerequisite-patch-id: 013e064c8c9dc0b7b0ff558ef0d9d6e674c629ee
prerequisite-patch-id: 5c5792a0435bdbdfd2aeb8a3d2dac79aa9ae7d6b
prerequisite-patch-id: 1e8d93ee75c56eecac13859c4024ea13f3cc872c
prerequisite-patch-id: b3a3589264ec10a5c33d4cea3ce69e9c6845d3dc
-- 
2.51.2


             reply	other threads:[~2026-03-23 15:38 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OxgMwl1EcYLh4AqdBa-FaFap0ODNxpID-Hnns6odQVjvPTXqh6VoXM01bZmoVkAOF_5udNfKuCP8YJoW4UE5Fg==@protonmail.internalid>
2026-03-23 15:37 ` Gary Guo [this message]
2026-03-23 15:37   ` [PATCH 1/8] rust: io: generalize `MmioRaw` to pointer to arbitrary type Gary Guo
2026-03-26 12:53     ` Andreas Hindborg
2026-03-26 14:31       ` Gary Guo
2026-03-23 15:37   ` [PATCH 2/8] rust: io: generalize `Mmio` " Gary Guo
2026-03-26 13:04     ` Andreas Hindborg
2026-03-26 14:32       ` Gary Guo
2026-03-26 18:23         ` Andreas Hindborg
2026-04-02 12:57           ` Gary Guo
2026-04-04 18:57     ` Miguel Ojeda
2026-04-05 14:55     ` Alexandre Courbot
2026-04-05 23:21       ` Gary Guo
2026-04-06  4:00         ` Alexandre Courbot
2026-03-23 15:37   ` [PATCH 3/8] rust: io: use pointer types instead of address Gary Guo
2026-03-26 14:20     ` Andreas Hindborg
2026-03-26 14:35       ` Gary Guo
2026-03-27 10:11         ` Miguel Ojeda
2026-04-05 14:56     ` Alexandre Courbot
2026-04-05 15:00       ` Danilo Krummrich
2026-04-06  3:49         ` Alexandre Courbot
2026-03-23 15:37   ` [PATCH 4/8] rust: io: add view type Gary Guo
2026-03-26 14:31     ` Andreas Hindborg
2026-04-02 13:01       ` Gary Guo
2026-03-23 15:37   ` [PATCH 5/8] rust: dma: add methods to unsafely create reference from subview Gary Guo
2026-03-26 14:37     ` Andreas Hindborg
2026-03-26 14:44       ` Gary Guo
2026-03-23 15:37   ` [PATCH 6/8] rust: io: add `read_val` and `write_val` function on I/O view Gary Guo
2026-03-27  8:21     ` Andreas Hindborg
2026-03-27 12:19       ` Gary Guo
2026-03-23 15:37   ` [PATCH 7/8] gpu: nova-core: use I/O projection for cleaner encapsulation Gary Guo
2026-03-23 15:38   ` [PATCH 8/8] rust: dma: drop `dma_read!` and `dma_write!` API Gary Guo
2026-03-27  8:25     ` Andreas Hindborg
2026-03-25 11:11   ` [PATCH 0/8] I/O type generalization and projection Andreas Hindborg
2026-03-25 11:19     ` Miguel Ojeda
2026-04-05 15:01   ` Alexandre Courbot
2026-04-05 23:17     ` Gary Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260323153807.1360705-1-gary@kernel.org \
    --to=gary@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.