The transport layer of the command queue works in whole page units (aka. slots) - the size in bytes of the message is only relevant to the message layer.
After queueing a message, we computed the number of slots to advance the queue's write pointer by from the message size in bytes, borrowing information from a layer we are not supposed to access while also re-computing a number we already have since the number of slots of the message is in the transport-level header. Therefore, use the correct information from our layer. This is necessary in order to extract the message layer code into its own module. No functional change intended. Signed-off-by: Alexandre Courbot <[email protected]> --- drivers/gpu/nova-core/gsp/cmdq.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs index a5595da23407..9285fd796f9d 100644 --- a/drivers/gpu/nova-core/gsp/cmdq.rs +++ b/drivers/gpu/nova-core/gsp/cmdq.rs @@ -863,9 +863,8 @@ fn receive_msg<M: MessageFromGsp>(&mut self, timeout: Delta) -> Result<M> }; // Advance the read pointer past this message. - self.gsp_mem.advance_cpu_read_ptr(u32::try_from( - message.header.length().div_ceil(GSP_PAGE_SIZE), - )?); + self.gsp_mem + .advance_cpu_read_ptr(message.header.element_count()); result } -- 2.55.0
