Since we are going to introduce a second type of message, add `rpc` to the names of the relevant command queue methods so we can distinguish between the two.
No functional change intended. Signed-off-by: Alexandre Courbot <[email protected]> --- drivers/gpu/nova-core/gsp.rs | 2 +- drivers/gpu/nova-core/gsp/boot.rs | 6 +++--- drivers/gpu/nova-core/gsp/cmdq/rpc.rs | 30 +++++++++++++++--------------- drivers/gpu/nova-core/gsp/commands/rpc.rs | 2 +- drivers/gpu/nova-core/gsp/sequencer.rs | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs index 75a3ba7d50f4..ed7eef21e8f9 100644 --- a/drivers/gpu/nova-core/gsp.rs +++ b/drivers/gpu/nova-core/gsp.rs @@ -221,7 +221,7 @@ pub(crate) fn new( /// Query the GSP for the static GPU information. pub(crate) fn get_static_info(&self) -> Result<commands::rpc::GetGspStaticInfoReply> { - self.cmdq.send_command(commands::rpc::GetGspStaticInfo) + self.cmdq.send_rpc_command(commands::rpc::GetGspStaticInfo) } } diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs index 8e446ad1eac2..0d0b07fafd4f 100644 --- a/drivers/gpu/nova-core/gsp/boot.rs +++ b/drivers/gpu/nova-core/gsp/boot.rs @@ -43,9 +43,9 @@ pub(crate) fn boot( let gsp_fw = KBox::pin_init(GspFirmware::new(dev, chipset), GFP_KERNEL)?; self.cmdq - .send_command_no_wait(commands::rpc::SetSystemInfo::new(pdev, chipset))?; + .send_rpc_command_no_wait(commands::rpc::SetSystemInfo::new(pdev, chipset))?; self.cmdq - .send_command_no_wait(commands::rpc::SetRegistry::new(ctx.vgpu.state())?)?; + .send_rpc_command_no_wait(commands::rpc::SetRegistry::new(ctx.vgpu.state())?)?; // Perform the chipset-specific boot sequence, and retrieve the unload bundle. let unload_bundle = hal.boot(&self, &mut ctx, &gsp_fw)?.or_else(|| { @@ -91,7 +91,7 @@ fn shutdown_gsp( mode: commands::rpc::PowerStateLevel, ) -> Result { // Command to shut the GSP down. - cmdq.send_command(commands::rpc::UnloadingGuestDriver::new(mode))?; + cmdq.send_rpc_command(commands::rpc::UnloadingGuestDriver::new(mode))?; // Wait until GSP signals it is suspended. const LIBOS_INTERRUPT_PROCESSOR_SUSPENDED: u32 = bits::bit_u32(31); diff --git a/drivers/gpu/nova-core/gsp/cmdq/rpc.rs b/drivers/gpu/nova-core/gsp/cmdq/rpc.rs index 335f94c4d2aa..81f8c79b1bb5 100644 --- a/drivers/gpu/nova-core/gsp/cmdq/rpc.rs +++ b/drivers/gpu/nova-core/gsp/cmdq/rpc.rs @@ -135,7 +135,7 @@ impl CmdqInner<'_> { /// written to by its [`CommandToGsp::init_variable_payload`] method. /// /// Error codes returned by the command initializers are propagated as-is. - fn send_single_command<M>(&mut self, command: M) -> Result + fn send_single_rpc_command<M>(&mut self, command: M) -> Result where M: CommandToGsp, // This allows all error types, including `Infallible`, to be used for `M::InitError`. @@ -196,19 +196,19 @@ fn send_single_command<M>(&mut self, command: M) -> Result /// written to by its [`CommandToGsp::init_variable_payload`] method. /// /// Error codes returned by the command initializers are propagated as-is. - fn send_command<M>(&mut self, command: M) -> Result + fn send_rpc_command<M>(&mut self, command: M) -> Result where M: CommandToGsp, Error: From<M::InitError>, { match SplitState::new(command)? { - SplitState::Single(command) => self.send_single_command(command), + SplitState::Single(command) => self.send_single_rpc_command(command), SplitState::Split(command, mut continuations) => { - self.send_single_command(command)?; + self.send_single_rpc_command(command)?; while let Some(continuation) = continuations.next() { // Turbofish needed because the compiler cannot infer M here. - self.send_single_command::<ContinuationRecord<'_>>(continuation)?; + self.send_single_rpc_command::<ContinuationRecord<'_>>(continuation)?; } Ok(()) @@ -216,7 +216,7 @@ fn send_command<M>(&mut self, command: M) -> Result } } - fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> { + fn wait_for_rpc_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> { let GspMessage { header, contents: (slice_1, slice_2), @@ -275,12 +275,12 @@ fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> { /// - `ERANGE` if the message had a recognized but non-matching function code. /// /// Error codes returned by [`MessageFromGsp::read`] are propagated as-is. - fn receive_msg<M: MessageFromGsp>(&mut self, timeout: Delta) -> Result<M> + fn receive_rpc_msg<M: MessageFromGsp>(&mut self, timeout: Delta) -> Result<M> where // This allows all error types, including `Infallible`, to be used for `M::InitError`. Error: From<M::InitError>, { - let message = self.wait_for_msg(timeout)?; + let message = self.wait_for_rpc_msg(timeout)?; let function = message.header.rpc_header().function().map_err(|_| EINVAL)?; // Extract the message. Store the result as we want to advance the read pointer even in @@ -329,7 +329,7 @@ impl Cmdq<'_> { /// written to by its [`CommandToGsp::init_variable_payload`] method. /// /// Error codes returned by the command and reply initializers are propagated as-is. - pub(crate) fn send_command<M>(&self, command: M) -> Result<M::Reply> + pub(crate) fn send_rpc_command<M>(&self, command: M) -> Result<M::Reply> where M: CommandToGsp, M::Reply: MessageFromGsp, @@ -337,10 +337,10 @@ pub(crate) fn send_command<M>(&self, command: M) -> Result<M::Reply> Error: From<<M::Reply as MessageFromGsp>::InitError>, { let mut inner = self.inner.lock(); - inner.send_command(command)?; + inner.send_rpc_command(command)?; loop { - match inner.receive_msg::<M::Reply>(Self::RECEIVE_TIMEOUT) { + match inner.receive_rpc_msg::<M::Reply>(Self::RECEIVE_TIMEOUT) { Ok(reply) => break Ok(reply), Err(ERANGE) => continue, Err(e) => break Err(e), @@ -357,22 +357,22 @@ pub(crate) fn send_command<M>(&self, command: M) -> Result<M::Reply> /// written to by its [`CommandToGsp::init_variable_payload`] method. /// /// Error codes returned by the command initializers are propagated as-is. - pub(crate) fn send_command_no_wait<M>(&self, command: M) -> Result + pub(crate) fn send_rpc_command_no_wait<M>(&self, command: M) -> Result where M: CommandToGsp<Reply = NoReply>, Error: From<M::InitError>, { - self.inner.lock().send_command(command) + self.inner.lock().send_rpc_command(command) } /// Receive a message from the GSP. /// /// See [`CmdqInner::receive_msg`] for details. - pub(crate) fn receive_msg<M: MessageFromGsp>(&self, timeout: Delta) -> Result<M> + pub(crate) fn receive_rpc_msg<M: MessageFromGsp>(&self, timeout: Delta) -> Result<M> where // This allows all error types, including `Infallible`, to be used for `M::InitError`. Error: From<M::InitError>, { - self.inner.lock().receive_msg(timeout) + self.inner.lock().receive_rpc_msg(timeout) } } diff --git a/drivers/gpu/nova-core/gsp/commands/rpc.rs b/drivers/gpu/nova-core/gsp/commands/rpc.rs index a3262cc3e0e9..ad4f466427c0 100644 --- a/drivers/gpu/nova-core/gsp/commands/rpc.rs +++ b/drivers/gpu/nova-core/gsp/commands/rpc.rs @@ -191,7 +191,7 @@ fn read( /// Waits for GSP initialization to complete. pub(crate) fn wait_gsp_init_done(cmdq: &Cmdq<'_>) -> Result { loop { - match cmdq.receive_msg::<GspInitDone>(Cmdq::RECEIVE_TIMEOUT) { + match cmdq.receive_rpc_msg::<GspInitDone>(Cmdq::RECEIVE_TIMEOUT) { Ok(_) => break Ok(()), Err(ERANGE) => continue, Err(e) => break Err(e), diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs index ebf13867746f..ab3237ed64d6 100644 --- a/drivers/gpu/nova-core/gsp/sequencer.rs +++ b/drivers/gpu/nova-core/gsp/sequencer.rs @@ -344,7 +344,7 @@ pub(crate) fn run( bootloader_app_version: u32, ) -> Result { let seq_info = loop { - match cmdq.receive_msg::<GspSequence>(Cmdq::RECEIVE_TIMEOUT) { + match cmdq.receive_rpc_msg::<GspSequence>(Cmdq::RECEIVE_TIMEOUT) { Ok(seq_info) => break seq_info, Err(ERANGE) => continue, Err(e) => return Err(e), -- 2.55.0
