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: gsp: Wait for gsp initialization to complete

This adds the GSP init done command to wait for GSP initialization
to complete. Once this command has been received the GSP is fully
operational and will respond properly to normal RPC commands.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
Co-developed-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
[acourbot@nvidia.com: move new definitions to end of commands.rs, rename
to `wait_gsp_init_done` and remove timeout argument.]
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Message-ID: <20251114195552.739371-13-joelagnelf@nvidia.com>

authored by

Alistair Popple and committed by
Alexandre Courbot
0e7d572b 77410985

+48 -3
+3
drivers/gpu/nova-core/gsp/boot.rs
··· 236 236 }; 237 237 GspSequencer::run(&mut self.cmdq, seq_params)?; 238 238 239 + // Wait until GSP is fully initialized. 240 + commands::wait_gsp_init_done(&mut self.cmdq)?; 241 + 239 242 Ok(()) 240 243 } 241 244 }
+45 -3
drivers/gpu/nova-core/gsp/commands.rs
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - use core::convert::Infallible; 3 + use core::{ 4 + array, 5 + convert::Infallible, // 6 + }; 4 7 5 8 use kernel::{ 6 9 device, 7 10 pci, 8 11 prelude::*, 9 - transmute::AsBytes, // 12 + time::Delta, 13 + transmute::{ 14 + AsBytes, 15 + FromBytes, // 16 + }, // 10 17 }; 11 18 12 19 use crate::{ 13 20 gsp::{ 14 - cmdq::CommandToGsp, 21 + cmdq::{ 22 + Cmdq, 23 + CommandToGsp, 24 + MessageFromGsp, // 25 + }, 15 26 fw::{ 16 27 commands::*, 17 28 MsgFunction, // ··· 136 125 } 137 126 138 127 dst.write_all(string_data.as_slice()) 128 + } 129 + } 130 + 131 + /// Message type for GSP initialization done notification. 132 + struct GspInitDone {} 133 + 134 + // SAFETY: `GspInitDone` is a zero-sized type with no bytes, therefore it 135 + // trivially has no uninitialized bytes. 136 + unsafe impl FromBytes for GspInitDone {} 137 + 138 + impl MessageFromGsp for GspInitDone { 139 + const FUNCTION: MsgFunction = MsgFunction::GspInitDone; 140 + type InitError = Infallible; 141 + type Message = GspInitDone; 142 + 143 + fn read( 144 + _msg: &Self::Message, 145 + _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>, 146 + ) -> Result<Self, Self::InitError> { 147 + Ok(GspInitDone {}) 148 + } 149 + } 150 + 151 + /// Waits for GSP initialization to complete. 152 + pub(crate) fn wait_gsp_init_done(cmdq: &mut Cmdq) -> Result { 153 + loop { 154 + match cmdq.receive_msg::<GspInitDone>(Delta::from_secs(10)) { 155 + Ok(_) => break Ok(()), 156 + Err(ERANGE) => continue, 157 + Err(e) => break Err(e), 158 + } 139 159 } 140 160 }