interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / kernel / gpu / contract / gb10_gsp.devc

99 lines · 7411 bytes Raw Blame History
1# gb10_gsp.devc -- the GB10B GSP start-up on BAR0 as a device contract (ADR 0021 devc 1, class gpu-boot;
2# L332 rung 1, L346).
3#
4# This file is the second, independent statement of what ../gsp_mmio.c does. crates/aienos-devc
5# (branch feat/devc-gpu) compiles it into
6# gen/gsb_contract.c the same API as ../gsp_mmio.h (ck_gsp_mmio_boot, ck_gsp_mmio_notify), with
7# its own register offsets and bits taken from the lines below, not from gsp_mmio.h
8# gen/gb10_gsp_boot.md the documentation page
9# The hand-written ../gsp_mmio.c stays as the reference twin. Both must pass test_gsp_mmio against the
10# simulated SEC2 + GSP and produce the same register trace in every scenario of gsp_boot_trace.
11#
12# Grammar (class gpu-boot): one statement per line, "#" to end of line is a comment, strings in double
13# quotes, numbers decimal or 0x hex. Steps in `boot` and `notify` come from a closed list; the checker
14# refuses unsafe orders (see gen/gb10_gsp_boot.md).
15
16devc 1
17device gb10-gsp-boot
18prefix ck_gsp
19class gpu-boot
20transport pci-bar
21
22# ---- evidence: the driver-source lines this contract is written from ----
23manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:27" "#define NV_PSEC_FALCON_MAILBOX0 0x00840040 /* RW-4R */"
24manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:30" "#define NV_PSEC_FALCON_MAILBOX1 0x00840044 /* RW-4R */"
25manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:32" "#define NV_PSEC_QUEUE_HEAD(i) (0x00840c00+(i)*8) /* RW-4A */"
26manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:36" "#define NV_PSEC_QUEUE_TAIL(i) (0x00840c04+(i)*8) /* RW-4A */"
27manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:40" "#define NV_PSEC_EMEMC(i) (0x00840ac0+(i)*8) /* RW-4A */"
28manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:42" "#define NV_PSEC_EMEMC_OFFS 7:2 /* RWIVF */"
29manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:44" "#define NV_PSEC_EMEMC_BLK 15:8 /* RWIVF */"
30manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:46" "#define NV_PSEC_EMEMC_AINCW 24:24 /* RWIVF */"
31manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_sec_pri.h:54" "#define NV_PSEC_EMEMD(i) (0x00840ac4+(i)*8) /* RW-4A */"
32manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb10b/dev_gsp.h:27" "#define NV_PGSP 0x113fff:0x110000 /* RW--D */"
33manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_falcon_v4.h:27" "#define NV_PFALCON_FALCON_MAILBOX0 0x00000040 /* RW-4R */"
34manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_falcon_v4.h:30" "#define NV_PFALCON_FALCON_MAILBOX1 0x00000044 /* RW-4R */"
35manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_falcon_v4.h:34" "#define NV_PFALCON_FALCON_OS 0x00000080 /* RW-4R */"
36manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_falcon_v4.h:39" "#define NV_PFALCON_FALCON_HWCFG2 0x000000f4 /* R--4R */"
37manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_falcon_v4.h:79" "#define NV_PFALCON_FALCON_HWCFG2_RISCV_BR_PRIV_LOCKDOWN 13:13 /* R--VF */"
38manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/ampere/ga102/dev_riscv_pri.h:27" "#define NV_FALCON2_GSP_BASE 0x00111000"
39manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_riscv_pri.h:58" "#define NV_PRISCV_RISCV_CPUCTL 0x00000388 /* RW-4R */"
40manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/hopper/gh100/dev_riscv_pri.h:68" "#define NV_PRISCV_RISCV_CPUCTL_ACTIVE_STAT 7:7 /* R-IVF */"
41manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/common/inc/swref/published/blackwell/gb20b/dev_gsp.h:33" "#define NV_PGSP_QUEUE_HEAD(i) (0x00110c00+(i)*8) /* RW-4A */"
42manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/nvidia/src/kernel/gpu/sec2/arch/blackwell/kernel_sec2_gb10b.c:39" "#define SEC2_EMEM_CHANNEL_RM_SIZE 1024"
43manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/nvidia/src/kernel/gpu/sec2/arch/blackwell/kernel_sec2_gb10b.c:271" "const NvU32 privErrTargetLocked = 0xBADF4100U;"
44manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/nvidia/src/kernel/gpu/sec2/arch/blackwell/kernel_sec2_gb10b.c:272" "const NvU32 privErrTargetLockedMask = 0xFFFFFF00U;"
45manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/nvidia/src/kernel/gpu/sec2/arch/blackwell/kernel_sec2_gb10b.c:292" "const NvU32 cmdHandlingState = 0xc001cafe;"
46manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/nvidia/src/kernel/gpu/sec2/arch/blackwell/kernel_sec2_gb10b.c:730" "_ksec2UpdateQueueHeadTail_GB10B(pGpu, pKernelSec2, 0, paddedSize - sizeof(NvU32));"
47manual "NVIDIA open-gpu-kernel-modules 580.173.02" "src/nvidia/src/kernel/gpu/gsp/arch/hopper/kernel_gsp_gh100.c:956" "kflcnRegWrite_HAL(pGpu, pKernelFalcon, NV_PFALCON_FALCON_OS, pRiscvDesc->appVersion);"
48# No chip has run this contract. GB10B silicon behaviour beyond the driver source is UNVERIFIED.
49proven gpu-sim aienos-host 2026-10-21 test_gsp_mmio pending
50
51# ---- constants (C: GSB_<NAME> in the generated file) ----
52const EMEM_CHANNEL_BYTES 1024
53const EMEM_DW_PER_BLK 64
54const SEC2_CMD_BUSY 0xc001cafe
55const PRIV_LOCKED 0xBADF4100
56const PRIV_LOCKED_MASK 0xFFFFFF00
57
58# ---- register windows and registers: window NAME bar N base B size S; reg WIN NAME OFF WIDTH ACCESS ----
59window sec2 bar 0 base 0x840000 size 0x1000
60window gsp bar 0 base 0x110000 size 0x4000
61reg sec2 SEC2_MAILBOX0 0x040 4 rw
62reg sec2 SEC2_MAILBOX1 0x044 4 rw
63reg sec2 EMEMC0 0xac0 4 rw
64reg sec2 EMEMD0 0xac4 4 rw
65reg sec2 QHEAD0 0xc00 4 rw
66reg sec2 QTAIL0 0xc04 4 rw
67reg gsp GSP_MAILBOX0 0x040 4 rw
68reg gsp GSP_MAILBOX1 0x044 4 rw
69reg gsp FALCON_OS 0x080 4 rw
70reg gsp HWCFG2 0x0f4 4 ro
71reg gsp GSP_QHEAD0 0xc00 4 rw
72reg gsp CPUCTL 0x1388 4 rw
73
74# ---- register bits and fields: bit NAME REG N; field NAME REG HI:LO ----
75bit AINCW EMEMC0 24
76bit LOCKDOWN HWCFG2 13
77bit ACTIVE CPUCTL 7
78field OFFS EMEMC0 7:2
79field BLK EMEMC0 15:8
80
81# ---- the start-up (ck_gsp_mmio_boot) ----
82boot
83 require-packet EMEM_CHANNEL_BYTES else E_ARG
84 wait-equal QHEAD0 QTAIL0 budget polls_can_send else E_BUSY
85 emem-send EMEMC0 EMEMD0 AINCW OFFS BLK EMEM_DW_PER_BLK else E_EMEM
86 post-tail QTAIL0
87 doorbell QHEAD0
88 wait-not SEC2_MAILBOX0 SEC2_CMD_BUSY budget polls_cmd into sec2_mb0 timeout-read SEC2_MAILBOX1 sec2_mb1 else E_SEC2
89 wait-released HWCFG2 PRIV_LOCKED PRIV_LOCKED_MASK budget polls_mask into hwcfg2 else E_MASK
90 wait-lockdown GSP_MAILBOX0 GSP_MAILBOX1 LOCKDOWN budget polls_lockdown else E_LOCKDOWN
91 refuse-nonzero GSP_MAILBOX0 into gsp_mb0 else E_FMC
92 write FALCON_OS app_version
93 require-bit ACTIVE into cpuctl else E_RISCV
94end
95
96# ---- new command-queue elements for GSP-RM (ck_gsp_mmio_notify) ----
97notify
98 write GSP_QHEAD0 0
99end