mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Courbot <acourbot@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
	 Alistair Popple <apopple@nvidia.com>,
	Timur Tabi <ttabi@nvidia.com>,
	 Eliot Courtney <ecourtney@nvidia.com>,
	Zhi Wang <zhiw@nvidia.com>,
	 nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
	 linux-kernel@vger.kernel.org,
	Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH v4 6/6] gpu: nova-core: gsp: logbuffer: add LIBOS3 log buffers and state monitor buffer
Date: Tue, 01 Dec 2026 17:15:52 +0900	[thread overview]
Message-ID: <20261201-nova-r000-staging-v4-6-de45770a47a1@nvidia.com> (raw)
In-Reply-To: <20261201-nova-r000-staging-v4-0-de45770a47a1@nvidia.com>

From: John Hubbard <jhubbard@nvidia.com>

GSP-RM runs on LibOS, and each LibOS task logs into a buffer that the
driver provides and names in the init argument array. On GA102 and
later, the r000 firmware runs LIBOS3, version 3 of LibOS, which has six
logging tasks. LIBOS3 also expects one more page, the state monitor
buffer, in which GSP-RM reports its own state. On Turing and GA100 the
r000 firmware runs LIBOS2, which maps only the init and RM log buffers
and skips the names that it does not have.

Nova-core allocates log buffers for three of the six tasks, and no state
monitor buffer.

Allocate the three missing log buffers and the state monitor buffer, and
name every log buffer in the init argument array. Give each new log a
debugfs file next to the existing ones, and retain it after unbind under
the same module parameter as the existing ones.

This is part of the r000 support. As it comes before the switch, the
r570 firmware is passed the three new log buffers too, and nothing uses
the state monitor buffer until the switch.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Co-developed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp.rs           |  3 ++
 drivers/gpu/nova-core/gsp/logbuffer.rs | 64 ++++++++++++++++++++++++++++++++--
 2 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index 28bd76626cf6..27ff2e8b7f5e 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -143,6 +143,8 @@ pub(crate) struct Gsp<'gsp> {
     pub(crate) cmdq: Cmdq<'gsp>,
     /// RM arguments.
     rmargs: Coherent<'gsp, GspArgumentsPadded>,
+    /// Buffer in which GSP-RM reports its own state.
+    rm_state_monitor: Coherent<'gsp, [u8; GSP_PAGE_SIZE]>,
 }
 
 impl<'gsp> Gsp<'gsp> {
@@ -162,6 +164,7 @@ pub(crate) fn new(
             Ok(try_pin_init!(Self {
                 cmdq <- Cmdq::new(dev, bar),
                 rmargs: Coherent::init(dev, GFP_KERNEL, GspArgumentsPadded::new(&cmdq))?,
+                rm_state_monitor: Coherent::zeroed(dev, GFP_KERNEL)?,
                 libos: {
                     let mut libos = LibosInitArgs::new(dev)?;
                     log_buffers.init_arguments(&mut libos)?;
diff --git a/drivers/gpu/nova-core/gsp/logbuffer.rs b/drivers/gpu/nova-core/gsp/logbuffer.rs
index 124e6aee2c63..5a9d5bd9992f 100644
--- a/drivers/gpu/nova-core/gsp/logbuffer.rs
+++ b/drivers/gpu/nova-core/gsp/logbuffer.rs
@@ -51,10 +51,14 @@ pub(super) struct LogBuffer<'a, const NUM_PAGES: usize>(
 
 /// A log buffer at the default size, [`RM_LOG_BUFFER_NUM_PAGES`] pages.
 ///
-/// Matches the registry defaults for the init, interrupt and RM tasks
+/// Matches the registry defaults for the init, interrupt, RM and MNOC tasks
 /// (`NV_REG_STR_RM_GSP_LOG_BUFFER_SIZE_TASK_*_DEFAULT`).
 type TaskLogBuffer<'a> = LogBuffer<'a, RM_LOG_BUFFER_NUM_PAGES>;
 
+/// A single-page log buffer, the size of the logs of the root task and of the RM state monitor
+/// task.
+type SmallLogBuffer<'a> = LogBuffer<'a, 1>;
+
 impl<'a, const NUM_PAGES: usize> LogBuffer<'a, NUM_PAGES> {
     /// Creates a new `LogBuffer` mapped on `dev`.
     fn new(dev: &'a device::Device<device::Bound>) -> Result<Self> {
@@ -98,6 +102,10 @@ fn snapshot(&self) -> Result<VVec<u8>> {
     }
 }
 
+/// The log buffers to which GSP-RM writes its debug output, one per LIBOS3 task.
+///
+/// The r000 firmware runs LIBOS3 on GA102 and later, and LIBOS2 on Turing and GA100. LIBOS2 maps
+/// only the init and RM log buffers, and skips the names that it does not have.
 pub(super) struct LogBuffers<'a> {
     /// Device the buffers belong to.
     dev: &'a device::Device<device::Bound>,
@@ -107,6 +115,12 @@ pub(super) struct LogBuffers<'a> {
     logintr: TaskLogBuffer<'a>,
     /// RM log buffer.
     logrm: TaskLogBuffer<'a>,
+    /// MNOC log buffer.
+    logmnoc: TaskLogBuffer<'a>,
+    /// Root task log buffer.
+    logroot: SmallLogBuffer<'a>,
+    /// RM state monitor task log buffer.
+    logrmon: SmallLogBuffer<'a>,
 }
 
 impl<'a> LogBuffers<'a> {
@@ -117,6 +131,9 @@ pub(super) fn new(dev: &'a device::Device<device::Bound>) -> Result<Self> {
             loginit: TaskLogBuffer::new(dev)?,
             logintr: TaskLogBuffer::new(dev)?,
             logrm: TaskLogBuffer::new(dev)?,
+            logmnoc: TaskLogBuffer::new(dev)?,
+            logroot: SmallLogBuffer::new(dev)?,
+            logrmon: SmallLogBuffer::new(dev)?,
         })
     }
 
@@ -130,7 +147,19 @@ pub(super) fn init_arguments(&self, libos: &mut LibosInitArgs<'_>) -> Result {
             "LOGINTR",
             &self.logintr.0,
         ))?;
-        libos.push(LibosMemoryRegionInitArgument::new("LOGRM", &self.logrm.0))
+        libos.push(LibosMemoryRegionInitArgument::new("LOGRM", &self.logrm.0))?;
+        libos.push(LibosMemoryRegionInitArgument::new(
+            "LOGMNOC",
+            &self.logmnoc.0,
+        ))?;
+        libos.push(LibosMemoryRegionInitArgument::new(
+            "LOGROOT",
+            &self.logroot.0,
+        ))?;
+        libos.push(LibosMemoryRegionInitArgument::new(
+            "LOGRMON",
+            &self.logrmon.0,
+        ))
     }
 
     /// Exposes the buffers in debugfs, in a directory named after their device.
@@ -145,6 +174,9 @@ pub(super) fn into_debugfs_scope(self) -> impl PinInit<debugfs::Scope<Self>> + '
             dir.read_binary_file(c"loginit", &logs.loginit.0);
             dir.read_binary_file(c"logintr", &logs.logintr.0);
             dir.read_binary_file(c"logrm", &logs.logrm.0);
+            dir.read_binary_file(c"logmnoc", &logs.logmnoc.0);
+            dir.read_binary_file(c"logroot", &logs.logroot.0);
+            dir.read_binary_file(c"logrmon", &logs.logrmon.0);
         })
     }
 
@@ -159,6 +191,9 @@ fn retain(&self) -> Result {
             loginit: self.loginit.snapshot()?,
             logintr: self.logintr.snapshot()?,
             logrm: self.logrm.snapshot()?,
+            logmnoc: self.logmnoc.snapshot()?,
+            logroot: self.logroot.snapshot()?,
+            logrmon: self.logrmon.snapshot()?,
         };
 
         if logs.is_empty() {
@@ -181,6 +216,15 @@ fn retain(&self) -> Result {
             if !logs.logrm.is_empty() {
                 dir.read_binary_file(c"logrm", &logs.logrm);
             }
+            if !logs.logmnoc.is_empty() {
+                dir.read_binary_file(c"logmnoc", &logs.logmnoc);
+            }
+            if !logs.logroot.is_empty() {
+                dir.read_binary_file(c"logroot", &logs.logroot);
+            }
+            if !logs.logrmon.is_empty() {
+                dir.read_binary_file(c"logrmon", &logs.logrmon);
+            }
         }))?;
 
         retained.push(scope)
@@ -205,6 +249,12 @@ struct RetainedLogBuffers {
     logintr: VVec<u8>,
     /// RM log buffer, empty if never written to.
     logrm: VVec<u8>,
+    /// MNOC log buffer, empty if never written to.
+    logmnoc: VVec<u8>,
+    /// Root task log buffer, empty if never written to.
+    logroot: VVec<u8>,
+    /// RM state monitor task log buffer, empty if never written to.
+    logrmon: VVec<u8>,
 }
 
 impl RetainedLogBuffers {
@@ -215,9 +265,17 @@ fn is_empty(&self) -> bool {
             loginit,
             logintr,
             logrm,
+            logmnoc,
+            logroot,
+            logrmon,
         } = self;
 
-        loginit.is_empty() && logintr.is_empty() && logrm.is_empty()
+        loginit.is_empty()
+            && logintr.is_empty()
+            && logrm.is_empty()
+            && logmnoc.is_empty()
+            && logroot.is_empty()
+            && logrmon.is_empty()
     }
 }
 

-- 
2.56.1


  parent reply	other threads:[~2026-12-01  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  8:15 [PATCH v4 0/6] gpu: nova-core: gsp: preparatory patches for the r000 firmware Alexandre Courbot
2026-12-01  8:15 ` [PATCH v4 1/6] gpu: nova-core: gsp: add the r000 queue element header Alexandre Courbot
2026-12-01 14:12   ` Danilo Krummrich
2026-12-01  8:15 ` [PATCH v4 2/6] gpu: nova-core: firmware: tlv: add method to load the file referenced by a TLV Alexandre Courbot
2026-12-01  8:15 ` [PATCH v4 3/6] gpu: nova-core: gsp: logbuffer: add LogBuffers::init_arguments() Alexandre Courbot
2026-12-01 14:22   ` Danilo Krummrich
2026-12-01  8:15 ` [PATCH v4 4/6] gpu: nova-core: gsp: logbuffer: make LogBuffer generic over its size Alexandre Courbot
2026-12-01  8:15 ` [PATCH v4 5/6] gpu: nova-core: gsp: logbuffer: add RetainedLogBuffers::is_empty() Alexandre Courbot
2026-12-01  8:15 ` Alexandre Courbot [this message]
2026-12-01  8:48   ` [PATCH v4 6/6] gpu: nova-core: gsp: logbuffer: add LIBOS3 log buffers and state monitor buffer Eliot Courtney
2026-12-01 14:23 ` [PATCH v4 0/6] gpu: nova-core: gsp: preparatory patches for the r000 firmware Danilo Krummrich

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=20261201-nova-r000-staging-v4-6-de45770a47a1@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=simona@ffwll.ch \
    --cc=ttabi@nvidia.com \
    --cc=zhiw@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

all inboxes | Powered by JetHome®