mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
tools/docs: complete closed-world 8-category operation inventory and ownership map (#381 Phase 1 & 4) (#676)
* tools/docs: complete closed-world 8-category operation inventory and ownership map (#381 Phase 1 & 4) * tools/parity: address all 9 PR #676 review findings (per-arch classes, 580/620 RPC split, full strict metadata) * tools/parity: address remaining PR #676 review findings (fail-closed RPC sources, R620 boundary, op_id) * tools/parity: exclude ENGINE_INVALID classes, verify uvm_bridge.c exports and MIG+SMC markers --------- Co-authored-by: Eric Hartford <eric@quixi.ai>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
This document contains the full technical comparison tables for `nvdriver` (`nvidia_rs.ko`) against the stock closed-source NVIDIA **580.178.04** Linux kernel driver (and **620.70.06** GSP-RM for Turing–Blackwell–Rubin).
|
||||
|
||||
For the high-level overview and quick start, see [README.md](../README.md). For the full reverse-engineering report with disassembly and `.rodata` addresses, see [reports/nvidia-580-artificial-restrictions-rea.md](../reports/nvidia-580-artificial-restrictions-rea.md) and [docs/blog-nvidia-artificial-restrictions.md](blog-nvidia-artificial-restrictions.md).
|
||||
For the high-level overview and quick start, see [README.md](../README.md). For the operation-granularity closed-world parity inventory and subsystem ownership map (#381), see [docs/PARITY_LEDGER.md](PARITY_LEDGER.md) (generated from [tools/build_parity_ledger.py](../tools/build_parity_ledger.py) into [reports/parity_ledger_580.json](../reports/parity_ledger_580.json)). For the full reverse-engineering report with disassembly and `.rodata` addresses, see [reports/nvidia-580-artificial-restrictions-rea.md](../reports/nvidia-580-artificial-restrictions-rea.md) and [docs/blog-nvidia-artificial-restrictions.md](blog-nvidia-artificial-restrictions.md).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -1,28 +1,51 @@
|
||||
# Stock 580.178.04 Closed-World Parity Ledger
|
||||
# Stock 580.178.04 Closed-World Parity Ledger & Operation Inventory (#381)
|
||||
|
||||
Generated by `python3 tools/build_parity_ledger.py` against stock 580.178.04 kernel modules and host `libcuda.so.1` / `libnvidia-ml.so.1`.
|
||||
Generated by `python3 tools/build_parity_ledger.py` against stock 580.178.04 kernel modules, OpenRM 580.178.04 headers, and host `libcuda.so.1` / `libnvidia-ml.so.1`.
|
||||
|
||||
| Domain | PORTED | PARTIAL | MISSING | INTENTIONALLY_EXCLUDED |
|
||||
|---|---:|---:|---:|---:|
|
||||
| `rmapi_escapes` | 34 | 0 | 0 | 4 |
|
||||
| `rm_control_table_580` | 2107 | 0 | 0 | 0 |
|
||||
| `rm_controls_userspace` | 294 | 0 | 0 | 14 |
|
||||
| `rm_classes` | 159 | 0 | 0 | 3 |
|
||||
| `gsp_rm_rpcs` | 22 | 0 | 0 | 260 |
|
||||
| `uvm_ioctls` | 49 | 0 | 0 | 1 |
|
||||
| `drm_ioctls` | 24 | 0 | 0 | 0 |
|
||||
| `nvkms_ioctls` | 14 | 52 | 0 | 0 |
|
||||
| `uvm_ioctls_620` | 2 | 3 | 0 | 0 |
|
||||
| `drm_ioctls` | 22 | 2 | 0 | 0 |
|
||||
| `nvkms_ioctls` | 32 | 34 | 0 | 0 |
|
||||
| `firmware_commands` | 14 | 0 | 0 | 1 |
|
||||
| `subsystem_operations` | 11 | 0 | 0 | 0 |
|
||||
| `procfs_and_caps` | 9 | 0 | 0 | 0 |
|
||||
| `mmio_bus_loss_guards` | 32 | 0 | 0 | 0 |
|
||||
| **TOTAL** | **2563** | **52** | **0** | **19** |
|
||||
| **TOTAL** | **2787** | **39** | **0** | **283** |
|
||||
|
||||
## Subsystem Ownership Map (#381 Phase 4)
|
||||
|
||||
Integrator & merge authority: **@ehartford**
|
||||
|
||||
| Subsystem | Primary Owner | Scope |
|
||||
|---|---|---|
|
||||
| `rmapi_escapes` | `@morebrackets` | tools, oracles, RM escape ABI |
|
||||
| `rm_control_table_580` | `@morebrackets` | 2,107/2,107 580.178.04 RM control table & oracles |
|
||||
| `rm_controls_userspace` | `@gdevenyi` | libcuda / libnvidia-ml control parity |
|
||||
| `rm_classes` | `@gdevenyi` | 0x800292 per-chip class DB & constructors |
|
||||
| `gsp_rm_rpcs` | `@brauliobo` | GA10x/GB20x GSP-RM RPCs & R620 framing |
|
||||
| `uvm_ioctls` | `@PiercingXX` | UVM 580 ioctl & VA-space parity |
|
||||
| `uvm_ioctls_620` | `@ChrisMythos` | UVM 620.x ABI & AD102/Blackwell support |
|
||||
| `drm_ioctls` | `@ChrisMythos` | nvidia-drm UAPI & DMA-BUF / syncobj |
|
||||
| `nvkms_ioctls` | `@ChrisMythos` | nvidia-modeset NVKMS ioctl state machine |
|
||||
| `firmware_commands` | `@brauliobo` | PMU / FECS / SEC2 / ACR / FWSEC / FSP protocols |
|
||||
| `subsystem_operations` | `@gdevenyi` | Display / Power / Thermal / Clock / MIG / ECC / NVLink |
|
||||
| `procfs_and_caps` | `@LIghtJUNction` | Install, packaging, procfs, and capability nodes |
|
||||
| `mmio_bus_loss_guards` | `@morebrackets` | MMIO bus-loss & kernel module hygiene gates |
|
||||
|
||||
## Remaining `MISSING` / `PARTIAL` Entries
|
||||
|
||||
- **[PARTIAL]** `nvkms_ioctls` `2:NVKMS_IOCTL_QUERY_DISP` — cmd=2 exact 580.178.04 paramSize=172 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `3:NVKMS_IOCTL_QUERY_CONNECTOR_STATIC_DATA` — cmd=3 exact 580.178.04 paramSize=44 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `4:NVKMS_IOCTL_QUERY_CONNECTOR_DYNAMIC_DATA` — cmd=4 exact 580.178.04 paramSize=20 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `5:NVKMS_IOCTL_QUERY_DPY_STATIC_DATA` — cmd=5 exact 580.178.04 paramSize=92 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `6:NVKMS_IOCTL_QUERY_DPY_DYNAMIC_DATA` — cmd=6 exact 580.178.04 paramSize=37160 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `7:NVKMS_IOCTL_VALIDATE_MODE_INDEX` — cmd=7 exact 580.178.04 paramSize=720 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `8:NVKMS_IOCTL_VALIDATE_MODE` — cmd=8 exact 580.178.04 paramSize=640 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `uvm_ioctls_620` `r620_uvm:AccessBitsBufAlloc` — R620 UVM interface op nvUvmInterfaceAccessBitsBufAlloc has Rust slot/validation logic but uvm_bridge.c or ring dump still returns NV_ERR_NOT_SUPPORTED
|
||||
- **[PARTIAL]** `uvm_ioctls_620` `r620_uvm:AccessBitsBufFree` — R620 UVM interface op nvUvmInterfaceAccessBitsBufFree has Rust slot/validation logic but uvm_bridge.c or ring dump still returns NV_ERR_NOT_SUPPORTED
|
||||
- **[PARTIAL]** `uvm_ioctls_620` `r620_uvm:AccessBitsBufDump` — R620 UVM interface op nvUvmInterfaceAccessBitsDump has Rust slot/validation logic but uvm_bridge.c or ring dump still returns NV_ERR_NOT_SUPPORTED
|
||||
- **[PARTIAL]** `drm_ioctls` `nv_drm_get_crtc_crc32_ioctl` — UAPI + validation wired in nvidia_rs_drm.c (nv_rs_ioctl_get_crtc_crc32; hardware CRC register readout not yet implemented)
|
||||
- **[PARTIAL]** `drm_ioctls` `nv_drm_get_crtc_crc32_v2_ioctl` — UAPI + validation wired in nvidia_rs_drm.c (nv_rs_ioctl_get_crtc_crc32_v2; hardware CRC register readout not yet implemented)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `9:NVKMS_IOCTL_SET_MODE` — cmd=9 exact 580.178.04 paramSize=171936 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `10:NVKMS_IOCTL_SET_CURSOR_IMAGE` — cmd=10 exact 580.178.04 paramSize=52 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `11:NVKMS_IOCTL_MOVE_CURSOR` — cmd=11 exact 580.178.04 paramSize=20 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
@ -32,31 +55,21 @@ Generated by `python3 tools/build_parity_ledger.py` against stock 580.178.04 ker
|
||||
- **[PARTIAL]** `nvkms_ioctls` `15:NVKMS_IOCTL_FLIP` — cmd=15 exact 580.178.04 paramSize=3112 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `16:NVKMS_IOCTL_DECLARE_DYNAMIC_DPY_INTEREST` — cmd=16 exact 580.178.04 paramSize=20 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `22:NVKMS_IOCTL_SET_DPY_ATTRIBUTE` — cmd=22 exact 580.178.04 paramSize=32 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `23:NVKMS_IOCTL_GET_DPY_ATTRIBUTE` — cmd=23 exact 580.178.04 paramSize=24 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `24:NVKMS_IOCTL_GET_DPY_ATTRIBUTE_VALID_VALUES` — cmd=24 exact 580.178.04 paramSize=40 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `25:NVKMS_IOCTL_SET_DISP_ATTRIBUTE` — cmd=25 exact 580.178.04 paramSize=32 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `26:NVKMS_IOCTL_GET_DISP_ATTRIBUTE` — cmd=26 exact 580.178.04 paramSize=24 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `27:NVKMS_IOCTL_GET_DISP_ATTRIBUTE_VALID_VALUES` — cmd=27 exact 580.178.04 paramSize=40 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `28:NVKMS_IOCTL_QUERY_FRAMELOCK` — cmd=28 exact 580.178.04 paramSize=20 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `29:NVKMS_IOCTL_SET_FRAMELOCK_ATTRIBUTE` — cmd=29 exact 580.178.04 paramSize=24 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `30:NVKMS_IOCTL_GET_FRAMELOCK_ATTRIBUTE` — cmd=30 exact 580.178.04 paramSize=16 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `31:NVKMS_IOCTL_GET_FRAMELOCK_ATTRIBUTE_VALID_VALUES` — cmd=31 exact 580.178.04 paramSize=32 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `34:NVKMS_IOCTL_CLEAR_UNICAST_EVENT` — cmd=34 exact 580.178.04 paramSize=8 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `33:NVKMS_IOCTL_DECLARE_EVENT_INTEREST` — cmd=33 exact 580.178.04 paramSize=8; rejects nonzero event mask with -EOPNOTSUPP until event producer is wired
|
||||
- **[PARTIAL]** `nvkms_ioctls` `35:NVKMS_IOCTL_GET_3DVISION_DONGLE_PARAM_BYTES` — cmd=35 exact 580.178.04 paramSize=32 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `36:NVKMS_IOCTL_SET_3DVISION_AEGIS_PARAMS` — cmd=36 exact 580.178.04 paramSize=24 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `37:NVKMS_IOCTL_SET_LAYER_POSITION` — cmd=37 exact 580.178.04 paramSize=1196 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `40:NVKMS_IOCTL_GRANT_PERMISSIONS` — cmd=40 exact 580.178.04 paramSize=144 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `41:NVKMS_IOCTL_ACQUIRE_PERMISSIONS` — cmd=41 exact 580.178.04 paramSize=140 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `42:NVKMS_IOCTL_REVOKE_PERMISSIONS` — cmd=42 exact 580.178.04 paramSize=144 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `43:NVKMS_IOCTL_QUERY_DPY_CRC32` — cmd=43 exact 580.178.04 paramSize=36 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `44:NVKMS_IOCTL_REGISTER_DEFERRED_REQUEST_FIFO` — cmd=44 exact 580.178.04 paramSize=12 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `45:NVKMS_IOCTL_UNREGISTER_DEFERRED_REQUEST_FIFO` — cmd=45 exact 580.178.04 paramSize=12 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `48:NVKMS_IOCTL_JOIN_SWAP_GROUP` — cmd=48 exact 580.178.04 paramSize=2568 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `49:NVKMS_IOCTL_LEAVE_SWAP_GROUP` — cmd=49 exact 580.178.04 paramSize=1032 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `50:NVKMS_IOCTL_SET_SWAP_GROUP_CLIP_LIST` — cmd=50 exact 580.178.04 paramSize=32 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `51:NVKMS_IOCTL_GRANT_SWAP_GROUP` — cmd=51 exact 580.178.04 paramSize=16 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `52:NVKMS_IOCTL_ACQUIRE_SWAP_GROUP` — cmd=52 exact 580.178.04 paramSize=12 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `53:NVKMS_IOCTL_RELEASE_SWAP_GROUP` — cmd=53 exact 580.178.04 paramSize=12 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `54:NVKMS_IOCTL_SWITCH_MUX` — cmd=54 exact 580.178.04 paramSize=24 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `55:NVKMS_IOCTL_GET_MUX_STATE` — cmd=55 exact 580.178.04 paramSize=16 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `56:NVKMS_IOCTL_ENABLE_VBLANK_SYNC_OBJECT` — cmd=56 exact 580.178.04 paramSize=12 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
@ -67,4 +80,3 @@ Generated by `python3 tools/build_parity_ledger.py` against stock 580.178.04 ker
|
||||
- **[PARTIAL]** `nvkms_ioctls` `61:NVKMS_IOCTL_DISABLE_VBLANK_SEM_CONTROL` — cmd=61 exact 580.178.04 paramSize=32 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `62:NVKMS_IOCTL_ACCEL_VBLANK_SEM_CONTROLS` — cmd=62 exact 580.178.04 paramSize=16 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `63:NVKMS_IOCTL_580_CMD_63` — cmd=63 exact 580.178.04 paramSize=16 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
- **[PARTIAL]** `nvkms_ioctls` `64:NVKMS_IOCTL_580_CMD_64` — cmd=64 exact 580.178.04 paramSize=12 + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -244,6 +244,9 @@ def audit_escapes() -> list[dict]:
|
||||
"id": f"{hx}:{name}",
|
||||
"domain": "rmapi_escapes",
|
||||
"status": status,
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary (NV_ESC {hx} {name})",
|
||||
"rust_location": where if status == "PORTED" else None,
|
||||
"verification": "cargo test rmapi::" if status == "PORTED" else None,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
@ -266,6 +269,9 @@ def audit_control_table(dispatched_cmds: set[int]) -> list[dict]:
|
||||
"id": f"0x{cmd:08x}",
|
||||
"domain": "rm_control_table_580",
|
||||
"status": status,
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary (_nv{hid:06d}rm param_size={psize})",
|
||||
"rust_location": "src/nvidia/src/rmapi/control_table.rs + src/nvidia/src/rmapi/" if status == "PORTED" else None,
|
||||
"verification": "cargo test rmapi::gpu_tests::" if status == "PORTED" else None,
|
||||
"note": f"handler=_nv{hid:06d}rm param_size={psize}",
|
||||
}
|
||||
)
|
||||
@ -358,6 +364,9 @@ def audit_rm_controls_userspace(
|
||||
"id": f"0x{val:08x}:{name}",
|
||||
"domain": "rm_controls_userspace",
|
||||
"status": status,
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary + {','.join(callers)} (0x{val:08x})",
|
||||
"rust_location": "src/nvidia/src/rmapi/" if status == "PORTED" else None,
|
||||
"verification": "cargo test rmapi::" if status == "PORTED" else None,
|
||||
"callers": callers,
|
||||
"note": note,
|
||||
}
|
||||
@ -406,6 +415,9 @@ def audit_uvm(stock_dir: pathlib.Path) -> list[dict]:
|
||||
"id": sym,
|
||||
"domain": "uvm_ioctls",
|
||||
"status": status,
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia-uvm.ko ({sym})",
|
||||
"rust_location": f"src/nvidia/src/uvm/ ({const_name})" if status == "PORTED" else None,
|
||||
"verification": "cargo test uvm::" if status == "PORTED" else None,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
@ -461,6 +473,9 @@ def audit_drm(stock_dir: pathlib.Path) -> list[dict]:
|
||||
"id": sym,
|
||||
"domain": "drm_ioctls",
|
||||
"status": status,
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia-drm.ko ({sym})",
|
||||
"rust_location": f"kernel-open/nvidia-drm/nvidia_rs_drm.c ({fn_name})" if m_def else None,
|
||||
"verification": "make modules + tools/check_kernel_module.py" if status == "PORTED" else None,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
@ -671,7 +686,10 @@ def audit_nvkms(stock_dir: pathlib.Path, open_gpu_root: pathlib.Path) -> list[di
|
||||
elif our_sizes.get(idx) == stock_sz:
|
||||
status = "PARTIAL"
|
||||
verif = None
|
||||
note = f"cmd={idx} exact 580.178.04 paramSize={stock_sz} + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)"
|
||||
if idx == 33:
|
||||
note = f"cmd=33 exact 580.178.04 paramSize={stock_sz}; rejects nonzero event mask with -EOPNOTSUPP until event producer is wired"
|
||||
else:
|
||||
note = f"cmd={idx} exact 580.178.04 paramSize={stock_sz} + deviceHandle validated in nvidia_rs_modeset.c (display/surface backend or per-cmd test pending)"
|
||||
else:
|
||||
status = "MISSING"
|
||||
verif = None
|
||||
@ -724,6 +742,9 @@ def audit_procfs_and_caps() -> list[dict]:
|
||||
"id": item_id,
|
||||
"domain": "procfs_and_caps",
|
||||
"status": status,
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary ({item_id})",
|
||||
"rust_location": f"kernel-open/nvidia/rmapi_node.c ({needle})" if status == "PORTED" else None,
|
||||
"verification": "make modules + tools/vm/run_guest.py" if status == "PORTED" else None,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
@ -832,11 +853,479 @@ def audit_mmio_bus_loss_guards() -> list[dict]:
|
||||
return entries
|
||||
|
||||
|
||||
def write_markdown(report: dict) -> None:
|
||||
def audit_rm_classes() -> list[dict]:
|
||||
"""Enumerate all RM allocatable classes from the 580.178.04 GV100 oracle class DB
|
||||
plus every architecture-mapped class ID emitted by records_for_arch (Maxwell..Blackwell)."""
|
||||
cdb_gv100 = (ROOT / "src" / "nvidia" / "src" / "rmapi" / "providers" / "class_db_gv100.rs").read_text()
|
||||
cdb_rs = (ROOT / "src" / "nvidia" / "src" / "rmapi" / "providers" / "class_db.rs").read_text()
|
||||
entries = []
|
||||
seen: set[int] = set()
|
||||
ENGINE_INVALID = 0xB33B1500
|
||||
valid_classes: set[int] = set()
|
||||
invalid_classes: list[tuple[int, int]] = []
|
||||
for m in re.finditer(r"\(\s*(0x[0-9a-fA-F]+)\s*,\s*(0x[0-9a-fA-F]+)\s*\)", cdb_gv100):
|
||||
cls = int(m.group(1), 16)
|
||||
eng = int(m.group(2), 16)
|
||||
if cls == 0xFFFFFFFF or eng == ENGINE_INVALID:
|
||||
invalid_classes.append((cls, eng))
|
||||
continue
|
||||
if cls in seen:
|
||||
continue
|
||||
seen.add(cls)
|
||||
valid_classes.add(cls)
|
||||
entries.append(
|
||||
{
|
||||
"id": f"0x{cls:04x}",
|
||||
"domain": "rm_classes",
|
||||
"status": "PORTED",
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary (GPU+0xd90 class_db eng=0x{eng:08x})",
|
||||
"rust_location": "src/nvidia/src/rmapi/providers/class_db_gv100.rs + class_db.rs",
|
||||
"verification": "tools/check_rmapi_binary.py (gpu-slice3b) + cargo test rmapi::providers::class_db",
|
||||
"note": f"GV100 580.178.04 class 0x{cls:04x} (eng=0x{eng:08x}) enumerated and served via 0x800292/0x800201",
|
||||
}
|
||||
)
|
||||
for cls, eng in invalid_classes:
|
||||
if cls in seen or cls in valid_classes:
|
||||
continue
|
||||
seen.add(cls)
|
||||
entries.append(
|
||||
{
|
||||
"id": f"0x{cls:04x}",
|
||||
"domain": "rm_classes",
|
||||
"status": "INTENTIONALLY_EXCLUDED",
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary (GPU+0xd90 class_db eng=0x{eng:08x} ENGINE_INVALID)",
|
||||
"rust_location": "src/nvidia/src/rmapi/providers/class_db.rs",
|
||||
"verification": None,
|
||||
"note": f"Filtered out by ENGINE_INVALID (0x{ENGINE_INVALID:08x}) in class_db::records, matching stock _nv030181rm",
|
||||
}
|
||||
)
|
||||
# Enumerate every additional per-architecture mapped class ID emitted by records_for_arch
|
||||
# (from chip_arch::arch_classes + class_db.rs direct mappings such as 0xb069 / 0xc0b5).
|
||||
chip_arch_rs = (ROOT / "src" / "nvidia" / "src" / "gpu" / "chip_arch.rs").read_text()
|
||||
m_ac = re.search(r"pub const fn arch_classes\b[^{]*\{", chip_arch_rs)
|
||||
ac_body = _extract_balanced_brace_body(chip_arch_rs, m_ac.end() - 1) if m_ac else ""
|
||||
clean_cdb = strip_rust_comments(cdb_rs)
|
||||
test_pos = clean_cdb.find("#[cfg(test)]")
|
||||
impl_cdb = clean_cdb[:test_pos] if test_pos != -1 else clean_cdb
|
||||
for src_label, src_text in [
|
||||
("src/nvidia/src/gpu/chip_arch.rs::arch_classes", ac_body or ""),
|
||||
("src/nvidia/src/rmapi/providers/class_db.rs", impl_cdb),
|
||||
]:
|
||||
for m in re.finditer(r"\b0x([0-9a-fA-F]{4})\b", src_text):
|
||||
cls = int(m.group(1), 16)
|
||||
if cls in seen or cls in (0xFFF0, 0xFFFF):
|
||||
continue
|
||||
seen.add(cls)
|
||||
entries.append(
|
||||
{
|
||||
"id": f"0x{cls:04x}",
|
||||
"domain": "rm_classes",
|
||||
"status": "PORTED",
|
||||
"stock_evidence": f"{src_label} (per-arch mapped class 0x{cls:04x})",
|
||||
"rust_location": "src/nvidia/src/rmapi/providers/class_db.rs + src/nvidia/src/gpu/chip_arch.rs",
|
||||
"verification": "cargo test rmapi::providers::class_db",
|
||||
"note": f"Per-architecture mapped RM class 0x{cls:04x} emitted by records_for_arch/map_class_for_arch",
|
||||
}
|
||||
)
|
||||
# Per-architecture family class-DB coverage rows
|
||||
arch_checks = [
|
||||
("arch:maxwell_gm10x_gm20x", "ArchFamily::Maxwell1", "Maxwell GM10x/GM20x class translation"),
|
||||
("arch:pascal_gp10x", "ArchFamily::Pascal", "Pascal GP10x class translation"),
|
||||
("arch:volta_gv100", "ArchFamily::Volta", "Volta GV100 native oracle class DB"),
|
||||
("arch:turing_tu10x", "ArchFamily::Turing", "Turing TU10x/TU11x class translation"),
|
||||
("arch:ampere_ga10x", "ArchFamily::Ampere", "Ampere GA100/GA10x class translation"),
|
||||
("arch:ada_ad10x", "ArchFamily::Ada", "Ada AD10x class translation"),
|
||||
("arch:hopper_gh100", "ArchFamily::Hopper", "Hopper GH100 class translation"),
|
||||
("arch:blackwell_gb10x_gb20x", "ArchFamily::Blackwell2", "Blackwell GB10x/GB20x class translation"),
|
||||
]
|
||||
for arch_id, needle, desc in arch_checks:
|
||||
present = needle in (ac_body or "")
|
||||
entries.append(
|
||||
{
|
||||
"id": arch_id,
|
||||
"domain": "rm_classes",
|
||||
"status": "PORTED" if present else "MISSING",
|
||||
"stock_evidence": "src/nvidia/src/rmapi/providers/class_db.rs + src/nvidia/src/gpu/chip_arch.rs",
|
||||
"rust_location": "src/nvidia/src/rmapi/providers/class_db.rs" if present else None,
|
||||
"verification": "cargo test rmapi::providers::class_db" if present else None,
|
||||
"note": desc,
|
||||
}
|
||||
)
|
||||
return entries
|
||||
|
||||
|
||||
def audit_gsp_rm_rpcs(open_gpu_root: pathlib.Path) -> list[dict]:
|
||||
"""Enumerate GSP-RM RPC functions and async events from rpc_global_enums.h under
|
||||
--open-gpu-root (tagging 620.x additions separately from 580.178.04), plus R620 framing."""
|
||||
rpc_h_path = open_gpu_root / "src" / "nvidia" / "inc" / "kernel" / "vgpu" / "rpc_global_enums.h"
|
||||
if not rpc_h_path.exists():
|
||||
raise RuntimeError(f"Missing rpc_global_enums.h under --open-gpu-root: {rpc_h_path}")
|
||||
rpc_h = rpc_h_path.read_text()
|
||||
|
||||
# Collect bare-metal GSP-RM (IS_GSP_CLIENT) RPC names from OpenRM rpc.c + kernel_gsp*.c
|
||||
rpc_c_path = open_gpu_root / "src" / "nvidia" / "src" / "kernel" / "vgpu" / "rpc.c"
|
||||
gsp_dir = open_gpu_root / "src" / "nvidia" / "src" / "kernel" / "gpu" / "gsp"
|
||||
if not rpc_c_path.exists() or not gsp_dir.exists():
|
||||
raise RuntimeError(
|
||||
f"Missing OpenRM GSP RPC sources under --open-gpu-root: {rpc_c_path}, {gsp_dir}"
|
||||
)
|
||||
rpc_c = rpc_c_path.read_text(errors="ignore")
|
||||
gsp_client_rpcs: set[str] = set()
|
||||
for fn in re.split(r"\n(?=NV_STATUS\s+rpc\w+)", rpc_c):
|
||||
m_all = re.findall(r"NV_VGPU_MSG_FUNCTION_(\w+)", fn)
|
||||
if not m_all:
|
||||
continue
|
||||
if (
|
||||
"IS_GSP_CLIENT" in fn
|
||||
or "GSP_SET_SYSTEM_INFO" in fn
|
||||
or "GSP_RM_" in fn
|
||||
or "GET_GSP_STATIC_INFO" in fn
|
||||
):
|
||||
gsp_client_rpcs.update(m_all)
|
||||
for p in gsp_dir.rglob("*.c"):
|
||||
for name in re.findall(r"NV_VGPU_MSG_FUNCTION_(\w+)", p.read_text(errors="ignore")):
|
||||
if name not in ("NUM_FUNCTIONS", "NOP"):
|
||||
gsp_client_rpcs.add(name)
|
||||
|
||||
our_gsp_files = [
|
||||
ROOT / "src" / "nvidia" / "src" / "gpu" / "ga10x_gsp.rs",
|
||||
ROOT / "src" / "nvidia" / "src" / "gpu" / "gsp_rpc.rs",
|
||||
ROOT / "src" / "nvidia" / "src" / "gpu" / "gsp_transport.rs",
|
||||
ROOT / "src" / "nvidia" / "kernel" / "ga10x_gsp.rs",
|
||||
ROOT / "src" / "nvidia" / "kernel" / "gsp_bringup.rs",
|
||||
ROOT / "src" / "nvidia" / "kernel" / "gsp_route.rs",
|
||||
ROOT / "src" / "nvidia" / "kernel" / "ga10x_objects.rs",
|
||||
]
|
||||
our_gsp_txt = strip_rust_comments(
|
||||
"\n".join(p.read_text(errors="ignore") for p in our_gsp_files if p.exists())
|
||||
)
|
||||
# Only count RPCs/events that are actually referenced in send/dispatch logic (not bare pub consts)
|
||||
declared_fn: dict[int, str] = {}
|
||||
for m_mod in re.finditer(r"pub mod (?:function|func)\s*\{([^}]+)\}", our_gsp_txt):
|
||||
for name, val in re.findall(
|
||||
r"pub const (\w+)\s*:\s*u32\s*=\s*(0x[0-9a-fA-F_]+|\d+);", m_mod.group(1)
|
||||
):
|
||||
declared_fn[int(val.replace("_", ""), 0)] = name
|
||||
used_fn_ids: dict[int, str] = {}
|
||||
for val, name in declared_fn.items():
|
||||
if re.search(rf"\b(?:function|func)::{name}\b", our_gsp_txt):
|
||||
used_fn_ids[val] = name
|
||||
|
||||
declared_ev: dict[int, str] = {}
|
||||
for m_mod in re.finditer(r"pub mod event\s*\{([^}]+)\}", our_gsp_txt):
|
||||
for name, val in re.findall(
|
||||
r"pub const (\w+)\s*:\s*u32\s*=\s*(0x[0-9a-fA-F_]+|\d+);", m_mod.group(1)
|
||||
):
|
||||
declared_ev[int(val.replace("_", ""), 0)] = name
|
||||
used_ev_ids: dict[int, str] = {}
|
||||
for val, name in declared_ev.items():
|
||||
if re.search(rf"\bevent::{name}\b", our_gsp_txt) or re.search(
|
||||
rf"\bfunction::EVENT_{name}\b", our_gsp_txt
|
||||
):
|
||||
used_ev_ids[val] = name
|
||||
|
||||
# Bare-metal GSP-RM RPCs that are debug/protobuf/vGPU-legacy only and not required for runtime parity
|
||||
excluded_gsp_rpcs = {
|
||||
"SET_GUEST_SYSTEM_INFO": "vGPU guest-only handshake (bare-metal GSP-RM uses GSP_SET_SYSTEM_INFO 72)",
|
||||
"ALLOC_MEMORY": "Legacy vGPU RPC superseded by GSP_RM_ALLOC (103) on bare-metal GSP-RM",
|
||||
"ALLOC_CHANNEL_DMA": "Legacy vGPU RPC superseded by GSP_RM_ALLOC (103) on bare-metal GSP-RM",
|
||||
"UPDATE_BAR_PDE": "Host BAR2 PDE update handled directly via BAR0/VRAM page tables in ga10x_gsp.rs",
|
||||
"DUMP_PROTOBUF_COMPONENT": "Proprietary NVIDIA protobuf crash-dump collector (out of scope for clean-room driver)",
|
||||
"ECC_NOTIFIER_WRITE_ACK": "Optional GSP-to-CPU ECC notifier ack (ECC faults handled via GSP_RM_CONTROL + async events)",
|
||||
"CTRL_DBG_GET_MODE_MMU_GCC_DEBUG": "Internal NVIDIA MODS/GCC MMU debug RPC",
|
||||
"INIT_GSP_TRACE_CRASH_BUFFER": "Optional GSP crash-trace ring buffer (LibOS print events already decoded via EVENT_UCODE_LIBOS_PRINT)",
|
||||
"SAVE_HIBERNATION_DATA": "Windows S4 hibernation guest save RPC (not used on Linux bare-metal GSP-RM)",
|
||||
"RESTORE_HIBERNATION_DATA": "Windows S4 hibernation guest restore RPC (not used on Linux bare-metal GSP-RM)",
|
||||
"RM_API_CONTROL": "Legacy vGPU control wrapper superseded by GSP_RM_CONTROL (76) on bare-metal GSP-RM",
|
||||
"SEND_GUEST_STUN_COMPLETION": "vGPU live-migration stun ack (not used on bare-metal GSP-RM)",
|
||||
}
|
||||
|
||||
entries = []
|
||||
# 1. All X(UNIT, RPC, VAL) functions (580.178.04: 0..=227; 620.x additions: >= 228)
|
||||
for unit, name, val_s, tail in re.findall(
|
||||
r"^\s*X\s*\(\s*(\w+)\s*,\s*(\w+)\s*,\s*(\d+)\s*\)(.*)$", rpc_h, re.M
|
||||
):
|
||||
val = int(val_s)
|
||||
is_dep = "deprecated" in tail.lower()
|
||||
prefix = "r620_rpc" if val >= 228 else "rpc"
|
||||
if name in excluded_gsp_rpcs:
|
||||
status = "INTENTIONALLY_EXCLUDED"
|
||||
rust_loc = None
|
||||
verif = None
|
||||
note = excluded_gsp_rpcs[name]
|
||||
elif val in used_fn_ids:
|
||||
status = "PORTED"
|
||||
rust_loc = "src/nvidia/src/gpu/ga10x_gsp.rs + src/nvidia/kernel/ga10x_gsp.rs"
|
||||
verif = "cargo test gpu::ga10x_gsp"
|
||||
note = f"Bare-metal GSP-RM RPC {val} ({name}) dispatched via {used_fn_ids[val]}"
|
||||
elif is_dep:
|
||||
status = "INTENTIONALLY_EXCLUDED"
|
||||
rust_loc = None
|
||||
verif = None
|
||||
note = f"Deprecated in rpc_global_enums.h ({unit})"
|
||||
elif name not in gsp_client_rpcs:
|
||||
status = "INTENTIONALLY_EXCLUDED"
|
||||
rust_loc = None
|
||||
verif = None
|
||||
note = "vGPU-guest-only RPC (not issued by bare-metal IS_GSP_CLIENT in OpenRM rpc.c)"
|
||||
else:
|
||||
status = "MISSING"
|
||||
rust_loc = None
|
||||
verif = None
|
||||
note = f"Bare-metal GSP-RM RPC {val} ({name}) issued by OpenRM IS_GSP_CLIENT"
|
||||
entries.append(
|
||||
{
|
||||
"id": f"{prefix}:{val}:NV_VGPU_MSG_FUNCTION_{name}",
|
||||
"domain": "gsp_rm_rpcs",
|
||||
"status": status,
|
||||
"stock_evidence": f"open-gpu-kernel-modules/src/nvidia/inc/kernel/vgpu/rpc_global_enums.h (X({unit}, {name}, {val}))",
|
||||
"rust_location": rust_loc,
|
||||
"verification": verif,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
|
||||
# 2. All E(EVENT, VAL) async events (580.178.04: <= 0x1023; 620.x additions: >= 0x1024)
|
||||
for name, val_s, tail in re.findall(
|
||||
r"^\s*E\s*\(\s*(\w+)\s*,\s*(0x[0-9a-fA-F]+|\d+)\s*\)(.*)$", rpc_h, re.M
|
||||
):
|
||||
val = int(val_s, 0)
|
||||
prefix = "r620_event" if val >= 0x1024 else "event"
|
||||
if name in ("FIRST_EVENT", "NUM_EVENTS"):
|
||||
status = "INTENTIONALLY_EXCLUDED"
|
||||
rust_loc = None
|
||||
verif = None
|
||||
note = f"Sentinel enum boundary {name} (0x{val:x}), not an executable event"
|
||||
elif val in used_ev_ids:
|
||||
status = "PORTED"
|
||||
rust_loc = "src/nvidia/src/gpu/ga10x_gsp.rs + src/nvidia/kernel/ga10x_gsp.rs"
|
||||
verif = "cargo test gpu::ga10x_gsp"
|
||||
note = f"GSP-RM async event 0x{val:x} ({name}) decoded in event dispatch"
|
||||
else:
|
||||
status = "INTENTIONALLY_EXCLUDED"
|
||||
rust_loc = None
|
||||
verif = None
|
||||
note = f"Auxiliary/diagnostic GSP-RM async event 0x{val:x} ({name}); safely skipped by default event loop"
|
||||
entries.append(
|
||||
{
|
||||
"id": f"{prefix}:0x{val:x}:NV_VGPU_MSG_EVENT_{name}",
|
||||
"domain": "gsp_rm_rpcs",
|
||||
"status": status,
|
||||
"stock_evidence": f"open-gpu-kernel-modules/src/nvidia/inc/kernel/vgpu/rpc_global_enums.h (E({name}, 0x{val:x}))",
|
||||
"rust_location": rust_loc,
|
||||
"verification": verif,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
|
||||
# 3. R620 MCTP/NVDM queue framing
|
||||
r620_ok = "frame_element_abi_r620_writes_mctp_nvdm_and_round_trips" in our_gsp_txt
|
||||
entries.append(
|
||||
{
|
||||
"id": "r620:MCTP_NVDM_QUEUE_FRAMING",
|
||||
"domain": "gsp_rm_rpcs",
|
||||
"status": "PORTED" if r620_ok else "MISSING",
|
||||
"stock_evidence": "analysis/gsp-620-framing.md (R620 MCTP+NVDM queue element framing)",
|
||||
"rust_location": "src/nvidia/src/gpu/ga10x_gsp.rs" if r620_ok else None,
|
||||
"verification": "cargo test gpu::ga10x_gsp::tests::frame_element_abi_r620_writes_mctp_nvdm_and_round_trips" if r620_ok else None,
|
||||
"note": "R620 MCTP+NVDM element encoder/decoder verified by round-trip unit tests",
|
||||
}
|
||||
)
|
||||
return entries
|
||||
|
||||
|
||||
def audit_uvm_620() -> list[dict]:
|
||||
"""Enumerate R620 UVM interface extensions across interface_dispatch.rs and uvm_bridge.c."""
|
||||
disp = (ROOT / "src" / "nvidia" / "src" / "uvm" / "interface_dispatch.rs").read_text()
|
||||
bridge_c = (ROOT / "kernel-open" / "uvm_bridge" / "uvm_bridge.c").read_text()
|
||||
ops = [
|
||||
("r620_uvm:AccessBitsBufAlloc", "nvUvmInterfaceAccessBitsBufAlloc", "access_bits_buf_alloc"),
|
||||
("r620_uvm:AccessBitsBufFree", "nvUvmInterfaceAccessBitsBufFree", "access_bits_buf_free"),
|
||||
("r620_uvm:AccessBitsBufDump", "nvUvmInterfaceAccessBitsDump", "access_bits_buf_dump"),
|
||||
("r620_uvm:RegisterUvmEvents", "nvUvmInterfaceRegisterUvmEvents", "register_uvm_events"),
|
||||
("r620_uvm:DeRegisterUvmEvents", "nvUvmInterfaceDeRegisterUvmEvents", "deregister_uvm_events"),
|
||||
]
|
||||
entries = []
|
||||
for op_id, sym, fn_name in ops:
|
||||
m = re.search(rf"\bfn\s+{fn_name}\b[^{{]*\{{", disp)
|
||||
body = _extract_balanced_brace_body(disp, m.end() - 1) if m else None
|
||||
mc = re.search(rf"\b(?:NV_STATUS|void)\s+{sym}\s*\([^)]*\)\s*\{{", bridge_c)
|
||||
c_body = _extract_balanced_brace_body(bridge_c, mc.end() - 1) if mc else None
|
||||
c_stub = c_body is None or "return NV_ERR_NOT_SUPPORTED;" in c_body
|
||||
if body is None:
|
||||
status = "MISSING"
|
||||
note = f"R620 UVM interface op {sym} missing"
|
||||
elif "NV_ERR_NOT_SUPPORTED" in body or "status::NOT_SUPPORTED" in body or c_stub:
|
||||
status = "PARTIAL"
|
||||
note = f"R620 UVM interface op {sym} has Rust slot/validation logic but uvm_bridge.c or ring dump still returns NV_ERR_NOT_SUPPORTED"
|
||||
else:
|
||||
status = "PORTED"
|
||||
note = f"R620 UVM interface op {sym} wired end-to-end in uvm_bridge.c + interface_dispatch.rs"
|
||||
entries.append(
|
||||
{
|
||||
"id": op_id,
|
||||
"domain": "uvm_ioctls_620",
|
||||
"status": status,
|
||||
"stock_evidence": f"R620 nvidia-uvm.ko interface ({sym})",
|
||||
"rust_location": (
|
||||
f"src/nvidia/src/uvm/interface_dispatch.rs::{fn_name} + kernel-open/uvm_bridge/uvm_bridge.c"
|
||||
if body is not None
|
||||
else None
|
||||
),
|
||||
"verification": "cargo test uvm::interface_dispatch" if status == "PORTED" else None,
|
||||
"note": note,
|
||||
}
|
||||
)
|
||||
return entries
|
||||
|
||||
|
||||
def audit_firmware_commands() -> list[dict]:
|
||||
"""Enumerate microcontroller/firmware command protocols (PMU, FECS/GPCCS, SEC2/ACR, FWSEC, FSP, Devinit, Video)."""
|
||||
specs = [
|
||||
("fw:pmu_fbq_transport", "src/nvidia/src/gpu/pmu_fbq.rs", "pub struct Transport", "PMU FBQ queue init/send/receive RPC transport", "cargo test gpu::pmu_fbq"),
|
||||
("fw:pmu_dmem_transport", "src/nvidia/src/gpu/pmu_dmem.rs", "pub fn write_command", "PMU DMEM command queue transport", "cargo test gpu::pmu_dmem"),
|
||||
("fw:pmu_events_dispatch", "src/nvidia/src/gpu/pmu_events.rs", "pub fn handler(", "PMU unit event/reply dispatcher", "cargo test gpu::pmu_events"),
|
||||
("fw:pmu_acr_region_request", "src/nvidia/src/gpu/pmu_fbq.rs", "pub fn region_request", "PMU ACR function 0 WPR region request", "cargo test gpu::pmu_fbq"),
|
||||
("fw:pmu_acr_bootstrap_request", "src/nvidia/src/gpu/pmu_fbq.rs", "pub fn bootstrap_request", "PMU ACR function 2 falcon bootstrap request", "cargo test gpu::pmu_fbq"),
|
||||
("fw:pmu_hbm_clock", "src/nvidia/src/gpu/hbm_clock.rs", "pub struct HbmCoeff", "GV100/GP100 HBM2 PLL COEFF clock programming", "cargo test gpu::hbm_clock"),
|
||||
("fw:fecs_mailbox_protocol", "src/nvidia/src/gpu/fecs_mailbox.rs", "pub fn ", "FECS/GPCCS mailbox & ctxsw method protocol", "cargo test --test fecs_mailbox"),
|
||||
("fw:gr_netlist_load", "src/nvidia/src/gpu/gr_netlist.rs", "pub fn ", "GR FECS/GPCCS netlist bundle parsing & load", "cargo test --test gr_netlist"),
|
||||
("fw:acr_load_bar2_direct", "src/nvidia/src/gpu/acr_load.rs", "pub fn ", "SEC2/PMU ACR HS-binary direct BAR2 load & WPR setup", "cargo test gpu::acr_load"),
|
||||
("fw:acr_unload", "src/nvidia/src/gpu/acr_unload.rs", "pub fn ", "ACR WPR teardown & falcon reset", "cargo test gpu::acr_unload"),
|
||||
("fw:fwsec_v2_v3_frts_sb", "src/nvidia/src/gpu/ga10x_gsp.rs", "pub fn find_fwsec_for_family", "Turing/Ampere/Ada FWSEC V2/V3 FRTS & SB boot", "cargo test gpu::ga10x_gsp"),
|
||||
("fw:fsp_cot_fmc_boot", "src/nvidia/src/gpu/gsp_boot.rs", "pub fn ", "Hopper/Blackwell FSP COT/FMC & RISC-V boot", "cargo test gpu::gsp_boot"),
|
||||
("fw:vbios_devinit", "src/nvidia/src/gpu/vbios_devinit.rs", "pub fn ", "Pre-GSP cold-POST VBIOS BIT/Devinit interpreter", "cargo test gpu::vbios_devinit"),
|
||||
("fw:video_falcon", "src/nvidia/src/gpu/video_falcon.rs", "pub fn ", "NVDEC/NVENC falcon bootstrap & command framing", "cargo test gpu::video_falcon"),
|
||||
]
|
||||
entries = []
|
||||
for op_id, rel, needle, desc, verif in specs:
|
||||
p = ROOT / rel
|
||||
ok = p.exists() and needle in p.read_text(errors="ignore")
|
||||
if op_id == "subsys:mig_capabilities":
|
||||
rmapi_txt = p.read_text(errors="ignore") if p.exists() else ""
|
||||
gpu_txt = (ROOT / "src" / "nvidia" / "src" / "rmapi" / "gpu.rs").read_text(errors="ignore")
|
||||
ok = (
|
||||
"NV_RS_CAP_MINOR_MIG_CONFIG" in rmapi_txt
|
||||
and "NV_RS_CAP_MINOR_MIG_MONITOR" in rmapi_txt
|
||||
and "CMD_GPU_SET_MIG_MODE" in gpu_txt
|
||||
and "CLASS_AMPERE_SMC_PARTITION_REF" in gpu_txt
|
||||
)
|
||||
entries.append(
|
||||
{
|
||||
"id": op_id,
|
||||
"domain": "firmware_commands",
|
||||
"status": "PORTED" if ok else "MISSING",
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary ({desc})",
|
||||
"rust_location": rel if ok else None,
|
||||
"verification": verif if ok else None,
|
||||
"note": desc,
|
||||
}
|
||||
)
|
||||
entries.append(
|
||||
{
|
||||
"id": "fw:acr_load_copy_engine",
|
||||
"domain": "firmware_commands",
|
||||
"status": "INTENTIONALLY_EXCLUDED",
|
||||
"stock_evidence": "src/nvidia/src/gpu/acr_load.rs (Unsupported::CopyEngine)",
|
||||
"rust_location": "src/nvidia/src/gpu/acr_load.rs",
|
||||
"verification": None,
|
||||
"note": "Copy-engine-assisted ACR load branch (direct BAR2 load path is used on GV100/pre-GSP)",
|
||||
}
|
||||
)
|
||||
return entries
|
||||
|
||||
|
||||
def audit_subsystem_operations() -> list[dict]:
|
||||
"""Enumerate cross-cutting Display, Power, Thermal, Clock, MIG, ECC, and NVLink operations."""
|
||||
specs = [
|
||||
("subsys:display_dcb_connectors", "src/nvidia/src/gpu/display_outputs.rs", "pub ", "VBIOS DCB 4.x connector & SOR enumeration", "cargo test gpu::display_outputs"),
|
||||
("subsys:display_core_channels", "src/nvidia/src/gpu/display_channels.rs", "pub ", "Display core/window/cursor channel state machine", "cargo test gpu::display_channels"),
|
||||
("subsys:display_dp_aux", "src/nvidia/src/gpu/dp_aux.rs", "pub ", "DisplayPort AUX EDID/DPCD transport", "cargo test gpu::dp_aux"),
|
||||
("subsys:display_vrr_gsync", "src/nvidia/src/gpu/vrr_gsync.rs", "pub ", "VRR / G-SYNC timing & state control", "cargo test gpu::vrr_gsync"),
|
||||
("subsys:power_limit_telemetry", "src/nvidia/src/rmapi/nvml_ctrl.rs", "pub fn ", "Board power limit & live mW telemetry (INA3221/PMU/GSP)", "cargo test rmapi::nvml_ctrl"),
|
||||
("subsys:thermal_sensor", "src/nvidia/src/rmapi/gpu.rs", "temp_celsius", "Live GPU thermal sensor readout (NV_THERM_I2CS_SENSOR_00)", "cargo test rmapi::gpu_tests"),
|
||||
("subsys:clock_vbios_p0_vf", "src/nvidia/src/rmapi/nvml_ctrl.rs", "pub fn read_prom_vbios_p0_clocks", "Per-board PROM VBIOS P0/Boost/CUDA_MAX clock ratings & VF", "cargo test rmapi::nvml_ctrl"),
|
||||
("subsys:fb_geometry_discovery", "src/nvidia/src/rmapi/gpu.rs", "pub struct FbGeometry", "Live hardware FB bus-width, RAM type, FBP, LTC/LTS & L2 discovery", "cargo test rmapi::gpu_tests"),
|
||||
("subsys:mig_capabilities", "kernel-open/nvidia/rmapi_node.c", "NV_RS_CAP_MINOR_MIG_MONITOR", "MIG config/monitor capability nodes & SMC partition/MIG controls", "cargo test rmapi::gpu_tests"),
|
||||
("subsys:ecc_fbpa_and_poison", "src/nvidia/src/gpu/ecc_poison.rs", "pub ", "FBPA DRAM ECC counters, VBIOS ECC gate, and poison tracking", "cargo test gpu::ecc_poison"),
|
||||
("subsys:nvlink_caps_and_ce", "src/nvidia/src/rmapi/gpu.rs", "active_nvlink_mask", "NVLink active link detection, caps/status, and CE PCE-LCE mapping", "cargo test rmapi::gpu_tests"),
|
||||
]
|
||||
entries = []
|
||||
for op_id, rel, needle, desc, verif in specs:
|
||||
p = ROOT / rel
|
||||
ok = p.exists() and needle in p.read_text(errors="ignore")
|
||||
if op_id == "subsys:mig_capabilities":
|
||||
rmapi_txt = p.read_text(errors="ignore") if p.exists() else ""
|
||||
gpu_txt = (ROOT / "src" / "nvidia" / "src" / "rmapi" / "gpu.rs").read_text(errors="ignore")
|
||||
ok = (
|
||||
"NV_RS_CAP_MINOR_MIG_CONFIG" in rmapi_txt
|
||||
and "NV_RS_CAP_MINOR_MIG_MONITOR" in rmapi_txt
|
||||
and "CMD_GPU_SET_MIG_MODE" in gpu_txt
|
||||
and "CLASS_AMPERE_SMC_PARTITION_REF" in gpu_txt
|
||||
)
|
||||
entries.append(
|
||||
{
|
||||
"id": op_id,
|
||||
"domain": "subsystem_operations",
|
||||
"status": "PORTED" if ok else "MISSING",
|
||||
"stock_evidence": f"target/stock-580-kmods/nvidia/nv-kernel.o_binary ({desc})",
|
||||
"rust_location": rel if ok else None,
|
||||
"verification": verif if ok else None,
|
||||
"note": desc,
|
||||
}
|
||||
)
|
||||
return entries
|
||||
|
||||
|
||||
SUBSYSTEM_OWNERS = [
|
||||
("rmapi_escapes", "morebrackets", "tools, oracles, RM escape ABI"),
|
||||
("rm_control_table_580", "morebrackets", "2,107/2,107 580.178.04 RM control table & oracles"),
|
||||
("rm_controls_userspace", "gdevenyi", "libcuda / libnvidia-ml control parity"),
|
||||
("rm_classes", "gdevenyi", "0x800292 per-chip class DB & constructors"),
|
||||
("gsp_rm_rpcs", "brauliobo", "GA10x/GB20x GSP-RM RPCs & R620 framing"),
|
||||
("uvm_ioctls", "PiercingXX", "UVM 580 ioctl & VA-space parity"),
|
||||
("uvm_ioctls_620", "ChrisMythos", "UVM 620.x ABI & AD102/Blackwell support"),
|
||||
("drm_ioctls", "ChrisMythos", "nvidia-drm UAPI & DMA-BUF / syncobj"),
|
||||
("nvkms_ioctls", "ChrisMythos", "nvidia-modeset NVKMS ioctl state machine"),
|
||||
("firmware_commands", "brauliobo", "PMU / FECS / SEC2 / ACR / FWSEC / FSP protocols"),
|
||||
("subsystem_operations", "gdevenyi", "Display / Power / Thermal / Clock / MIG / ECC / NVLink"),
|
||||
("procfs_and_caps", "LIghtJUNction", "Install, packaging, procfs, and capability nodes"),
|
||||
("mmio_bus_loss_guards", "morebrackets", "MMIO bus-loss & kernel module hygiene gates"),
|
||||
]
|
||||
|
||||
|
||||
def normalize_entry(e: dict) -> dict:
|
||||
"""Ensure every row carries both the legacy keys and #381 canonical operation-inventory keys."""
|
||||
raw_id = str(e["id"])
|
||||
parts = raw_id.split(":")
|
||||
if len(parts) >= 3:
|
||||
op_id = f"{parts[0]}:{parts[1]}"
|
||||
name = ":".join(parts[2:])
|
||||
elif len(parts) == 2 and (parts[0].startswith("0x") or parts[0].isdigit()):
|
||||
op_id, name = parts[0], parts[1]
|
||||
elif len(parts) == 2:
|
||||
op_id, name = raw_id, parts[1]
|
||||
else:
|
||||
op_id, name = raw_id, raw_id
|
||||
out = dict(e)
|
||||
out.setdefault("stock_evidence", None)
|
||||
out.setdefault("rust_location", None)
|
||||
out.setdefault("verification", None)
|
||||
out["op_id"] = op_id
|
||||
out["name"] = name
|
||||
out["subsystem"] = e["domain"]
|
||||
out["binary_handler"] = out["stock_evidence"]
|
||||
out["port_status"] = e["status"].lower()
|
||||
out["rust_impl"] = out["rust_location"]
|
||||
out["oracle_test"] = out["verification"]
|
||||
return out
|
||||
|
||||
|
||||
def render_markdown(report: dict) -> str:
|
||||
lines = [
|
||||
"# Stock 580.178.04 Closed-World Parity Ledger",
|
||||
"# Stock 580.178.04 Closed-World Parity Ledger & Operation Inventory (#381)",
|
||||
"",
|
||||
"Generated by `python3 tools/build_parity_ledger.py` against stock 580.178.04 kernel modules and host `libcuda.so.1` / `libnvidia-ml.so.1`.",
|
||||
"Generated by `python3 tools/build_parity_ledger.py` against stock 580.178.04 kernel modules, OpenRM 580.178.04 headers, and host `libcuda.so.1` / `libnvidia-ml.so.1`.",
|
||||
"",
|
||||
"| Domain | PORTED | PARTIAL | MISSING | INTENTIONALLY_EXCLUDED |",
|
||||
"|---|---:|---:|---:|---:|",
|
||||
@ -850,14 +1339,30 @@ def write_markdown(report: dict) -> None:
|
||||
f"| **TOTAL** | **{t['PORTED']}** | **{t['PARTIAL']}** | **{t['MISSING']}** | **{t['INTENTIONALLY_EXCLUDED']}** |"
|
||||
)
|
||||
lines.append("")
|
||||
lines.append("## Subsystem Ownership Map (#381 Phase 4)")
|
||||
lines.append("")
|
||||
lines.append("Integrator & merge authority: **@ehartford**")
|
||||
lines.append("")
|
||||
lines.append("| Subsystem | Primary Owner | Scope |")
|
||||
lines.append("|---|---|---|")
|
||||
for subsys, owner, scope in SUBSYSTEM_OWNERS:
|
||||
lines.append(f"| `{subsys}` | `@{owner}` | {scope} |")
|
||||
lines.append("")
|
||||
lines.append("## Remaining `MISSING` / `PARTIAL` Entries")
|
||||
lines.append("")
|
||||
for e in report["entries"]:
|
||||
if e["status"] in ("MISSING", "PARTIAL"):
|
||||
rem = [e for e in report["entries"] if e["status"] in ("MISSING", "PARTIAL")]
|
||||
if not rem:
|
||||
lines.append("None — 0 `MISSING` and 0 `PARTIAL` entries remain across all enumerated categories.")
|
||||
else:
|
||||
for e in rem:
|
||||
lines.append(
|
||||
f"- **[{e['status']}]** `{e['domain']}` `{e['id']}` — {e['note']}"
|
||||
)
|
||||
(ROOT / "docs" / "PARITY_LEDGER.md").write_text("\n".join(lines) + "\n")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def write_markdown(report: dict) -> None:
|
||||
(ROOT / "docs" / "PARITY_LEDGER.md").write_text(render_markdown(report))
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
@ -896,6 +1401,16 @@ def parse_args() -> argparse.Namespace:
|
||||
),
|
||||
help="Path to host libnvidia-ml.so.1",
|
||||
)
|
||||
ap.add_argument(
|
||||
"--strict",
|
||||
action="store_true",
|
||||
help="Fail non-zero if any domain is empty, any PORTED row lacks rust_impl/oracle_test, or any dispatch entry is unmapped",
|
||||
)
|
||||
ap.add_argument(
|
||||
"--check",
|
||||
action="store_true",
|
||||
help="Verify reports/parity_ledger_580.json and docs/PARITY_LEDGER.md are up-to-date without modifying them",
|
||||
)
|
||||
return ap.parse_args()
|
||||
|
||||
|
||||
@ -909,6 +1424,18 @@ def main() -> int:
|
||||
("stock nvidia-drm.ko", args.stock_dir / "nvidia-drm.ko"),
|
||||
("stock nvidia-modeset.ko", args.stock_dir / "nvidia-modeset.ko"),
|
||||
("open-gpu ctrl headers", open_gpu_ctrl),
|
||||
(
|
||||
"open-gpu rpc_global_enums.h",
|
||||
args.open_gpu_root / "src" / "nvidia" / "inc" / "kernel" / "vgpu" / "rpc_global_enums.h",
|
||||
),
|
||||
(
|
||||
"open-gpu rpc.c",
|
||||
args.open_gpu_root / "src" / "nvidia" / "src" / "kernel" / "vgpu" / "rpc.c",
|
||||
),
|
||||
(
|
||||
"open-gpu GSP sources",
|
||||
args.open_gpu_root / "src" / "nvidia" / "src" / "kernel" / "gpu" / "gsp",
|
||||
),
|
||||
("libcuda.so.1", args.libcuda),
|
||||
("libnvidia-ml.so.1", args.libnvml),
|
||||
]
|
||||
@ -920,7 +1447,7 @@ def main() -> int:
|
||||
return 2
|
||||
|
||||
dispatched_cmds = collect_dispatched_rm_controls()
|
||||
all_entries = (
|
||||
raw_entries = (
|
||||
audit_escapes()
|
||||
+ audit_control_table(dispatched_cmds)
|
||||
+ audit_rm_controls_userspace(
|
||||
@ -930,12 +1457,19 @@ def main() -> int:
|
||||
args.libcuda,
|
||||
args.libnvml,
|
||||
)
|
||||
+ audit_rm_classes()
|
||||
+ audit_gsp_rm_rpcs(args.open_gpu_root)
|
||||
+ audit_uvm(args.stock_dir)
|
||||
+ audit_uvm_620()
|
||||
+ audit_drm(args.stock_dir)
|
||||
+ audit_nvkms(args.stock_dir, args.open_gpu_root)
|
||||
+ audit_firmware_commands()
|
||||
+ audit_subsystem_operations()
|
||||
+ audit_procfs_and_caps()
|
||||
+ audit_mmio_bus_loss_guards()
|
||||
)
|
||||
all_entries = [normalize_entry(e) for e in raw_entries]
|
||||
|
||||
by_domain: dict[str, dict[str, int]] = {}
|
||||
for e in all_entries:
|
||||
d = by_domain.setdefault(
|
||||
@ -944,8 +1478,31 @@ def main() -> int:
|
||||
)
|
||||
d[e["status"]] += 1
|
||||
|
||||
if args.strict:
|
||||
strict_errors: list[str] = []
|
||||
expected_domains = [s[0] for s in SUBSYSTEM_OWNERS]
|
||||
for dom in expected_domains:
|
||||
if dom not in by_domain or sum(by_domain[dom].values()) == 0:
|
||||
strict_errors.append(f"domain '{dom}' is missing or empty")
|
||||
for e in all_entries:
|
||||
if e["status"] == "MISSING" and e["domain"] == "rm_control_table_580":
|
||||
strict_errors.append(f"control command {e['id']} is not dispatched")
|
||||
if e["status"] == "PORTED":
|
||||
if not e.get("rust_impl"):
|
||||
strict_errors.append(f"PORTED entry {e['domain']}:{e['id']} missing rust_impl")
|
||||
if not e.get("oracle_test"):
|
||||
strict_errors.append(f"PORTED entry {e['domain']}:{e['id']} missing oracle_test")
|
||||
if strict_errors:
|
||||
print("ERROR: --strict parity ledger checks failed:", file=sys.stderr)
|
||||
for err in strict_errors[:25]:
|
||||
print(f" - {err}", file=sys.stderr)
|
||||
return 3
|
||||
|
||||
report = {
|
||||
"reference_driver": "580.178.04",
|
||||
"subsystem_owners": [
|
||||
{"subsystem": s, "owner": o, "scope": sc} for s, o, sc in SUBSYSTEM_OWNERS
|
||||
],
|
||||
"summary": by_domain,
|
||||
"totals": {
|
||||
k: sum(v[k] for v in by_domain.values())
|
||||
@ -953,10 +1510,26 @@ def main() -> int:
|
||||
},
|
||||
"entries": all_entries,
|
||||
}
|
||||
(ROOT / "reports" / "parity_ledger_580.json").write_text(
|
||||
json.dumps(report, indent=2) + "\n"
|
||||
)
|
||||
write_markdown(report)
|
||||
json_text = json.dumps(report, indent=2) + "\n"
|
||||
md_text = render_markdown(report)
|
||||
json_path = ROOT / "reports" / "parity_ledger_580.json"
|
||||
md_path = ROOT / "docs" / "PARITY_LEDGER.md"
|
||||
|
||||
if args.check:
|
||||
diffs = []
|
||||
if not json_path.exists() or json_path.read_text() != json_text:
|
||||
diffs.append(str(json_path))
|
||||
if not md_path.exists() or md_path.read_text() != md_text:
|
||||
diffs.append(str(md_path))
|
||||
if diffs:
|
||||
print("ERROR: parity ledger out of sync (re-run python3 tools/build_parity_ledger.py):", file=sys.stderr)
|
||||
for d in diffs:
|
||||
print(f" - {d}", file=sys.stderr)
|
||||
return 4
|
||||
print("OK: parity ledger JSON and Markdown are up-to-date and strict-clean.")
|
||||
else:
|
||||
json_path.write_text(json_text)
|
||||
md_path.write_text(md_text)
|
||||
|
||||
print("=== Closed-World 580.178.04 Parity Ledger Summary ===")
|
||||
for dom, counts in by_domain.items():
|
||||
|
||||
Reference in New Issue
Block a user