Re: [PATCH 02/10] gpu: nova-core: specify base type for registers

From: Alexandre Courbot

Date: Tue Jul 28 2026 - 02:47:27 EST


On Wed Jul 22, 2026 at 1:54 AM JST, Gary Guo wrote:
> All registers use the same base type, which is `<Bar0 as IO>::Target`. Thus
> add the base parameter to `register!` invocation.
>
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> drivers/gpu/nova-core/driver.rs | 1 +
> drivers/gpu/nova-core/fb/regs.rs | 4 ++++
> drivers/gpu/nova-core/gsp/regs.rs | 4 ++++
> drivers/gpu/nova-core/regs.rs | 42 ++++++++++++++++++++++++++++++++++++++-
> drivers/gpu/nova-core/vbios.rs | 11 +++++++++-
> 5 files changed, 60 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> index 48380ac15f68..fe82363a8201 100644
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs
> @@ -37,6 +37,7 @@ pub(crate) struct NovaCore<'bound> {
> const BAR0_SIZE: usize = SZ_16M;
>
> pub(crate) type Bar0<'a> = &'a pci::Bar<'a, BAR0_SIZE>;
> +pub(crate) type NovaRegisters = kernel::io::Region<BAR0_SIZE>;
>
> kernel::pci_device_table!(
> PCI_TABLE,
> diff --git a/drivers/gpu/nova-core/fb/regs.rs b/drivers/gpu/nova-core/fb/regs.rs
> index b2ec02f584be..4296bef5f262 100644
> --- a/drivers/gpu/nova-core/fb/regs.rs
> +++ b/drivers/gpu/nova-core/fb/regs.rs
> @@ -2,9 +2,13 @@
>
> use kernel::io::register;
>
> +use crate::driver::NovaRegisters;
> +
> // PDISP
>
> register! {
> + base: NovaRegisters;
> +
> pub(super) NV_PDISP_VGA_WORKSPACE_BASE(u32) @ 0x00625f04 {
> /// VGA workspace base address divided by 0x10000.
> 31:8 addr;
> diff --git a/drivers/gpu/nova-core/gsp/regs.rs b/drivers/gpu/nova-core/gsp/regs.rs
> index a76dea3c3ab0..34ce8dd1f464 100644
> --- a/drivers/gpu/nova-core/gsp/regs.rs
> +++ b/drivers/gpu/nova-core/gsp/regs.rs
> @@ -2,9 +2,13 @@
>
> use kernel::io::register;
>
> +use crate::driver::NovaRegisters;
> +
> // PGSP
>
> register! {
> + base: NovaRegisters;
> +
> pub(super) NV_PGSP_QUEUE_HEAD(u32) @ 0x00110c00 {
> 31:0 address;
> }
> diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
> index 397124f245ee..f2aadeb429b8 100644
> --- a/drivers/gpu/nova-core/regs.rs
> +++ b/drivers/gpu/nova-core/regs.rs
> @@ -13,7 +13,7 @@
> };
>
> use crate::{
> - driver::Bar0,
> + driver::{Bar0, NovaRegisters},

nit: formatting of imports.