gpu: nova-core: arm32 build errors

Danilo Krummrich dakr at kernel.org
Thu Aug 28 17:54:45 UTC 2025


Hi Miguel,

Thanks for reporting!

On 8/28/25 6:02 PM, Miguel Ojeda wrote:
> Hi Danilo et al.,
> 
> In Linus' tree and -next, for an arm32 LLVM defconfig plus Rust build, I see:
> 
>      error[E0308]: mismatched types
>        --> drivers/gpu/nova-core/fb.rs:49:59
>         |
>      49 |         hal::fb_hal(chipset).write_sysmem_flush_page(bar, page.dma_handle())?;
>         |                              -----------------------      ^^^^^^^^^^^^^^^^^ expected `u64`, found `u32`
>         |                              |
>         |                              arguments to this method are incorrect
>         |
>      note: method defined here
>        --> drivers/gpu/nova-core/fb/hal.rs:19:8
>         |
>      19 |     fn write_sysmem_flush_page(&self, bar: &Bar0, addr: u64) -> Result;
>         |        ^^^^^^^^^^^^^^^^^^^^^^^
>      help: you can convert a `u32` to a `u64`
>         |
>      49 |         hal::fb_hal(chipset).write_sysmem_flush_page(bar, page.dma_handle().into())?;
>         |                                                                            +++++++
> 
> 
>      error[E0308]: mismatched types
>        --> drivers/gpu/nova-core/fb.rs:65:47
>         |
>      65 |         if hal.read_sysmem_flush_page(bar) == self.page.dma_handle() {
>         |            -------------------------------    ^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `u32`
>         |            |
>         |            expected because this is `u64`
>         |
>      help: you can convert a `u32` to a `u64`
>         |
>      65 |         if hal.read_sysmem_flush_page(bar) == self.page.dma_handle().into() {

I think those should just use the DMA address type introduced in [1].
Unfortunately, for a fix we have to stick to bindings::dma_addr_t.

[1] https://lore.kernel.org/lkml/20250828133323.53311-3-dakr@kernel.org/

>         |                                                                     +++++++
> 
> 
>      error: this arithmetic operation will overflow
>         --> drivers/gpu/nova-core/falcon.rs:469:23
>          |
>      469 |             .set_base((dma_start >> 40) as u16)
>          |                       ^^^^^^^^^^^^^^^^^ attempt to shift right by `40_i32`, which would overflow
>          |
>          = note: `#[deny(arithmetic_overflow)]` on by default

Should probably just be

	val.checked_shr(shift).unwrap_or(0)

I'll send a patch to fix this up.

> Similar to another one I sent, I hope it helps -- it may be useful to make it
> build in 32-bit as a test for those kinds of platforms.

Agreed.

Thanks,
Danilo


More information about the Nouveau mailing list