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

gpu: nova-core: gsp: Add support for checking if GSP reloaded

During the sequencer process, we need to check if GSP was successfully
reloaded. Add functionality to check for the same.

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

authored by

Joel Fernandes and committed by
Alexandre Courbot
f77be04d 0f2c8e27

+24
+18
drivers/gpu/nova-core/falcon/gsp.rs
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 + use kernel::{ 4 + io::poll::read_poll_timeout, 5 + prelude::*, 6 + time::Delta, // 7 + }; 8 + 3 9 use crate::{ 4 10 driver::Bar0, 5 11 falcon::{ ··· 42 36 regs::NV_PFALCON_FALCON_IRQSCLR::default() 43 37 .set_swgen0(true) 44 38 .write(bar, &Gsp::ID); 39 + } 40 + 41 + /// Checks if GSP reload/resume has completed during the boot process. 42 + #[expect(dead_code)] 43 + pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> { 44 + read_poll_timeout( 45 + || Ok(regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar)), 46 + |val| val.boot_stage_3_handoff(), 47 + Delta::ZERO, 48 + timeout, 49 + ) 50 + .map(|_| true) 45 51 } 46 52 }
+6
drivers/gpu/nova-core/regs.rs
··· 138 138 // These scratch registers remain powered on even in a low-power state and have a designated group 139 139 // number. 140 140 141 + // Boot Sequence Interface (BSI) register used to determine 142 + // if GSP reload/resume has completed during the boot process. 143 + register!(NV_PGC6_BSI_SECURE_SCRATCH_14 @ 0x001180f8 { 144 + 26:26 boot_stage_3_handoff as bool; 145 + }); 146 + 141 147 // Privilege level mask register. It dictates whether the host CPU has privilege to access the 142 148 // `PGC6_AON_SECURE_SCRATCH_GROUP_05` register (which it needs to read GFW_BOOT). 143 149 register!(NV_PGC6_AON_SECURE_SCRATCH_GROUP_05_PRIV_LEVEL_MASK @ 0x00118128,