linux/rust
Danilo Krummrich b07fc8d60b I/O type generalization and projection
This series presents a major rework of I/O types, as a summary:
 
 - Make I/O regions typed. The existing untyped region still exists
   with a dynamically sized `Region` type.
 
 - Create I/O view types to represent subregion of a full I/O region mapped.
   A projection macro is added to allow safely create such subviews.
 
 - Split I/O traits, make I/O views play a central role, avoid
   duplicate monomorphization and less `unsafe` code.
 
 - Add a `SysMem` backend, and make `Coherent` implement `Io`.
 
 - Add copying methods (memcpy_{from,to}io and friends).
 
 This series generalize `Mmio` 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.
 
 Building on top of that, `Mmio` and `ConfigSpace` have been converted to
 typed views of I/O regions rather than just a big chunk of untyped I/O
 memory. These changes made it possible to implement `Io` trait for
 `Coherent<T>`.
 
 Shared system memory, `SysMem` is also added to the series, given it
 similarity in implementation compared to `Coherent`. In fact, the series
 use `SysMem` to implement `Coherent`'s I/O methods.
 
 Built on these generalization, this series add `io_project!()`.
 `io_project!()` performs a safe way to project a bigger view to a small
 subviews, and some Nova code has been converted in this series to
 demonstrate cleanups possible with this addition.
 
 New `io_read!()`, `io_write!()` has been added that supersedes
 `dma_read!()`, `dma_write!()` macro. Although, they work for primitives
 only (to be exact, types that the backend is `IoCapable` of).
 One feature that was lost from the old `dma_read!()` and `dma_write!()`
 series was the ability to read/write a large structs. However, the
 semantics was unclear to begin with, as there was no guarantee about their
 atomicity even for structs that were small enough to fit in u32.
 
 Suggested-by: Danilo Krummrich <dakr@kernel.org>
 Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/near/571198078
 
 This is a stable tag for other trees to merge.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCalVZTQAKCRBFlHeO1qrK
 LtfZAP90BcixGO6G0L0UkyJ/f2yJz9wa2xD2lCwTvEnAxDa0EwEAzRxi9a/4CVOx
 y5lnqkmV+ViRYDrSihy8r994+ADI8w0=
 =+R8A
 -----END PGP SIGNATURE-----

Merge patch series "rust: I/O type generalization and projection"

Gary Guo <gary@garyguo.net> says:

This series presents a major rework of I/O types, as a summary:

- Make I/O regions typed. The existing untyped region still exists
  with a dynamically sized `Region` type.

- Create I/O view types to represent subregion of a full I/O region mapped.
  A projection macro is added to allow safely create such subviews.

- Split I/O traits, make I/O views play a central role, avoid
  duplicate monomorphization and less `unsafe` code.

- Add a `SysMem` backend, and make `Coherent` implement `Io`.

- Add copying methods (memcpy_{from,to}io and friends).

This series generalize `Mmio` 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.

Building on top of that, `Mmio` and `ConfigSpace` have been converted to
typed views of I/O regions rather than just a big chunk of untyped I/O
memory. These changes made it possible to implement `Io` trait for
`Coherent<T>`.

Shared system memory, `SysMem` is also added to the series, given it
similarity in implementation compared to `Coherent`. In fact, the series
use `SysMem` to implement `Coherent`'s I/O methods.

Built on these generalization, this series add `io_project!()`.
`io_project!()` performs a safe way to project a bigger view to a small
subviews, and some Nova code has been converted in this series to
demonstrate cleanups possible with this addition.

New `io_read!()`, `io_write!()` has been added that supersedes
`dma_read!()`, `dma_write!()` macro. Although, they work for primitives
only (to be exact, types that the backend is `IoCapable` of).
One feature that was lost from the old `dma_read!()` and `dma_write!()`
series was the ability to read/write a large structs. However, the
semantics was unclear to begin with, as there was no guarantee about their
atomicity even for structs that were small enough to fit in u32.

Suggested-by: Danilo Krummrich <dakr@kernel.org>
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/near/571198078
Link: https://patch.msgid.link/20260706-io_projection-v6-0-72cd5d055d54@garyguo.net
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-13 23:50:39 +02:00
..
bindings rust: drm: add base GPUVM immediate mode abstraction 2026-05-05 12:52:49 +02:00
helpers rust: io: add copying methods 2026-07-11 18:09:04 +02:00
kernel I/O type generalization and projection 2026-07-13 23:50:39 +02:00
macros rust: types: introduce ForLt base trait for CovariantForLt 2026-07-11 19:42:03 +02:00
pin-init rust: pin_init: internal: use loop {} to produce never value 2026-05-29 21:58:36 +01:00
proc-macro2 rust: proc-macro2: rebuild if the version text changes 2026-01-23 10:44:27 +01:00
quote rust: quote: add README.md 2025-11-24 17:15:43 +01:00
syn rust: syn: add README.md 2025-11-24 17:15:47 +01:00
uapi rust: declare cfi_encoding for lru_status 2026-04-07 10:00:25 +02:00
zerocopy rust: zerocopy: add README.md 2026-06-09 04:13:22 +02:00
zerocopy-derive rust: zerocopy-derive: add README.md 2026-06-09 04:13:23 +02:00
.gitignore rust: support running Rust documentation tests as KUnit ones 2023-07-19 09:32:53 -06:00
.kunitconfig rust: add kunitconfig 2025-03-19 23:22:21 +01:00
bindgen_parameters rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts 2026-06-10 16:25:13 +02:00
build_error.rs rust: add build_error crate 2022-12-04 01:59:16 +01:00
compiler_builtins.rs ARM: 9441/1: rust: Enable Rust support for ARMv7 2025-03-26 13:31:16 +00:00
exports.c kbuild: rust: provide an option to inline C helpers into Rust 2026-03-30 02:03:52 +02:00
ffi.rs rust: replace CStr with core::ffi::CStr 2025-10-22 07:47:27 +02:00
Makefile s390 updates for 7.2 merge window 2026-06-16 05:08:13 +05:30