* [PATCH] gpu: nova-core: depend on CONFIG_64BIT
@ 2025-08-28 22:39 Danilo Krummrich
2025-08-28 23:17 ` John Hubbard
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Danilo Krummrich @ 2025-08-28 22:39 UTC (permalink / raw)
To: acourbot
Cc: nouveau, dri-devel, rust-for-linux, Danilo Krummrich,
John Hubbard, Miguel Ojeda
If built on architectures with CONFIG_ARCH_DMA_ADDR_T_64BIT=y nova-core
produces that following build failures:
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() {
| +++++++
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
This is due to the code making assumptions on the width of dma_addr_t to
be 64 bit.
While this could technically be handled, it is rather painful to deal
with, as the following example illustrates:
pub(super) fn read_sysmem_flush_page_ga100(bar: &Bar0) -> DmaAddress {
let addr = u64::from(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR::read(bar).adr_39_08())
<< FLUSH_SYSMEM_ADDR_SHIFT
| u64::from(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI::read(bar).adr_63_40())
<< FLUSH_SYSMEM_ADDR_SHIFT_HI;
addr.try_into().unwrap_or_else(|_| {
kernel::warn_on!(true);
0
})
}
At the same time there's not much value for nova-core to support 32-bit,
given that the supported GPU architectures are Turing and later, hence
depend on CONFIG_64BIT.
Cc: John Hubbard <jhubbard@nvidia.com>
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/lkml/20250828160247.37492-1-ojeda@kernel.org/
Fixes: 6554ad65b589 ("gpu: nova-core: register sysmem flush page")
Fixes: 69f5cd67ce41 ("gpu: nova-core: add falcon register definitions and base code")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/gpu/nova-core/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/nova-core/Kconfig b/drivers/gpu/nova-core/Kconfig
index 8726d80d6ba4..20d3e6d0d796 100644
--- a/drivers/gpu/nova-core/Kconfig
+++ b/drivers/gpu/nova-core/Kconfig
@@ -1,5 +1,6 @@
config NOVA_CORE
tristate "Nova Core GPU driver"
+ depends on 64BIT
depends on PCI
depends on RUST
depends on RUST_FW_LOADER_ABSTRACTIONS
base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpu: nova-core: depend on CONFIG_64BIT
2025-08-28 22:39 [PATCH] gpu: nova-core: depend on CONFIG_64BIT Danilo Krummrich
@ 2025-08-28 23:17 ` John Hubbard
2025-08-29 0:32 ` Alexandre Courbot
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: John Hubbard @ 2025-08-28 23:17 UTC (permalink / raw)
To: Danilo Krummrich, acourbot
Cc: nouveau, dri-devel, rust-for-linux, Miguel Ojeda
On 8/28/25 3:39 PM, Danilo Krummrich wrote:
...
> diff --git a/drivers/gpu/nova-core/Kconfig b/drivers/gpu/nova-core/Kconfig
> index 8726d80d6ba4..20d3e6d0d796 100644
> --- a/drivers/gpu/nova-core/Kconfig
> +++ b/drivers/gpu/nova-core/Kconfig
> @@ -1,5 +1,6 @@
> config NOVA_CORE
> tristate "Nova Core GPU driver"
> + depends on 64BIT
Yes!
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
thanks,
--
John Hubbard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpu: nova-core: depend on CONFIG_64BIT
2025-08-28 22:39 [PATCH] gpu: nova-core: depend on CONFIG_64BIT Danilo Krummrich
2025-08-28 23:17 ` John Hubbard
@ 2025-08-29 0:32 ` Alexandre Courbot
2025-08-29 11:23 ` Alexandre Courbot
2025-09-01 10:30 ` Danilo Krummrich
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Courbot @ 2025-08-29 0:32 UTC (permalink / raw)
To: Danilo Krummrich
Cc: nouveau, dri-devel, rust-for-linux, John Hubbard, Miguel Ojeda
On Fri Aug 29, 2025 at 7:39 AM JST, Danilo Krummrich wrote:
> If built on architectures with CONFIG_ARCH_DMA_ADDR_T_64BIT=y nova-core
> produces that following build failures:
>
> 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() {
> | +++++++
>
> 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
>
> This is due to the code making assumptions on the width of dma_addr_t to
> be 64 bit.
>
> While this could technically be handled, it is rather painful to deal
> with, as the following example illustrates:
>
> pub(super) fn read_sysmem_flush_page_ga100(bar: &Bar0) -> DmaAddress {
> let addr = u64::from(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR::read(bar).adr_39_08())
> << FLUSH_SYSMEM_ADDR_SHIFT
> | u64::from(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI::read(bar).adr_63_40())
> << FLUSH_SYSMEM_ADDR_SHIFT_HI;
>
> addr.try_into().unwrap_or_else(|_| {
> kernel::warn_on!(true);
>
> 0
> })
> }
>
> At the same time there's not much value for nova-core to support 32-bit,
> given that the supported GPU architectures are Turing and later, hence
> depend on CONFIG_64BIT.
>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Reported-by: Miguel Ojeda <ojeda@kernel.org>
> Closes: https://lore.kernel.org/lkml/20250828160247.37492-1-ojeda@kernel.org/
> Fixes: 6554ad65b589 ("gpu: nova-core: register sysmem flush page")
> Fixes: 69f5cd67ce41 ("gpu: nova-core: add falcon register definitions and base code")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Thanks!
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpu: nova-core: depend on CONFIG_64BIT
2025-08-28 22:39 [PATCH] gpu: nova-core: depend on CONFIG_64BIT Danilo Krummrich
2025-08-28 23:17 ` John Hubbard
2025-08-29 0:32 ` Alexandre Courbot
@ 2025-08-29 11:23 ` Alexandre Courbot
2025-09-01 10:30 ` Danilo Krummrich
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Courbot @ 2025-08-29 11:23 UTC (permalink / raw)
To: Danilo Krummrich
Cc: nouveau, dri-devel, rust-for-linux, John Hubbard, Miguel Ojeda
On Fri Aug 29, 2025 at 7:39 AM JST, Danilo Krummrich wrote:
<snip>
> diff --git a/drivers/gpu/nova-core/Kconfig b/drivers/gpu/nova-core/Kconfig
> index 8726d80d6ba4..20d3e6d0d796 100644
> --- a/drivers/gpu/nova-core/Kconfig
> +++ b/drivers/gpu/nova-core/Kconfig
> @@ -1,5 +1,6 @@
> config NOVA_CORE
> tristate "Nova Core GPU driver"
> + depends on 64BIT
> depends on PCI
> depends on RUST
> depends on RUST_FW_LOADER_ABSTRACTIONS
Another thing we probably want to depend on: a little-endian
architecture. There is an assumption in the code that the CPU will use
this endianness, and while it can be changed to be more portable, this
would require stuff like proc-macros to properly build a struct from a
data stream with endianness in mind, which we don't have yet.
Most (all?) the platforms on which NVIDIA GPUs are to run are
little-endian anyway, so I am not even sure big-endian support would be
useful.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpu: nova-core: depend on CONFIG_64BIT
2025-08-28 22:39 [PATCH] gpu: nova-core: depend on CONFIG_64BIT Danilo Krummrich
` (2 preceding siblings ...)
2025-08-29 11:23 ` Alexandre Courbot
@ 2025-09-01 10:30 ` Danilo Krummrich
3 siblings, 0 replies; 5+ messages in thread
From: Danilo Krummrich @ 2025-09-01 10:30 UTC (permalink / raw)
To: acourbot; +Cc: nouveau, dri-devel, rust-for-linux, John Hubbard, Miguel Ojeda
On Fri Aug 29, 2025 at 12:39 AM CEST, Danilo Krummrich wrote:
> If built on architectures with CONFIG_ARCH_DMA_ADDR_T_64BIT=y nova-core
> produces that following build failures:
>
> 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() {
> | +++++++
>
> 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
>
> This is due to the code making assumptions on the width of dma_addr_t to
> be 64 bit.
>
> While this could technically be handled, it is rather painful to deal
> with, as the following example illustrates:
>
> pub(super) fn read_sysmem_flush_page_ga100(bar: &Bar0) -> DmaAddress {
> let addr = u64::from(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR::read(bar).adr_39_08())
> << FLUSH_SYSMEM_ADDR_SHIFT
> | u64::from(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI::read(bar).adr_63_40())
> << FLUSH_SYSMEM_ADDR_SHIFT_HI;
>
> addr.try_into().unwrap_or_else(|_| {
> kernel::warn_on!(true);
>
> 0
> })
> }
>
> At the same time there's not much value for nova-core to support 32-bit,
> given that the supported GPU architectures are Turing and later, hence
> depend on CONFIG_64BIT.
>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Reported-by: Miguel Ojeda <ojeda@kernel.org>
> Closes: https://lore.kernel.org/lkml/20250828160247.37492-1-ojeda@kernel.org/
> Fixes: 6554ad65b589 ("gpu: nova-core: register sysmem flush page")
> Fixes: 69f5cd67ce41 ("gpu: nova-core: add falcon register definitions and base code")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Applied to drm-rust-fixes, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-01 10:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 22:39 [PATCH] gpu: nova-core: depend on CONFIG_64BIT Danilo Krummrich
2025-08-28 23:17 ` John Hubbard
2025-08-29 0:32 ` Alexandre Courbot
2025-08-29 11:23 ` Alexandre Courbot
2025-09-01 10:30 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).