diff options
| author | Danilo Krummrich <dakr@kernel.org> | 2026-09-06 14:09:09 +0200 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-09-06 14:09:21 +0200 |
| commit | 1676a4478e434d43f8cab79587becd16d3e86552 (patch) | |
| tree | c267cfde685b361ab7a201f0dcdd56bac0b56c37 /scripts/Makefile.thinlto | |
| parent | e1df8a1560a97d2f5c1965d4844ab64769e92a91 (diff) | |
| parent | a12f711dc53c1ca1d7ff4184e1609182174de87b (diff) | |
| download | linux-next-1676a4478e434d43f8cab79587becd16d3e86552.tar.gz linux-next-1676a4478e434d43f8cab79587becd16d3e86552.zip | |
Merge tag 'rust-io-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core into drm-rust-next
rust: io: support register projections and remove relative registers
Currently registers work for all untyped I/O regions, which is not ideal.
It allows registers defined for device A to work for another device B and
there is no safeguarding at all.
Change this by requiring a base type for registers. `register!` can still
define registers on untyped `Region`s, although users would need to do so
explicitly and supply a concrete type.
This change makes it possible to use projection for relative registers;
relative registers can be implemented by defining new types for the I/O
subregions and just define registers for these subregion types like normal
registers.
This actually results in more ergnomic code for users of relative registers
(currently only nova-core), because non-array registers can be written to
with
#[...]
struct Subregion(...);
register! {
base: MyBase;
SUBREGION: Subregion @ ...;
}
register! {
base: Subregion;
REG(u32) @ .. { .. }
}
let subregion = io_project!(bar, build: SUBREGION);
subregion.read(REG)
subregion.write_reg(reg)
instead of
struct SubregionType;
struct Subregion;
impl RegisterBase<SubregionType> for Subregion {
const BASE: usize = ...;
}
register! {
REG(u32) @ Subregion + .. { .. }
}
bar.read(REG::of::<Subregion>())
bar.write(WithBase::of::<Subregion>(), reg)
This also allows a lot more code sharing between I/O projection and
`register!` macro.
The expressiveness power of Rust declarative macros is becoming limiting,
so it is converted to a proc macro before new features being added to it.
This is a stable tag for other trees to merge.
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
