interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / driver / gsp / irq.om

160 lines · 3813 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note GSP host interrupt service policy. Host model ONLY; no physical IRQ/MMIO admission.
3note Source: NVIDIA open-gpu-kernel-modules 580.173.02 @20e4e6e19cc26ba47b5cbe23130a396be100c427
4note kernel_gsp_tu102.c:1188-1203: clear edge SWGEN0 BEFORE draining RPC, stop register access on lockdown.
5note kernel_falcon_ga102.c:318-320: pending = FALCON_IRQSTAT & RISCV_IRQMASK & RISCV_IRQDEST.
6note dev_falcon_v4.h:26-35: IRQSCLR=4, IRQSTAT=8, SWGEN0 bit6, HALT bit4.
7note WolframLanguageEvaluator {2^6,2^4,BitOr[2^6,2^4]} -> {64,16,80}.
8note HALT (bit4=16) sets iqhalt=1 and quarantines (-13) with pending bit retained; link irqcc.om + logdec.om for CrashCat V1 decoding.
9note Unknown non-HALT routed sources retain pending bits and quarantine (-13) with iqhalt=0.
10note iqinit admits one nonzero generation exactly once. No reset/rearm/reclaim or idle claim exists.
11note iqservice gen budget returns serviced events, or -1 args, -4 lifecycle, -9 non-model/inactive,
12note -10 generation, -11 budget exhausted, -12 quarantined, -13 unsupported IRQ, -14 lockdown,
13note -15 peer service failure. iqdone is progress before an error, never completion/idle authority.
14note Link irqsim.om explicitly. Its seam iqread/iqclear/iqready/iqrecv/iqmask/iqpm has no device effects.
15const IQSW uint 64
16const IQHALT uint 16
17const IQMAX ulong 64
18const IQCCMAX ulong 65536
19global iqmode ulong 1
20global iqstate ulong 1
21global iqgen ulong 1
22global iqdone ulong 1
23global iqpend uint 1
24global iqhalt ulong 1
25global iqccbound ulong 1
26global iqccpa ulong 1
27global iqccsz ulong 1
28global iqccpkts ulong 1
29global iqccerr long 1
30note iqccbind registers or clears a CrashCat queue buffer for HALT IRQ decoding (used by irqcc.om):
31note mode=0 unbind, mode=1 linear ccbuf[0..sz), mode=2 paged LibosLog ring lgbuf[0..sz).
32fn iqccbind mode ulong pa ulong sz ulong to long
33if eq mode 0
34put iqccbound 0 0
35put iqccpa 0 0
36put iqccsz 0 0
37put iqccpkts 0 0
38put iqccerr 0 0
39ret 0
40end
41if eq mode 1
42if or eq sz 0 gt sz IQCCMAX
43ret -1
44end
45put iqccbound 0 1
46put iqccpa 0 pa
47put iqccsz 0 sz
48put iqccpkts 0 0
49put iqccerr 0 0
50ret 0
51end
52if eq mode 2
53if or lt sz 4096 gt sz IQCCMAX
54ret -1
55end
56if ne and sz 4095 0
57ret -1
58end
59put iqccbound 0 2
60put iqccpa 0 pa
61put iqccsz 0 sz
62put iqccpkts 0 0
63put iqccerr 0 0
64ret 0
65end
66ret -1
67end
68fn iqinit gen ulong to long
69if eq gen 0
70ret -1
71end
72if ne get iqstate 0 0
73ret -4
74end
75put iqgen 0 gen
76put iqstate 0 1
77ret 0
78end
79fn iqstop err long to long
80iqmask
81put iqstate 0 2
82ret err
83end
84fn iqpump budget ulong to long
85note At most IQMAX messages plus one readiness check; never consumes beyond caller budget.
86for i ulong IQMAX
87if not iqready
88ret long get iqdone 0
89end
90if ge get iqdone 0 budget
91ret iqstop -11
92end
93r = iqrecv
94if lt r 0
95ret iqstop -15
96end
97if or eq r 1 eq r 2
98put iqdone 0 add get iqdone 0 1
99else
100ret iqstop -15
101end
102if eq r 2
103note Lockdown notification forbids ALL subsequent register accesses, including status/masking.
104put iqstate 0 3
105ret long get iqdone 0
106end
107end
108if iqready
109ret iqstop -11
110end
111ret long get iqdone 0
112end
113fn iqservice gen ulong budget ulong to long
114if or eq budget 0 gt budget IQMAX
115ret -1
116end
117if ne gen get iqgen 0
118ret -10
119end
120if eq get iqstate 0 2
121ret -12
122end
123if eq get iqstate 0 3
124ret -14
125end
126if ne get iqstate 0 1
127ret -4
128end
129if and ne get iqmode 0 0 ne get iqmode 0 2
130ret -9
131end
132if not iqpm
133ret -9
134end
135put iqdone 0 0
136put iqhalt 0 0
137p = iqread
138put iqpend 0 p
139if eq p 0
140ret 0
141end
142if ne and p not IQSW 0
143if ne and p IQHALT 0
144put iqhalt 0 1
145end
146ret iqstop -13
147end
148note This acknowledgement must precede the first RPC readiness/service access.
149iqclear IQSW
150r = iqpump budget
151if lt r 0
152ret r
153end
154if eq get iqstate 0 3
155ret r
156end
157note Preserve a new edge raised during or after draining. Never clear status after service.
158put iqpend 0 iqread
159ret r
160end