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: Implement core resume operation

Implement core resume operation. This is the last step of the sequencer
resulting in resume of the GSP and proceeding to INIT_DONE stage of GSP
boot.

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-12-joelagnelf@nvidia.com>

authored by

Joel Fernandes and committed by
Alexandre Courbot
77410985 9641f052

+42 -3
-1
drivers/gpu/nova-core/falcon/gsp.rs
··· 45 45 } 46 46 47 47 /// Checks if GSP reload/resume has completed during the boot process. 48 - #[expect(dead_code)] 49 48 pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> { 50 49 read_poll_timeout( 51 50 || Ok(regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar)),
+42 -2
drivers/gpu/nova-core/gsp/sequencer.rs
··· 79 79 CoreReset, 80 80 CoreStart, 81 81 CoreWaitForHalt, 82 + CoreResume, 82 83 } 83 84 84 85 impl GspSeqCmd { ··· 117 116 fw::SeqBufOpcode::CoreReset => (GspSeqCmd::CoreReset, opcode_size), 118 117 fw::SeqBufOpcode::CoreStart => (GspSeqCmd::CoreStart, opcode_size), 119 118 fw::SeqBufOpcode::CoreWaitForHalt => (GspSeqCmd::CoreWaitForHalt, opcode_size), 120 - _ => return Err(EINVAL), 119 + fw::SeqBufOpcode::CoreResume => (GspSeqCmd::CoreResume, opcode_size), 121 120 }; 122 121 123 122 if data.len() < size { ··· 130 129 } 131 130 132 131 /// GSP Sequencer for executing firmware commands during boot. 133 - #[expect(dead_code)] 134 132 pub(crate) struct GspSequencer<'a> { 135 133 /// Sequencer information with command data. 136 134 seq_info: GspSequence, ··· 231 231 } 232 232 GspSeqCmd::CoreWaitForHalt => { 233 233 seq.gsp_falcon.wait_till_halted(seq.bar)?; 234 + Ok(()) 235 + } 236 + GspSeqCmd::CoreResume => { 237 + // At this point, 'SEC2-RTOS' has been loaded into SEC2 by the sequencer 238 + // but neither SEC2-RTOS nor GSP-RM is running yet. This part of the 239 + // sequencer will start both. 240 + 241 + // Reset the GSP to prepare it for resuming. 242 + seq.gsp_falcon.reset(seq.bar)?; 243 + 244 + // Write the libOS DMA handle to GSP mailboxes. 245 + seq.gsp_falcon.write_mailboxes( 246 + seq.bar, 247 + Some(seq.libos_dma_handle as u32), 248 + Some((seq.libos_dma_handle >> 32) as u32), 249 + ); 250 + 251 + // Start the SEC2 falcon which will trigger GSP-RM to resume on the GSP. 252 + seq.sec2_falcon.start(seq.bar)?; 253 + 254 + // Poll until GSP-RM reload/resume has completed (up to 2 seconds). 255 + seq.gsp_falcon 256 + .check_reload_completed(seq.bar, Delta::from_secs(2))?; 257 + 258 + // Verify SEC2 completed successfully by checking its mailbox for errors. 259 + let mbox0 = seq.sec2_falcon.read_mailbox0(seq.bar); 260 + if mbox0 != 0 { 261 + dev_err!(seq.dev, "Sequencer: sec2 errors: {:?}\n", mbox0); 262 + return Err(EIO); 263 + } 264 + 265 + // Configure GSP with the bootloader version. 266 + seq.gsp_falcon 267 + .write_os_version(seq.bar, seq.bootloader_app_version); 268 + 269 + // Verify the GSP's RISC-V core is active indicating successful GSP boot. 270 + if !seq.gsp_falcon.is_riscv_active(seq.bar) { 271 + dev_err!(seq.dev, "Sequencer: RISC-V core is not active\n"); 272 + return Err(EIO); 273 + } 234 274 Ok(()) 235 275 } 236 276 }