[PATCH v3 05/33] gpu: nova-core: regs: add msgq v2 BAR0 register declarations

From: John Hubbard

Date: Thu Sep 17 2026 - 21:08:28 EST


Msgq is the pair of ring buffers in shared memory through which the
driver and GSP-RM communicate. The command queue carries commands from
the driver to GSP-RM, and the message queue carries messages from GSP-RM
to the driver. Each ring buffer has a write pointer and a read pointer.

Msgq v0, which the r570 firmware uses, keeps both pointers of each ring
buffer in that ring buffer's header, in shared memory. Msgq v2, which
the r000 firmware uses, keeps the four pointers, two per ring buffer, in
four BAR0 registers instead:

NV_PGSP_QUEUE_HEAD command queue write pointer
NV_PGSP_QUEUE_TAIL command queue read pointer
NV_PGSP_MSGQ_HEAD message queue write pointer
NV_PGSP_MSGQ_TAIL message queue read pointer

The GSP numbers its queues 0 through 7, and each numbered queue is one
such pair of ring buffers with its own four pointer registers, so the
hardware has 32 pointer registers in all. Nova-core uses queue 0 only.

A write to NV_PGSP_QUEUE_HEAD also interrupts the GSP. Msgq v0 uses that
write as the doorbell, so nova-core already declares NV_PGSP_QUEUE_HEAD.

Declare the other three, NV_PGSP_QUEUE_TAIL, NV_PGSP_MSGQ_HEAD and
NV_PGSP_MSGQ_TAIL, each as a scalar at its queue 0 offset rather than as
an array of eight.

Assisted-by: LLM
Reviewed-by: Timur Tabi <ttabi@xxxxxxxxxx>
Reviewed-by: Zhi Wang <zhiw@xxxxxxxxxx>
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/regs.rs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/nova-core/gsp/regs.rs b/drivers/gpu/nova-core/gsp/regs.rs
index 3c410d65e8e4..fae7825f0846 100644
--- a/drivers/gpu/nova-core/gsp/regs.rs
+++ b/drivers/gpu/nova-core/gsp/regs.rs
@@ -8,13 +8,32 @@
};

// PGSP
+// The GSP has eight numbered queues, each with its own four msgq pointer registers. nova-core
+// uses queue 0 only, so each register is declared as a scalar at its queue 0 offset.

register! {
base: NovaRegisters;

+ /// Write pointer of the CPU-to-GSP command queue, which the driver advances. A write to this
+ /// register also interrupts the GSP, so this register is also the doorbell.
pub(super) NV_PGSP_QUEUE_HEAD(u32) @ 0x00110c00 {
31:0 address;
}
+
+ /// Read pointer of the CPU-to-GSP command queue, which the GSP advances.
+ pub(super) NV_PGSP_QUEUE_TAIL(u32) @ 0x00110c04 {
+ 31:0 address;
+ }
+
+ /// Write pointer of the GSP-to-CPU message queue, which the GSP advances.
+ pub(super) NV_PGSP_MSGQ_HEAD(u32) @ 0x00110c80 {
+ 31:0 address;
+ }
+
+ /// Read pointer of the GSP-to-CPU message queue, which the driver advances.
+ pub(super) NV_PGSP_MSGQ_TAIL(u32) @ 0x00110c84 {
+ 31:0 address;
+ }
}

// PBUS
--
2.55.0