From: John Hubbard <jhubbard@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>
Cc: "Timur Tabi" <ttabi@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"Zhi Wang" <zhiw@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>,
"John Hubbard" <jhubbard@nvidia.com>
Subject: [PATCH v2 09/31] gpu: nova-core: add LIBOS3 log buffers and state monitor buffer
Date: Fri, 21 Aug 2026 18:54:26 -0700 [thread overview]
Message-ID: <20260822015448.238214-10-jhubbard@nvidia.com> (raw)
In-Reply-To: <20260822015448.238214-1-jhubbard@nvidia.com>
GSP-RM on the new firmware logs from six LIBOS3 tasks on GA102 and
later, where r570 logs from three, and it maps a small buffer during
init to report RM state for diagnostics. Turing and GA100 run LIBOS2,
where only the init and RM task logs exist. Two of the six task logs are
a single page, where the rest are 64KB.
Allocate the three missing log buffers and the state monitor buffer,
give the log buffer type a const page count so the single-page buffers
can exist, and expose the new log buffers through the debugfs directory
that already carries the others.
Nothing passes these to GSP-RM yet. The libos init arguments gain them
when the driver switches to the new firmware.
Assisted-by: Cursor:claude-opus-5
Reviewed-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
drivers/gpu/nova-core/gsp.rs | 66 ++++++++++++++++++++++++++----------
1 file changed, 49 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index f9a622edf299..de5cf3914949 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -82,7 +82,6 @@ pub(crate) fn dev(&self) -> &'gpu device::Device<device::Bound> {
/// Number of GSP pages to use in a RM log buffer.
const RM_LOG_BUFFER_NUM_PAGES: usize = 0x10;
-const LOG_BUFFER_SIZE: usize = RM_LOG_BUFFER_NUM_PAGES * GSP_PAGE_SIZE;
/// Array of page table entries, as understood by the GSP bootloader.
#[repr(C)]
@@ -118,9 +117,20 @@ fn init(view: CoherentView<'_, Self>, start: DmaAddress) -> Result<()> {
/// then pp points to index into the buffer where the next logging entry will
/// be written. Therefore, the logging data is valid if:
/// 1 <= pp < sizeof(buffer)/sizeof(u64)
-struct LogBuffer(Coherent<[u8; LOG_BUFFER_SIZE]>);
+struct LogBuffer<const NUM_PAGES: usize>(Coherent<[[u8; GSP_PAGE_SIZE]; NUM_PAGES]>);
-impl LogBuffer {
+/// Log buffer for a task that GSP-RM logs to at its default size.
+///
+/// Matches the registry defaults for the init, interrupt, RM, and MNOC tasks
+/// (`NV_REG_STR_RM_GSP_LOG_BUFFER_SIZE_TASK_*_DEFAULT`).
+type TaskLogBuffer = LogBuffer<RM_LOG_BUFFER_NUM_PAGES>;
+
+/// Log buffer for a task that GSP-RM gives a single page.
+///
+/// Matches the size GSP-RM hardcodes for the root and RM state monitor tasks.
+type SmallLogBuffer = LogBuffer<1>;
+
+impl<const NUM_PAGES: usize> LogBuffer<NUM_PAGES> {
/// Creates a new `LogBuffer` mapped on `dev`.
fn new(dev: &device::Device<device::Bound>) -> Result<Self> {
let obj = Self(Coherent::zeroed(dev, GFP_KERNEL)?);
@@ -129,22 +139,35 @@ fn new(dev: &device::Device<device::Bound>) -> Result<Self> {
let pte_view = io_project!(
obj.0,
- [build: size_of::<u64>()..][build: ..RM_LOG_BUFFER_NUM_PAGES * size_of::<u64>()]
+ [build: 0][build: size_of::<u64>()..][build: ..NUM_PAGES * size_of::<u64>()]
)
- .try_cast::<PteArray<RM_LOG_BUFFER_NUM_PAGES>>()?;
+ .try_cast::<PteArray<NUM_PAGES>>()?;
PteArray::init(pte_view, start_addr)?;
Ok(obj)
}
}
+/// Log buffers used by GSP-RM for debug logging.
+///
+/// r000+ firmware expects log buffers for all LIBOS3 tasks. Each buffer is
+/// registered as a libos memory region entry, identified by its id8 name.
+///
+/// The Open RM equivalents are `_kgspInitLibosLoggingStructures`, which allocates the buffers,
+/// and `kgspSetupLibosInitArgs_IMPL`, which builds the `pLibosInitArgs[]` array.
struct LogBuffers {
- /// Init log buffer.
- loginit: LogBuffer,
- /// Interrupts log buffer.
- logintr: LogBuffer,
- /// RM log buffer.
- logrm: LogBuffer,
+ /// Init task log buffer (LOGINIT).
+ loginit: TaskLogBuffer,
+ /// Interrupt task log buffer (LOGINTR).
+ logintr: TaskLogBuffer,
+ /// RM task log buffer (LOGRM).
+ logrm: TaskLogBuffer,
+ /// MNOC task log buffer (LOGMNOC).
+ logmnoc: TaskLogBuffer,
+ /// Root task log buffer (LOGROOT).
+ logroot: SmallLogBuffer,
+ /// RM state monitor task log buffer (LOGRMON).
+ logrmon: SmallLogBuffer,
}
/// GSP runtime data.
@@ -159,6 +182,8 @@ pub(crate) struct Gsp {
pub(crate) cmdq: Arc<Cmdq>,
/// RM arguments.
rmargs: Coherent<GspArgumentsPadded>,
+ /// RM state monitor buffer (required by r000+ GSP-RM for diagnostics).
+ rm_state_monitor: Coherent<[u8; GSP_PAGE_SIZE]>,
}
impl Gsp {
@@ -167,16 +192,17 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> impl PinInit<Self, Error
pin_init::pin_init_scope(move || {
let dev = pdev.as_ref();
- let loginit = LogBuffer::new(dev)?;
- let logintr = LogBuffer::new(dev)?;
- let logrm = LogBuffer::new(dev)?;
+ let loginit = TaskLogBuffer::new(dev)?;
+ let logintr = TaskLogBuffer::new(dev)?;
+ let logrm = TaskLogBuffer::new(dev)?;
+ let logmnoc = TaskLogBuffer::new(dev)?;
+ let logroot = SmallLogBuffer::new(dev)?;
+ let logrmon = SmallLogBuffer::new(dev)?;
- // Initialise the logging structures. The OpenRM equivalents are in:
- // _kgspInitLibosLoggingStructures (allocates memory for buffers)
- // kgspSetupLibosInitArgs_IMPL (creates pLibosInitArgs[] array)
Ok(try_pin_init!(Self {
cmdq: Arc::pin_init(Cmdq::new(dev), GFP_KERNEL)?,
rmargs: Coherent::init(dev, GFP_KERNEL, GspArgumentsPadded::new(cmdq.as_ref()))?,
+ rm_state_monitor: Coherent::zeroed(dev, GFP_KERNEL)?,
libos: {
let mut libos = CoherentBox::zeroed_slice(
dev,
@@ -196,6 +222,9 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> impl PinInit<Self, Error
loginit,
logintr,
logrm,
+ logmnoc,
+ logroot,
+ logrmon,
};
#[allow(static_mut_refs)]
@@ -212,6 +241,9 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> impl PinInit<Self, Error
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);
})
},
}))
--
2.55.0
next prev parent reply other threads:[~2026-08-22 1:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 1:54 [PATCH v2 00/31] gpu: nova-core: boot on the r000 GSP firmware John Hubbard
2026-08-22 1:54 ` [PATCH v2 01/31] rust: pci: add domain_nr() accessor John Hubbard
2026-08-22 7:57 ` Miguel Ojeda
2026-08-22 20:11 ` John Hubbard
2026-08-23 0:08 ` Alexandre Courbot
2026-08-22 1:54 ` [PATCH v2 02/31] gpu: nova-core: firmware: add r000 bindings John Hubbard
2026-08-22 1:54 ` [PATCH v2 03/31] gpu: nova-core: extract radix3 page table into its own module John Hubbard
2026-08-22 1:54 ` [PATCH v2 04/31] gpu: nova-core: set MCTP transport header version to 1 John Hubbard
2026-08-22 1:54 ` [PATCH v2 05/31] gpu: nova-core: add Falcon helpers for r000 LOAD_EXEC events John Hubbard
2026-08-22 1:54 ` [PATCH v2 06/31] gpu: nova-core: zero-pad radix3 page table levels to page boundary John Hubbard
2026-08-22 1:54 ` [PATCH v2 07/31] gpu: nova-core: distinguish async GSP RPC traffic in debug logs John Hubbard
2026-08-22 1:54 ` [PATCH v2 08/31] gpu: nova-core: add optional ucodes firmware loading John Hubbard
2026-08-23 16:26 ` M Henning
2026-08-22 1:54 ` John Hubbard [this message]
2026-08-22 1:54 ` [PATCH v2 10/31] gpu: nova-core: add build ID headers to debugfs log buffer dumps John Hubbard
2026-08-22 1:54 ` [PATCH v2 11/31] gpu: nova-core: rename the FbRanges elf field to fw_image John Hubbard
2026-08-22 1:54 ` [PATCH v2 12/31] gpu: nova-core: regs: add msgq v2 BAR0 register declarations John Hubbard
2026-08-22 1:54 ` [PATCH v2 13/31] gpu: nova-core: gsp: add msgq v2 internals John Hubbard
2026-08-22 1:54 ` [PATCH v2 14/31] gpu: nova-core: generalize allocate_command() for variable headers John Hubbard
2026-08-22 1:54 ` [PATCH v2 15/31] gpu: nova-core: add GMC API message types John Hubbard
2026-08-22 1:54 ` [PATCH v2 16/31] gpu: nova-core: add GMC send path John Hubbard
2026-08-22 1:54 ` [PATCH v2 17/31] gpu: nova-core: add GMC transport receive path John Hubbard
2026-08-22 1:54 ` [PATCH v2 18/31] gpu: nova-core: gsp: add GMC dispatch on receive John Hubbard
2026-08-22 1:54 ` [PATCH v2 19/31] gpu: nova-core: separate the generic falcon bootloader from FWSEC John Hubbard
2026-08-22 1:54 ` [PATCH v2 20/31] gpu: nova-core: handle the r000 load-and-execute HS binary event John Hubbard
2026-08-22 1:54 ` [PATCH v2 21/31] gpu: nova-core: handle the r000 load-and-execute bootloader event John Hubbard
2026-08-22 1:54 ` [PATCH v2 22/31] gpu: nova-core: gsp: add the GMC boot event dispatcher John Hubbard
2026-08-22 1:54 ` [PATCH v2 23/31] gpu: nova-core: gsp: add the GSP_INIT request builder John Hubbard
2026-08-22 1:54 ` [PATCH v2 24/31] gpu: nova-core: gsp: send GSP_INIT and decode its reply John Hubbard
2026-08-22 1:54 ` [PATCH v2 25/31] gpu: nova-core: gsp: pass the remaining log buffers to GSP-RM John Hubbard
2026-08-22 1:54 ` [PATCH v2 27/31] gpu: nova-core: gsp: validate RPC element framing on receive John Hubbard
2026-08-22 1:54 ` [PATCH v2 28/31] gpu: nova-core: gsp: remove the RPCs that GSP_INIT replaced John Hubbard
2026-08-22 1:54 ` [PATCH v2 30/31] gpu: nova-core: print GMC command names in debug logs John Hubbard
2026-08-22 1:54 ` [PATCH v2 31/31] gpu: nova-core: distinguish GMC event and response " 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=20260822015448.238214-10-jhubbard@nvidia.com \
--to=jhubbard@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=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 \
--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