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 4/4] gpu: nova-core: gsp: distinguish GMC events from responses in debug logs
Date: Thu, 17 Sep 2026 19:12:49 -0700 [thread overview]
Message-ID: <20260918021249.1187837-5-jhubbard@nvidia.com> (raw)
In-Reply-To: <20260918021249.1187837-1-jhubbard@nvidia.com>
GSP-RM numbers its GMC events from bit 63 upward, apart from the
driver's request numbers, and marks a response with a flag in the
command word.
The GMC receive debug line printed the raw sequence and labeled every
element a receive:
GSP GMC: receive: seq# 9223372036854775808, command=EXEC_GENERIC_BOOTLOADER (0x10002), length=0xb0
GSP GMC: receive: seq# 0, command=GSP_INIT (0x10001), length=0x450
Print the sequence with bit 63 cleared, and label each received element
an event or a response by the flag:
GSP GMC: event: seq# 0, command=EXEC_GENERIC_BOOTLOADER (0x10002), length=0xb0
GSP GMC: response: seq# 0, command=GSP_INIT (0x10001), length=0x450
Assisted-by: LLM
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
drivers/gpu/nova-core/gsp/cmdq.rs | 35 +++++++++++++++++++++++--------
drivers/gpu/nova-core/gsp/fw.rs | 11 +++++++++-
2 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
index 2b53b1e6cebf..530ad51304ce 100644
--- a/drivers/gpu/nova-core/gsp/cmdq.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq.rs
@@ -1062,10 +1062,17 @@ fn log_event(&self, function: Result<MsgFunction, u32>, seq: u32) {
/// Logs a GMC message that no caller is waiting for: a response to a request that has already
/// timed out, or an event that arrives outside the boot sequence.
fn log_gmc_event(&self, header: &GspGmcMsgElement) {
+ let kind = if header.gmc.is_response() {
+ "response"
+ } else {
+ "event"
+ };
+
dev_warn!(
&self.dev,
- "GSP GMC: dropping unclaimed message (seq {}, command={})\n",
- header.gmc.sequence,
+ "GSP GMC: dropping unclaimed {} (seq# {}, command={})\n",
+ kind,
+ header.gmc.sequence_number(),
GmcCommand(header.gmc.command_id()),
);
}
@@ -1268,13 +1275,23 @@ fn consume_element<R>(
message.header.function(),
message.header.length(),
),
- QueueElement::Gmc(message) => dev_dbg!(
- &self.dev,
- "GSP GMC: receive: seq# {}, command={}, length=0x{:x}\n",
- message.header.gmc.sequence,
- GmcCommand(message.header.gmc.command_id()),
- message.header.length(),
- ),
+ QueueElement::Gmc(message) => {
+ let gmc = &message.header.gmc;
+ let kind = if gmc.is_response() {
+ "response"
+ } else {
+ "event"
+ };
+
+ dev_dbg!(
+ &self.dev,
+ "GSP GMC: {}: seq# {}, command={}, length=0x{:x}\n",
+ kind,
+ gmc.sequence_number(),
+ GmcCommand(gmc.command_id()),
+ message.header.length(),
+ )
+ }
}
let result = f(self, element);
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 106d71f95fc3..ec474a175ee6 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -729,6 +729,10 @@ pub(crate) struct GmcApiHeader {
/// Flag bit of [`GmcApiHeader::command`] that GSP-RM sets on a response.
const GMCAPI_COMMAND_FLAGS_RESPONSE: u32 = 0x0100_0000;
+/// First sequence number of the space that GSP-RM numbers its events from, so that an event's
+/// number cannot collide with a request's. Requests are numbered from zero.
+const GMC_EVENT_SEQUENCE_BASE: u64 = 1 << 63;
+
/// GMC request that carries the system information and registry keys to GSP-RM. GSP-RM answers
/// it with the static GPU configuration once it has finished starting.
pub(crate) const GMCAPI_CMD_GSP_INIT: u32 = bindings::GMCAPI_COMMANDS_GMCAPI_CMD_GSP_INIT;
@@ -776,10 +780,15 @@ pub(crate) fn command_id(&self) -> u32 {
}
/// Returns `true` if GSP-RM sent this header as a response rather than an event.
- fn is_response(&self) -> bool {
+ pub(crate) fn is_response(&self) -> bool {
self.command & GMCAPI_COMMAND_FLAGS_RESPONSE != 0
}
+ /// Returns the sequence number without the bit that marks an event's sequence space.
+ pub(crate) fn sequence_number(&self) -> u64 {
+ self.sequence & !GMC_EVENT_SEQUENCE_BASE
+ }
+
/// Returns the `NV_STATUS` that a response carries.
///
/// The value is meaningful only when [`Self::is_response`] is `true`. In a request, the same
--
2.55.0
prev parent reply other threads:[~2026-09-18 2:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 2:12 [PATCH 0/4] gpu: nova-core: debug logging essentials for r000 John Hubbard
2026-09-18 2:12 ` [PATCH 1/4] gpu: nova-core: record the BOOT_42 implementation field in the GPU spec John Hubbard
2026-09-18 2:12 ` [PATCH 2/4] gpu: nova-core: enable decoding of the GSP firmware logs John Hubbard
2026-09-18 2:12 ` [PATCH 3/4] gpu: nova-core: gsp: print GMC command names in debug logs John Hubbard
2026-09-18 2:12 ` John Hubbard [this message]
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=20260918021249.1187837-5-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
all inboxes | Powered by JetHome®