The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount
@ 2026-06-17 13:24 Alexandre Courbot
  2026-06-17 13:24 ` [PATCH v3 1/3] gpu: nova-core: move GSP unload state to a pinned Gpu subobject Alexandre Courbot
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-06-17 13:24 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Benno Lossin, Gary Guo
  Cc: nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alexandre Courbot, Eliot Courtney, Joel Fernandes

This series performs some light refactoring required to be able to
initialize members of the `Gpu` struct from GSP commands, and makes use
of that refactoring to obtain and store the amount of VRAM on the
device.

This is useful as probe-time information to be displayed, but will also
become a parameter that can be queried from user-space once the nova-drm
to nova-core bridge is established.

This revision is just a rebase on top of the latest `drm-rust-next`, as
the newly pushed patches introduced some non-trivial conflicts.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes in v3:
- Rebase against latest `drm-rust-next`.
- Link to v2: https://patch.msgid.link/20260617-boot-vram-v2-0-15c979001c70@nvidia.com

Changes in v2:
- Move `sysmem_flush` after `gsp_resources` to avoid use-after-drop.
  (Eliot and Sashiko)
- Rename `usable_fb_regions_iter` to `usable_fb_regions`.
- Return all usable regions as a `KVec`.
- Let the caller compute the usable VRAM size instead of storing it as a
  `GetGspStaticInfoReply` property.
- Dropped `Reviewed-by` tags on patch 3 as code has changed
  considerably.
- Link to v1: https://patch.msgid.link/20260609-boot-vram-v1-0-d9382610507a@nvidia.com

To: Danilo Krummrich <dakr@kernel.org>
To: Alice Ryhl <aliceryhl@google.com>
To: Alexandre Courbot <acourbot@nvidia.com>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
To: Benno Lossin <lossin@kernel.org>
To: Gary Guo <gary@garyguo.net>
Cc: nova-gpu@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: rust-for-linux@vger.kernel.org

---
Alexandre Courbot (2):
      gpu: nova-core: move GSP unload state to a pinned Gpu subobject
      gpu: nova-core: move GPU static information acquisition to a GSP method

Joel Fernandes (1):
      gpu: nova-core: gsp: Extract and display usable FB regions from GSP

 drivers/gpu/nova-core/gpu.rs             | 136 +++++++++++++++++++++----------
 drivers/gpu/nova-core/gsp.rs             |  14 +++-
 drivers/gpu/nova-core/gsp/boot.rs        |   7 --
 drivers/gpu/nova-core/gsp/commands.rs    |  13 ++-
 drivers/gpu/nova-core/gsp/fw/commands.rs |  40 ++++++++-
 5 files changed, 151 insertions(+), 59 deletions(-)
---
base-commit: e655873885063245fd7f49f81cebfdfdef66a59d
change-id: 20260609-boot-vram-00d5057102d5

Best regards,
--  
Alexandre Courbot <acourbot@nvidia.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/3] gpu: nova-core: move GSP unload state to a pinned Gpu subobject
  2026-06-17 13:24 [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
@ 2026-06-17 13:24 ` Alexandre Courbot
  2026-06-17 13:24 ` [PATCH v3 2/3] gpu: nova-core: move GPU static information acquisition to a GSP method Alexandre Courbot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-06-17 13:24 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Benno Lossin, Gary Guo
  Cc: nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alexandre Courbot, Eliot Courtney

`Gpu` currently owns the state needed to unload the GSP directly. This
means that `unload_bundle` has to be the last initialized field: once GSP
boot succeeds, any later initialization failure would leave `Gpu`
partially initialized, and its `PinnedDrop` implementation would not run.

This prevents adding fallible `Gpu` fields that need to query the GSP
after it has booted.

Move the GSP state and unload bundle into a dedicated pinned
`GspResources` object. Once that subobject has been initialized, its
`PinnedDrop` implementation will run even if initialization of a later
`Gpu` field fails, ensuring that the GSP unload sequence is executed.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
---
 drivers/gpu/nova-core/gpu.rs | 104 +++++++++++++++++++++++++------------------
 1 file changed, 60 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 6a9572107cf3..acee9a3ab37f 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -263,35 +263,62 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     }
 }
 
-/// Structure holding the resources required to operate the GPU.
+/// Self-contained resources to operate and drop the GSP.
 #[pin_data(PinnedDrop)]
-pub(crate) struct Gpu<'gpu> {
+struct GspResources<'gpu> {
     /// Device owning the GPU.
     device: &'gpu device::Device<device::Bound>,
-    spec: Spec,
     /// MMIO mapping of PCI BAR 0.
     bar: Bar0<'gpu>,
-    /// System memory page required for flushing all pending GPU-side memory writes done through
-    /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
-    sysmem_flush: SysmemFlush<'gpu>,
     /// GSP falcon instance, used for GSP boot up and cleanup.
     gsp_falcon: Falcon<GspFalcon>,
     /// SEC2 falcon instance, used for GSP boot up and cleanup.
     sec2_falcon: Falcon<Sec2Falcon>,
-    /// GSP runtime data. Temporarily an empty placeholder.
+    /// GSP runtime data.
     #[pin]
     gsp: Gsp,
     /// GSP unload firmware bundle, if any.
     unload_bundle: Option<gsp::UnloadBundle>,
 }
 
+/// Structure holding the resources required to operate the GPU.
+#[pin_data]
+pub(crate) struct Gpu<'gpu> {
+    spec: Spec,
+    /// GSP and its resources.
+    #[pin]
+    gsp_resources: GspResources<'gpu>,
+    /// System memory page required for flushing all pending GPU-side memory writes done through
+    /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
+    ///
+    /// Must be kept declared *after* `gsp_resources`, as the latter's `PinnedDrop` implementation
+    /// requires the sysmem flush page to be in place.
+    sysmem_flush: SysmemFlush<'gpu>,
+}
+
+#[pinned_drop]
+impl PinnedDrop for GspResources<'_> {
+    fn drop(self: Pin<&mut Self>) {
+        let this = self.project();
+        let device = *this.device;
+        let bar = *this.bar;
+        let bundle = this.unload_bundle.take();
+
+        let _ = this
+            .gsp
+            .as_ref()
+            .get_ref()
+            .unload(device, bar, &*this.gsp_falcon, &*this.sec2_falcon, bundle)
+            .inspect_err(|e| dev_err!(device, "failed to unload GSP: {:?}\n", e));
+    }
+}
+
 impl<'gpu> Gpu<'gpu> {
     pub(crate) fn new(
         pdev: &'gpu pci::Device<device::Core<'_>>,
         bar: Bar0<'gpu>,
     ) -> impl PinInit<Self, Error> + 'gpu {
         try_pin_init!(Self {
-            device: pdev.as_ref(),
             spec: Spec::new(pdev.as_ref(), bar).inspect(|spec| {
                 dev_info!(pdev,"NVIDIA ({})\n", spec);
             })?,
@@ -309,46 +336,35 @@ pub(crate) fn new(
                     .inspect_err(|_| dev_err!(pdev, "GFW boot did not complete\n"))?;
             },
 
+            // Initialize this early because `gsp_resources` depends on it.
             sysmem_flush: SysmemFlush::register(pdev.as_ref(), bar, spec.chipset)?,
 
-            gsp_falcon: Falcon::new(
-                pdev.as_ref(),
-                spec.chipset,
-            )
-            .inspect(|falcon| falcon.clear_swgen0_intr(bar))?,
+            gsp_resources <- try_pin_init!(GspResources {
+                device: pdev.as_ref(),
 
-            sec2_falcon: Falcon::new(pdev.as_ref(), spec.chipset)?,
-
-            gsp <- Gsp::new(pdev),
-
-            // This member must be initialized last, so the `UnloadBundle` can never be dropped from
-            // outside of the constructed `Gpu`, ensuring that the unload sequence is properly run
-            // in case of failure.
-            unload_bundle: gsp.boot(GspBootContext {
-                pdev,
                 bar,
-                chipset: spec.chipset,
-                gsp_falcon,
-                sec2_falcon,
-            })?,
-            bar,
+
+                gsp_falcon: Falcon::new(
+                    pdev.as_ref(),
+                    spec.chipset,
+                )
+                .inspect(|falcon| falcon.clear_swgen0_intr(bar))?,
+
+                sec2_falcon: Falcon::new(pdev.as_ref(), spec.chipset)?,
+
+                gsp <- Gsp::new(pdev),
+
+                // This member must be initialized last, so the `UnloadBundle` can never be dropped
+                // from outside of the constructed `GspResources`, ensuring that the unload sequence
+                // is properly run in case of failure.
+                unload_bundle: gsp.boot(GspBootContext {
+                    pdev,
+                    bar,
+                    chipset: spec.chipset,
+                    gsp_falcon,
+                    sec2_falcon,
+                })?,
+            }),
         })
     }
 }
-
-#[pinned_drop]
-impl PinnedDrop for Gpu<'_> {
-    fn drop(self: Pin<&mut Self>) {
-        let this = self.project();
-        let device = *this.device;
-        let bar = *this.bar;
-        let bundle = this.unload_bundle.take();
-
-        let _ = this
-            .gsp
-            .as_ref()
-            .get_ref()
-            .unload(device, bar, &*this.gsp_falcon, &*this.sec2_falcon, bundle)
-            .inspect_err(|e| dev_err!(device, "failed to unload GSP: {:?}\n", e));
-    }
-}

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] gpu: nova-core: move GPU static information acquisition to a GSP method
  2026-06-17 13:24 [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
  2026-06-17 13:24 ` [PATCH v3 1/3] gpu: nova-core: move GSP unload state to a pinned Gpu subobject Alexandre Courbot
@ 2026-06-17 13:24 ` Alexandre Courbot
  2026-06-17 13:24 ` [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP Alexandre Courbot
  2026-06-20 10:49 ` [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
  3 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-06-17 13:24 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Benno Lossin, Gary Guo
  Cc: nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alexandre Courbot, Eliot Courtney

The GSP static information is useful during regular driver runtime;
however it is currently obtained from `Gsp::boot`, with no elegant way
to pass it back to the caller.

Solve this by moving the code acquiring it to a dedicated method of
`Gsp` that can be called as soon as the `Gsp` is booted. This allows us
to obtain and display the static information from the `Gpu` constructor,
and to store the static information for later use.

Its location at the end of `Gsp::boot` was a bit out-of-place anyway:
technically, the GSP is considered booted after we have received the
`GspInitDone` message, so anything that happens afterwards is not part
of the boot sequence anymore.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
---
 drivers/gpu/nova-core/gpu.rs      | 14 ++++++++++++++
 drivers/gpu/nova-core/gsp.rs      | 14 ++++++++++----
 drivers/gpu/nova-core/gsp/boot.rs |  7 -------
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index acee9a3ab37f..a34114d3afcb 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -23,6 +23,7 @@
     fb::SysmemFlush,
     gsp::{
         self,
+        commands::GetGspStaticInfoReply,
         Gsp,
         GspBootContext, //
     },
@@ -285,6 +286,8 @@ struct GspResources<'gpu> {
 #[pin_data]
 pub(crate) struct Gpu<'gpu> {
     spec: Spec,
+    /// Static GPU information as provided by the GSP.
+    gsp_static_info: GetGspStaticInfoReply,
     /// GSP and its resources.
     #[pin]
     gsp_resources: GspResources<'gpu>,
@@ -365,6 +368,17 @@ pub(crate) fn new(
                     sec2_falcon,
                 })?,
             }),
+
+            gsp_static_info: {
+                // Obtain and display basic GPU information.
+                let info = gsp_resources.gsp.get_static_info(bar)?;
+                match info.gpu_name() {
+                    Ok(name) => dev_info!(pdev, "GPU name: {}\n", name),
+                    Err(e) => dev_warn!(pdev, "GPU name unavailable: {:?}\n", e),
+                }
+
+                info
+            }
         })
     }
 }
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index 3876208779ad..fb8baf3eed71 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -39,10 +39,12 @@
         Falcon, //
     },
     gpu::Chipset,
-    gsp::cmdq::Cmdq,
-    gsp::fw::{
-        GspArgumentsPadded,
-        LibosMemoryRegionInitArgument, //
+    gsp::{
+        cmdq::Cmdq,
+        fw::{
+            GspArgumentsPadded,
+            LibosMemoryRegionInitArgument, //
+        },
     },
     num,
 };
@@ -208,6 +210,10 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> impl PinInit<Self, Error
             }))
         })
     }
+
+    pub(crate) fn get_static_info(&self, bar: Bar0<'_>) -> Result<commands::GetGspStaticInfoReply> {
+        self.cmdq.send_command(bar, commands::GetGspStaticInfo)
+    }
 }
 
 /// Opaque bundle required to unload the GSP. Created by [`Gsp::boot`], consumed by [`Gsp::unload`].
diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index e380334e937b..bb2000b7a78b 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -142,13 +142,6 @@ pub(crate) fn boot(
         // Wait until GSP is fully initialized.
         commands::wait_gsp_init_done(&self.cmdq)?;
 
-        // Obtain and display basic GPU information.
-        let info = self.cmdq.send_command(bar, commands::GetGspStaticInfo)?;
-        match info.gpu_name() {
-            Ok(name) => dev_info!(pdev, "GPU name: {}\n", name),
-            Err(e) => dev_warn!(pdev, "GPU name unavailable: {:?}\n", e),
-        }
-
         Ok(unload_guard.dismiss())
     }
 

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP
  2026-06-17 13:24 [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
  2026-06-17 13:24 ` [PATCH v3 1/3] gpu: nova-core: move GSP unload state to a pinned Gpu subobject Alexandre Courbot
  2026-06-17 13:24 ` [PATCH v3 2/3] gpu: nova-core: move GPU static information acquisition to a GSP method Alexandre Courbot
@ 2026-06-17 13:24 ` Alexandre Courbot
  2026-06-20 11:30   ` Danilo Krummrich
  2026-06-20 10:49 ` [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
  3 siblings, 1 reply; 8+ messages in thread
From: Alexandre Courbot @ 2026-06-17 13:24 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Benno Lossin, Gary Guo
  Cc: nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alexandre Courbot, Joel Fernandes

From: Joel Fernandes <joelagnelf@nvidia.com>

Add usable_fb_regions() to GspStaticConfigInfo to extract the usable FB
regions from GSP's fbRegionInfoParams. Usable regions are those that are
not reserved or protected.

The extracted regions are stored in GetGspStaticInfoReply and exposed
for use by the memory subsystem.

Display the regions and their total size upon device probe.

Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
[acourbot: expose all regions as a KVec, display usable regions and
total usable VRAM.]
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gpu.rs             | 18 +++++++++++++-
 drivers/gpu/nova-core/gsp/commands.rs    | 13 +++++++++--
 drivers/gpu/nova-core/gsp/fw/commands.rs | 40 +++++++++++++++++++++++++++++++-
 3 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index a34114d3afcb..42dabcc1b3e4 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -9,7 +9,8 @@
     io::Io,
     num::Bounded,
     pci,
-    prelude::*, //
+    prelude::*,
+    sizes::SizeConstants, //
 };
 
 use crate::{
@@ -377,6 +378,21 @@ pub(crate) fn new(
                     Err(e) => dev_warn!(pdev, "GPU name unavailable: {:?}\n", e),
                 }
 
+                if !info.usable_fb_regions.is_empty() {
+                    dev_info!(pdev, "Usable FB regions:\n");
+                    for region in &info.usable_fb_regions {
+                        dev_info!(pdev, "  - {:#x?}\n", region);
+                    }
+
+                    dev_info!(
+                        pdev,
+                        "Total usable VRAM: {} MiB\n",
+                        info.usable_fb_regions.iter().fold(0u64, |res, region| res
+                            .saturating_add(region.end - region.start))
+                            / u64::SZ_1M
+                    );
+                }
+
                 info
             }
         })
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index f84de9f4f045..86a3747cd31c 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -5,6 +5,7 @@
     array,
     convert::Infallible,
     ffi::FromBytesUntilNulError,
+    ops::Range,
     str::Utf8Error, //
 };
 
@@ -191,22 +192,30 @@ fn init(&self) -> impl Init<Self::Command, Self::InitError> {
     }
 }
 
-/// The reply from the GSP to the [`GetGspInfo`] command.
+/// The reply from the GSP to the [`GetGspStaticInfo`] command.
 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 = Infallible;
+    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,
         })
     }
 }
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 7bcc41fc7fa0..ebdc12bcd4e3 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
+use core::ops::Range;
+
 use kernel::{
     device,
     pci,
@@ -13,7 +15,8 @@
 
 use crate::{
     gpu::Chipset,
-    gsp::GSP_PAGE_SIZE, //
+    gsp::GSP_PAGE_SIZE,
+    num::IntoSafeCast, //
 };
 
 use super::bindings;
@@ -129,6 +132,41 @@ impl GspStaticConfigInfo {
     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.

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount
  2026-06-17 13:24 [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
                   ` (2 preceding siblings ...)
  2026-06-17 13:24 ` [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP Alexandre Courbot
@ 2026-06-20 10:49 ` Alexandre Courbot
  3 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-06-20 10:49 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Benno Lossin, Gary Guo
  Cc: nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alexandre Courbot, Eliot Courtney, Joel Fernandes

On Wed Jun 17, 2026 at 10:24 PM JST, Alexandre Courbot wrote:
>       gpu: nova-core: move GSP unload state to a pinned Gpu subobject
>       gpu: nova-core: move GPU static information acquisition to a GSP method

These two pushed to drm-rust-next, thanks!

>       gpu: nova-core: gsp: Extract and display usable FB regions from GSP

Waiting for a review tag to push this one as well, since it has changed
a bit.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP
  2026-06-17 13:24 ` [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP Alexandre Courbot
@ 2026-06-20 11:30   ` Danilo Krummrich
  2026-06-20 14:06     ` Alexandre Courbot
  0 siblings, 1 reply; 8+ messages in thread
From: Danilo Krummrich @ 2026-06-20 11:30 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Alice Ryhl, David Airlie, Simona Vetter, Benno Lossin, Gary Guo,
	nova-gpu, dri-devel, linux-kernel, rust-for-linux, Joel Fernandes

On Wed Jun 17, 2026 at 3:24 PM CEST, Alexandre Courbot wrote:
> @@ -377,6 +378,21 @@ pub(crate) fn new(
>                      Err(e) => dev_warn!(pdev, "GPU name unavailable: {:?}\n", e),
>                  }
>  
> +                if !info.usable_fb_regions.is_empty() {
> +                    dev_info!(pdev, "Usable FB regions:\n");
> +                    for region in &info.usable_fb_regions {
> +                        dev_info!(pdev, "  - {:#x?}\n", region);
> +                    }
> +
> +                    dev_info!(
> +                        pdev,
> +                        "Total usable VRAM: {} MiB\n",
> +                        info.usable_fb_regions.iter().fold(0u64, |res, region| res
> +                            .saturating_add(region.end - region.start))
> +                            / u64::SZ_1M
> +                    );
> +                }

Drivers should generally remain silent when they work properly, some exceptions
are fine, but this seems too verbose. Let's use dev_dbg!() instead.

Also, would it make sense to (rather) warn in the else case? (I think OpenRM
treats this as error, although the check in OpenRM checks whether there are no
regions at all.)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP
  2026-06-20 11:30   ` Danilo Krummrich
@ 2026-06-20 14:06     ` Alexandre Courbot
  2026-06-20 14:26       ` Danilo Krummrich
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Courbot @ 2026-06-20 14:06 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: Alice Ryhl, David Airlie, Simona Vetter, Benno Lossin, Gary Guo,
	nova-gpu, dri-devel, linux-kernel, rust-for-linux, Joel Fernandes

On Sat Jun 20, 2026 at 8:30 PM JST, Danilo Krummrich wrote:
> On Wed Jun 17, 2026 at 3:24 PM CEST, Alexandre Courbot wrote:
>> @@ -377,6 +378,21 @@ pub(crate) fn new(
>>                      Err(e) => dev_warn!(pdev, "GPU name unavailable: {:?}\n", e),
>>                  }
>>  
>> +                if !info.usable_fb_regions.is_empty() {
>> +                    dev_info!(pdev, "Usable FB regions:\n");
>> +                    for region in &info.usable_fb_regions {
>> +                        dev_info!(pdev, "  - {:#x?}\n", region);
>> +                    }
>> +
>> +                    dev_info!(
>> +                        pdev,
>> +                        "Total usable VRAM: {} MiB\n",
>> +                        info.usable_fb_regions.iter().fold(0u64, |res, region| res
>> +                            .saturating_add(region.end - region.start))
>> +                            / u64::SZ_1M
>> +                    );
>> +                }
>
> Drivers should generally remain silent when they work properly, some exceptions
> are fine, but this seems too verbose. Let's use dev_dbg!() instead.

Right, it seemed useful for the time being to display some information
since that's all the driver is currently able to do, but I'll change it
to `dev_dbg!`.

>
> Also, would it make sense to (rather) warn in the else case? (I think OpenRM
> treats this as error, although the check in OpenRM checks whether there are no
> regions at all.)

I expect that the users of the VRAM regions (i.e. the MM subsystem) will
not be able to contruct properly if no region is detected, and that sounds
like the right place to raise an error rather than making an assumption
here that no VRAM region is an error. For instance, I am not sure what
the regions layout will be on Tegra systems, although your comment about
OpenRM seems to hint that there are regions defined for them as well.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP
  2026-06-20 14:06     ` Alexandre Courbot
@ 2026-06-20 14:26       ` Danilo Krummrich
  0 siblings, 0 replies; 8+ messages in thread
From: Danilo Krummrich @ 2026-06-20 14:26 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Alice Ryhl, David Airlie, Simona Vetter, Benno Lossin, Gary Guo,
	nova-gpu, dri-devel, linux-kernel, rust-for-linux, Joel Fernandes

On Sat Jun 20, 2026 at 4:06 PM CEST, Alexandre Courbot wrote:
> I expect that the users of the VRAM regions (i.e. the MM subsystem) will
> not be able to contruct properly if no region is detected, and that sounds
> like the right place to raise an error rather than making an assumption
> here that no VRAM region is an error. For instance, I am not sure what
> the regions layout will be on Tegra systems, although your comment about
> OpenRM seems to hint that there are regions defined for them as well.

Well, the question is whether it would just be an assumption that no VRAM region
is an error. I'm not entirely sure, but I think it generally is an error. If
that's confirmed I'd rather fail early and with a clear message, and not carry
on with something we already know won't work out.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-06-20 14:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 13:24 [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
2026-06-17 13:24 ` [PATCH v3 1/3] gpu: nova-core: move GSP unload state to a pinned Gpu subobject Alexandre Courbot
2026-06-17 13:24 ` [PATCH v3 2/3] gpu: nova-core: move GPU static information acquisition to a GSP method Alexandre Courbot
2026-06-17 13:24 ` [PATCH v3 3/3] gpu: nova-core: gsp: Extract and display usable FB regions from GSP Alexandre Courbot
2026-06-20 11:30   ` Danilo Krummrich
2026-06-20 14:06     ` Alexandre Courbot
2026-06-20 14:26       ` Danilo Krummrich
2026-06-20 10:49 ` [PATCH v3 0/3] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox