Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpu: nova-core: sequencer: Add delay opcode support

Implement a sequencer opcode for delay operations.

Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Message-ID: <20251114195552.739371-10-joelagnelf@nvidia.com>

authored by

Joel Fernandes and committed by
Alexandre Courbot
e386680e 2367ce2e

+18 -3
-2
drivers/gpu/nova-core/gsp/fw.rs
··· 473 473 #[derive(Copy, Clone)] 474 474 pub(crate) struct DelayUsPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_DELAY_US); 475 475 476 - #[expect(unused)] 477 476 impl DelayUsPayload { 478 477 /// Returns the delay value in microseconds. 479 478 pub(crate) fn val(&self) -> u32 { ··· 514 515 #[repr(transparent)] 515 516 pub(crate) struct SequencerBufferCmd(r570_144::GSP_SEQUENCER_BUFFER_CMD); 516 517 517 - #[expect(unused)] 518 518 impl SequencerBufferCmd { 519 519 /// Returns the opcode as a `SeqBufOpcode` enum, or error if invalid. 520 520 pub(crate) fn opcode(&self) -> Result<SeqBufOpcode> {
+18 -1
drivers/gpu/nova-core/gsp/sequencer.rs
··· 14 14 device, 15 15 io::poll::read_poll_timeout, 16 16 prelude::*, 17 - time::Delta, 17 + time::{ 18 + delay::fsleep, 19 + Delta, // 20 + }, 18 21 transmute::FromBytes, 19 22 types::ARef, // 20 23 }; ··· 74 71 RegWrite(fw::RegWritePayload), 75 72 RegModify(fw::RegModifyPayload), 76 73 RegPoll(fw::RegPollPayload), 74 + DelayUs(fw::DelayUsPayload), 77 75 RegStore(fw::RegStorePayload), 78 76 } 79 77 ··· 99 95 let payload = fw_cmd.reg_poll_payload()?; 100 96 let size = opcode_size + size_of_val(&payload); 101 97 (GspSeqCmd::RegPoll(payload), size) 98 + } 99 + fw::SeqBufOpcode::DelayUs => { 100 + let payload = fw_cmd.delay_us_payload()?; 101 + let size = opcode_size + size_of_val(&payload); 102 + (GspSeqCmd::DelayUs(payload), size) 102 103 } 103 104 fw::SeqBufOpcode::RegStore => { 104 105 let payload = fw_cmd.reg_store_payload()?; ··· 191 182 } 192 183 } 193 184 185 + impl GspSeqCmdRunner for fw::DelayUsPayload { 186 + fn run(&self, _sequencer: &GspSequencer<'_>) -> Result { 187 + fsleep(Delta::from_micros(i64::from(self.val()))); 188 + Ok(()) 189 + } 190 + } 191 + 194 192 impl GspSeqCmdRunner for fw::RegStorePayload { 195 193 fn run(&self, sequencer: &GspSequencer<'_>) -> Result { 196 194 let addr = usize::from_safe_cast(self.addr()); ··· 212 196 GspSeqCmd::RegWrite(cmd) => cmd.run(seq), 213 197 GspSeqCmd::RegModify(cmd) => cmd.run(seq), 214 198 GspSeqCmd::RegPoll(cmd) => cmd.run(seq), 199 + GspSeqCmd::DelayUs(cmd) => cmd.run(seq), 215 200 GspSeqCmd::RegStore(cmd) => cmd.run(seq), 216 201 } 217 202 }