NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: Zhi Wang <zhiw@nvidia.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	nova-gpu@lists.linux.dev, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 26/27] gpu: nova-core: gsp: remove the retired system-info and static-info RPCs
Date: Thu, 20 Aug 2026 21:59:56 +0300	[thread overview]
Message-ID: <20260820215956.35ec589b@inno-dell> (raw)
In-Reply-To: <20260819035221.336390-27-jhubbard@nvidia.com>

On Tue, 18 Aug 2026 20:52:19 -0700
John Hubbard <jhubbard@nvidia.com> wrote:

We can remove SetRegistry in gsp/commands.rs and gsp/fw/commands.rs as
well.

> The r000 boot path folds the system information and the static GPU
> configuration into the GSP_INIT request, whose reply carries that
> configuration back to the driver.
> 
> The set-system-info and get-static-info commands stayed behind after
> the switch, unreachable and marked dead, along with the two payload
> structures that encoded them.
> 
> Remove both commands and their payloads, and keep the decoded static
> configuration that the GSP_INIT reply fills in. The two
> message-function entries stay, because that table catalogs the wire
> protocol rather than what the driver implements, and already names
> many functions nova-core never sends.
> 
> Assisted-by: Cursor:claude-opus-5
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
>  drivers/gpu/nova-core/gsp.rs             |   8 --
>  drivers/gpu/nova-core/gsp/commands.rs    |  65 +------------
>  drivers/gpu/nova-core/gsp/fw/commands.rs | 115
> +---------------------- 3 files changed, 3 insertions(+), 185
> deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/gsp.rs
> b/drivers/gpu/nova-core/gsp.rs index 8e912eaf8e2e..b128153fda86 100644
> --- a/drivers/gpu/nova-core/gsp.rs
> +++ b/drivers/gpu/nova-core/gsp.rs
> @@ -407,14 +407,6 @@ pub(crate) fn new(
>          })
>      }
>  
> -    /// Query the GSP for the static GPU information.
> -    ///
> -    /// The r000 boot path gets the same information from the
> `GSP_INIT` reply instead.
> -    #[expect(dead_code)]
> -    pub(crate) fn get_static_info(&self, bar: Bar0<'_>) ->
> Result<commands::GetGspStaticInfoReply> {
> -        self.cmdq.send_command(bar, commands::GetGspStaticInfo)
> -    }
> -
>      /// Returns a shared handle to the GSP command queue.
>      pub(crate) fn cmdq(&self) -> Arc<Cmdq> {
>          self.cmdq.clone()
> diff --git a/drivers/gpu/nova-core/gsp/commands.rs
> b/drivers/gpu/nova-core/gsp/commands.rs index
> 26ea07dc4a28..9079393da0b3 100644 ---
> a/drivers/gpu/nova-core/gsp/commands.rs +++
> b/drivers/gpu/nova-core/gsp/commands.rs @@ -49,34 +49,6 @@
>      vgpu::VgpuState, //
>  };
>  
> -/// The `GspSetSystemInfo` command.
> -///
> -/// The r000 boot path folds this into the `GSP_INIT` payload
> instead. -pub(crate) struct SetSystemInfo<'a> {
> -    pdev: &'a pci::Device<device::Bound>,
> -    chipset: Chipset,
> -}
> -
> -#[expect(dead_code)]
> -impl<'a> SetSystemInfo<'a> {
> -    /// Creates a new `GspSetSystemInfo` command using the
> parameters of `pdev`.
> -    pub(crate) fn new(pdev: &'a pci::Device<device::Bound>, chipset:
> Chipset) -> Self {
> -        Self { pdev, chipset }
> -    }
> -}
> -
> -impl<'a> CommandToGsp for SetSystemInfo<'a> {
> -    const FUNCTION: MsgFunction = MsgFunction::GspSetSystemInfo;
> -    const IS_ASYNC: bool = true;
> -    type Command = fw::commands::GspSetSystemInfo;
> -    type Reply = NoReply;
> -    type InitError = Error;
> -
> -    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
> -        Self::Command::init(self.pdev, self.chipset)
> -    }
> -}
> -
>  struct RegistryEntry {
>      key: &'static str,
>      value: u32,
> @@ -186,48 +158,13 @@ fn init_variable_payload(
>      }
>  }
>  
> -/// The `GetGspStaticInfo` command.
> -pub(crate) struct GetGspStaticInfo;
> -
> -impl CommandToGsp for GetGspStaticInfo {
> -    const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo;
> -    type Command = fw::commands::GspStaticConfigInfo;
> -    type Reply = GetGspStaticInfoReply;
> -    type InitError = Infallible;
> -
> -    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
> -        Self::Command::init_zeroed()
> -    }
> -}
> -
> -/// The reply from the GSP to the [`GetGspStaticInfo`] command.
> +/// The static GPU configuration, as decoded from the `GSP_INIT`
> reply. pub(crate) struct GetGspStaticInfoReply {
>      gpu_name: [u8; 64],
>      /// Usable FB (VRAM) regions for driver memory allocation.
>      pub(crate) usable_fb_regions: KVec<Range<u64>>,
>  }
>  
> -impl MessageFromGsp for GetGspStaticInfoReply {
> -    const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo;
> -    type Message = fw::commands::GspStaticConfigInfo;
> -    type InitError = Error;
> -
> -    fn read(
> -        msg: &Self::Message,
> -        _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
> -    ) -> Result<Self, Self::InitError> {
> -        let mut usable_fb_regions = KVec::new();
> -        for region in msg.usable_fb_regions() {
> -            usable_fb_regions.push(region, GFP_KERNEL)?;
> -        }
> -
> -        Ok(GetGspStaticInfoReply {
> -            gpu_name: msg.gpu_name_str(),
> -            usable_fb_regions,
> -        })
> -    }
> -}
> -
>  /// Error type for [`GetGspStaticInfoReply::gpu_name`].
>  #[derive(Debug)]
>  pub(crate) enum GpuNameError {
> diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs
> b/drivers/gpu/nova-core/gsp/fw/commands.rs index
> 00e40a435053..e49234f35d0f 100644 ---
> a/drivers/gpu/nova-core/gsp/fw/commands.rs +++
> b/drivers/gpu/nova-core/gsp/fw/commands.rs @@ -14,11 +14,7 @@
>      }, //
>  };
>  
> -use crate::{
> -    gpu::Chipset,
> -    gsp::GSP_PAGE_SIZE,
> -    num::IntoSafeCast, //
> -};
> +use crate::gpu::Chipset;
>  
>  use crate::gsp::nvkv::{
>      nvkv_decode,
> @@ -37,56 +33,6 @@
>  
>  use super::bindings;
>  
> -/// Payload of the `GspSetSystemInfo` command.
> -#[repr(transparent)]
> -pub(crate) struct GspSetSystemInfo {
> -    inner: bindings::GspSystemInfo,
> -}
> -static_assert!(size_of::<GspSetSystemInfo>() < GSP_PAGE_SIZE);
> -
> -impl GspSetSystemInfo {
> -    /// Returns an in-place initializer for the `GspSetSystemInfo`
> command.
> -    pub(crate) fn init<'a>(
> -        dev: &'a pci::Device<device::Bound>,
> -        chipset: Chipset,
> -    ) -> impl Init<Self, Error> + 'a {
> -        type InnerGspSystemInfo = bindings::GspSystemInfo;
> -        let pci_config_mirror_range =
> chipset.pci_config_mirror_range();
> -        let init_inner = try_init!(InnerGspSystemInfo {
> -            gpuPhysAddr: dev.resource_start(0)?,
> -            gpuPhysFbAddr: dev.resource_start(1)?,
> -            gpuPhysInstAddr: dev.resource_start(3)?,
> -            nvDomainBusDeviceFunc: u64::from(dev.dev_id()),
> -
> -            // Using TASK_SIZE in r535_gsp_rpc_set_system_info()
> seems wrong because
> -            // TASK_SIZE is per-task. That's probably a design issue
> in GSP-RM though.
> -            maxUserVa: (1 << 47) - 4096,
> -            pciConfigMirrorBase: pci_config_mirror_range.start,
> -            pciConfigMirrorSize: pci_config_mirror_range.end -
> pci_config_mirror_range.start, -
> -            PCIDeviceID: (u32::from(dev.device_id()) << 16) |
> u32::from(dev.vendor_id().as_raw()),
> -            PCISubDeviceID: (u32::from(dev.subsystem_device_id()) <<
> 16)
> -                | u32::from(dev.subsystem_vendor_id()),
> -            PCIRevisionID: u32::from(dev.revision_id()),
> -            bIsPrimary: 0,
> -            bPreserveVideoMemoryAllocations: 0,
> -            ..Zeroable::init_zeroed()
> -        });
> -
> -        try_init!(GspSetSystemInfo {
> -            inner <- init_inner,
> -        })
> -    }
> -}
> -
> -// SAFETY: These structs don't meet the no-padding requirements of
> AsBytes but -//         that is not a problem because they are not
> used outside the kernel. -unsafe impl AsBytes for GspSetSystemInfo {}
> -
> -// SAFETY: These structs don't meet the no-padding requirements of
> FromBytes but -//         that is not a problem because they are not
> used outside the kernel. -unsafe impl FromBytes for GspSetSystemInfo
> {} -
>  #[repr(transparent)]
>  pub(crate) struct
> PackedRegistryEntry(bindings::PACKED_REGISTRY_ENTRY); 
> @@ -136,60 +82,6 @@ unsafe impl AsBytes for PackedRegistryTable {}
>  // are valid.
>  unsafe impl FromBytes for PackedRegistryTable {}
>  
> -/// Payload of the `GetGspStaticInfo` command and message.
> -#[repr(transparent)]
> -#[derive(Zeroable)]
> -pub(crate) struct
> GspStaticConfigInfo(bindings::GspStaticConfigInfo_t); -
> -impl GspStaticConfigInfo {
> -    /// Returns a bytes array containing the (hopefully)
> zero-terminated name of this GPU.
> -    pub(crate) fn gpu_name_str(&self) -> [u8; 64] {
> -        self.0.gpuNameString
> -    }
> -
> -    /// Returns an iterator over valid FB regions from GSP firmware
> data.
> -    fn fb_regions(
> -        &self,
> -    ) -> impl Iterator<Item =
> &bindings::NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO> {
> -        let fb_info = &self.0.fbRegionInfoParams;
> -        fb_info
> -            .fbRegion
> -            .iter()
> -            .take(fb_info.numFBRegions.into_safe_cast())
> -            .filter(|reg| reg.limit >= reg.base)
> -    }
> -
> -    /// Iterates over usable FB regions from GSP firmware data.
> -    ///
> -    /// Each yielded region is a [`Range<u64>`] suitable for driver
> memory allocation.
> -    /// Usable regions are those that satisfy all the following
> properties:
> -    /// - Are not reserved for firmware internal use.
> -    /// - Are not protected (hardware-enforced access restrictions).
> -    /// - Support compression (can use GPU memory compression for
> bandwidth).
> -    /// - Support ISO (isochronous memory for display requiring
> guaranteed bandwidth).
> -    pub(crate) fn usable_fb_regions(&self) -> impl Iterator<Item =
> Range<u64>> + '_ {
> -        self.fb_regions().filter_map(|reg| {
> -            // Filter: not reserved, not protected, supports
> compression and ISO.
> -            if reg.reserved == 0
> -                && reg.bProtected == 0
> -                && reg.supportCompressed != 0
> -                && reg.supportISO != 0
> -            {
> -                reg.limit.checked_add(1).map(|end| reg.base..end)
> -            } else {
> -                None
> -            }
> -        })
> -    }
> -}
> -
> -// SAFETY: Padding is explicit and will not contain uninitialized
> data. -unsafe impl AsBytes for GspStaticConfigInfo {}
> -
> -// SAFETY: This struct only contains integer types for which all bit
> patterns -// are valid.
> -unsafe impl FromBytes for GspStaticConfigInfo {}
> -
>  /// Power level requested to the [`UnloadingGuestDriver`] command.
>  #[derive(Clone, Copy, Debug, PartialEq, Eq)]
>  #[repr(u32)]
> @@ -369,8 +261,6 @@ impl GspInitRequest {
>      const NV_DOMAIN_BUS_DEVICE_FUNC_KEY: KeyId = 0x1020;
>  
>      /// Describes `dev` to GSP-RM and asks it to apply `regkeys`.
> -    ///
> -    /// The same identifiers reach GSP-RM through
> [`GspSetSystemInfo::init`] on the RPC path. pub(crate) fn new(
>          dev: &pci::Device<device::Bound>,
>          chipset: Chipset,
> @@ -442,8 +332,7 @@ pub(crate) fn gpu_name(&self) -> &[u8] {
>      /// Iterates over the FB regions the driver may allocate from.
>      ///
>      /// A region qualifies when it is untagged, unprotected, and
> supports both compression and
> -    /// isochronous access, which is the same set the RPC path
> selects from
> -    /// [`GspStaticConfigInfo::usable_fb_regions`].
> +    /// isochronous access.
>      pub(crate) fn usable_fb_regions(&self) -> impl Iterator<Item =
> Range<u64>> + '_ { self.fb_regions.iter().filter_map(|region| {
>              if region.limit >= region.base


  reply	other threads:[~2026-08-20 19:01 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19  3:51 [PATCH 00/27] gpu: nova-core: boot on the r000 GSP firmware John Hubbard
2026-08-19  3:51 ` [PATCH 01/27] gpu: nova-core: firmware: add r000 bindings John Hubbard
2026-08-19  3:51 ` [PATCH 02/27] gpu: nova-core: extract radix3 page table into its own module John Hubbard
2026-08-19 17:37   ` Timur Tabi
2026-08-20  1:05     ` John Hubbard
2026-08-19  3:51 ` [PATCH 03/27] gpu: nova-core: set MCTP transport header version to 1 John Hubbard
2026-08-20  9:38   ` Zhi Wang
2026-08-19  3:51 ` [PATCH 04/27] gpu: nova-core: add Falcon helpers for r000 LOAD_EXEC events John Hubbard
2026-08-20  9:53   ` Zhi Wang
2026-08-19  3:51 ` [PATCH 05/27] gpu: nova-core: zero-pad radix3 page table levels to page boundary John Hubbard
2026-08-19 17:41   ` Timur Tabi
2026-08-20  2:18     ` John Hubbard
2026-08-19  3:51 ` [PATCH 06/27] gpu: nova-core: distinguish async GSP RPC traffic in debug logs John Hubbard
2026-08-20 10:26   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 07/27] gpu: nova-core: add optional ucodes firmware loading John Hubbard
2026-08-19 17:55   ` Timur Tabi
2026-08-20  2:22     ` John Hubbard
2026-08-19 18:41   ` Timur Tabi
2026-08-20  2:31     ` John Hubbard
2026-08-19  3:52 ` [PATCH 08/27] gpu: nova-core: add LIBOS3 log buffers and state monitor buffer John Hubbard
2026-08-19 18:12   ` Timur Tabi
2026-08-20  2:26     ` John Hubbard
2026-08-19  3:52 ` [PATCH 09/27] gpu: nova-core: add build ID headers to debugfs log buffer dumps John Hubbard
2026-08-19 18:20   ` Timur Tabi
2026-08-20  1:00     ` John Hubbard
2026-08-20  1:30       ` Timur Tabi
2026-08-20  2:03         ` John Hubbard
2026-08-19  3:52 ` [PATCH 10/27] gpu: nova-core: rename the FbRanges elf field to fw_image John Hubbard
2026-08-19 18:21   ` Timur Tabi
2026-08-20  1:01     ` John Hubbard
2026-08-19  3:52 ` [PATCH 11/27] gpu: nova-core: regs: add msgq v2 BAR0 register declarations John Hubbard
2026-08-20 10:39   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 12/27] gpu: nova-core: gsp: add msgq v2 internals John Hubbard
2026-08-19  3:52 ` [PATCH 13/27] gpu: nova-core: generalize allocate_command() for variable headers John Hubbard
2026-08-20 12:47   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 14/27] gpu: nova-core: add GMC API message types John Hubbard
2026-08-20 10:53   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 15/27] gpu: nova-core: add GMC send path John Hubbard
2026-08-20 11:12   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 16/27] gpu: nova-core: add GMC transport receive path John Hubbard
2026-08-20 12:00   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 17/27] gpu: nova-core: gsp: add GMC dispatch on receive John Hubbard
2026-08-20 12:30   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 18/27] gpu: nova-core: separate the generic falcon bootloader from FWSEC John Hubbard
2026-08-20 13:02   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 19/27] gpu: nova-core: handle the r000 load-and-execute HS binary event John Hubbard
2026-08-19  3:52 ` [PATCH 20/27] gpu: nova-core: handle the r000 load-and-execute bootloader event John Hubbard
2026-08-20 16:24   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 21/27] gpu: nova-core: gsp: add the GMC boot event dispatcher John Hubbard
2026-08-20 17:28   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 22/27] gpu: nova-core: gsp: add the GSP_INIT request builder John Hubbard
2026-08-20 18:16   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 23/27] gpu: nova-core: gsp: send GSP_INIT and decode its reply John Hubbard
2026-08-20 18:36   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 24/27] gpu: nova-core: gsp: pass the remaining log buffers to GSP-RM John Hubbard
2026-08-20 18:47   ` Zhi Wang
2026-08-19  3:52 ` [PATCH 25/27] gpu: nova-core: switch to the r000 GSP firmware John Hubbard
2026-08-19 18:58   ` Timur Tabi
2026-08-20  1:02     ` John Hubbard
2026-08-19  3:52 ` [PATCH 26/27] gpu: nova-core: gsp: remove the retired system-info and static-info RPCs John Hubbard
2026-08-20 18:59   ` Zhi Wang [this message]
2026-08-19  3:52 ` [PATCH 27/27] gpu: nova-core: firmware: delete the r570 bindings John Hubbard
2026-08-20 19:00   ` Zhi Wang
2026-08-19 19:25 ` [PATCH 00/27] gpu: nova-core: boot on the r000 GSP firmware Timur Tabi
2026-08-20 19:29   ` John Hubbard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260820215956.35ec589b@inno-dell \
    --to=zhiw@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox