Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The `io_read!` macro invocation uses a runtime loop variable `i` with the `[build: i]` syntax, which relies on the optimizer to eliminate the bounds check and may cause a build failure. --
--- Patch [12]: [PATCH v2 12/12] gpu: nova-core: mm: Add PRAMIN aperture self-tests --- commit e3c26c738212001e40a3ab7fef15d2c8cf5421b5 Author: Joel Fernandes <[email protected]> gpu: nova-core: mm: Add PRAMIN aperture self-tests This commit adds self-tests for the PRAMIN aperture mechanism to verify correct operation, alignment requirements, and corner cases during GPU probe. The tests are default disabled and gated behind CONFIG_NOVA_CORE_SELFTESTS. > diff --git a/drivers/gpu/nova-core/mm/pramin.rs > b/drivers/gpu/nova-core/mm/pramin.rs > --- a/drivers/gpu/nova-core/mm/pramin.rs > +++ b/drivers/gpu/nova-core/mm/pramin.rs [ ... ] > + fn test_u32_as_bytes( > + dev: &device::Device<device::Bound>, > + pramin: &mut Pramin<'_>, > + base: VramAddress, > + ) -> Result { > + let addr = base + 0x10; > + let val: u32 = 0xDEADBEEF; > + pramin.window_at::<u32>(addr)?.view().write_val(val); > + > + let window = pramin.window_at::<[u8; 4]>(addr)?; > + for (i, &expected) in val.to_le_bytes().iter().enumerate() { > + selftest_assert_eq!(dev, io_read!(window.view(), [build: i]), > expected); [Severity: Low] Will this cause a link-time build failure if the optimizer does not unroll the loop? The io_read! macro invocation in test_u32_as_bytes uses the runtime loop variable i with the [build: i] syntax. This relies on LLVM optimization heuristics to unroll the loop and resolve the value statically at build time. If the compiler fails to unroll this loop, the code will retain a call to rust_build_error, which results in an undefined symbol linker error unless CONFIG_RUST_BUILD_ASSERT_ALLOW is explicitly enabled. Should this be rewritten to manually unroll the four reads, or use a runtime index rather than [build: i]? > + } > + Ok(()) > + } -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=12
