[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250829173254.2068763-11-joelagnelf@nvidia.com>
Date: Fri, 29 Aug 2025 13:32:47 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
dakr@...nel.org,
acourbot@...dia.com
Cc: Alistair Popple <apopple@...dia.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
bjorn3_gh@...tonmail.com,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
John Hubbard <jhubbard@...dia.com>,
Joel Fernandes <joelagnelf@...dia.com>,
Timur Tabi <ttabi@...dia.com>,
joel@...lfernandes.org,
nouveau@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org
Subject: [PATCH 10/17] nova-core: sequencer: Implement basic core operations
These opcodes implement various falcon-related boot operations: reset,
start, wait-for-halt.
Signed-off-by: Joel Fernandes <joelagnelf@...dia.com>
---
drivers/gpu/nova-core/gsp/sequencer.rs | 27 ++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
index 803956a74c8c..826c06041e41 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -40,6 +40,9 @@ pub(crate) enum GspSeqCmd {
RegPoll(fw::GSP_SEQ_BUF_PAYLOAD_REG_POLL),
DelayUs(fw::GSP_SEQ_BUF_PAYLOAD_DELAY_US),
RegStore(fw::GSP_SEQ_BUF_PAYLOAD_REG_STORE),
+ CoreReset,
+ CoreStart,
+ CoreWaitForHalt,
}
impl GspSeqCmd {
@@ -63,6 +66,11 @@ pub(crate) fn from_fw_cmd(cmd: &fw::GSP_SEQUENCER_BUFFER_CMD) -> Result<Self> {
fw::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE => {
Ok(GspSeqCmd::RegStore(unsafe { cmd.payload.regStore }))
}
+ fw::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET => Ok(GspSeqCmd::CoreReset),
+ fw::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START => Ok(GspSeqCmd::CoreStart),
+ fw::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT => {
+ Ok(GspSeqCmd::CoreWaitForHalt)
+ }
_ => Err(EINVAL),
}
}
@@ -84,6 +92,9 @@ pub(crate) fn new(data: &[u8], dev: &device::Device<device::Bound>) -> Result<Se
pub(crate) fn size_bytes(&self) -> usize {
let opcode_size = size_of::<fw::GSP_SEQ_BUF_OPCODE>();
match self {
+ // Each simple command type just adds 4 bytes (opcode_size) for the header
+ GspSeqCmd::CoreReset | GspSeqCmd::CoreStart | GspSeqCmd::CoreWaitForHalt => opcode_size,
+
// For commands with payloads, add the payload size in bytes
GspSeqCmd::RegWrite(_) => opcode_size + size_of::<fw::GSP_SEQ_BUF_PAYLOAD_REG_WRITE>(),
GspSeqCmd::RegModify(_) => {
@@ -225,6 +236,22 @@ fn run(&self, seq: &GspSequencer<'_>) -> Result {
GspSeqCmd::RegPoll(cmd) => cmd.run(seq),
GspSeqCmd::DelayUs(cmd) => cmd.run(seq),
GspSeqCmd::RegStore(cmd) => cmd.run(seq),
+ GspSeqCmd::CoreReset => {
+ dev_dbg!(seq.dev, "CoreReset\n");
+ seq.gsp_falcon.reset(seq.bar)?;
+ seq.gsp_falcon.dma_reset(seq.bar);
+ Ok(())
+ }
+ GspSeqCmd::CoreStart => {
+ dev_dbg!(seq.dev, "CoreStart\n");
+ seq.gsp_falcon.start(seq.bar)?;
+ Ok(())
+ }
+ GspSeqCmd::CoreWaitForHalt => {
+ dev_dbg!(seq.dev, "CoreWaitForHalt\n");
+ seq.gsp_falcon.wait_till_halted(seq.bar)?;
+ Ok(())
+ }
}
}
}
--
2.34.1
Powered by blists - more mailing lists