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

"Alexandre Courbot" <[email protected]> Tue, 28 Jul 2026 15:47:13 +0900
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
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`. Th=
us
> add the base parameter to `register!` invocation.
>
> Signed-off-by: Gary Guo <[email protected]>
> ---
>  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/driv=
er.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 =3D SZ_16M;
> =20
>  pub(crate) type Bar0<'a> =3D &'a pci::Bar<'a, BAR0_SIZE>;
> +pub(crate) type NovaRegisters =3D kernel::io::Region<BAR0_SIZE>;
> =20
>  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 @@
> =20
>  use kernel::io::register;
> =20
> +use crate::driver::NovaRegisters;
> +
>  // PDISP
> =20
>  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/gs=
p/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 @@
> =20
>  use kernel::io::register;
> =20
> +use crate::driver::NovaRegisters;
> +
>  // PGSP
> =20
>  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.r=
s
> index 397124f245ee..f2aadeb429b8 100644
> --- a/drivers/gpu/nova-core/regs.rs
> +++ b/drivers/gpu/nova-core/regs.rs
> @@ -13,7 +13,7 @@
>  };
> =20
>  use crate::{
> -    driver::Bar0,
> +    driver::{Bar0, NovaRegisters},

nit: formatting of imports.