From: John Hubbard <[email protected]> The entry offset is a property of the queue layout. Take it from the layout of `Msgq`.
No functional change as both values are `GSP_PAGE_SIZE`. Signed-off-by: John Hubbard <[email protected]> [acourbot: use associated consts instead of parameters for constant values.] Co-developed-by: Alexandre Courbot <[email protected]> Signed-off-by: Alexandre Courbot <[email protected]> --- drivers/gpu/nova-core/gsp/cmdq.rs | 6 ++++++ drivers/gpu/nova-core/gsp/fw.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs index 2cdf8c1f7189..54b5d94d1328 100644 --- a/drivers/gpu/nova-core/gsp/cmdq.rs +++ b/drivers/gpu/nova-core/gsp/cmdq.rs @@ -473,6 +473,12 @@ impl<'cmdq> Cmdq<'cmdq> { /// Offset of the data after the PTEs. const POST_PTE_OFFSET: usize = core::mem::offset_of!(GspMem, cpuq); + /// Size of a queue slot. An element spans one or more slots. + pub(super) const MSG_SIZE: usize = GSP_PAGE_SIZE; + + /// Offset of the ring buffer of a queue from its TX header. + pub(super) const MSGQ_ENTRY_OFFSET: usize = core::mem::offset_of!(Msgq, msgq); + /// Offset of command queue ring buffer. pub(super) const CMDQ_OFFSET: usize = core::mem::offset_of!(GspMem, cpuq) + core::mem::offset_of!(Msgq, msgq) diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs index 937cbbc24e93..2ddc2e8f6274 100644 --- a/drivers/gpu/nova-core/gsp/fw.rs +++ b/drivers/gpu/nova-core/gsp/fw.rs @@ -715,12 +715,12 @@ pub(crate) fn new(msgq_size: u32, rx_hdr_offset: u32, msg_count: u32) -> Self { Self(bindings::msgqTxHeader { version: 0, size: msgq_size, - msgSize: cv!(GSP_PAGE_SIZE), + msgSize: cv!(Cmdq::MSG_SIZE), msgCount: msg_count, writePtr: 0, flags: 1, rxHdrOff: rx_hdr_offset, - entryOff: cv!(GSP_PAGE_SIZE), + entryOff: cv!(Cmdq::MSGQ_ENTRY_OFFSET), }) } -- 2.56.1
