linux/drivers/gpu/nova-core
Zhi Wang 121d87b28e rust: io: separate generic I/O helpers from MMIO implementation
The previous Io<SIZE> type combined both the generic I/O access helpers
and MMIO implementation details in a single struct. This coupling prevented
reusing the I/O helpers for other backends, such as PCI configuration
space.

Establish a clean separation between the I/O interface and concrete
backends by separating generic I/O helpers from MMIO implementation.

Introduce a new trait hierarchy to handle different access capabilities:

- IoCapable<T>: A marker trait indicating that a backend supports I/O
  operations of a certain type (u8, u16, u32, or u64).

- Io trait: Defines fallible (try_read8, try_write8, etc.) and infallibile
  (read8, write8, etc.) I/O methods with runtime bounds checking and
  compile-time bounds checking.

- IoKnownSize trait: The marker trait for types support infallible I/O
  methods.

Move the MMIO-specific logic into a dedicated Mmio<SIZE> type that
implements the Io traits. Rename IoRaw to MmioRaw and update consumers to
use the new types.

Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260121202212.4438-3-zhiw@nvidia.com
[ Add #[expect(unused)] to define_{read,write}!(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-23 21:20:11 +01:00
..
falcon gpu: nova-core: sequencer: Implement core resume operation 2025-11-15 21:54:18 +09:00
fb gpu: nova-core: justify remaining uses of `as` 2025-11-08 08:22:51 +09:00
firmware gpu: nova-core: gsp: Boot GSP 2025-11-14 20:25:57 +09:00
gsp rust: io: separate generic I/O helpers from MMIO implementation 2026-01-23 21:20:11 +01:00
regs rust: io: separate generic I/O helpers from MMIO implementation 2026-01-23 21:20:11 +01:00
Kconfig gpu: nova-core: select RUST_FW_LOADER_ABSTRACTIONS 2025-12-16 21:56:44 +09:00
Makefile
bitfield.rs gpu: nova-core: bitfield: remove BitOr implementation 2025-10-25 13:16:31 +09:00
dma.rs gpu: nova-core: Simplify `DmaObject::from_data` in nova-core/dma.rs 2025-11-07 23:10:44 +09:00
driver.rs Driver core changes for 6.19-rc1 2025-12-05 21:29:02 -08:00
falcon.rs gpu: nova-core: falcon: Move dma_reset functionality into helper 2025-11-15 20:08:49 +09:00
fb.rs gpu: nova-core: gsp: Create wpr metadata 2025-11-14 20:25:56 +09:00
firmware.rs gpu: nova-core: replace use of `as` with functions from `num` 2025-11-08 08:22:45 +09:00
gfw.rs gpu: nova-core: apply the one "use" item per line policy 2025-11-07 23:10:44 +09:00
gpu.rs gpu: nova-core: make formatting compatible with rust tree 2025-11-17 12:56:36 +00:00
gsp.rs gpu: nova-core: Implement the GSP sequencer 2025-11-15 21:05:50 +09:00
nova_core.rs gpu: nova-core: gsp: Retrieve GSP static info to gather GPU information 2025-11-15 21:54:18 +09:00
num.rs gpu: nova-core: num: add functions to safely convert a const value to a smaller type 2025-11-14 20:25:15 +09:00
regs.rs gpu: nova-core: provide a clear error report for unsupported GPUs 2025-11-15 23:11:28 +09:00
sbuffer.rs gpu: nova-core: Implement the GSP sequencer 2025-11-15 21:05:50 +09:00
util.rs gpu: nova-core: gsp: Retrieve GSP static info to gather GPU information 2025-11-15 21:54:18 +09:00
vbios.rs rust: io: separate generic I/O helpers from MMIO implementation 2026-01-23 21:20:11 +01:00