Some GMC commands are answered with a status and no payload. Their reply type cannot be `NoReply`, which marks commands that the GSP does not answer at all.
Implement `MessageFromGsp` for `()` so these commands can use it as their reply type. Signed-off-by: Alexandre Courbot <[email protected]> --- drivers/gpu/nova-core/gsp/cmdq/gmc.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs index 512a327a1c89..f4311593e360 100644 --- a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs +++ b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs @@ -3,6 +3,8 @@ //! Support for the GMC (GPU Management Controller) API message type on the GSP command queue. +use core::convert::Infallible; + use kernel::{ device, prelude::*, @@ -53,8 +55,8 @@ pub(crate) trait CommandToGsp { /// after the GMC API header. type Command: FromBytes + AsBytes; - /// Type of the reply expected from the GSP, or [`NoReply`] for commands that don't have a - /// reply. + /// Type of the reply expected from the GSP. Can be [`NoReply`] for commands that don't have a + /// reply, or `()` for commands that only expect a status code without a reply payload. type Reply; /// Largest reply this command accepts, in bytes. Zero for commands that the GSP does not @@ -178,6 +180,17 @@ fn read( ) -> Result<Self, Self::InitError>; } +/// Reply type for commands that the GSP answers with a status and no payload. +impl MessageFromGsp for () { + type InitError = Infallible; + + fn read( + _payload: &mut SBufferIter<core::array::IntoIter<&[u8], 2>>, + ) -> Result<Self, Self::InitError> { + Ok(()) + } +} + /// A GMC message ready to be processed from the message queue. pub(crate) struct GmcMessage<'a> { // Reference to the GMC API header of the message. -- 2.56.0
