mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
1041 lines
69 KiB
Python
Executable File
1041 lines
69 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Divide the original-driver BAR0 transcript of 0000:b3:00.0 into attributed segments.
|
|
|
|
Input: target/trace/b3-bar0.txt (`R|W <bar0 offset> <value> <time>` plus MARK
|
|
lines), the per-GPU extract of reports/original-mmiotrace-b3-first/mmiotrace.txt.
|
|
Output: reports/original-trace-b3-segment-map.json.
|
|
|
|
The segment boundaries and attributions in SEGMENTS are analysis results entered
|
|
by hand; everything countable (line spans, times, per-block read/write counts,
|
|
lost-event markers, PRAMIN structure, Falcon load sizes, bit-banged I2C bytes,
|
|
BAR1/BAR2 activity, Rust citations of the named symbols) is recomputed from the
|
|
inputs on every run, and ANCHORS pins each attribution to exact trace lines so a
|
|
different transcript fails instead of silently shifting.
|
|
|
|
Confidence values:
|
|
verified_disassembly body already compared with the original instructions
|
|
by earlier work (a validation report exists) and the
|
|
trace lines equal that body's accesses
|
|
matched_pseudocode the access sequence or register set was matched
|
|
against the inferred pseudocode export
|
|
inferred_register_meaning only the meaning of the registers and the position
|
|
in the stage order support the attribution
|
|
|
|
Usage:
|
|
tools/map_trace_segments.py write the report
|
|
tools/map_trace_segments.py --check regenerate and compare with the report
|
|
"""
|
|
import argparse
|
|
from collections import Counter, OrderedDict
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
from analyze_mmiotrace import BLOCKS, block # noqa: E402
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
TRACE = ROOT / "target/trace/b3-bar0.txt"
|
|
FULL_TRACE = ROOT / "reports/original-mmiotrace-b3-first/mmiotrace.txt"
|
|
REPORT = ROOT / "reports/original-trace-b3-segment-map.json"
|
|
RUST = ROOT / "src/nvidia/src"
|
|
PACK = ROOT / "reports/gv100-firmware-pack.json"
|
|
SYMBOLS = Path("/home/geodd/nvidia-driver/analysis-580.178.04/decompiled/kernel-rm-all/"
|
|
"original-symbol-export-map.jsonl")
|
|
FIRST_LINE = 198 # the brief says 199; line 198 is the read half of the same rewrite
|
|
BAR1 = (0x39a000000000, 0x39a7ffffffff)
|
|
BAR2 = (0x39a800000000, 0x39a801ffffff) # PCI resource 3
|
|
|
|
V = "verified_disassembly"
|
|
P = "matched_pseudocode"
|
|
I = "inferred_register_meaning"
|
|
|
|
PRE = "pre-stage of first open (_nv000790rm, RmInitAdapter)"
|
|
PREINIT = "PreInit (_nv031503rm -> _nv031221rm -> _nv031220rm)"
|
|
INIT = "Init (_nv031501rm -> _nv031215rm)"
|
|
GLUE = "between Init and Load"
|
|
PRELOAD = "PreLoad (inside _nv031217rm)"
|
|
LOAD = "Load (_nv031502rm -> _nv031217rm)"
|
|
POSTLOAD = "PostLoad (_nv031219rm)"
|
|
TAIL = "after StateLoad, still first open (_nv000790rm tail)"
|
|
API = "later RM API / channel work"
|
|
|
|
|
|
def seg(first, stage, engine, what, confidence, basis, symbols=(), rust=("none", (), "")):
|
|
return {"first": first, "stage": stage, "engine": engine, "description": what,
|
|
"confidence": confidence, "basis": basis, "symbols": list(symbols),
|
|
"rust": {"status": rust[0], "modules": list(rust[1]), "note": rust[2]}}
|
|
|
|
|
|
# Each segment runs from its first line to the line before the next segment.
|
|
SEGMENTS = [
|
|
seg(198, PRE, "OS layer / BIF",
|
|
"PCI device-control rewrite (0x88080 twice), 0x88114, one fuse and two PBUS 0x1580 reads "
|
|
"before the ROM is read.",
|
|
I, "position before the first PROM read; no body matched"),
|
|
seg(206, PRE, "VBIOS (GPU+20c8 child)",
|
|
"VBIOS image read through PROM 0x300000-0x340600, one 32-bit word at a time, re-reading "
|
|
"PMC_BOOT_0 after every all-ones word; ends with header probes at 0x33e8xx/0x33f8xx/0x3405ex.",
|
|
P, "PROM word order equals the Rust ROM source probe, which cites the original bodies",
|
|
("_nv054392rm", "_nv059939rm", "_nv060125rm"),
|
|
("implemented", ("gpu/rom_prom.rs", "gpu/rom_acquire.rs", "gpu/rom_source.rs", "gpu/rom_validate.rs"),
|
|
"ROM acquisition chain exists in core; not compared line by line here")),
|
|
seg(24754, PRE, "PMU (legacy boot wait)",
|
|
"12,463 polls of PMU IRQSTAT 0x10a100 until bit 4 is set (0.32 s).",
|
|
P, "poll loop equals the legacy PMU readiness wait already reproduced in core",
|
|
(), ("implemented", ("gpu/pmu_wait.rs",), "see reports/gv100-pmu-wait-validation.json")),
|
|
seg(37220, PRE, "PMU (legacy boot wait)",
|
|
"PMU IRQSCLR=0x10, PBUS 0x1594, then two DMEM reads through port 0 (0x10a1c0/0x10a1c4) at "
|
|
"0x1b20 (16 words, first 0x50414d44) and 0x1ba0 (36 words).",
|
|
P, "DMEM port protocol equals the core bootstrap DMEM reader",
|
|
(), ("implemented", ("gpu/pmu_dmem.rs", "gpu/pmu_init.rs"), "")),
|
|
seg(37279, PRE, "OBJMC / OBJBUS / OBJTMR",
|
|
"First-open engine reset: bus master off, PMC_ENABLE 0x42000020/0x42001120/0xbfffffff, bus "
|
|
"master on, PBUS 0x1140=0x8c0001fe, then timer time 0x9410/0x9400.",
|
|
V, "given: _nv043609rm, _nv018640rm and timer init (reports/gpu-mc-reset-validation.json)",
|
|
("_nv043609rm", "_nv018640rm", "_nv059661rm"),
|
|
("implemented", ("gpu/mc_reset.rs", "gpu/bus_stage.rs", "gpu/timer/init.rs"), "ran on hardware at level 3")),
|
|
seg(37296, PREINIT, "GPU object (PF PreInit wrapper)",
|
|
"PCI subsystem id, PTOP 0x2240c/0x22400, 0x1074 and six fuse words, each fuse read "
|
|
"preceded by a read of 0x1373a0.",
|
|
I, "read-only identification; fuse guard reader _nv039060rm is the only constant match",
|
|
("_nv039060rm", "_nv031221rm"),
|
|
("partial", ("gpu/base_pre_init.rs",), "base pass exists; the PF wrapper steps do not")),
|
|
seg(37312, PREINIT, "GPU object (device info table)",
|
|
"PTOP device-info table 0x22700-0x227fc, 64 words.",
|
|
P, "0x22700 is read only by _nv047218rm in the pseudocode",
|
|
("_nv047218rm",),
|
|
("partial", ("mmu/engine_discovery.rs",), "decodes a supplied table; no reader of 0x22700 in core")),
|
|
seg(37376, PREINIT, "OBJMC engine-enable helper (caller not established)",
|
|
"PMC_ENABLE read and rewrite of the same value 0x1fecdff1, then 57 reads of the IOCTRL "
|
|
"discovery words at 0xa00000-0xa000d8.",
|
|
I, "task brief lists line 37377 as MC load; the MC StateLoad sequence itself is at 139243. "
|
|
"Same-value PMC rewrites recur before every CE PreInit write (47931-47966)",
|
|
("_nv041568rm",), ("partial", ("gpu/mc_load.rs",), "leaf cited there; this caller is not implemented")),
|
|
seg(37435, PREINIT, "KernelFifo engine info (lazy)",
|
|
"PFIFO 0x2004, the 14-entry PBDMA map 0x2390-0x23c4, and a second pass over the PTOP "
|
|
"device-info table.",
|
|
P, "0x2390 only in _nv027760rm, 0x2004 in _nv027828rm/_nv040335rm, 0x22700 in _nv047218rm",
|
|
("_nv027760rm", "_nv027828rm", "_nv047218rm"),
|
|
("partial", ("mmu/engine_discovery.rs", "mmu/engine_cache.rs"), "table decode only")),
|
|
seg(37519, PREINIT, "OBJFIFO+1a0 -> OBJBUS+260",
|
|
"PRI-fault probe of register 0x2634: two reads of PBUS 0x1100, write 0x1100=8, two reads, "
|
|
"read 0x2634, read 0x1100. This is the writer of line 37521.",
|
|
P, "seven accesses equal _nv018588rm(gpu, bus, 0x2634) statement by statement; _nv028103rm "
|
|
"(OBJFIFO HAL +1a0) is the only caller passing 0x2634",
|
|
("_nv028103rm", "_nv018588rm"), ("none", (), "")),
|
|
seg(37526, PREINIT, "MemorySystem / KernelMemorySystem / MemoryManager PreInitLocked",
|
|
"Read-only probing: PTOP 0x2243c, fuses, PPRIV 0x12006c, PFB 0x100ce0/0x100b18/0x100b14/"
|
|
"0x100a0c, FBPA 0x9a0590/0x9a0470/0x9a050c/0x9a016c, 0x118fb0, 0x205e4, FECS 0x409660, "
|
|
"LTC 0x17e27c/0x17e000/0x17e3f4/0x17e480, 16 fuse words 0x21c00.",
|
|
I, "register meaning; 0x120074 is in the MemorySystem PreInitLocked call tree",
|
|
("_nv041679rm", "_nv045118rm"), ("partial", ("mmu/vram.rs",), "FB range decode only")),
|
|
seg(37591, PREINIT, "KernelGmmu+368",
|
|
"Fault-buffer size registers: 0x100e34 and 0x100e48 read, rewritten, read back.",
|
|
V, "given: _nv040937rm (reports/gpu-gmmu-fault-buffer-size-validation.json)",
|
|
("_nv040937rm",), ("implemented", ("gpu/gmmu_fault_buffer_size.rs",), "verified, not wired")),
|
|
seg(37597, PREINIT, "OBJBUS / KernelBus PreInitLocked",
|
|
"Reads of 0x2008, 0x104028, PPRIV 0x120070/0x120078, PTOP 0x22430/38/34, PCI 0x8860c/"
|
|
"0x88610, PBUS 0x1708, 0x10100c and PMC_ENABLE twice.",
|
|
P, "_nv018541rm (OBJBUS+300) reads 0x120070 and discards it; the rest is by position",
|
|
("_nv018656rm", "_nv018541rm"), ("partial", ("gpu/bus_stage.rs",), "OBJBUS bodies only")),
|
|
seg(37610, PREINIT, "Graphics PreInitLocked",
|
|
"Clock-gating table loads: 54 writes of the first family, 49 of the second (PGRAPH, FECS, "
|
|
"GPCCS, PTRIM 0x13c8xx).",
|
|
V, "given: _nv033505rm (reports/gpu-clock-gating-validation.json)",
|
|
("_nv033505rm",), ("implemented", ("gpu/clock_gating.rs", "gpu/clock_gating_tables.rs"), "verified, not wired")),
|
|
seg(37713, PREINIT, "OBJACR+150",
|
|
"One fuse word, then WPR region read through index register 0x100cd4 (indices 2, 3, 0, 1).",
|
|
V, "given: _nv016745rm (reports/gpu-acr-wpr-region-validation.json)",
|
|
("_nv016745rm",), ("implemented", ("gpu/acr_wpr_region.rs",), "verified, not wired")),
|
|
seg(37723, PREINIT, "OBJINFOROM PreInitLocked",
|
|
"InfoROM file system at ROM 0x41000 (signature 'JFFS'): header probes, then 128-byte "
|
|
"blocks read through PROM with the ROM serial-bypass bit 0xe208[0] cleared before and set "
|
|
"after each block; PBUS 0x1724 (reads back 0x6800e208) is read before each toggle. Objects "
|
|
"seen: ROM, IMG, OBD, OEM, ECC, NVL, BBX, PBL, EEN, PPO, OCT. These are the '1,010 I2C "
|
|
"writes': every write to 0xe208 before the first PRAMIN write is this toggle (most of them "
|
|
"in this segment, the rest in the later InfoROM object reads); none is I2C.",
|
|
P, "0xe208 write (param&1 | old&~1) is _nv051775rm (Pmgr+218); 0x1724 read is _nv018565rm "
|
|
"(OBJBUS+2f8). The owning stage is by position between ACR and CE in engine order",
|
|
("_nv051775rm", "_nv018565rm", "_nv051772rm", "_nv051764rm"), ("none", (), "")),
|
|
seg(47931, PREINIT, "OBJCE x9 PreInitLocked",
|
|
"Nine times: PMC_ENABLE read and same-value rewrite, then read and rewrite of "
|
|
"0x104414+0x80*i (value 0xa). Preceded by a 63,020-event loss.",
|
|
I, "nine instances match the nine OBJCE objects with a non-default PreInitLocked slot",
|
|
(), ("none", (), "")),
|
|
seg(47967, INIT, "OBJBIF / KernelBif InitLocked",
|
|
"XVE 0x8c1c0, PCI 0x88088/0x88488, one fuse, writes 0x88030=0, 0x8800c=0xf800 and the "
|
|
"device-control rewrite 0x88080.",
|
|
I, "first engines in Init order; register meaning", (),
|
|
("partial", ("gpu/gv100_link.rs", "gpu/kernel_mc.rs"), "")),
|
|
seg(47980, INIT, "ClockManager InitUnlocked/InitLocked",
|
|
"Read-only clock discovery: 0x137f20-0x137f2c, fuses 0x2162c-0x21668, 0x136e90, nine PLL "
|
|
"words (0x1e0214.., 0x136414/e14/614), straps 0x101000.",
|
|
I, "register meaning", (),
|
|
("partial", ("gpu/clock_inputs.rs", "gpu/clock_registry.rs"), "clock object model exists; provider binding not traced")),
|
|
seg(48033, INIT, "Pmgr InitLocked (DPAUX pads)",
|
|
"Seven read/rewrite pairs of 0xd97c+0x50*i.",
|
|
I, "register meaning; 0xd97c readers are _nv026313rm/_nv026307rm/_nv026193rm",
|
|
("_nv026313rm",), ("none", (), "")),
|
|
seg(48047, INIT, "Pmgr InitLocked (InfoROM object)",
|
|
"Three reads of the 128-byte InfoROM block at ROM 0x48a90 (object 'PPO'), with bypass toggles.",
|
|
P, "same block reader as the InfoROM PreInit segment", ("_nv051775rm", "_nv018565rm"), ("none", (), "")),
|
|
seg(48161, INIT, "Pmgr InitLocked (I2C port reset)",
|
|
"0x13718c read, 0xdc28=0, then for nine ports a read of 0xd7a0+4*i and a write of 7 "
|
|
"(SCL and SDA released) to 0xd014+0x20*i.",
|
|
P, "0xd014+0x20*port is used by the bit-bang functions _nv014307rm.._nv014324rm, "
|
|
"_nv036690rm, _nv048183rm; exact body not selected",
|
|
("_nv036630rm", "_nv036712rm"), ("none", (), "")),
|
|
seg(48182, INIT, "OBJTMR InitLocked",
|
|
"Timer control 0x9430 read, time written high word 0x9410 then low word 0x9400.",
|
|
P, "same three accesses as the verified time-programming body used at line 37293",
|
|
("_nv059663rm", "_nv059661rm"), ("implemented", ("gpu/timer/init.rs",), "")),
|
|
seg(48185, INIT, "Pmgr/Therm (GPIO table programming)",
|
|
"GPIO output-control registers 0xd634/0xd63c/0xd64c/0xd680/0xd684/0xd610/0xd790/0xd798 "
|
|
"rewritten with their current values, each batch latched with 0xd604=1; seven DPAUX words "
|
|
"0xd964+0x50*i cleared and restored to 0x07d000fa; 0xdc08/0xdc88 cleared.",
|
|
I, "register meaning; 0xd604 appears in _nv030035rm/_nv047980rm, 0xd798 in _nv051576rm (Pmgr+208)",
|
|
("_nv051576rm", "_nv030035rm", "_nv047980rm"), ("none", (), "")),
|
|
seg(48246, INIT, "Pmgr (hardware mutexes)",
|
|
"Two PTHERM reads, then all 16 PMGR mutexes acquired: read 0xdf08+4*i, read id from 0xdf00 "
|
|
"(0xcc..0xdb), write it to 0xdf08+4*i, read back.",
|
|
P, "_nv051596rm (Pmgr+288) reads 0xdf08+4*i, _nv051590rm (Pmgr+290) is the only 0xdf00 user",
|
|
("_nv051590rm", "_nv051596rm"), ("none", (), "")),
|
|
seg(48312, INIT, "I2C (bit-banged, port 0)",
|
|
"Port 0 transaction on 0xd014: START, byte 0x02, ninth clock, STOP, timed with "
|
|
"NV_USERMODE_TIME 0x810080/0x810084. The only real I2C traffic in the transcript.",
|
|
I, "decoded from SCL/SDA levels; body not selected", ("_nv014321rm",), ("none", (), "")),
|
|
seg(48472, INIT, "I2C (bit-banged, ports 1 and 3-8)",
|
|
"Each of seven ports gets 7 written twice and is then polled about 600 times for 10 ms "
|
|
"(always reads 7: sense bits low) before the driver gives up. Almost all of the 4,205 "
|
|
"PGPIO reads and 21,032 usermode timer reads of this segment are that polling.",
|
|
I, "decoded from the poll pattern; body not selected", ("_nv014321rm",), ("none", (), "")),
|
|
seg(73723, INIT, "Pmgr (hardware mutexes)",
|
|
"All 16 PMGR mutexes released: 0xdf08+4*i cleared, id written back to 0xdf04.",
|
|
P, "_nv051598rm (Pmgr+298) is the 0xdf04 release leaf", ("_nv051598rm",), ("none", (), "")),
|
|
seg(73787, INIT, "Therm+1f8",
|
|
"Twelve indexed reads: 0x206d4 low nibble set to 0..5 (twice each), data from 0x206e4; then "
|
|
"0x204a0, 0x118fb0, 0x205e4.",
|
|
P, "_nv058958rm writes 0x206d4 as (old & ~0xf) | index", ("_nv058958rm",), ("none", (), "")),
|
|
seg(73826, INIT, "MemorySystem InitUnlocked/InitLocked",
|
|
"LTC 0x17e2b0 and 0x17e2bc rewritten, PMC_ENABLE written 0x3ffcdffd (reads back "
|
|
"0x1fecdff1), PFB 0x100c80 rewritten, FBPA 0x9a0388 pulsed and 0x9a0478-0x9a048c/0x9a0474 "
|
|
"programmed, 24 fuse words, per-LTC 0x140480+0x2000*i, PFB 0x100c10 rewritten. The nine "
|
|
"'PNVLINK' writes of the block table are these FBPA writes.",
|
|
P, "0x100c10 writers are _nv041625rm/_nv041661rm/_nv041665rm; 0x100c80 has 26 users; rest by meaning",
|
|
("_nv041661rm",), ("none", (), "")),
|
|
seg(73938, INIT, "MemoryManager InitLocked",
|
|
"InfoROM object 'PBL' (retired-page list) read twice: 12 blocks at ROM 0x46410-0x469fc.",
|
|
I, "object name and position after MemorySystem", ("_nv051775rm",), ("none", (), "")),
|
|
seg(74914, INIT, "KernelBus / KernelGmmu InitLocked (buffer zero fill)",
|
|
"0x2008, 0x104028, PFB 0x100b20/b14/b18/b24 read; PRAMIN window moved to 0x7fdf90000 and "
|
|
"64 KiB zero-filled (16,384 words); window restored to 0x7fff0. The address reappears as "
|
|
"0x100ccc = 0x7fdf900 (MMU debug read buffer by register meaning).",
|
|
P, "0x1700 window writers are _nv039556rm/_nv039656rm (value = base >> 16)",
|
|
("_nv039556rm", "_nv039656rm"),
|
|
("partial", ("mmu/pramin.rs",), "window protocol exists (cites 039507); no caller that zero-fills these ranges")),
|
|
seg(91313, INIT, "KernelBus / KernelGmmu InitLocked (buffer zero fill)",
|
|
"Window to 0x7fdf80000, second 64 KiB zero fill, window restored. The address reappears as "
|
|
"0x100cc8 = 0x7fdf800 (MMU debug write buffer by register meaning).",
|
|
P, "as above", ("_nv039556rm", "_nv039656rm"), ("partial", ("mmu/pramin.rs",), "")),
|
|
seg(107705, INIT, "KernelGmmu (called during BAR2 setup)",
|
|
"Fault-buffer registers again: 0x100e48 rewritten once, 0x100e34 twice; seven fuse words "
|
|
"0x2125c-0x21274.",
|
|
P, "same registers as _nv040937rm/_nv040889rm/_nv040989rm; which of them is not established",
|
|
("_nv040937rm", "_nv040989rm"), ("partial", ("gpu/gmmu_fault_buffer_size.rs", "mmu/fault_setup.rs"), "")),
|
|
seg(107728, INIT, "KernelBus InitLocked (BAR2 page directory)",
|
|
"Window to 0x7fffa0000. Page directory page 0x7fffa2000 zero-filled (1,024 words). BAR2 "
|
|
"instance block at 0x7fffa1000: address limit 0x208/0x20c = 0x0a090fff/0, then page "
|
|
"directory base high 0x204 = 7, low 0x200 = 0xfffa2c00. Directory chain: 0x7fffa2000[0] = "
|
|
"0x7fffa302, 0x7fffa3000[0] = 0x7fffa402, 0x7fffa4000[0] = 0x7fffa502, then 16 dual "
|
|
"entries at 0x7fffa5000 pointing at page tables 0x7fffa6000 onward.",
|
|
P, "PDB words equal mmu/ramin.rs encode_pdb (video aperture, version 2, 64K big page) "
|
|
"written high then low; directory entries are (address >> 12) << 8 | 2",
|
|
(), ("partial", ("mmu/ramin.rs", "mmu/bar2.rs", "mmu/table_store.rs"),
|
|
"encoders exist for unpublished CPU-owned memory; nothing writes them through PRAMIN")),
|
|
seg(108830, INIT, "KernelBus InitLocked (BAR2 page tables)",
|
|
"Page tables 0x7fffa6000-0x7ffff6488 filled with 8-byte entries of value 8 (invalid, "
|
|
"volatile): 41,105 entries, one per 4 KiB of the 0xa091000-byte BAR2 address space. Two "
|
|
"loss markers fall inside: the second (828) equals its missing words exactly, the first "
|
|
"(52,164) is 260 more than the 51,904 words missing from the address range.",
|
|
P, "address span / 8 equals (limit + 1) / 4096; table_store.rs has the same sparse entry",
|
|
(), ("partial", ("mmu/table_store.rs",), "sparsify_4k exists for owned backing only")),
|
|
seg(138310, INIT, "KernelBus InitLocked (BAR2 bind)",
|
|
"Window restored, NV_PBUS_BAR2_BLOCK 0x1714 = 0xc07fffa1 (virtual mode, instance block "
|
|
"0x7fffa1000), bind status 0x1710 read.",
|
|
P, "value equals mmu/bar2.rs encode_bind (cites original 039307); writer _nv039307rm",
|
|
("_nv039307rm",), ("partial", ("mmu/bar2.rs",), "encoder only; no register write path")),
|
|
seg(138316, INIT, "KernelBus InitLocked (page-table self map)",
|
|
"85 valid entries written at 0x7fffadd50-0x7fffadff8 mapping BAR2 offsets 0xfaa000-"
|
|
"0xfff000 to the page-table pages 0x7fffa2000-0x7ffff6000; last entry read back; window "
|
|
"restored.",
|
|
P, "entry value (address >> 12) << 8 | 1; entry index gives the BAR2 offset", (),
|
|
("partial", ("mmu/table_store.rs",), "")),
|
|
seg(138496, INIT, "KernelBus (flush + TLB invalidate)",
|
|
"Flush 0x70000=1 and invalidate (0x100cb8 = 0x7fffa20, 0x100cec = 0, 0x100cbc = "
|
|
"0x80000005, each bracketed by reads of 0x100c80), three invalidates.",
|
|
P, "0x100cb8/0x100cec writers _nv040941rm/_nv040943rm, 0x100cbc _nv040663rm/_nv040665rm, flush _nv018613rm",
|
|
("_nv040941rm", "_nv040663rm", "_nv018613rm"), ("implemented", ("mmu/rm_tlb.rs",), "selected RM invalidate and flush")),
|
|
seg(138515, INIT, "KernelBus InitLocked (BAR2 verification)",
|
|
"Pattern 0xabcdabcd written through PRAMIN at 0x7fdf7e000 and read back, LTC broadcast "
|
|
"0x17e2a4/0x17e2a0 written with all 16 LTCs read after each, the pattern rewritten as "
|
|
"0xabcdabdd for four words. In the full trace the same words appear through BAR2 offset 0: "
|
|
"BAR2 offset 0 maps 0x7fdf7e000.",
|
|
I, "pattern test seen from both apertures; body not selected", (), ("none", (), "")),
|
|
seg(138651, INIT, "engines after KernelBus in Init order (not separated)",
|
|
"18.5 s with only three TLB invalidates in BAR0. The full trace shows BAR2 byte-wide zero "
|
|
"fills here: 4 KiB at offset 0, then 0x2000-0x102000 (1 MiB) twice (the first recorded only "
|
|
"from 0xc97b5), then 0x2000-0x9a00. 1,065,268 events were lost in this interval.",
|
|
I, "BAR2 offsets and widths from the full trace; the engines (OBJFBFLCN, Graphics, OBJLSFM, "
|
|
"OBJACR, PMU and others) are by Init order only",
|
|
(), ("none", (), "")),
|
|
seg(138668, INIT, "late Init engine (not established)",
|
|
"InfoROM object 'OCT' block at ROM 0x48b10 read three times.",
|
|
I, "position", ("_nv051775rm",), ("none", (), "")),
|
|
seg(138782, INIT, "OBJBSP, OBJMSENC x3, KernelFifo/OBJFIFO InitLocked",
|
|
"Read-only: fuses 0x21d68/0x21500, NVDEC 0x85304, 0x21644, fuse 0x21610 three times, "
|
|
"PFIFO 0x2008.",
|
|
I, "three identical fuse reads match the three OBJMSENC objects; 0x2008 is in the OBJFIFO "
|
|
"InitLocked call tree", (), ("none", (), "")),
|
|
seg(138794, GLUE, "GPU stage wrapper / Intr",
|
|
"Timer interrupt 0x9100=1 and enable 0x9140=1, GPIO interrupt 0xdc60=0xffffffff and "
|
|
"0xdc68=0x07777777, PCI 0x88704=0, two GPIO reads.",
|
|
I, "position between the last Init reads and the PreLoad writes",
|
|
("_nv059639rm", "_nv026165rm"), ("none", (), "")),
|
|
seg(138803, PRELOAD, "KernelMemorySystem, Lpwr/GCX, OBJCE x9 PreLoad",
|
|
"0x100c10 rewritten; 0x104204=0x40 and 0x104200=0xc242; nine read/rewrite pairs of "
|
|
"0x104414+0x80*i.",
|
|
I, "order matches the PreLoad slots in load order (17, 31/32, 46-54)", ("_nv041661rm",), ("none", (), "")),
|
|
seg(138825, LOAD, "OBJBIF Load",
|
|
"PCIe/XVE programming: AER masks 0x8814c/0x88150/0x88154, 0x8d900 and 0x884b8 clears, "
|
|
"0x8c300, 0x8841c, 0x8c040, 0x8b940, 0x8c384, 0x88708, 0x88484, 0x88080, 0x884e8, 0x8d328, "
|
|
"0x137450, 0x8e008, 0x88658, 0x8d324, 0x88088/0x8a088, 0x8d100, 0x88144, 0x8e000, "
|
|
"0x8b8c0, 0x88a20, 0x8b800.",
|
|
P, "0x8d900 users _nv017119rm..; 0x8841c in _nv017281rm (power policy callback cited by gv100_power.rs)",
|
|
("_nv017632rm", "_nv017281rm", "_nv017282rm"),
|
|
("partial", ("gpu/gv100_load.rs", "gpu/gv100_power.rs", "gpu/gv100_aspm.rs", "gpu/gv100_l1ss.rs", "gpu/gv100_error_init.rs"),
|
|
"ordered StateLoad core exists; children are caller-supplied")),
|
|
seg(138918, LOAD, "KernelBif Load (config save)",
|
|
"PCI configuration space read out for function 0 (0x88000-0x88a68) and function 1 "
|
|
"(0x8a000-0x8a748): 325 reads.",
|
|
I, "public kbifStateLoad_IMPL ends with kbifSavePcieConfigRegisters_HAL", (), ("none", (), "")),
|
|
seg(139243, LOAD, "OBJMC Load",
|
|
"PMC_ENABLE read, written 0xffffffff, read back 0x5fecdff1, written 0x1fecdff1.",
|
|
P, "equals gpu/mc_load.rs (class body _nv043630rm, HAL _nv043573rm), which was compared "
|
|
"with the original instructions (reports/gpu-mc-load-original.json)",
|
|
("_nv043630rm", "_nv043573rm"), ("implemented", ("gpu/mc_load.rs",), "ran on hardware")),
|
|
seg(139247, LOAD, "KernelMc Load, Intr/Therm",
|
|
"PCI word 0x8800c written 0xf800 (latency timer bits 15:11); 0x206b8 = 8.",
|
|
P, "kernel_mc.rs: StateLoad _nv041565rm writes bits 15:11 of configuration word 0xc; 0x206b8 by meaning",
|
|
("_nv041565rm",), ("implemented", ("gpu/kernel_mc.rs",), "")),
|
|
seg(139250, LOAD, "OBJTMR Load",
|
|
"Timer interrupt 0x9100=2, enable 0x9140=3, alarm 0x9428 scheduled from the usermode time.",
|
|
P, "0x9100 writers _nv059639rm/_nv059651rm; StateLoad is 059665 per gpu/timer/load.rs",
|
|
("_nv059665rm", "_nv059639rm"), ("implemented", ("gpu/timer/load.rs", "gpu/timer/alarm.rs"), "")),
|
|
seg(139260, LOAD, "Therm, MemorySystem Load",
|
|
"PTHERM 0x20474/0x20714, 0x1180fc/0x1180f4, WPR information through index register "
|
|
"0x100cd0 (0, 1, 2), 0x21644, PMU 0x10ac08.",
|
|
P, "0x100cd0 users _nv045156rm/_nv046005rm", ("_nv046005rm",), ("none", (), "")),
|
|
seg(139279, LOAD, "MemorySystem Load (NVDEC Falcon, memory scrubber by inference)",
|
|
"NVDEC Falcon reset through PMC bit 15, then IMEM 256 bytes at 0, IMEM 3,328 bytes "
|
|
"secure at 0x100, DMEM 256 bytes, BOOTVEC 0, CPUCTL start, 21 polls until halt. "
|
|
"The 992 'NVDEC' writes are this load.",
|
|
I, "IMEM total 3,584 bytes equals the pack record of decoded size 3584 (tag 0x23); the "
|
|
"scrubber role is inferred from the Falcon and the position inside MemorySystem Load",
|
|
(), ("partial", ("gpu/falcon_imem.rs", "gpu/firmware_pack.rs"), "IMEM word transfer exists; no NVDEC launch parent")),
|
|
seg(140309, LOAD, "MemorySystem / KernelMemorySystem Load",
|
|
"WPR information again, 0x100cd8 = 2 then 3, LTC 0x17e39c, FB clock-gating tables "
|
|
"(0x100d10.., 0x1facb0, 0x9a0000, 0x17e030.., 0x13c824..), per-LTC reads, 0x17e2bc, FBPA "
|
|
"0x9a0584, FBHUB copies 0x1fac80/0x1facc4/0x1facc8/0x1faccc of PFB 0x100c80 and of the MMU "
|
|
"debug buffer registers 0x100cc4/0x100cc8/0x100ccc.",
|
|
P, "0x100cd8 writer _nv044383rm, 0x1facc8 writer _nv046031rm", ("_nv044383rm", "_nv046031rm"), ("none", (), "")),
|
|
seg(140405, LOAD, "Nvlink / KernelNvlink Load",
|
|
"PBUS 0x15f8, IOCTRL 0xa00000 block: six links probed and configured (0xa00240.., "
|
|
"0xa00144 per-link pulses, 0xa10018+0x8000*i, 0xa16494+0x8000*i), 0x15f8 restored.",
|
|
I, "register block", (), ("none", (), "")),
|
|
seg(140553, LOAD, "KernelGmmu Load",
|
|
"0x10ecc0, fault interrupt enables 0x100a2c (three writes), invalidate, fault buffer "
|
|
"0x100e28 = 0, 0x100e24 = 0x2000000, 0x100e34 rewritten then enabled (0xe0002061).",
|
|
P, "0x100e24 writer _nv040986rm; 0x100a2c writers _nv040697rm/_nv040700rm",
|
|
("_nv040986rm", "_nv040697rm"), ("partial", ("mmu/fault_setup.rs",), "")),
|
|
seg(140573, LOAD, "OBJBUS Load",
|
|
"0x1140 = 0x8c0001fe, 0x1c00 = 0x42, 0x1c04 = 0, 0x1900-0x191c cleared, 0x1100 read, "
|
|
"0x1140 again, 0x9080, 0x88714, fuse, 0x1598.",
|
|
P, "bus_stage.rs: StateLoad _nv018654rm with OBJBUS+220 _nv018640rm",
|
|
("_nv018654rm", "_nv018640rm"), ("implemented", ("gpu/bus_stage.rs",), "")),
|
|
seg(140591, LOAD, "KernelBus, OBJLSFM, OBJACR Load (prelude)",
|
|
"PMU 0x10a100/0x10ac08/0x10a108 and SEC2 0x87108 reads between TLB invalidates. In the "
|
|
"full trace the WPR image is copied through BAR2 during this interval: five 32-bit copies "
|
|
"at offsets 0x3000 (230,144 bytes), 0x3c000 (17,408), 0x41000 (34,816), 0x4a000 (288,512) "
|
|
"and 0x91000 (204,544), then 0x2078 = 0xffffffff.",
|
|
I, "BAR2 copy sizes from the full trace; the live-init report places LSFM image "
|
|
"construction and the ACR WPR gather here",
|
|
("_nv016741rm", "_nv016753rm", "_nv043236rm", "_nv027605rm", "_nv029864rm"),
|
|
("partial", ("gpu/acr_image.rs", "gpu/wpr_shadow.rs", "gpu/lsf_image.rs", "gpu/lsf_entry.rs"),
|
|
"image assembly and shadow selection exist; real VRAM and mapping are caller leaves")),
|
|
seg(140621, LOAD, "OBJACR Load -> early OBJFIFO Load",
|
|
"Bus master off, PMC_ENABLE bit 8 (host) pulsed, bus master on, 0x1140, 0x9080, 0x88714, "
|
|
"BAR1 base 0x88014/0x88018, 0x12d0 = 0x2800.",
|
|
P, "reset shape of _nv043609rm with the host engine; 0x12d0 writer _nv017752rm; the live-init "
|
|
"report places _nv028309rm -> _nv028308rm inside the ACR bootstrap",
|
|
("_nv028309rm", "_nv028308rm", "_nv017752rm"), ("partial", ("gpu/mc_reset.rs", "fifo/reset.rs"), "")),
|
|
seg(140634, LOAD, "early OBJFIFO Load (FIFO setup)",
|
|
"0x2528, interrupts 0x2100/0x2140; 14 PBDMAs: 0x4013c+0x2000*i masked, 0x40108/0x4010c/"
|
|
"0x40148/0x4014c; 0x26e0/0x26ec; 13 runlists: engine status read, 0x2630 bit set, base "
|
|
"0x2270 and submit 0x2274 written twice, preempt 0x2638; 0x2a0c; runlists re-enabled one "
|
|
"bit at a time; 0x2a04; PBDMA timeouts 0x4012c+0x2000*i = 0xffff then 0xf4240; 0x2254 = "
|
|
"0x10000000. About 260 writes.",
|
|
P, "0x2270/0x2274 writer _nv028203rm, 0x2638 _nv027673rm/_nv028063rm, 0x2a0c _nv027656rm.., "
|
|
"0x4012c _nv027665rm/_nv027667rm, 0x40108 _nv028346rm, 0x2254 _nv040417rm",
|
|
("_nv028308rm", "_nv028203rm", "_nv027673rm", "_nv027665rm", "_nv040417rm"),
|
|
("partial", ("fifo/init.rs", "fifo/reset.rs", "fifo/context.rs", "fifo.rs"),
|
|
"selected FIFO initialization leaves exist; the enclosing engine graph does not")),
|
|
seg(140935, LOAD, "OBJACR Load (CE utility channel)",
|
|
"Invalidates for a second page directory (0x100cb8 = 0x7fdf7d0), channel 0 bound "
|
|
"(0x800000 = 0x807fdf77, enable 0x800004), runlist 6 submitted with two entries (0x2270 = "
|
|
"0x7fdf76, 0x2274 = 0x600002), usermode doorbell 0x810090 = 0, channel disabled, 0x2634, "
|
|
"fault buffer get/put read, channel unbound, 0x2254 = 0, FIFO interrupts and 0x2528 off.",
|
|
P, "0x800000 writers _nv027684rm/_nv027719rm, doorbell _nv040437rm; the live-init report "
|
|
"names the CE utility FIFO path _nv016753rm -> .. -> _nv028064rm",
|
|
("_nv016753rm", "_nv027684rm", "_nv040437rm", "_nv044027rm"),
|
|
("partial", ("gpu/wpr_shadow.rs", "fifo.rs"), "wpr_shadow implements the CPU-shadow branch, not this CE route")),
|
|
seg(141023, LOAD, "OBJACR Load -> SEC2 (HS ACR launch)",
|
|
"SEC2 engine reset 0x873c0 pulsed three times with PMC bit 14, Falcon interrupts masked, "
|
|
"invalidates for the Falcon address space (0x100cb8 = 0x7fdf770), ITFEN, 0x87604, "
|
|
"instance pointer 0x87054 = 0x407fdf78, 0x87090, 0x870a4, DMEM 84 bytes (boot descriptor), "
|
|
"IMEM 512 bytes at 0xfe00 (boot loader), mailbox 0 = 0xfe, BOOTVEC 0xfd00, CPUCTL start.",
|
|
P, "0x873c0 is only in _nv055862rm; falcon_boot.rs describes this parent (_nv028470rm) and "
|
|
"falcon_imem.rs the IMEM transfer (_nv028579rm/_nv028523rm); IMEM size equals the 512-byte pack records",
|
|
("_nv028470rm", "_nv028579rm", "_nv028523rm", "_nv055862rm"),
|
|
("partial", ("gpu/falcon_boot.rs", "gpu/falcon_imem.rs", "gpu/acr_image.rs"), "parent and IMEM leaf exist; providers missing")),
|
|
seg(141317, LOAD, "OBJACR Load -> SEC2 (HS ACR run)",
|
|
"5,922 polls of SEC2 CPUCTL until halted (0.07 s), interrupt clear, invalidate, mailboxes "
|
|
"read (both 0), then WPR region read twice through 0x100cd4: start index 2 = 0x7fde802, "
|
|
"end index 3 = 0x7fdf403, plus indices 4, 5, 0, 1.",
|
|
P, "wait is the tail of _nv028470rm; WPR read equals _nv016745rm's index protocol",
|
|
("_nv028470rm", "_nv016745rm"), ("partial", ("gpu/falcon_boot.rs", "gpu/acr_wpr_region.rs"), "")),
|
|
seg(147278, LOAD, "PMU Load (LS PMU start)",
|
|
"PMU reset 0x10a3c0 twice, interrupts, invalidates, ITFEN, instance pointer 0x10a480 = "
|
|
"0x407fdf7e, 0x10ae00-0x10ae10, DMEM 48 bytes of arguments at 0xffd0, BOOTVEC 0x5e00, "
|
|
"CPUCTL 0x52 then alias start, 0x10a080.",
|
|
P, "0x10a480 writer _nv052277rm, 0x10ae00 _nv051924rm/_nv051927rm", ("_nv052277rm", "_nv051924rm"),
|
|
("partial", ("gpu/pmu_reset.rs", "gpu/pmu_dmem.rs"), "legacy PMU pieces only")),
|
|
seg(147457, LOAD, "OBJFBFLCN Load",
|
|
"FB Falcon at 0x9a4000: reset, DMEM 56 bytes, 16 DMA transfers 0x3e00-0x4d00 through "
|
|
"0x9a4110-0x9a411c, BOOTVEC 0x3e00, start. The remaining 'PNVLINK' writes are this Falcon.",
|
|
P, "0x9a4100 is only in _nv027284rm", ("_nv027284rm",), ("none", (), "")),
|
|
seg(147574, LOAD, "PMU, Lpwr, Perf and other PMU clients (not separated)",
|
|
"PMU INIT message, then a command/reply stream on the DMEM queues (command head 0x10a804, "
|
|
"message tail 0x10a4cc, interrupt clear 0x10a004 = 0x40) with interrupt-status polling "
|
|
"(0x0, 0x100, 0x9100, 0x100a20) between replies; mutex words 0x10a504-0x10a57c; timer "
|
|
"alarms. Includes a 4.9 s wait; the full trace has 1.09 million byte-wide BAR2 zero writes "
|
|
"here, in descending fragments between offsets 0x1b2b0 and 0x1ee190.",
|
|
P, "queue protocol equals the core PMU transport modules", ("_nv051847rm",),
|
|
("implemented", ("gpu/pmu_init.rs", "gpu/pmu_post_init.rs", "gpu/pmu_queue.rs", "gpu/pmu_reply.rs",
|
|
"gpu/pmu_sequence.rs", "gpu/pmu_irq.rs", "gpu/pmu_command_memory.rs", "fifo/lpwr/mutex.rs"),
|
|
"transport only; the command payloads of the clients are not implemented")),
|
|
seg(156714, LOAD, "Graphics / KernelGraphics Load",
|
|
"GR engine initialization: 0x400500, 0x4188xx, MMU debug buffer addresses 0x100cc4-0x100ccc "
|
|
"copied to 0x1facc4-0x1faccc and 0x4188b0-0x4188b8, interrupt and exception enables "
|
|
"0x400080-0x400148, 0x404000, then netlist register lists and a second pass of the "
|
|
"clock-gating tables. About 1,000 writes in the PGRAPH/FECS/GPCCS blocks and 274 in the "
|
|
"PTRIM block. FECS is not started here.",
|
|
P, "live-init report places GR StateLoad _nv033665rm here; clock-gating tail repeats the "
|
|
"values of _nv033505rm",
|
|
("_nv033665rm", "_nv033664rm", "_nv033505rm"),
|
|
("partial", ("gpu/gr_load.rs", "gpu/gr_netlist.rs", "gpu/clock_gating.rs"), "load parent exists; its large child is a caller leaf")),
|
|
seg(158349, LOAD, "PMU clients (not separated)",
|
|
"Second PMU command/reply stream, same protocol.",
|
|
P, "as the first stream", (), ("implemented", ("gpu/pmu_queue.rs", "gpu/pmu_reply.rs"), "transport only")),
|
|
seg(164713, LOAD, "OBJBSP Load",
|
|
"NVDEC interrupt mask 0x84014, two fuse reads, 0x85320-0x85330, 0x84134, 0x84674; two "
|
|
"timer alarm writes.",
|
|
I, "register block and load position 43", (), ("none", (), "")),
|
|
seg(164731, LOAD, "OBJCE / KernelCE Load",
|
|
"Runlists of the copy engines reprogrammed (0x2630, 0x2270/0x2274, 0x2638), CE words "
|
|
"0x104034-0x104060 written and read back, runlists re-enabled.",
|
|
P, "runlist writer _nv028203rm", ("_nv028203rm",), ("none", (), "")),
|
|
seg(164942, LOAD, "OBJMSENC x3 Load",
|
|
"Three NVENC instances (0x1c8000, 0x1cc000, 0x1d0000): interrupt mask, 0xf20/0xf24, "
|
|
"0x134, 0x874, 0x1200-0x1208.",
|
|
I, "three identical groups", (), ("none", (), "")),
|
|
seg(164966, LOAD, "OBJSEC2 Load (LS SEC2 start)",
|
|
"SEC2 ITFEN, interrupt mask, two PMU replies, DMEM 84 bytes of arguments, mailbox 0 = 1, "
|
|
"alias start 0x87130 = 2, 0x87080, 0x87134, 0x87674, 0x8783c.",
|
|
I, "Falcon register meaning", (), ("partial", ("gpu/falcon_boot.rs",), "HS launch only")),
|
|
seg(165084, LOAD, "KernelFifo / OBJFIFO Load",
|
|
"Host reset through PMC bit 8 and the same FIFO setup as the early load, then interrupt "
|
|
"leaves 0x244018.., 0x246018.., 0x248018 = 0xffffffff and 0x24a124 = 1.",
|
|
P, "same writers as the early load; 0x248018/0x24a124 writer _nv019298rm",
|
|
("_nv028309rm", "_nv028308rm", "_nv019298rm"), ("partial", ("fifo/init.rs", "fifo/reset.rs"), "")),
|
|
seg(165428, LOAD, "Load tail (stage wrapper)",
|
|
"PCI words 0x88624-0x8863c written, 0x8841c and 0x88000 read, PPRIV 0x122454 read "
|
|
"(returns 0x8f0a20), 0x8f0a3c toggled 3 -> 2 -> 3. From here on the fault interrupt and "
|
|
"fault buffer registers are accessed at 0x8f0a2x/0x8f0e2x instead of 0x100a2x/0x100e2x.",
|
|
I, "0x122454 reader _nv029430rm; meaning of the 0x8f0000 alias not established",
|
|
("_nv029430rm",), ("none", (), "")),
|
|
seg(165442, POSTLOAD, "KernelBus PostLoad and following engines",
|
|
"Invalidates, BAR1 bind 0x1704 = 0x807fffa0 (instance block 0x7fffa0000), FB Falcon "
|
|
"interrupt, PMU commands, 0x10e07c/0x10e17c/0x1200a8 cleared, long fuse sweeps, per-FBPA "
|
|
"reads 0x500c30+0x8000*i.",
|
|
P, "0x1704 writer _nv039290rm", ("_nv039290rm",), ("partial", ("mmu/bar2.rs",), "BAR2 only; no BAR1 bind")),
|
|
seg(166380, POSTLOAD, "KernelGraphics PostLoad (FECS/GPCCS start)",
|
|
"FECS interrupts and 0x409a20 prepared, PMU command and reply, FECS started (0x409130 = "
|
|
"2), another PMU exchange, GPCCS started (0x41a130 = 2), FECS ready wait on 0x409800, then "
|
|
"mailbox methods through 0x409500/0x409504: 0x21 (data 0x3fffffff), 0x10 -> 0x111800, "
|
|
"0x16 -> 0xf0c00, 0x25 -> 0xb300, 0x1a -> 0x140e00.",
|
|
P, "mailbox protocol equals gpu/fecs_mailbox.rs (033685/031747/055403)",
|
|
("_nv055403rm", "_nv033685rm", "_nv031747rm"),
|
|
("partial", ("gpu/fecs_mailbox.rs",), "mailbox primitives exist; the PMU bootstrap command does not")),
|
|
seg(167098, POSTLOAD, "kernel channels (owner not established)",
|
|
"Channel-time PBDMA timeout 0x2254 = 0x107ffdf0, invalidates for new address spaces, "
|
|
"channel 0 bound (0x800000 = 0x807fdf66) on runlist 6, channel 1 bound (0x800008 = "
|
|
"0x807fdb96), runlist 6 resubmitted with four entries, doorbell 0x810090 = 1 twice.",
|
|
I, "register meaning; candidates are the MemoryManager scrubber and KernelCE channels",
|
|
("_nv027684rm", "_nv040437rm"), ("none", (), "")),
|
|
seg(167362, TAIL, "Nvlink (link bring-up after StateLoad)",
|
|
"Fuses, 0x88700, interrupt enables dropped (0x180/0x160/0x184), then 462 IOCTRL accesses "
|
|
"over 2.4 s: six links trained.",
|
|
I, "register block; position after the last PostLoad work", (), ("none", (), "")),
|
|
seg(167837, TAIL, "repeated engine reprogramming (cause not established)",
|
|
"FBHUB mirrors rewritten, then four repetitions of the CE/MSENC load shape: runlist "
|
|
"reprogramming, CE words 0x104034-0x104060, NVENC interrupt masks.",
|
|
I, "same shape as the CE and MSENC Load segments", ("_nv028203rm",), ("none", (), "")),
|
|
seg(168760, TAIL, "fuse poll",
|
|
"Interrupts masked, then 120 read pairs of 0x1373a0 and fuse 0x21204.",
|
|
I, "register meaning", (), ("none", (), "")),
|
|
seg(169005, TAIL, "interrupt self-test, lock interrupt masking, SEC2 INIT message",
|
|
"Software interrupt 0x1a0 = 1 raised and observed in 0x100, then the per-lock interrupt "
|
|
"mask pairs that dominate the rest of the transcript (0x8f0a34/0x8f0a2c with 0x180/0x160/"
|
|
"0x164), timer service, PRI error registers 0x12xx2c read and 0x12004c = 2, SEC2 message "
|
|
"queue 0x87a30-0x87ac4 drained, first invalidates for page directory 0x7fdb950.",
|
|
P, "0x1a0 writers _nv037520rm/_nv037765rm; public RmInitAdapter runs "
|
|
"osVerifySystemEnvironment after RmInitNvDevice",
|
|
("_nv037520rm", "_nv053043rm"), ("partial", ("gpu/gv100_stall.rs", "gpu/gv100_nonstall.rs"), "PMC mask routes only")),
|
|
seg(169464, API, "Graphics golden context (first GR channel)",
|
|
"After a 7.2 s gap with no BAR0 access: runlist 0 disabled and preempted, GR reset "
|
|
"0x404170, FECS/GPCCS 0x88c, FECS methods, then about 5,450 PGRAPH-block writes of "
|
|
"context and bundle initialization, 0x404488/0x40448c bundle loads, FECS context save "
|
|
"methods on instance 0x7fdb90000.",
|
|
I, "register meaning; channel 2 is bound to the same instance right after", (),
|
|
("partial", ("gpu/gr_netlist.rs", "gpu/gr_images.rs", "gpu/fecs_mailbox.rs"), "netlist decode only")),
|
|
seg(177469, API, "kernel CE channel 1 work",
|
|
"Doorbell 0x810090 = 1 written 274 times with FECS status reads between; the full trace "
|
|
"has 273 BAR1 writes in the same interval (USERD updates by inference).",
|
|
I, "channel id from the doorbell value; purpose not established", ("_nv040437rm",), ("none", (), "")),
|
|
seg(177780, API, "GR channel 2 bind and first submissions",
|
|
"FECS current context 0x409b00, channel 2 bound (0x800010 = 0x807fdb90, enable), "
|
|
"invalidate, runlist 0 submitted with two entries (0x2270 = 0x7fdb50, 0x2274 = 2), "
|
|
"doorbell 0x810090 = 2 twice.",
|
|
P, "0x800000+8*chid writers _nv027684rm/_nv027719rm, runlist _nv028203rm, doorbell _nv040437rm",
|
|
("_nv027684rm", "_nv028203rm", "_nv040437rm"), ("partial", ("fifo/context.rs", "fifo.rs"), "")),
|
|
seg(177801, API, "lock interrupt masking, timer and PMU service until the capture stopped",
|
|
"No further engine programming: about 730 mask/unmask cycles (0x8f0a2c/0x8f0a34, 0x180/0x160/"
|
|
"0x164), timer alarms, eight PMU exchanges, PCI 0x88704. Channel work in this period goes "
|
|
"through BAR1 (USERD), which this transcript does not contain.",
|
|
I, "register meaning", (), ("partial", ("gpu/gv100_stall.rs", "gpu/pmu_queue.rs"), "")),
|
|
]
|
|
|
|
# (line, kind, offset, value): every attribution above depends on these lines.
|
|
ANCHORS = [
|
|
(198, "R", 0x088080, 0x2937), (199, "W", 0x088080, 0x2937), (206, "R", 0x300000, None), (24754, "R", 0x10a100, 0x0),
|
|
(37221, "W", 0x10a004, 0x10), (37282, "W", 0x000200, 0x42000020), (37295, "W", 0x009400, None),
|
|
(37312, "R", 0x022700, None), (37377, "W", 0x000200, 0x1fecdff1), (37439, "R", 0x002390, None),
|
|
(37521, "W", 0x001100, 0x8), (37524, "R", 0x002634, None), (37592, "W", 0x100e34, 0x60002061),
|
|
(37599, "R", 0x120070, None), (37610, "W", 0x4041f0, 0xc646), (37712, "W", 0x41bed4, 0xfffffff8),
|
|
(37715, "W", 0x100cd4, 0x2), (37741, "W", 0x00e208, 0xa00), (37745, "R", 0x341000, 0x5346464a),
|
|
(47934, "W", 0x104414, 0xa), (47966, "W", 0x104814, 0xa), (47972, "W", 0x088030, 0x0),
|
|
(48034, "W", 0x00d97c, 0x1), (48164, "W", 0x00d014, 0x7), (48183, "W", 0x009410, None),
|
|
(48187, "W", 0x00d604, 0x1), (48250, "W", 0x00df08, 0xcc), (48312, "W", 0x00d014, 0x7),
|
|
(48472, "W", 0x00d034, 0x7), (73724, "W", 0x00df08, 0x0), (73788, "W", 0x0206d4, 0x200),
|
|
(73829, "W", 0x000200, 0x3ffcdffd), (73839, "W", 0x9a0388, 0x81000100), (73937, "W", 0x100c10, None),
|
|
(74922, "W", 0x001700, 0x7fdf9), (74925, "W", 0x700000, 0x0), (91314, "W", 0x001700, 0x7fdf8),
|
|
(107706, "W", 0x100e48, None), (107729, "W", 0x001700, 0x7fffa), (108759, "W", 0x701200, 0xfffa2c00),
|
|
(108758, "W", 0x701204, 0x7), (108760, "W", 0x702000, 0x7fffa302), (138314, "W", 0x001714, 0xc07fffa1),
|
|
(138320, "W", 0x70dd50, 0x7fffa201), (138496, "W", 0x070000, 0x1), (138499, "W", 0x100cb8, 0x7fffa20),
|
|
(138521, "W", 0x70e000, 0xabcdabcd), (138651, "R", 0x100c80, None), (138674, "R", 0x348b10, 0x154434f), (138794, "W", 0x009100, 0x1),
|
|
(138804, "W", 0x100c10, None), (138826, "W", 0x08814c, None), (138920, "R", 0x088000, 0x1db510de),
|
|
(139244, "W", 0x000200, 0xffffffff), (139246, "W", 0x000200, 0x1fecdff1), (139248, "W", 0x08800c, 0xf800),
|
|
(139253, "W", 0x009100, 0x2), (139269, "W", 0x100cd0, 0x0), (139281, "W", 0x084014, 0xffffffff),
|
|
(140286, "W", 0x084100, 0x2), (140401, "R", 0x100cc8, 0x7fdf800), (156726, "W", 0x100cc8, 0x7fdf800), (140315, "W", 0x100cd8, 0x2), (140408, "W", 0x0015f8, None),
|
|
(140554, "W", 0x10ecc0, None), (140568, "W", 0x100e34, 0xe0002061), (140573, "W", 0x001140, 0x8c0001fe),
|
|
(140624, "W", 0x000200, 0x1fecdef1), (140634, "W", 0x002528, 0x80000000), (140934, "W", 0x002254, 0x10000000),
|
|
(140982, "W", 0x800000, 0x807fdf77), (140993, "W", 0x810090, 0x0), (141028, "W", 0x0873c0, 0x1),
|
|
(141316, "W", 0x087100, 0x2), (147254, "R", 0x100cd4, 0x7fde802), (147284, "W", 0x10a3c0, 0x0),
|
|
(147451, "W", 0x10a130, 0x2), (147457, "W", 0x9a407c, 0x1), (147569, "W", 0x9a4100, 0x2),
|
|
(147608, "W", 0x10a4cc, 0x1), (156721, "W", 0x400500, 0x0), (158348, "W", 0x41bed4, 0xfffffff8),
|
|
(164713, "W", 0x084014, 0xffffffff), (164734, "W", 0x002630, 0x1), (164942, "W", 0x1c8014, 0xffffffff),
|
|
(164967, "W", 0x087048, 0x4), (165076, "W", 0x087130, 0x2), (165087, "W", 0x000200, 0x1fecdef1),
|
|
(165427, "W", 0x24a124, 0x1), (165437, "R", 0x122454, 0x8f0a20), (165464, "W", 0x001704, 0x807fffa0),
|
|
(166425, "W", 0x409130, 0x2), (167025, "W", 0x41a130, 0x2), (167040, "W", 0x409504, 0x21),
|
|
(167231, "W", 0x800000, 0x807fdf66), (167328, "W", 0x800008, 0x807fdb96), (167375, "R", 0xa10000, None),
|
|
(169022, "W", 0x0001a0, 0x1), (169489, "W", 0x404170, 0x12), (177469, "W", 0x810090, 0x1),
|
|
(177785, "W", 0x800010, 0x807fdb90), (177799, "W", 0x810090, 0x2), (177801, "W", 0x8f0a2c, 0xf8000003),
|
|
]
|
|
|
|
BLOCK_NOTES = [
|
|
"Block names are those of tools/analyze_mmiotrace.py so counts agree with HANDOFF.md. Three "
|
|
"of its ranges are mislabelled for a GV100 and the descriptions use the meaning instead:",
|
|
"0x9a0000-0x9fffff is listed as PNVLINK; the accesses are FBPA broadcast registers "
|
|
"(0x9a0xxx) and the FB Falcon at 0x9a4000. NVLINK itself is the IOCTRL block at 0xa00000.",
|
|
"0x120000-0x12ffff is listed as PLTCG; the accesses are the PRI hub (0x12006c, 0x12004c, "
|
|
"0x122454, 0x12xx2c error words).",
|
|
"0x130000-0x17ffff is listed as PCLOCK/PTRIM; 0x140000-0x17ffff are the 16 LTC instances "
|
|
"and their broadcast copy at 0x17e000. 0x00e000 (PPWR/I2C) holds the ROM serial-bypass "
|
|
"control 0xe208 here; the bit-banged I2C ports are in PGPIO at 0xd014+0x20*port.",
|
|
"0x800000 onward is listed as USERD/PFIFO-CH: 0x800000+8*chid is the channel table, "
|
|
"0x810080/0x810084 the usermode time and 0x810090 the doorbell. 0x8f0a2x/0x8f0e2x are "
|
|
"accessed like the PFB fault interrupt and fault buffer registers at 0x100a2x/0x100e2x.",
|
|
]
|
|
|
|
MINIMUM_COMPUTE_PATH = {
|
|
"label": "Assessment, not evidence. It ranks segments by what the registers do; no reduced "
|
|
"sequence has been run on hardware and dependencies inside the firmware are unknown.",
|
|
"plausibly_required": [
|
|
{"what": "engine reset, bus and timer (37279-37295), MC Load (139243), OBJBUS Load (140573)",
|
|
"why": "PMC enables every engine used later; the PRI timeout value and timer are read by every wait loop",
|
|
"confidence": "high"},
|
|
{"what": "BAR2 instance block, page tables, bind and invalidate (107728-138514)",
|
|
"why": "every later structure (WPR image, instance blocks, runlists, context buffers) is "
|
|
"written through BAR2; the PRAMIN volume is two 64 KiB buffer zero fills plus the sparse "
|
|
"fill of 41,105 entries and would shrink with a smaller address limit", "confidence": "high"},
|
|
{"what": "KernelGmmu fault buffer and interrupt enables (37591, 107705, 140553)",
|
|
"why": "needed for fault reporting rather than for a first channel; cheap", "confidence": "medium"},
|
|
{"what": "WPR image build through BAR2, SEC2 reset and HS ACR launch (140591-147277)",
|
|
"why": "FECS and GPCCS only start from images the ACR has authenticated into WPR", "confidence": "high"},
|
|
{"what": "CE utility channel inside the ACR bootstrap (140621-141022)",
|
|
"why": "the original used the copy engine for the WPR shadow copy; core wpr_shadow.rs "
|
|
"implements the registry-selected CPU branch, which would avoid this early FIFO bring-up",
|
|
"confidence": "medium (the CPU branch has not been run on hardware)"},
|
|
{"what": "LS PMU start and at least the PMU exchanges that bootstrap FECS/GPCCS (147278, 166380)",
|
|
"why": "FECS and GPCCS were started right after PMU command/reply pairs, so the falcon "
|
|
"bootstrap request goes through the PMU on this chip", "confidence": "medium"},
|
|
{"what": "FIFO setup (140634 shape, repeated at 165084), runlist submit, channel table, doorbell",
|
|
"why": "channel scheduling", "confidence": "high"},
|
|
{"what": "GR engine init (156714), FECS mailbox queries (166380), golden context (169464)",
|
|
"why": "a compute class needs a GR context; 5,095 PGRAPH writes are the golden context", "confidence": "high"},
|
|
{"what": "BAR1 bind (165464)", "why": "USERD is reached through BAR1", "confidence": "high"},
|
|
{"what": "MemorySystem Init/Load FB programming (73826, 140309)",
|
|
"why": "rewrites of values the registers already hold, plus copies of the MMU debug buffer "
|
|
"addresses into FBHUB and GR; the copies may matter, the rewrites probably not", "confidence": "low"},
|
|
],
|
|
"plausibly_peripheral": [
|
|
{"what": "InfoROM reads (37723, 48047, 73938, 138668)", "why": "read-only inventory, ECC and "
|
|
"retired-page data; skipping loses page retirement, not execution", "confidence": "high"},
|
|
{"what": "GPIO, DPAUX, PMGR mutexes, bit-banged I2C (48033-73786)",
|
|
"why": "board peripherals; seven of eight I2C ports time out on this board", "confidence": "high"},
|
|
{"what": "NVLINK (37376 reads, 140405, 167362)", "why": "peer links between GPUs", "confidence": "high"},
|
|
{"what": "NVDEC, NVENC, copy-engine engine loads (164713-164965, 167837)",
|
|
"why": "other engines; the copy engine matters only if the CE shadow route is kept", "confidence": "medium"},
|
|
{"what": "NVDEC Falcon run in MemorySystem Load (139279)",
|
|
"why": "looks like a memory scrubber; a cold board may need it before WPR can be set up, so "
|
|
"this one is uncertain", "confidence": "low"},
|
|
{"what": "PCIe/AER/ASPM programming and config save (138825-139242)", "why": "link policy", "confidence": "high"},
|
|
{"what": "FB Falcon (147457), most PMU client traffic (147574, 158349), Therm reads",
|
|
"why": "memory training support, power, thermal and clock management; the GPU was already "
|
|
"posted by the VBIOS", "confidence": "medium"},
|
|
{"what": "clock-gating tables (37610, 140309, 156714 tail)", "why": "power saving", "confidence": "medium"},
|
|
],
|
|
}
|
|
|
|
|
|
def load(path):
|
|
rows = []
|
|
with open(path) as stream:
|
|
for number, line in enumerate(stream, 1):
|
|
fields = line.split()
|
|
if fields[0] in ("R", "W"):
|
|
rows.append((number, fields[0], int(fields[1], 16), int(fields[2], 16), float(fields[3])))
|
|
else:
|
|
rows.append((number, "M", 0, " ".join(fields[2:]), None))
|
|
return rows
|
|
|
|
|
|
def pramin_structures(rows):
|
|
"""Contiguous PRAMIN write runs by physical address, tracking the 0x1700 window."""
|
|
window, runs, current = None, [], None
|
|
for number, kind, offset, value, _time in rows:
|
|
if kind == "M":
|
|
current = None
|
|
continue
|
|
if offset == 0x1700:
|
|
if kind == "W" or window is None:
|
|
window = value
|
|
continue
|
|
if kind == "W" and 0x700000 <= offset < 0x800000 and window is not None:
|
|
address = (window << 16) + offset - 0x700000
|
|
if current and address == current["end"]:
|
|
current["end"] += 4
|
|
current["words"] += 1
|
|
current["last_line"] = number
|
|
current["values"][value] += 1
|
|
else:
|
|
current = {"first_line": number, "last_line": number, "start": address,
|
|
"end": address + 4, "words": 1, "values": Counter({value: 1})}
|
|
runs.append(current)
|
|
elif not (0x700000 <= offset < 0x800000):
|
|
current = None
|
|
out = []
|
|
for run in runs:
|
|
if run["words"] < 16:
|
|
continue
|
|
common = run["values"].most_common(2)
|
|
out.append({"first_line": run["first_line"], "last_line": run["last_line"],
|
|
"physical": f"{run['start']:#x}-{run['end']:#x}", "words": run["words"],
|
|
"content": "zero" if set(run["values"]) == {0}
|
|
else " ".join(f"{value:#x}x{count}" for value, count in common)})
|
|
return out, sum(run["words"] for run in runs)
|
|
|
|
|
|
FALCONS = {0x084000: "NVDEC", 0x087000: "SEC2", 0x10a000: "PMU", 0x409000: "FECS",
|
|
0x41a000: "GPCCS", 0x9a4000: "FBFLCN"}
|
|
|
|
|
|
def falcon_loads(rows):
|
|
loads, open_load, control = [], {}, {}
|
|
starts = []
|
|
for number, kind, offset, value, _time in rows:
|
|
if kind != "W":
|
|
continue
|
|
for base, name in FALCONS.items():
|
|
relative = offset - base
|
|
if not 0 <= relative < 0x1000:
|
|
continue
|
|
if relative in (0x180, 0x1c0):
|
|
key = (name, "IMEM" if relative == 0x180 else "DMEM")
|
|
open_load.pop(key, None)
|
|
control[key] = value
|
|
elif relative in (0x184, 0x1c4):
|
|
key = (name, "IMEM" if relative == 0x184 else "DMEM")
|
|
entry = open_load.get(key)
|
|
if entry is None:
|
|
entry = {"falcon": name, "memory": key[1], "first_line": number,
|
|
"last_line": number, "bytes": 0, "control": f"{control.get(key, 0):#x}"}
|
|
open_load[key] = entry
|
|
loads.append(entry)
|
|
entry["bytes"] += 4
|
|
entry["last_line"] = number
|
|
elif relative in (0x100, 0x130) and value & 2:
|
|
starts.append({"falcon": name, "line": number,
|
|
"register": "CPUCTL" if relative == 0x100 else "CPUCTL_ALIAS"})
|
|
return loads, starts
|
|
|
|
|
|
def i2c_ports(rows, first, last):
|
|
ports = []
|
|
for port in range(9):
|
|
register = 0xd014 + 0x20 * port
|
|
sequence = [(kind, value, time) for number, kind, offset, value, time in rows
|
|
if first <= number <= last and offset == register]
|
|
if not sequence:
|
|
continue
|
|
previous, events = 7, ""
|
|
for kind, value, _time in sequence:
|
|
if kind != "W":
|
|
continue
|
|
scl, sda, old_scl, old_sda = value & 1, value >> 1 & 1, previous & 1, previous >> 1 & 1
|
|
if scl and old_scl and old_sda and not sda:
|
|
events += "S"
|
|
elif scl and old_scl and not old_sda and sda:
|
|
events += "P"
|
|
elif scl and not old_scl:
|
|
events += str(sda)
|
|
previous = value
|
|
ports.append({"port": port, "register": f"{register:#x}",
|
|
"writes": sum(kind == "W" for kind, _v, _t in sequence),
|
|
"reads": sum(kind == "R" for kind, _v, _t in sequence),
|
|
"seconds": round(sequence[-1][2] - sequence[0][2], 6), "clocked": events})
|
|
return ports
|
|
|
|
|
|
def other_bars():
|
|
"""BAR1/BAR2 accesses of this GPU from the full trace as (time, bar, kind, offset, width, value)."""
|
|
if not FULL_TRACE.exists():
|
|
return None
|
|
try:
|
|
text = subprocess.run(["grep", "-E", r"^[RW] [0-9] [0-9.]+ [0-9]+ 0x39a[0-8]", str(FULL_TRACE)],
|
|
check=True, capture_output=True, text=True, env={"LC_ALL": "C"}).stdout
|
|
except (OSError, subprocess.CalledProcessError):
|
|
return None
|
|
out = []
|
|
for line in text.splitlines():
|
|
kind, width, time, _map, address, value = line.split()[:6]
|
|
address = int(address, 16)
|
|
if BAR1[0] <= address <= BAR1[1]:
|
|
out.append((float(time), "BAR1", kind, address - BAR1[0], int(width), int(value, 16)))
|
|
elif BAR2[0] <= address <= BAR2[1]:
|
|
out.append((float(time), "BAR2", kind, address - BAR2[0], int(width), int(value, 16)))
|
|
return out
|
|
|
|
|
|
def bar_runs(accesses):
|
|
runs, current = [], None
|
|
for time, bar, kind, offset, width, value in accesses:
|
|
if (current and current["bar"] == bar and current["kind"] == kind
|
|
and offset == current["end"] and time - current["last"] < 0.5):
|
|
current["end"] += width
|
|
current["count"] += 1
|
|
current["last"] = time
|
|
current["zero"] &= value == 0
|
|
else:
|
|
current = {"bar": bar, "kind": kind, "start": offset, "end": offset + width, "count": 1,
|
|
"width": width, "first": time, "last": time, "zero": value == 0}
|
|
runs.append(current)
|
|
return runs
|
|
|
|
|
|
def rust_citations(symbols):
|
|
hits = {}
|
|
files = sorted(RUST.rglob("*.rs"))
|
|
for symbol in symbols:
|
|
digits = symbol[3:9]
|
|
pattern = re.compile(rf"(?<![0-9A-Za-z]){digits}(?![0-9])|_nv{digits}")
|
|
found = []
|
|
for path in files:
|
|
if path.name.endswith("vectors.rs"):
|
|
continue
|
|
for line in path.read_text(errors="replace").splitlines():
|
|
if "//" in line and pattern.search(line.split("//", 1)[1]):
|
|
found.append(str(path.relative_to(RUST)))
|
|
break
|
|
hits[symbol] = found
|
|
return hits
|
|
|
|
|
|
def build():
|
|
rows = load(TRACE)
|
|
by_line = {row[0]: row for row in rows}
|
|
problems = []
|
|
for line, kind, offset, value in ANCHORS:
|
|
row = by_line.get(line)
|
|
if not row or row[1] != kind or row[2] != offset or (value is not None and row[3] != value):
|
|
problems.append(f"anchor line {line}: expected {kind} {offset:06x} "
|
|
f"{'' if value is None else format(value, 'x')}, found {row}")
|
|
firsts = [entry["first"] for entry in SEGMENTS]
|
|
if firsts[0] != FIRST_LINE or firsts != sorted(set(firsts)):
|
|
problems.append("segment starts are not strictly increasing from the first line")
|
|
last_line = rows[-1][0]
|
|
known = None
|
|
if SYMBOLS.exists():
|
|
known = {json.loads(line)["name"] for line in SYMBOLS.open()}
|
|
all_symbols = sorted({symbol for entry in SEGMENTS for symbol in entry["symbols"]})
|
|
if known is not None:
|
|
problems += [f"symbol {symbol} is not in the original export map"
|
|
for symbol in all_symbols if symbol not in known]
|
|
citations = rust_citations(all_symbols)
|
|
accesses = other_bars()
|
|
|
|
segments = []
|
|
for index, entry in enumerate(SEGMENTS):
|
|
first = entry["first"]
|
|
last = SEGMENTS[index + 1]["first"] - 1 if index + 1 < len(SEGMENTS) else last_line
|
|
part = [row for row in rows if first <= row[0] <= last]
|
|
timed = [row for row in part if row[1] != "M"]
|
|
if not timed:
|
|
problems.append(f"segment at {first} has no accesses")
|
|
continue
|
|
reads, writes, registers = Counter(), Counter(), Counter()
|
|
for _number, kind, offset, _value, _time in timed:
|
|
(reads if kind == "R" else writes)[block(offset)] += 1
|
|
if kind == "W":
|
|
registers[offset] += 1
|
|
for module in entry["rust"]["modules"]:
|
|
if not (RUST / module).exists():
|
|
problems.append(f"segment at {first}: {module} does not exist")
|
|
record = OrderedDict()
|
|
record["id"] = index + 1
|
|
record["first_line"] = first
|
|
record["last_line"] = last
|
|
record["time_first"] = timed[0][4]
|
|
record["time_last"] = timed[-1][4]
|
|
record["seconds"] = round(timed[-1][4] - timed[0][4], 6)
|
|
record["stage"] = entry["stage"]
|
|
record["engine"] = entry["engine"]
|
|
record["description"] = entry["description"]
|
|
record["confidence"] = entry["confidence"]
|
|
record["basis"] = entry["basis"]
|
|
record["original_symbols"] = entry["symbols"]
|
|
record["reads"] = dict(sorted(reads.items(), key=lambda item: -item[1]))
|
|
record["writes"] = dict(sorted(writes.items(), key=lambda item: -item[1]))
|
|
record["read_total"] = sum(reads.values())
|
|
record["write_total"] = sum(writes.values())
|
|
record["most_written"] = [f"{offset:06x}x{count}" for offset, count in registers.most_common(8)]
|
|
record["lost_markers"] = [{"line": row[0], "text": row[3]} for row in part if row[1] == "M"]
|
|
record["rust"] = dict(entry["rust"])
|
|
record["rust"]["symbols_cited_in_core"] = {symbol: citations[symbol] for symbol in entry["symbols"]
|
|
if citations[symbol]}
|
|
if accesses is not None:
|
|
end = (next(row[4] for row in rows if row[0] > last and row[1] != "M")
|
|
if last < last_line else float("inf"))
|
|
inside = [access for access in accesses if timed[0][4] <= access[0] < end]
|
|
if inside:
|
|
counts = Counter(f"{access[1]} {access[2]}" for access in inside)
|
|
big = sorted((run for run in bar_runs(inside) if run["count"] >= 256),
|
|
key=lambda run: run["first"])
|
|
record["other_bars"] = {
|
|
"counts": dict(counts),
|
|
"runs": [{"bar": run["bar"], "kind": run["kind"],
|
|
"offsets": f"{run['start']:#x}-{run['end']:#x}",
|
|
"bytes": run["end"] - run["start"], "access_width": run["width"],
|
|
"content": "zero" if run["zero"] else "data"} for run in big[:12]]}
|
|
segments.append(record)
|
|
for before, after in zip(segments, segments[1:]):
|
|
if before["last_line"] + 1 != after["first_line"]:
|
|
problems.append(f"gap between segments {before['id']} and {after['id']}")
|
|
if segments and segments[-1]["last_line"] != last_line:
|
|
problems.append("last segment does not reach the end of the transcript")
|
|
|
|
structures, pramin_words = pramin_structures(rows)
|
|
loads, starts = falcon_loads(rows)
|
|
bypass = sum(1 for _n, kind, offset, _v, _t in rows if kind == "W" and offset == 0xe208)
|
|
bypass_early = sum(1 for number, kind, offset, _v, _t in rows
|
|
if kind == "W" and offset == 0xe208 and 37296 <= number < 74925)
|
|
pack_sizes = sorted({record["decoded_size"] for record in json.loads(PACK.read_text())["records"]}) \
|
|
if PACK.exists() else []
|
|
nvdec_imem = sum(entry["bytes"] for entry in loads
|
|
if entry["falcon"] == "NVDEC" and entry["memory"] == "IMEM" and entry["first_line"] < 141000)
|
|
sec2_boot = next((entry["bytes"] for entry in loads
|
|
if entry["falcon"] == "SEC2" and entry["memory"] == "IMEM"), None)
|
|
if bypass_early != 1010:
|
|
problems.append(f"0xe208 writes before the first PRAMIN write: {bypass_early}")
|
|
fill = [run for run in structures if 108830 <= run["first_line"] <= 138309]
|
|
lost_in_fill = sum(int(row[3].split()[1]) for row in rows
|
|
if row[1] == "M" and 108830 <= row[0] <= 138309 and row[3].startswith("Lost"))
|
|
fill_start = int(fill[0]["physical"].split("-")[0], 16)
|
|
fill_end = int(fill[-1]["physical"].split("-")[1], 16)
|
|
span_words = (fill_end - fill_start) // 4
|
|
recorded_words = sum(run["words"] for run in fill)
|
|
if span_words // 2 != 0xa091000 // 4096:
|
|
problems.append(f"page-table span is {span_words // 2} entries")
|
|
|
|
report = OrderedDict()
|
|
report["scope"] = (
|
|
"Attribution of the original 580.178.04 driver's register transcript for one Tesla V100 "
|
|
"(0000:b3:00.0), from its first access to the end of the capture. Boundaries and "
|
|
"attributions are analysis; counts are recomputed from the inputs by "
|
|
"tools/map_trace_segments.py. Pseudocode is inferred decompiler output: "
|
|
"matched_pseudocode means the register use agrees with it, not that the function was "
|
|
"observed executing.")
|
|
report["inputs"] = {
|
|
"transcript": str(TRACE.relative_to(ROOT)),
|
|
"transcript_sha256": hashlib.sha256(TRACE.read_bytes()).hexdigest(),
|
|
"transcript_lines": last_line, "first_line": FIRST_LINE,
|
|
"full_trace_used_for_other_bars": accesses is not None,
|
|
"symbol_map_checked": known is not None}
|
|
report["confidence_values"] = {
|
|
V: "earlier work compared the body with the original instructions; the lines equal its accesses",
|
|
P: "access sequence or register set matched against inferred pseudocode",
|
|
I: "register meaning and stage position only"}
|
|
report["block_label_notes"] = BLOCK_NOTES
|
|
report["stage_boundaries"] = {
|
|
"pre_stage": [FIRST_LINE, 37295], "PreInit": [37296, 47966], "Init": [47967, 138793],
|
|
"between_Init_and_Load": [138794, 138802], "PreLoad": [138803, 138824],
|
|
"Load": [138825, 165441], "PostLoad": [165442, 167361],
|
|
"first_open_tail": [167362, 169463], "later_RM_API": [169464, last_line],
|
|
"basis": "PreInit to Init: nine OBJCE PreInit writes are the last PreInit work in engine "
|
|
"order and BIF registers follow. Init to Load: the MC StateLoad sequence at 139243 "
|
|
"and the KernelMc write at 139248 fix the Load order; PCIe programming (OBJBIF, "
|
|
"first in load order) starts at 138825 and the PreLoad-shaped writes precede it. "
|
|
"Load to PostLoad and the end of PostLoad are inferred from the BAR1 bind and the "
|
|
"interrupt self-test and are the least certain boundaries."}
|
|
report["segments"] = segments
|
|
report["derived"] = OrderedDict([
|
|
("rom_bypass_writes_0xe208", {"lines_37296_to_74924": bypass_early, "whole_transcript": bypass}),
|
|
("i2c_bit_bang", i2c_ports(rows, 48312, 73722)),
|
|
("pramin_write_words", pramin_words),
|
|
("pramin_runs_of_16_words_or_more", structures),
|
|
("bar2_page_table_entries",
|
|
{"address_span": f"{fill_start:#x}-{fill_end:#x}", "entries_in_span": span_words // 2,
|
|
"address_limit": "0xa090fff", "pages_under_limit": 0xa091000 // 4096,
|
|
"recorded_words": recorded_words, "words_missing_from_span": span_words - recorded_words,
|
|
"lost_events_inside": lost_in_fill}),
|
|
("falcon_loads", loads), ("falcon_starts", starts),
|
|
("firmware_pack_comparison",
|
|
{"nvdec_imem_bytes": nvdec_imem, "pack_has_record_of_that_size": nvdec_imem in pack_sizes,
|
|
"sec2_boot_loader_imem_bytes": sec2_boot,
|
|
"pack_has_record_of_that_size_too": sec2_boot in pack_sizes,
|
|
"wpr_image_copies_through_bar2_bytes": [230144, 17408, 34816, 288512, 204544],
|
|
"largest_pack_record_bytes": max(pack_sizes) if pack_sizes else None,
|
|
"note": "The five BAR2 copies are far larger than any record of gv100.fw except the "
|
|
"126,472-byte netlist; they are assembled images (LS ucode with headers), and "
|
|
"two of them exceed everything in the pack, so the PMU and SEC2 LS images are "
|
|
"not explained by the pack records listed in reports/gv100-firmware-pack.json."}),
|
|
])
|
|
report["lost_event_gaps"] = [
|
|
{"lines": "3240-34810 (twelve markers)", "effect": "inside the VBIOS read and the PMU poll; "
|
|
"both are uniform streams, nothing structural is missing"},
|
|
{"lines": "47930", "lost": 63020, "effect": "0.4 s between the last InfoROM block and the "
|
|
"CE PreInit writes. Content unknown: the rest of the InfoROM read and any PreInit work of "
|
|
"the engines between OBJINFOROM and OBJCE in engine order."},
|
|
{"lines": "113897, 114752", "lost": 52992, "effect": "inside the page-table fill; 52,732 "
|
|
"words are missing from the address span, 260 fewer than the events lost, so at most a "
|
|
"few hundred other events are missing"},
|
|
{"lines": "138656, 138662", "lost": 1065268, "effect": "18.5 s of Init after BAR2 came up. "
|
|
"The second marker (19,872) equals the bytes missing from the second 1 MiB BAR2 zero "
|
|
"fill. If the first fill also started at 0x2000, the first marker exceeds its missing bytes "
|
|
"by about 228,000 events, so register accesses of the engines initialised here (Graphics, LSFM, ACR, PMU "
|
|
"among them) may be missing from the transcript."},
|
|
]
|
|
report["surprises"] = [
|
|
"The 1,010 'I2C' writes are ROM serial-bypass toggles around InfoROM block reads. Real I2C "
|
|
"is 46 writes of bit-banging in PGPIO: one one-byte probe on port 0 and seven ports that "
|
|
"never see the bus idle.",
|
|
"Line 37521 (0x1100 = 8) is the PRI-fault probe _nv018588rm called through OBJFIFO+1a0 "
|
|
"with register 0x2634.",
|
|
"The MC StateLoad sequence of gpu/mc_load.rs is at lines 139243-139246. Line 37377 is a "
|
|
"same-value PMC_ENABLE rewrite of a different shape, repeated before each CE PreInit write.",
|
|
"A Falcon image is loaded and run on NVDEC during MemorySystem Load, before any ACR work.",
|
|
"FIFO is brought up twice: once inside the ACR bootstrap for a copy-engine channel that is "
|
|
"kicked once and torn down, and again at its own Load position.",
|
|
"FECS and GPCCS are started in PostLoad after PMU command/reply pairs, not during Graphics Load.",
|
|
"The 4,545 PMC writes after the first SEC2 write are interrupt mask/unmask pairs around "
|
|
"lock acquisition, not engine control.",
|
|
"After PPRIV 0x122454 returns 0x8f0a20 the driver uses 0x8f0a2x/0x8f0e2x for the fault "
|
|
"interrupt and fault buffer registers.",
|
|
"BAR2 carries the heavy data: 2.9 million BAR1/BAR2 accesses in the full trace, including "
|
|
"byte-wide zero fills that took 18 s under mmiotrace, and the five WPR image copies.",
|
|
]
|
|
report["minimum_compute_path"] = MINIMUM_COMPUTE_PATH
|
|
report["problems"] = problems
|
|
return report
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
|
parser.add_argument("--check", action="store_true", help="compare with the existing report")
|
|
arguments = parser.parse_args()
|
|
report = build()
|
|
if report["problems"]:
|
|
for problem in report["problems"]:
|
|
print("PROBLEM:", problem, file=sys.stderr)
|
|
return 1
|
|
text = json.dumps(report, indent=1) + "\n"
|
|
if arguments.check:
|
|
if not REPORT.exists():
|
|
print("report is missing", file=sys.stderr)
|
|
return 1
|
|
stored = json.loads(REPORT.read_text())
|
|
fresh = json.loads(text)
|
|
if stored != fresh:
|
|
# Core sources change independently of the transcript: a moved citation is
|
|
# reported, anything else is a failure.
|
|
for document in (stored, fresh):
|
|
for segment in document.get("segments", []):
|
|
segment["rust"].pop("symbols_cited_in_core", None)
|
|
if stored != fresh:
|
|
print("report differs from a fresh run", file=sys.stderr)
|
|
return 1
|
|
print("note: symbol citations in src/nvidia/src changed since the report was written")
|
|
print(f"{REPORT.relative_to(ROOT)}: {len(report['segments'])} segments, up to date")
|
|
else:
|
|
REPORT.write_text(text)
|
|
print(f"wrote {REPORT.relative_to(ROOT)}: {len(report['segments'])} segments")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|