From: Eliot Courtney <ecourtney@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
Alexandre Courbot <acourbot@nvidia.com>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
Alistair Popple <apopple@nvidia.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
Timur Tabi <ttabi@nvidia.com>,
rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Eliot Courtney <ecourtney@nvidia.com>
Subject: [PATCH v3 9/9] gpu: nova-core: gsp: add FaultMethodBufferSize RM control command
Date: Wed, 25 Mar 2026 21:13:47 +0900 [thread overview]
Message-ID: <20260325-rmcontrol-v3-9-f3101093484e@nvidia.com> (raw)
In-Reply-To: <20260325-rmcontrol-v3-0-f3101093484e@nvidia.com>
Add `CeGetFaultMethodBufferSizeParams` which wraps the bindings.
Add `FaultMethodBufferSize` RM control command which returns the fault
method buffer size we should use. This is needed for channel allocation.
Finally, print out the fault method buffer size on GSP boot.
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
drivers/gpu/nova-core/gsp/boot.rs | 11 +++++++++++
drivers/gpu/nova-core/gsp/commands.rs | 2 --
drivers/gpu/nova-core/gsp/fw/rm.rs | 25 ++++++++++++++++++++---
drivers/gpu/nova-core/gsp/rm/commands.rs | 34 ++++++++++++++++++++++++++++----
4 files changed, 63 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index e55210ebb6d1..8a4ad4c6ea98 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -33,6 +33,10 @@
gpu::Chipset,
gsp::{
commands,
+ rm::commands::{
+ FaultMethodBufferSize,
+ RmControl, //
+ },
sequencer::{
GspSequencer,
GspSequencerParams, //
@@ -232,6 +236,13 @@ pub(crate) fn boot(
Err(e) => dev_warn!(pdev, "GPU name unavailable: {:?}\n", e),
}
+ match RmControl::new(info.client(), info.subdevice(), FaultMethodBufferSize)
+ .send(&self.cmdq, bar)
+ {
+ Ok(size) => dev_info!(pdev, "Fault method buffer size: {} bytes\n", size),
+ Err(e) => dev_warn!(pdev, "Failed to get fault method buffer size: {:?}\n", e),
+ }
+
Ok(())
}
}
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 8c9599aa227b..56655bade9ab 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -285,13 +285,11 @@ pub(crate) fn gpu_name(&self) -> core::result::Result<&str, GpuNameError> {
}
/// Returns the client handle allocated by GSP-RM.
- #[expect(dead_code)]
pub(crate) fn client(&self) -> Handle<Client> {
self.client
}
/// Returns the subdevice handle allocated by GSP-RM.
- #[expect(dead_code)]
pub(crate) fn subdevice(&self) -> Handle<Subdevice> {
self.subdevice
}
diff --git a/drivers/gpu/nova-core/gsp/fw/rm.rs b/drivers/gpu/nova-core/gsp/fw/rm.rs
index 1c6e8b4c4865..73913541d9d4 100644
--- a/drivers/gpu/nova-core/gsp/fw/rm.rs
+++ b/drivers/gpu/nova-core/gsp/fw/rm.rs
@@ -8,9 +8,12 @@
}, //
};
-use crate::gsp::commands::{
- Client,
- Handle, //
+use crate::{
+ gsp::commands::{
+ Client,
+ Handle, //
+ },
+ num, //
};
use super::{
@@ -85,3 +88,19 @@ unsafe impl FromBytes for GspRmControl {}
// SAFETY: This struct contains no padding.
unsafe impl AsBytes for GspRmControl {}
+
+/// Wrapper for [`bindings::NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS`].
+#[repr(transparent)]
+pub(crate) struct CeGetFaultMethodBufferSizeParams(
+ bindings::NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS,
+);
+
+impl CeGetFaultMethodBufferSizeParams {
+ /// Returns the CE fault method buffer size in bytes.
+ pub(crate) fn size(&self) -> usize {
+ num::u32_as_usize(self.0.size)
+ }
+}
+
+// SAFETY: This struct only contains integer types for which all bit patterns are valid.
+unsafe impl FromBytes for CeGetFaultMethodBufferSizeParams {}
diff --git a/drivers/gpu/nova-core/gsp/rm/commands.rs b/drivers/gpu/nova-core/gsp/rm/commands.rs
index 8845ca0a0225..de290f4845f4 100644
--- a/drivers/gpu/nova-core/gsp/rm/commands.rs
+++ b/drivers/gpu/nova-core/gsp/rm/commands.rs
@@ -1,8 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
-use core::array;
+use core::{
+ array,
+ mem::size_of, //
+};
-use kernel::prelude::*;
+use kernel::{
+ prelude::*,
+ transmute::FromBytes, //
+};
use crate::{
driver::Bar0,
@@ -14,7 +20,8 @@
},
commands::{
Client,
- Handle, //
+ Handle,
+ Subdevice, //
},
fw::{
rm::*,
@@ -75,7 +82,6 @@ pub(crate) struct RmControl<T>
cmd: T,
}
-#[expect(unused)]
impl<T: RmControlCommand> RmControl<T> {
/// Creates a new RM control command.
pub(crate) fn new(client: Handle<Client>, object: Handle<T::Target>, cmd: T) -> Self {
@@ -139,3 +145,23 @@ pub(crate) trait RmControlCommand {
/// reply type.
fn parse_reply(&self, params: &[u8]) -> Result<Self::Reply>;
}
+
+/// RM control command for querying the fault method buffer size. This is required for setting up
+/// channels.
+pub(crate) struct FaultMethodBufferSize;
+
+impl RmControlCommand for FaultMethodBufferSize {
+ const FUNCTION: RmControlMsgFunction = RmControlMsgFunction::CeGetFaultMethodBufferSize;
+ const LEN: usize = size_of::<CeGetFaultMethodBufferSizeParams>();
+ type Reply = usize;
+ type Target = Subdevice;
+
+ fn write_payload(&self, dst: &mut SBufferIter<array::IntoIter<&mut [u8], 2>>) -> Result {
+ dst.write_all(&[0u8; Self::LEN])
+ }
+
+ fn parse_reply(&self, params: &[u8]) -> Result<Self::Reply> {
+ let reply = CeGetFaultMethodBufferSizeParams::from_bytes(params).ok_or(EINVAL)?;
+ Ok(reply.size())
+ }
+}
--
2.53.0
next prev parent reply other threads:[~2026-03-25 12:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 12:13 [PATCH v3 0/9] gpu: nova-core: gsp: add RM control command infrastructure Eliot Courtney
2026-03-25 12:13 ` [PATCH v3 1/9] gpu: nova-core: gsp: add NV_STATUS error code bindings Eliot Courtney
2026-04-05 19:55 ` John Hubbard
2026-04-06 8:54 ` Eliot Courtney
2026-04-06 19:05 ` John Hubbard
2026-03-25 12:13 ` [PATCH v3 2/9] gpu: nova-core: gsp: add NvStatus enum for RM control errors Eliot Courtney
2026-04-05 20:05 ` John Hubbard
2026-04-06 12:09 ` Eliot Courtney
2026-04-06 19:02 ` John Hubbard
2026-03-25 12:13 ` [PATCH v3 3/9] gpu: nova-core: gsp: expose GSP-RM internal client and subdevice handles Eliot Courtney
2026-03-25 12:13 ` [PATCH v3 4/9] gpu: nova-core: gsp: add RM control RPC structure binding Eliot Courtney
2026-03-25 12:13 ` [PATCH v3 5/9] gpu: nova-core: gsp: add types for RM control RPCs Eliot Courtney
2026-03-25 12:13 ` [PATCH v3 6/9] gpu: nova-core: use KVVec for SBufferIter flush Eliot Courtney
2026-03-25 12:13 ` [PATCH v3 7/9] gpu: nova-core: gsp: add RM control command infrastructure Eliot Courtney
2026-03-25 12:13 ` [PATCH v3 8/9] gpu: nova-core: gsp: add CE fault method buffer size bindings Eliot Courtney
2026-03-25 12:13 ` Eliot Courtney [this message]
2026-04-05 20:12 ` [PATCH v3 9/9] gpu: nova-core: gsp: add FaultMethodBufferSize RM control command John Hubbard
2026-04-06 2:30 ` Eliot Courtney
2026-04-05 19:48 ` [PATCH v3 0/9] gpu: nova-core: gsp: add RM control command infrastructure John Hubbard
2026-04-06 2:29 ` Eliot Courtney
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=20260325-rmcontrol-v3-9-f3101093484e@nvidia.com \
--to=ecourtney@nvidia.com \
--cc=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=jhubbard@nvidia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=ttabi@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