diff options
| author | Gary Guo <gary@garyguo.net> | 2026-07-06 13:44:29 +0100 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-07-11 18:09:04 +0200 |
| commit | 89814c42c19ea63600f7235156ae665f6bf8b369 (patch) | |
| tree | 10b2f6ef9dbc741e146499c5fcc8112c6b38bf24 /Kbuild | |
| parent | 1d409d1e7a874b3aeff8908292bc26ba4113cc06 (diff) | |
| download | linux-next-89814c42c19ea63600f7235156ae665f6bf8b369.tar.gz linux-next-89814c42c19ea63600f7235156ae665f6bf8b369.zip | |
rust: io: add `read_val` and `write_val` functions on `Io`
Provide `read_val` and `write_val` that allow I/O views to be accessed when
they're narrowed down to just views of primitives.
This is used to provide `io_read!` and `io_write!` macros, which are
generalized version of current `dma_read!` and `dma_write!` macro that work
for all types that implement `Io`.
Note though `io_read!` and `io_write!` only works if backend implements
`IoCapable` for the type; which is typically only implemented for
atomically accessible primitives. `dma_read!` and `dma_write!` currently
supports them via `read_volatile` and `write_volatile`; this can be
undesirable for aggregates as LLVM may turn them to multiple instructions
to access parts and re-assemble, even if they could be combined to a single
instruction. Thus, `io_read!()` and `io_write!()` does not fully replace
`dma_read!()` and `dma_write!()` in this scenario. The ability to
read/write aggregates (when atomicity is of no concern) is better served
with copying primitives (e.g. memcpy_{from,to}io).
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://patch.msgid.link/20260706-io_projection-v6-16-72cd5d055d54@garyguo.net
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'Kbuild')
0 files changed, 0 insertions, 0 deletions
