* [PATCH 1/5] gpu: nova-core: fsp: compute the FRTS offset like OpenRM 615
2026-12-04 4:16 [PATCH 0/5] gpu: nova-core: r000 follow-up fixes and cleanups Alexandre Courbot
@ 2026-12-04 4:16 ` Alexandre Courbot
2026-12-04 4:16 ` [PATCH 2/5] gpu: nova-core: gsp: match GSP RPC replies by sequence, not just function Alexandre Courbot
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-12-04 4:16 UTC (permalink / raw)
To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
Alexandre Courbot
The FRTS offset sent to FSP is still computed the r570 way: an estimate
of the memory reserved at the end of the framebuffer plus the PMU
region, aligned to 2 MiB.
OpenRM 615 (kfspPrepareBootCommands_GH100) starts from the 128 KiB VGA
workspace instead, and aligns the result to the 128 KiB WPR granularity.
Do the same in Nova.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/fb.rs | 3 +++
drivers/gpu/nova-core/fsp.rs | 19 ++++++-------------
drivers/gpu/nova-core/fsp/hal.rs | 4 ----
drivers/gpu/nova-core/fsp/hal/gb100.rs | 6 ------
drivers/gpu/nova-core/fsp/hal/gb202.rs | 9 +--------
drivers/gpu/nova-core/fsp/hal/gh100.rs | 9 +--------
drivers/gpu/nova-core/gsp/fw.rs | 5 +----
7 files changed, 12 insertions(+), 43 deletions(-)
diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
index 5ceb7760c78e..4893a36d05a7 100644
--- a/drivers/gpu/nova-core/fb.rs
+++ b/drivers/gpu/nova-core/fb.rs
@@ -327,6 +327,9 @@ pub(crate) struct FbSizes {
}
impl FbSizes {
+ /// Size of the VGA workspace at the end of the framebuffer, in bytes.
+ pub(crate) const VGA_WORKSPACE_SIZE: u64 = u64::SZ_128K;
+
/// Computes the framebuffer region sizes for GSP-FMC boot.
pub(crate) fn new(chipset: Chipset, bar: Bar0<'_>, vgpu_state: VgpuState) -> Result<Self> {
let hal = hal::fb_hal(chipset);
diff --git a/drivers/gpu/nova-core/fsp.rs b/drivers/gpu/nova-core/fsp.rs
index 5976a1730981..23150b5f7648 100644
--- a/drivers/gpu/nova-core/fsp.rs
+++ b/drivers/gpu/nova-core/fsp.rs
@@ -253,19 +253,12 @@ struct FspCotMessage {
impl FspCotMessage {
/// Computes the FRTS vidmem offset for the Chain-of-Trust message. It is measured backwards
/// from the end of the framebuffer.
- fn frts_vidmem_offset(hal: &dyn hal::FspHal, fb_info: &FbSizes) -> Result<u64> {
- let mut offset = hal.fb_end_reserved_size();
-
+ fn frts_vidmem_offset(fb_info: &FbSizes) -> Result<u64> {
// As per OpenRM's `kfspPrepareBootCommands_GH100`.
- if fb_info.pmu_reserved_size != 0 {
- offset = (offset + u64::from(fb_info.pmu_reserved_size))
- // This must be aligned to WPR alignment (128 KiB) and be at least 128 KiB in size.
- // 2 MiB satisfies both.
- .align_up(Alignment::SZ_2M)
- .ok_or(EINVAL)?;
- }
-
- Ok(offset)
+ (FbSizes::VGA_WORKSPACE_SIZE + u64::from(fb_info.pmu_reserved_size))
+ // FRTS must start on a WPR boundary.
+ .align_up(Alignment::SZ_128K)
+ .ok_or(EINVAL)
}
/// Returns an in-place initializer for [`FspCotMessage`].
@@ -277,7 +270,7 @@ fn new<'a>(
let hal = hal::fsp_hal(args.chipset).ok_or(ENOTSUPP)?;
let frts_vidmem_offset = if !args.resume {
- Self::frts_vidmem_offset(hal, fb_info)?
+ Self::frts_vidmem_offset(fb_info)?
} else {
0
};
diff --git a/drivers/gpu/nova-core/fsp/hal.rs b/drivers/gpu/nova-core/fsp/hal.rs
index f2de7cc296ce..600121770b07 100644
--- a/drivers/gpu/nova-core/fsp/hal.rs
+++ b/drivers/gpu/nova-core/fsp/hal.rs
@@ -20,10 +20,6 @@ pub(super) trait FspHal: Sync {
/// Returns the FSP Chain of Trust protocol version this chipset advertises.
fn cot_version(&self) -> u16;
- // TODO: consider moving this into the TLV firmware metadata when ready
- /// Returns the size reserved at the end of the framebuffer, in bytes.
- fn fb_end_reserved_size(&self) -> u64;
-
/// Return if the bug 3957833 is affected
fn is_bug_3957833_affected(&self, _bar: Bar0<'_>) -> bool {
false
diff --git a/drivers/gpu/nova-core/fsp/hal/gb100.rs b/drivers/gpu/nova-core/fsp/hal/gb100.rs
index 7cf53aa3d1ff..42f5ecfc6400 100644
--- a/drivers/gpu/nova-core/fsp/hal/gb100.rs
+++ b/drivers/gpu/nova-core/fsp/hal/gb100.rs
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-use kernel::sizes::SizeConstants;
-
use crate::{
driver::Bar0,
fsp::hal::FspHal, //
@@ -19,10 +17,6 @@ fn fsp_boot_status(&self, bar: Bar0<'_>) -> u32 {
fn cot_version(&self) -> u16 {
2
}
-
- fn fb_end_reserved_size(&self) -> u64 {
- u64::SZ_2M + u64::SZ_128K
- }
}
const GB100: Gb100 = Gb100;
diff --git a/drivers/gpu/nova-core/fsp/hal/gb202.rs b/drivers/gpu/nova-core/fsp/hal/gb202.rs
index e380bbc5d58d..1091b169a645 100644
--- a/drivers/gpu/nova-core/fsp/hal/gb202.rs
+++ b/drivers/gpu/nova-core/fsp/hal/gb202.rs
@@ -1,10 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-use kernel::{
- io::Io,
- sizes::SizeConstants, //
-};
+use kernel::io::Io;
use crate::{
driver::Bar0,
@@ -24,10 +21,6 @@ fn fsp_boot_status(&self, bar: Bar0<'_>) -> u32 {
fn cot_version(&self) -> u16 {
2
}
-
- fn fb_end_reserved_size(&self) -> u64 {
- u64::SZ_2M + u64::SZ_128K
- }
}
const GB202: Gb202 = Gb202;
diff --git a/drivers/gpu/nova-core/fsp/hal/gh100.rs b/drivers/gpu/nova-core/fsp/hal/gh100.rs
index 7f6c8e404f30..f00ca29ca2d1 100644
--- a/drivers/gpu/nova-core/fsp/hal/gh100.rs
+++ b/drivers/gpu/nova-core/fsp/hal/gh100.rs
@@ -1,10 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-use kernel::{
- io::Io,
- sizes::SizeConstants, //
-};
+use kernel::io::Io;
use crate::{
driver::Bar0,
@@ -31,10 +28,6 @@ fn cot_version(&self) -> u16 {
1
}
- fn fb_end_reserved_size(&self) -> u64 {
- u64::SZ_2M
- }
-
fn is_bug_3957833_affected(&self, bar: Bar0<'_>) -> bool {
bar.read(NV_GFW_FSP_UCODE_VERSION).is_bug_3957833_affected()
}
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 48e0ea6aaea9..4fb150dfba8b 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -239,9 +239,6 @@ pub(crate) fn from_sizes<'a>(
gsp_firmware: &'a GspFirmware<'_>,
sizes: &'a FbSizes,
) -> impl Init<Self> + 'a {
- /// VGA workspace size to reserve at the end of the framebuffer, in bytes.
- const VGA_WORKSPACE_SIZE: u64 = u64::SZ_128K;
-
let init_inner = init!(bindings::GspFwWprMeta {
// CAST: we want to store the bits of `GSP_FW_WPR_META_MAGIC` unmodified.
magic: bindings::GSP_FW_WPR_META_MAGIC as u64,
@@ -263,7 +260,7 @@ pub(crate) fn from_sizes<'a>(
gspFwHeapSize: sizes.wpr2_heap_size,
frtsSize: sizes.frts_size,
gspFwHeapVfPartitionCount: sizes.vf_partition_count,
- vgaWorkspaceSize: VGA_WORKSPACE_SIZE,
+ vgaWorkspaceSize: FbSizes::VGA_WORKSPACE_SIZE,
pmuReservedSize: sizes.pmu_reserved_size,
..Zeroable::init_zeroed()
});
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/5] gpu: nova-core: gsp: match GSP RPC replies by sequence, not just function
2026-12-04 4:16 [PATCH 0/5] gpu: nova-core: r000 follow-up fixes and cleanups Alexandre Courbot
2026-12-04 4:16 ` [PATCH 1/5] gpu: nova-core: fsp: compute the FRTS offset like OpenRM 615 Alexandre Courbot
@ 2026-12-04 4:16 ` Alexandre Courbot
2026-12-04 4:16 ` [PATCH 3/5] gpu: nova-core: gsp: cmdq: reject GMC messages with inconsistent lengths Alexandre Courbot
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-12-04 4:16 UTC (permalink / raw)
To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
Alexandre Courbot
From: John Hubbard <jhubbard@nvidia.com>
Since r000, GSP-RM copies a command's RPC sequence number into its
reply, alongside the function code. r570 was leaving that field at zero,
meaning nova-core matches a reply on the function code alone and never
sets the sequence in a command, so a reply to a command that has already
timed out can satisfy a later command with the same function code.
Write the sequence number into every RPC command, and require both the
function code and the sequence to match before accepting a reply. A
message with the expected function code and a stale sequence is a late
reply rather than an event, so it is logged and dropped.
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Documentation/gpu/nova/core/interrupts.rst | 5 +++-
drivers/gpu/nova-core/gsp/cmdq/rpc.rs | 46 ++++++++++++++++++++----------
drivers/gpu/nova-core/gsp/fw.rs | 8 +++++-
3 files changed, 42 insertions(+), 17 deletions(-)
diff --git a/Documentation/gpu/nova/core/interrupts.rst b/Documentation/gpu/nova/core/interrupts.rst
index 27fa21f4b10f..a155c0532cfc 100644
--- a/Documentation/gpu/nova/core/interrupts.rst
+++ b/Documentation/gpu/nova/core/interrupts.rst
@@ -583,7 +583,10 @@ GMC replies match on command ID and sequence number, and GMC events arriving
during a wait go to the caller's handler; unclaimed replies and unknown command
IDs are logged at warning level, and other GMC events are dropped.
-The RPC sequence number takes no part in the match.
+A command's reply must carry the RPC sequence number that nova-core wrote into
+the command, as well as its function code to be considered a reply to that
+command. An unsolicited event answers no command, so a caller awaiting one
+matches on the function code alone.
The read pointer advances past every valid element, whether it matched or was
an event. An element that fails framing or message-header validation, or
diff --git a/drivers/gpu/nova-core/gsp/cmdq/rpc.rs b/drivers/gpu/nova-core/gsp/cmdq/rpc.rs
index ffe8b950c1d9..fb7397012804 100644
--- a/drivers/gpu/nova-core/gsp/cmdq/rpc.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq/rpc.rs
@@ -127,7 +127,7 @@ fn write(&self, dev: &device::Device, seq: u32, dst: &mut GspCommand<'_>) -> Res
let (rpc_header, contents) =
RpcMessageHeader::from_bytes_mut_prefix(dst.contents.0).ok_or(EIO)?;
let (cmd, payload_1) = M::Command::from_bytes_mut_prefix(contents).ok_or(EIO)?;
- let rpc_header_init = RpcMessageHeader::init(size_in_bytes, M::FUNCTION);
+ let rpc_header_init = RpcMessageHeader::init(seq, size_in_bytes, M::FUNCTION);
// SAFETY: `rpc_header` is a valid reference, and is not touched if the initializer fails.
unsafe {
pin_init::raw_try_init(core::ptr::from_mut(rpc_header), rpc_header_init)?;
@@ -278,9 +278,9 @@ pub(crate) fn send_rpc_command<M>(&self, command: M) -> Result<M::Reply>
Error: From<<M::Reply as MessageFromGsp>::InitError>,
{
self.with_inner_locked(|inner| {
- inner.send_rpc_command(command)?;
+ let seq = inner.send_rpc_command(command)?;
- inner.await_rpc_msg()
+ inner.await_rpc_msg(Some(seq))
})
}
@@ -298,12 +298,14 @@ pub(crate) fn send_rpc_command_no_wait<M>(&self, command: M) -> Result
M: CommandToGsp<Reply = NoReply>,
Error: From<M::InitError>,
{
- self.with_inner_locked(|inner| inner.send_rpc_command(command))
+ self.with_inner_locked(|inner| inner.send_rpc_command(command).map(|_| ()))
}
/// Waits for an unsolicited GSP event of type `M`. Events that arrive before it are logged and
/// consumed.
///
+ /// Events answer no command and are matched on function code alone.
+ ///
/// The queue mutex is held for the whole wait, up to [`Self::RECEIVE_TIMEOUT`], so no other
/// caller can send a command or consume an event meanwhile.
///
@@ -319,14 +321,15 @@ pub(crate) fn await_rpc_msg<M: MessageFromGsp>(&self) -> Result<M>
// This allows all error types, including `Infallible`, to be used for `M::InitError`.
Error: From<M::InitError>,
{
- self.with_inner_locked(|inner| inner.await_rpc_msg())
+ self.with_inner_locked(|inner| inner.await_rpc_msg(None))
}
}
impl CmdqInner<'_> {
- /// Sends `command` to the GSP.
+ /// Sends `command` to the GSP, and returns the sequence number of its first element.
///
- /// The command may be split into multiple messages if it is large.
+ /// The command may be split into multiple messages if it is large. Each message carries its
+ /// own sequence number, and GSP-RM copies the one of the first message into its reply.
///
/// # Errors
///
@@ -335,29 +338,29 @@ impl CmdqInner<'_> {
/// written to by its [`CommandToGsp::init_variable_payload`] method.
///
/// Error codes returned by the command initializers are propagated as-is.
- fn send_rpc_command<M>(&mut self, command: M) -> Result
+ fn send_rpc_command<M>(&mut self, command: M) -> Result<u32>
where
M: CommandToGsp,
Error: From<M::InitError>,
{
match SplitState::new(command)? {
- SplitState::Single(command) => self
- .send_command_element(RpcCommandElement(command))
- .map(|_| ()),
+ SplitState::Single(command) => self.send_command_element(RpcCommandElement(command)),
SplitState::Split(command, mut continuations) => {
- self.send_command_element(RpcCommandElement(command))?;
+ let seq = self.send_command_element(RpcCommandElement(command))?;
while let Some(continuation) = continuations.next() {
self.send_command_element(RpcCommandElement(continuation))?;
}
- Ok(())
+ Ok(seq)
}
}
}
/// Receives a message of type `M`, waiting up to [`Cmdq::RECEIVE_TIMEOUT`] from the call.
///
+ /// If `expected_seq` is set, then the message must carry that sequence number too.
+ ///
/// Any other message that arrives first is logged as an event and does not extend the
/// deadline.
///
@@ -368,7 +371,7 @@ fn send_rpc_command<M>(&mut self, command: M) -> Result
/// - `EIO` if a message fails framing validation.
///
/// Error codes returned by [`MessageFromGsp::read`] are propagated as-is.
- fn await_rpc_msg<M: MessageFromGsp>(&mut self) -> Result<M>
+ fn await_rpc_msg<M: MessageFromGsp>(&mut self, expected_seq: Option<u32>) -> Result<M>
where
// This allows all error types, including `Infallible`, to be used for `M::InitError`.
Error: From<M::InitError>,
@@ -382,7 +385,10 @@ fn await_rpc_msg<M: MessageFromGsp>(&mut self) -> Result<M>
}
};
let function = rpc_message.header.function();
- if matches!(function, Ok(f) if f == M::FUNCTION) {
+ let seq = rpc_message.header.sequence();
+ let func_matches = matches!(function, Ok(f) if f == M::FUNCTION);
+ let seq_matches = expected_seq.is_none_or(|expected| seq == expected);
+ if func_matches && seq_matches {
let (cmd, contents_1) =
M::Message::from_bytes_prefix(rpc_message.contents.0).ok_or(EIO)?;
let mut sbuffer = SBufferIter::new_reader([contents_1, rpc_message.contents.1]);
@@ -399,6 +405,16 @@ fn await_rpc_msg<M: MessageFromGsp>(&mut self) -> Result<M>
}
})
.map(Some)
+ } else if func_matches {
+ dev_warn!(
+ self.dev,
+ "GSP RPC: dropping stale {:?} reply (seq {}, awaiting {:?})\n",
+ M::FUNCTION,
+ seq,
+ expected_seq,
+ );
+
+ Ok(None)
} else {
rpc_message.log(self.dev);
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 4fb150dfba8b..a576fc86708c 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -478,13 +478,19 @@ pub(crate) struct RpcMessageHeader {
impl RpcMessageHeader {
/// Creates a new RPC header.
///
+ /// `sequence` is the sequence number of the message, which GSP-RM copies into its reply.
/// `cmd_size` is the size in bytes of the payload. `function` is the RPC function of the
/// message.
- pub(crate) fn init(cmd_size: usize, function: MsgFunction) -> impl Init<Self, Error> {
+ pub(crate) fn init(
+ sequence: u32,
+ cmd_size: usize,
+ function: MsgFunction,
+ ) -> impl Init<Self, Error> {
let init_inner = try_init!(bindings::rpc_message_header_v {
header_version: MsgHeaderVersion::new().into(),
signature: bindings::NV_VGPU_MSG_SIGNATURE_VALID,
function: function.into(),
+ sequence,
length: size_of::<Self>()
.checked_add(cmd_size)
.ok_or(EOVERFLOW)
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/5] gpu: nova-core: gsp: cmdq: reject GMC messages with inconsistent lengths
2026-12-04 4:16 [PATCH 0/5] gpu: nova-core: r000 follow-up fixes and cleanups Alexandre Courbot
2026-12-04 4:16 ` [PATCH 1/5] gpu: nova-core: fsp: compute the FRTS offset like OpenRM 615 Alexandre Courbot
2026-12-04 4:16 ` [PATCH 2/5] gpu: nova-core: gsp: match GSP RPC replies by sequence, not just function Alexandre Courbot
@ 2026-12-04 4:16 ` Alexandre Courbot
2026-12-04 4:16 ` [PATCH 4/5] gpu: nova-core: gsp: cmdq: consume elements of unknown NVDM type Alexandre Courbot
2026-12-04 4:16 ` [PATCH 5/5] gpu: nova-core: gsp: boot: ignore events that are not load-and-execute Alexandre Courbot
4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2026-12-04 4:16 UTC (permalink / raw)
To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
Alexandre Courbot
From: John Hubbard <jhubbard@nvidia.com>
GSP-RM writes the payload length of a GMC message twice, in the queue
element header and in the GMC API header. The driver currently only
fails when the element is too short for the payload length in the GMC
API header.
The two lengths must be equal, so fail with EIO when they differ.
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/gsp/cmdq/gmc.rs | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
index 0ddd319e15b7..6565a8fb0e96 100644
--- a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
@@ -204,13 +204,12 @@ pub(crate) struct GmcMessage<'a> {
}
impl<'a> GmcMessage<'a> {
- /// Validates the GMC layer of `element` and returns its GMC API header and its contents trimmed
- /// down to the GMC payload.
+ /// Validates the GMC layer of `element` and returns its GMC API header and its contents.
///
/// # Errors
///
- /// - `EIO` if the element is shorter than the GMC API header, or than the payload length
- /// advertised by the GMC API header.
+ /// - `EIO` if the element is shorter than the GMC API header, or if the GMC API header and
+ /// queue element header advertise different payload lengths.
pub(super) fn parse(dev: &device::Device, element: GspMessage<'a>) -> Result<GmcMessage<'a>> {
static_assert!(
size_of::<QueueElementHeader>() + size_of::<GmcApiHeader>() <= GSP_PAGE_SIZE
@@ -235,9 +234,22 @@ pub(super) fn parse(dev: &device::Device, element: GspMessage<'a>) -> Result<Gmc
payload_size,
);
+ // GSP-RM writes both lengths from the same payload, so a difference means that one of the
+ // two headers is corrupt, and the driver cannot know which.
+ let contents_len = slice_1.len() + slice_2.len();
+ if contents_len != payload_size {
+ dev_err!(
+ dev,
+ "GSP GMC: payload is {} bytes in the queue element header but {} in the GMC API header\n",
+ contents_len,
+ payload_size,
+ );
+ return Err(EIO);
+ }
+
Ok(GmcMessage {
header: gmc_header,
- contents: super::trim_message_slice((slice_1, slice_2), payload_size)?,
+ contents: (slice_1, slice_2),
})
}
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/5] gpu: nova-core: gsp: cmdq: consume elements of unknown NVDM type
2026-12-04 4:16 [PATCH 0/5] gpu: nova-core: r000 follow-up fixes and cleanups Alexandre Courbot
` (2 preceding siblings ...)
2026-12-04 4:16 ` [PATCH 3/5] gpu: nova-core: gsp: cmdq: reject GMC messages with inconsistent lengths Alexandre Courbot
@ 2026-12-04 4:16 ` Alexandre Courbot
2026-12-04 4:29 ` sashiko-bot
2026-12-04 4:16 ` [PATCH 5/5] gpu: nova-core: gsp: boot: ignore events that are not load-and-execute Alexandre Courbot
4 siblings, 1 reply; 8+ messages in thread
From: Alexandre Courbot @ 2026-12-04 4:16 UTC (permalink / raw)
To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
Alexandre Courbot
An element whose framing is valid but whose NVDM type is neither RPC nor
GMC currently fails the receive with EIO and stays at the head of the
queue, which stalls it for good.
Its length is known, so log it and move past it instead, as OpenRM does.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Documentation/gpu/nova/core/interrupts.rst | 8 ++++----
drivers/gpu/nova-core/gsp/cmdq.rs | 24 ++++++++++++------------
drivers/gpu/nova-core/gsp/fw.rs | 5 +++++
3 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/Documentation/gpu/nova/core/interrupts.rst b/Documentation/gpu/nova/core/interrupts.rst
index a155c0532cfc..bb3509f636a3 100644
--- a/Documentation/gpu/nova/core/interrupts.rst
+++ b/Documentation/gpu/nova/core/interrupts.rst
@@ -581,16 +581,16 @@ reply or an unsolicited event:
GMC replies match on command ID and sequence number, and GMC events arriving
during a wait go to the caller's handler; unclaimed replies and unknown command
-IDs are logged at warning level, and other GMC events are dropped.
+IDs are logged at warning level, and other GMC events are dropped. Elements of
+unsupported NVDM types are also logged at warning level and dropped.
A command's reply must carry the RPC sequence number that nova-core wrote into
the command, as well as its function code to be considered a reply to that
command. An unsolicited event answers no command, so a caller awaiting one
matches on the function code alone.
-The read pointer advances past every valid element, whether it matched or was
-an event. An element that fails framing or message-header validation, or
-carries an unsupported NVDM type, stays at the queue head and every later
+The read pointer advances past every element that passes framing and
+message-header validation; otherwise it stays at the queue head and every later
receive fails with ``EIO`` until the device is reset.
The polling path and the IRQ thread both read the queue under the command-queue
diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
index f6bede6a77e7..f526558d4d59 100644
--- a/drivers/gpu/nova-core/gsp/cmdq.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq.rs
@@ -57,7 +57,10 @@
GSP_PAGE_SHIFT,
GSP_PAGE_SIZE, //
},
- mctp::NvdmType,
+ mctp::{
+ NvdmHeader,
+ NvdmType, //
+ },
num, //
};
@@ -432,6 +435,8 @@ enum GspParsedMessage<'a> {
Rpc(rpc::RpcMessage<'a>),
/// A [GMC message](gmc::GmcMessage).
Gmc(gmc::GmcMessage<'a>),
+ /// A message of a type that the queue does not use.
+ Other(NvdmHeader),
}
impl GspParsedMessage<'_> {
@@ -440,6 +445,9 @@ fn log(&self, dev: &device::Device) {
match self {
GspParsedMessage::Rpc(rpc) => rpc.log(dev),
GspParsedMessage::Gmc(gmc) => gmc.log(dev),
+ GspParsedMessage::Other(nvdm_header) => {
+ dev_warn!(dev, "GSP receive: ignoring {:?}\n", nvdm_header);
+ }
}
}
}
@@ -645,9 +653,8 @@ fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> {
/// # Errors
///
/// - `ETIMEDOUT` if `timeout` has elapsed before any message becomes available.
- /// - `EIO` if a message fails framing validation, or carries an NVDM type that the queue does
- /// not use. In this case, the read pointer does not advance and the queue is stalled. This
- /// is a fatal error.
+ /// - `EIO` if a message fails framing validation. In this case, the read pointer does not
+ /// advance and the queue is stalled. This is a fatal error.
///
/// If an error is returned, then `f` has not been called.
///
@@ -669,14 +676,7 @@ fn consume_element<R>(
Ok(NvdmType::GmcApi) => {
GspParsedMessage::Gmc(gmc::GmcMessage::parse(self.dev, message)?)
}
- nvdm_type => {
- dev_err!(
- &self.dev,
- "GSP receive: unexpected NVDM type {:?}\n",
- nvdm_type
- );
- return Err(EIO);
- }
+ _ => GspParsedMessage::Other(message.header.nvdm_header()),
};
let res = f(message);
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index a576fc86708c..5fd8cff209df 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -665,6 +665,11 @@ pub(crate) fn element_count(&self) -> u32 {
self.mctp_payload_size.div_ceil(cv!(GSP_PAGE_SIZE))
}
+ /// Returns the NVDM header of the message following this header.
+ pub(crate) fn nvdm_header(&self) -> NvdmHeader {
+ self.nvdm_header
+ }
+
/// Returns the NVDM type of the message following this header, or `EINVAL` if it is not a
/// known one.
pub(crate) fn nvdm_type(&self) -> Result<NvdmType> {
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 4/5] gpu: nova-core: gsp: cmdq: consume elements of unknown NVDM type
2026-12-04 4:16 ` [PATCH 4/5] gpu: nova-core: gsp: cmdq: consume elements of unknown NVDM type Alexandre Courbot
@ 2026-12-04 4:29 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-12-04 4:29 UTC (permalink / raw)
To: Alexandre Courbot, Danilo Krummrich, Alice Ryhl, David Airlie,
Simona Vetter, Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, ojeda
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] nova-core: missing Fixes trailer referencing commit 3662e69cb0da
--
commit 721b27f79b9d3a1c4be62e37849784c6f0c7761f
Author: Alexandre Courbot <acourbot@nvidia.com>
> gpu: nova-core: gsp: cmdq: consume elements of unknown NVDM type
>
> An element whose framing is valid but whose NVDM type is neither RPC nor
> GMC currently fails the receive with EIO and stays at the head of the
> queue, which stalls it for good.
>
> Its length is known, so log it and move past it instead, as OpenRM does.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
[Severity: Low]
This fixes a queue stall on unsupported NVDM types introduced when
switching to the r000 GSP firmware. Should this include:
Fixes: 3662e69cb0da ("gpu: nova-core: switch to the r000 GSP firmware")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-r000-followups-v1-0-17164ae87e31@nvidia.com?part=4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/5] gpu: nova-core: gsp: boot: ignore events that are not load-and-execute
2026-12-04 4:16 [PATCH 0/5] gpu: nova-core: r000 follow-up fixes and cleanups Alexandre Courbot
` (3 preceding siblings ...)
2026-12-04 4:16 ` [PATCH 4/5] gpu: nova-core: gsp: cmdq: consume elements of unknown NVDM type Alexandre Courbot
@ 2026-12-04 4:16 ` Alexandre Courbot
2026-12-04 4:23 ` sashiko-bot
4 siblings, 1 reply; 8+ messages in thread
From: Alexandre Courbot @ 2026-12-04 4:16 UTC (permalink / raw)
To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
Alexandre Courbot
Every GMC event received while waiting for the GSP_INIT reply currently
goes to the load-and-execute dispatcher, which rejects anything else
with EINVAL. An unrelated event thus fails the boot, where OpenRM
carries on.
Rename the dispatcher to try_handle_load_exec_event() and return None on
unrelated events so boot() logs and ignores them instead. A failing
load-and-execute handler remains fatal, as it leaves the GSP halted.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/gsp/boot.rs | 6 +++++-
drivers/gpu/nova-core/gsp/cmdq/gmc.rs | 2 +-
drivers/gpu/nova-core/gsp/load_exec.rs | 20 +++++++++-----------
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index 763dbe1f8fdb..1f5a6682b768 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -92,7 +92,11 @@ pub(crate) fn boot(
let static_info = self
.cmdq
.send_gmc_command(GspInit::new(pdev, chipset, ctx.vgpu.state())?, |event| {
- ctx.handle_load_exec_event(libos_dma_address, bootloader_app_version, event)
+ ctx.try_handle_load_exec_event(libos_dma_address, bootloader_app_version, event)
+ .unwrap_or_else(|| {
+ event.log(dev);
+ Ok(())
+ })
})?
.map_err(|status| {
dev_err!(dev, "GSP_INIT failed with status {:#x}\n", status);
diff --git a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
index 6565a8fb0e96..14ef82db7be7 100644
--- a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
@@ -281,7 +281,7 @@ fn reply_status(&self, command: GmcCommandId, seq: u32) -> Option<u32> {
///
/// A reply that nobody claimed (e.g. one that arrived after its request timed out) and an
/// unknown command id are logged at warning level. Other events are not logged.
- pub(super) fn log(&self, dev: &device::Device) {
+ pub(crate) fn log(&self, dev: &device::Device) {
let command = self.header.command();
let seq = self.header.sequence();
diff --git a/drivers/gpu/nova-core/gsp/load_exec.rs b/drivers/gpu/nova-core/gsp/load_exec.rs
index 7d379eb13e02..752259a55059 100644
--- a/drivers/gpu/nova-core/gsp/load_exec.rs
+++ b/drivers/gpu/nova-core/gsp/load_exec.rs
@@ -120,7 +120,7 @@ pub(super) fn resume_gsp_rm(
}
impl GspBootContext<'_, '_> {
- /// Runs the handler of the load-and-execute event `event`.
+ /// Runs the handler of `event` if it is a load-and-execute event, or returns `None` otherwise.
///
/// The command ID of `event` selects the handler, and the payload of `event`
/// holds the parameters of that handler. Each handler is followed by
@@ -129,20 +129,19 @@ impl GspBootContext<'_, '_> {
///
/// # Errors
///
- /// - `EINVAL` if the command ID of `event` is not that of a load-and-execute
- /// event, or if the payload of `event` is shorter than the parameters of
+ /// - `EINVAL` if the payload of `event` is shorter than the parameters of
/// the handler.
/// - `EIO` if the binary did not start or reported a non-zero status in
/// `MAILBOX0`.
///
/// Errors from the handlers and from the resume of GSP-RM are propagated
/// as-is.
- pub(super) fn handle_load_exec_event(
+ pub(super) fn try_handle_load_exec_event(
&self,
libos_dma_address: DmaAddress,
bootloader_app_version: u32,
event: &GmcMessage<'_>,
- ) -> Result {
+ ) -> Option<Result> {
let dev = self.dev();
let command = event.header().command();
let (slice_1, slice_2) = event.payload();
@@ -159,13 +158,10 @@ pub(super) fn handle_load_exec_event(
HsBinaryParams::read(&mut payload)
.and_then(|params| self.handle_hs_binary(¶ms)),
),
- _ => {
- dev_err!(dev, "Not a load-and-execute event: {:?}\n", command);
- return Err(EINVAL);
- }
+ _ => return None,
};
- result
+ let result = result
.and_then(|mbox0| match mbox0 {
FLCN_OK => {
dev_dbg!(dev, "Binary of load-and-execute event {:?} succeeded\n", id);
@@ -198,7 +194,9 @@ pub(super) fn handle_load_exec_event(
})
.inspect_err(|e| {
dev_err!(dev, "Load-and-execute event {:?} failed: {:?}\n", id, e);
- })
+ });
+
+ Some(result)
}
/// Waits until GSP-RM has suspended the RISC-V core, and then resets the GSP
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 5/5] gpu: nova-core: gsp: boot: ignore events that are not load-and-execute
2026-12-04 4:16 ` [PATCH 5/5] gpu: nova-core: gsp: boot: ignore events that are not load-and-execute Alexandre Courbot
@ 2026-12-04 4:23 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-12-04 4:23 UTC (permalink / raw)
To: Alexandre Courbot, Danilo Krummrich, Alice Ryhl, David Airlie,
Simona Vetter, Benno Lossin, Gary Guo
Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
Zhi Wang, nova-gpu, dri-devel, ojeda
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] gpu: nova-core: missing Fixes trailer on Gsp::boot() bug fix
--
commit 98207279cdc5bb547610d262a73eeb91a465b0f1
Author: Alexandre Courbot <acourbot@nvidia.com>
> gpu: nova-core: gsp: boot: ignore events that are not load-and-execute
>
> Every GMC event received while waiting for the GSP_INIT reply currently
> goes to the load-and-execute dispatcher, which rejects anything else
> with EINVAL. An unrelated event thus fails the boot, where OpenRM
> carries on.
>
> Rename the dispatcher to try_handle_load_exec_event() and return None on
> unrelated events so boot() logs and ignores them instead. A failing
> load-and-execute handler remains fatal, as it leaves the GSP halted.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
[Severity: Low]
This fixes a boot failure introduced when Gsp::boot() was wired to pass
all GMC events during GSP_INIT to handle_load_exec_event(). Should this
include:
Fixes: 3662e69cb0da ("gpu: nova-core: switch to the r000 GSP firmware")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-r000-followups-v1-0-17164ae87e31@nvidia.com?part=5
^ permalink raw reply [flat|nested] 8+ messages in thread