Re: [PATCH v8 00/10] rust: add `register!` macro

From: Alexandre Courbot

Date: Wed Mar 11 2026 - 22:24:06 EST


On Wed Mar 11, 2026 at 10:38 PM JST, Danilo Krummrich wrote:
> On Wed Mar 11, 2026 at 2:35 PM CET, Alexandre Courbot wrote:
>> On Wed Mar 11, 2026 at 10:07 PM JST, Danilo Krummrich wrote:
>>> On Wed Mar 11, 2026 at 2:01 PM CET, Alexandre Courbot wrote:
>>>> On Wed Mar 11, 2026 at 2:20 AM JST, Danilo Krummrich wrote:
>>>>> On Mon Mar 9, 2026 at 4:13 PM CET, Alexandre Courbot wrote:
>>>>>> Alexandre Courbot (10):
>>>>>> rust: enable the `generic_arg_infer` feature
>>>>>> rust: num: add `shr` and `shl` methods to `Bounded`
>>>>>> rust: num: add `into_bool` method to `Bounded`
>>>>>> rust: num: make Bounded::get const
>>>>>> rust: io: add IoLoc type and generic I/O accessors
>>>>>> rust: io: use generic read/write accessors for primitive accesses
>>>>>> rust: io: introduce `IntoIoVal` trait and single-argument `write_val`
>>>>>> rust: io: add `register!` macro
>>>>>> sample: rust: pci: use `register!` macro
>>>>>> [FOR REFERENCE] gpu: nova-core: use the kernel `register!` macro
>>>>>
>>>>> I did not look into the root cause, but fetching this patch series my build
>>>>> fails due to a build_assert!(). Maybe you have CONFIG_RUST_BUILD_ASSERT_ALLOW
>>>>> enabled?
>>>>
>>>> Nope, it is disabled and I build with Clippy so I am surprised you are
>>>> getting this. Do you know which module is failing?
>>>
>>> ERROR: modpost: "rust_build_error" [drivers/gpu/nova-core/nova_core.ko] undefined!
>>
>> Does it happen with the exact branch I posted?
>
> Yup, my HEAD is at commit 5c558172827e ("[FOR REFERENCE] gpu: nova-core: use the
> kernel `register!` macro").

I did a mistake when updating the nova-core code - changed a
dynamically-checked index into a static one, and since it could not be
proven at build-time it failed. Working as intended, apart from the too
cryptic error message.

For the record, here is the fix:

--- a/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs
+++ b/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs
@@ -291,14 +291,15 @@ pub(crate) fn run(
.inspect_err(|e| dev_err!(dev, "Failed to load FWSEC firmware: {:?}\n", e))?;

// Configure DMA index for the bootloader to fetch the FWSEC firmware from system memory.
- bar.try_update(
+ bar.update(
regs::NV_PFALCON_FBIF_TRANSCFG::of::<Gsp>()
- .at(usize::from_safe_cast(self.dmem_desc.ctx_dma)),
+ .try_at(usize::from_safe_cast(self.dmem_desc.ctx_dma))
+ .ok_or(EINVAL)?,
|v| {
v.with_target(FalconFbifTarget::CoherentSysmem)
.with_mem_type(FalconFbifMemType::Physical)
},
- )?;
+ );

let (mbox0, _) = falcon
.boot(bar, Some(0), None)