[PATCH 2/9] rust: io: drop the CONFIG_64BIT restriction on system memory u64 access
From: Laura Nao
Date: Tue Sep 15 2026 - 06:59:35 EST
SysMemBackend's IoCapable<u64> impl is currently gated on CONFIG_64BIT,
copying the MMIO backend's restriction. MMIO needs that gate because
readq() is not available on 32bit. System memory has no such dependency:
a u64 volatile load/store compiles on any architecture, it's just not
single-copy atomic on 32bit.
Drop the gate so u64-backed types, such as bitfields, work on 32bit too.
Document the non-atomicity at the impl instead of enforcing it at build
time.
Co-developed-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
Signed-off-by: Laura Nao <laura.nao@xxxxxxxxxxxxx>
---
rust/kernel/io.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs
index de8ef8e2aec4..a85ddd07cb7f 100644
--- a/rust/kernel/io.rs
+++ b/rust/kernel/io.rs
@@ -1428,7 +1428,9 @@ fn io_write(view: SysMem<'_, $ty>, value: $ty) {
impl_sysmem_io_capable!(u8);
impl_sysmem_io_capable!(u16);
impl_sysmem_io_capable!(u32);
-#[cfg(CONFIG_64BIT)]
+// Unlike MMIO, that needs `readq` which is not available on 32-bit, a
+// system-memory `u64` access compiles on any target. It is just not
+// single-copy atomic on 32-bit.
impl_sysmem_io_capable!(u64);
impl IoCopyable for SysMemBackend {
--
2.39.5