]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: io: add IoLoc type and generic I/O accessors
authorAlexandre Courbot <acourbot@nvidia.com>
Sat, 14 Mar 2026 01:06:15 +0000 (10:06 +0900)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 17 Mar 2026 19:04:11 +0000 (20:04 +0100)
commit498823541be1e2d9f947b37a10cc98e681da9828
treee402f64c35f1565961735bda406f5fa1545fe696
parent7836ec76ec5cd8d45759a6a360b1fda4829d2734
rust: io: add IoLoc type and generic I/O accessors

I/O accesses are defined by the following properties:

- An I/O location, which consists of a start address, a width, and a
  type to interpret the read value as,
- A value, which is returned for reads or provided for writes.

Introduce the `IoLoc` trait, which allows implementing types to fully
specify an I/O location.

This allows I/O operations to be made generic through the new `read` and
`write` methods.

This design will allow us to factorize the I/O code working with
primitives, and to introduce ways to perform I/O with a higher degree of
control through register types.

Co-developed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260314-register-v9-5-86805b2f7e9d@nvidia.com
[ Fix incorrect reference to io_addr_assert() in try_update(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/io.rs