The 620 framing carried one queue element's worth of RPC but validated the length against the R580 limit (0xffd0), so the largest payload the 24-byte header allows (0xffc8, rpc.length 0xffe8) was refused. Derive the 620 limit from `queueElementSizeMax - queueElementHeaderSize` as the closed driver does (`gspMsgQueueGetMaxRpcSize`), and test framing exactly at the limit. `gmcapi::write_message` zeroed its header with a plain store, which LLVM can lower to memset once the module is linked; use the same black_box form as the R580 packer. The NVKV walker branched on "has following words", silently dropping zero-count SEQ*/ARRAY* entries; branch on the opcode instead. Also remove the duplicated oracle fields, correct the 0x18 header size in the framing comments, and update the oracle's own tests for the two accepted 620 releases and the two new probe headers. Co-Authored-By: Codebuff <noreply@codebuff.com>
13 KiB
GSP-RM 620 wire framing: which boot path GB20x uses, and what it speaks
Target: RTX 5050 (GB207, 10de:2d83), stock driver 620.73.04, kernel 7.3.0-11-generic.
Evidence classes: [A] instructions/objects read from the shipped binaries, [S] public source
match (nouveau / open-gpu-kernel-modules tag stated), [I] inference, [E] repo test.
1. Finding: two GSP-RM boots exist, with different wire framings
| Boot path | Entry | Framing it spoke before this change |
|---|---|---|
| Legacy 580-era | src/nvidia/kernel/gsp_bringup.rs → src/nvidia/src/gpu/gsp_transport.rs |
ABI-aware: R580 element header and R620 MCTP+NVDM (send_rpc_620) |
| Multi-generation (nouveau r535 shape) | src/nvidia/kernel/ga10x.rs:538 → src/nvidia/kernel/ga10x_gsp.rs → src/nvidia/src/gpu/ga10x_gsp.rs |
R580 element header only (ELEMENT_HEADER_BYTES = 48, frame_element) |
ga10x.rs:538 (g.gsp = ga10x_gsp::boot(pci)) is the path that makes an object-GPU/session for
GA10x and later, i.e. the one an RTX 50 card reaches once engines are requested. It framed every
outbound RPC with the 48-byte GSP_MSG_QUEUE_ELEMENT header and page padding, and parsed replies
at offset 48 [A] (src/nvidia/src/gpu/ga10x_gsp.rs, kernel/ga10x_gsp.rs).
620.7x firmware speaks MCTP + NVDM. That framing code is ours, not NVIDIA's: commit 321278a
("Bump Turing-Blackwell-Rubin GSP-RM path to 620.70.06 (MCTP+NVDM+GMCAPI, GR100, C-header oracle)",
2026-11-28) added MSG_ELEM_HDR_620_NO_ENC = 0x18, MCTP_MAGIC, NVDM_TYPE_RM_RPC = 0x25 and
pack_message_620 / unpack_message_620. The values are [S] against NVIDIA's published source,
which is present locally at target/ref/ogkm (NVIDIA_VERSION 620.73.04, the release on the
card under test):
| Ours | NVIDIA 620.73.04 |
|---|---|
MCTP_MAGIC = 0x4D435450 |
message_queue_priv.h #define MCTP_MAGIC 0x4D435450 |
MSG_ELEM_HDR_620_NO_ENC = 0x18 |
GSP_MSG_QUEUE_ELEMENT_SIZE_NO_ENCRYPTION = offsetof(withEncryption) (16) + 2 u32 |
MSG_ELEM_HDR_620_WITH_ENC = 0x28, enc offset 0x20 |
SIZE_WITH_ENCRYPTION = sizeof (40), GSP_MSG_QUEUE_ELEMENT_ENCRYPTION_OFFSET = 0x20 |
magic +0x00, payload size +0x04, MCTP hdr +0x08, NVDM hdr +0x0c, nvdmPayloadSize +0x10 (plain) / +0x20 (CC) |
same struct fields in the same order |
mctpPayloadSize = 24 + rpc_len, no page padding when unencrypted, pages = div_ceil(size, 4096) |
GspMsgQueueSendCommand (message_queue_cpu.c:483): mctpPayloadSize = queueElementHdrSize + size, padding only under bEncryptionEnabled, gspMsgQueueBytesToElements(mctpPayloadSize, 4096) |
NVDM_TYPE_RM_RPC = 0x25 |
nvdm_format.h:62 |
Checked offline with the repo's own header parity oracle,
OPEN_GPU_ROOT=target/ref/ogkm python3 tools/oracle_gsp_620.py: passed, 19 fields, 0 diffs
against 620.73.04.
So on the path GB20x actually takes, the MCTP/NVDM framing was missing entirely; the ABI-aware framing lived only in the legacy path. That is the framing gap for the RTX 5000 track.
Not established here: that 620.7x firmware rejects a 48-byte element header. The 620.73.04
nv-kernel.o_binary keeps only _nvXXXXXXrm symbols (57,397 defined; no descriptive names), and
the shared Ghidra project rm580 is 580-only and must not be replaced, so the 620 handler has not
been disassembled for this note. Treat "620 needs MCTP" as [S] from the published 620.73.04
message-queue source, not as [A] from the 620 binary.
2. Change (offline only)
src/nvidia/src/gpu/ga10x_gsp.rs:
element_header_bytes(abi)— 48 for R580,MSG_ELEM_HDR_620_NO_ENC(24) for R620.max_rpc_payload(abi)— one element's payload limit for the selected framing.frame_element_abi(buf, function, payload, rpc_seq, elem_seq, abi)— R580 delegates toframe_elementunchanged; R620 builds the MCTP+NVDM frame withgsp_rpc::pack_message_620andRpcHeader::request(same RPC header layout,length = 0x20 + payload).parse_reply_abi(head, abi)— R580RpcReply::parseat 48; R620 checksMCTP_MAGIC, then decodes the RPC header at 24 and mapsrpc_result/rpc_result_private/sequence.element_pages(head, abi)— R580 reads the element header's page count at +40; R620 derives it from the MCTP payload size at +0x04.
src/nvidia/kernel/ga10x_gsp.rs:
pushframes throughframe_element_abiinstead of copying the payload at a fixed 48 + 32 offset and callingframe_element, but with a fixedRPC_ABI = R580. This graph'sgsprm_loadrequests GSP-RM 580.178.04 andgsprm_copyrejects any other image, so it must speak the ABI of the firmware it actually boots. Reading the process-widegsp_abihere would send MCTP+NVDM elements to 580 firmware whenever the defaultgsp_abi=620is in force.recvanddrop_messageuse that same fixedR580withelement_header_bytes/parse_reply_abi/element_pages, so the reply header offset, the page count and the bad-message skip agree with whatpushsent.- The R620 helpers (
frame_element_abi,parse_reply_abiandelement_pageswithR620) remain offline and are exercised by tests; they belong togsp_bringup's 620 path, whose firmware and framinggsp_abidoes select. Changinggsp_abidoes not enable R620 framing on this path.
3. Checks run
cargo test -p nv-rs-core --lib gpu::ga10x_gsp: 18 passed, including[E]frame_element_abi_r580_is_frame_element(byte-identical to the old path),frame_element_abi_r620_writes_mctp_nvdm_and_round_trips(0x3a8-byteGSP_SET_SYSTEM_INFOpayload survives, type 0x25, sequence preserved),parse_reply_abi_reads_each_framing,r620_reply_rejects_lengths_that_disagree_with_its_element_header,r620_payload_limit_is_one_header_smaller_than_r580.make -C src/nvidiabuildskernel-open/nvidia/nv-rust.o_binary;tools/check_kernel_module.pypasses (largest stack 1000 bytes, no GOT relocations, no SIMD).cargo clippy -p nv-rs-core --all-targets -- -D warningsandcargo fmt --all -- --checkclean.- No hardware was touched; no
/dev/nvidia*opened.
4. What this does not do
- It changes framing, not boot stages. The multi-generation path still needs its GSP-RM boot
(FWSEC-FRTS, SEC2 Booter-Load, RISC-V bootloader, LIBOS args) verified on GB20x; nothing here
claims a GB207
GSP_INIT_DONE. - This graph stays on R580 framing regardless of
gsp_abi, because it still loads and checks GSP-RM 580.178.04; nothing about the V100 / GA100 behaviour moves. R620 framing on the runtime session returns only when this path also loads matching 620 firmware. - Encryption (
MSG_ELEM_HDR_620_WITH_ENC) is not used: confidential compute is off on consumer Blackwell, andpack_message_620is called withencrypted = falseassend_rpc_620does.
5. The 620 boot sequence itself: one GMCAPI command, not three RPCs
620 replaced the init RPCs. kernel_gsp.c:6371 kgspSendInitRpcs_IMPL sends one GMCAPI command:
gmcapiCommand(pGpu, GMCAPI_CMD_GSP_INIT, pEncodedSystemInfo,
sizeof(NvU64) * encodedSystemInfoCount, pKVStaticInfoData, &responseSize);
then decodes the reply with _kgspDecodeGspStaticInfo. The comment above the call says it replaces
"the old fire-and-forget GSP_SET_SYSTEM_INFO + INIT_DONE + GSP_GET_STATIC_INFO sequence", and
rpc_global_enums.h marks GSP_SET_SYSTEM_INFO (72), SET_REGISTRY (73) and GSP_INIT_POST_OBJGPU
(74) // deprecated in 620. The same call is on Turing (kernel_gsp_tu102.c:424) and Hopper/Blackwell
(kernel_gsp_gh100.c:1207), so this is the whole 620 family, not just GB20x.
Wire format, all read from 620.73.04 [S]:
- The message is an ordinary RPC-framed message with NVDM type 0x26 (
NVDM_TYPE_GMCAPI) instead of 0x25:gpuSendGmcRpc_KERNEL(gpu.c:8040) fillscommand,size = inParamSize,sequence,request.max_response_size,reserved[5] = 0, then the payload, and callskgspSendRpc(..., NVDM_TYPE_GMCAPI, inParamSize + sizeof(GMCAPI_HEADER), bSync). - The payload is an NVKV key/value array of
NvU64built by_kgspEncodeSystemInfo, not the fixed 936-byteGSP_SET_SYSTEM_INFOstruct we send today. Keys are 16-bit; each instruction word isopcode[31:28] | index[27:16] | key[15:0]with the count or 32-bit immediate in[63:32]. _kgspEncodeSystemInfoemits: PCI device/subdevice/revision (0x0001-0x0003), the four GPU physical addresses (0x1010-0x1013), domain/bus/device/function (0x1020), host arch (0x0070), host OS type (0x0071), the PCI config mirror (0x0010/0x0011, zero on Blackwell+ where the mirror is gone), console memory size and max user VA (0x1031/0x1032), host page size (0x0078), the three default timeouts (0x00A0-0x00A2), the four 64-bit flag words (0x1000-0x1003), driver name/version/changelist (0x1100-0x1102) andUNSTABLE_INTERFACE_SUPPORT(0x1110), then the packed registry keys.
Implemented (offline, verified)
src/nvidia/src/gpu/gmcapi.rs is new and carries the transport and the encoder:
HEADER_BYTES = 40,COMMAND_ID_MASK,COMMAND_FLAG_RESPONSE,CMD_GSP_INIT(0x00010001),SYSTEM_INFO_MAX_WORDS(8192) andSTATIC_INFO_MAX_BYTES(48 KiB) — the limitskgspSendInitRpcs_IMPLuses.Nvkv— the instruction encoder:imm32,seq32,seq64,array32,string8, with NVIDIA's overflow semantics (the index advances past the limit and stores are dropped, so a too-small buffer is reported rather than silently truncated).encode_system_info(&SystemInfo, &mut [u64])— the key set above in the closed driver's order, including the zeroed PCI-config-mirror keys that Blackwell still expects to see.write_message/parse_message— the 40-byte header plus payload, and a reply decoder that checkssizeagainst the buffer.decode— the NVKV walker (nvkvDecode's job): instruction, index, key, count, then the value in whichever of the six forms it takes, refusing unknown opcodes and counts that run past the buffer.decode_static_info—_kgspDecodeGspStaticInfo's job for the keys this driver uses: GPU name string, FB length, BAR1/BAR2 PDE base, VMMU segment size, the WPR non-WPR-heap and FRTS offsets, VBIOS revision and the three internal handles, skipping unknown keys as the original does.
Tests ([E], 10 new): instruction word layout against the nvkv.h bit fields, imm32/seq32 packing,
seq64/string8 packing (count includes the NUL), a full GSP_INIT request (header fields,
reserved[5] zeroed, payload at 40), the key order and word count of a real system-info encode (33
words for a GB207-shaped input), overflow reported not hidden, reply parse/truncation, a decode round
of every opcode the encoder emits, a static-info reply covering the keys the boot consumes (plus an
unknown key that must be skipped), and malformed replies (bad opcode, count past the end).
The oracle grew to 106 fields, 0 diffs against 620.73.04, now covering the GMCAPI_HEADER offsets
(0/4/8, reserved 0x14, data 0x28), the id mask, the 30 NVGMC_SI_* keys this module emits and the 12
NVGMC_SC_* keys it decodes.
Not done yet, and why
The boot path still sends the deprecated RPC sequence: nothing calls gmcapi.rs yet. Three things are
missing before it can be switched over:
- The remaining request keys.
CHIPSET(0x0030), the PCIe power-control/link/atomics keys (0x0020, 0x0050-0x0052),SYS_TIMER_OFFSET_NS(0x1040) and the packed registry table have no source in this driver yet. Most are readable (chip id from the architecture table, the rest from the BIF config-space mirror and the system timer), but the registry packer (_kgspEncodePackedRegistryKeys) is a separate subsystem. - The GMCAPI element framing. GMCAPI messages carry no
rpc_message_header_v; the element payload is MCTP + NVDM(0x26) +GMCAPI_HEADERdirectly (gpuSendGmcRpc_KERNELpassesinParamSize + sizeof(GMCAPI_HEADER)tokgspSendRpc). Ourframe_element_abialways writes the RPC header, so a GMCAPI send needs its own frame and reply parse. - The switch itself.
execute_gsp_boot_with_abi(legacy path) and the multi-generation path both sendGSP_SET_SYSTEM_INFO; both would have to select the GMCAPI request under the R620 ABI, and the reply's static info would have to be checked (FB length against the WPR layout at least) rather than discarded.
Switching early would trade a known-wrong sequence for an unverified one, so the encoder and decoder are library code with their tests, and the boot keeps its current behaviour.
6. Tooling fix made alongside
tools/oracle_gsp_620.py pinned NVIDIA_VERSION to 620.70.06 and returned skipped for any other
tree, so the 620.73.04 tree this machine actually has could never be checked. It now accepts both
620 patch releases — the pair gsp_image::releases_for_abi(R620) supports — and the check above runs
against the local 620.73.04 source instead of being skipped.