Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/gpu/driver/gsp/transport.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / driver / gsp / transport.om` 328 lines ยท 6208 bytes Raw Blame History 1 note Linux-process checked-mapping mechanism, NOT kernel transport or a hardware admission resolver. 2 note Link instead of replay.om; no implicit simulator fallback, no device opens or automatic retries. 3 note Coherent or explicitly cache-maintained queue memory is a mandatory external platform prerequisite. 4 note Compiler397e6704 mapget/mapset use one aligned access with DSB SY before/after; bulk copies do not. 5 note Legitimate pointer operations order payload stores before producer publish, acquire before capture, 6 note and captured loads before consumer acknowledgement. DSB does not establish cache coherency. 7 note Vendor msgq.c:411-420 SWAP_RX; message_queue_cpu.c:568-578; kernel_gsp.c:411-425. 8 note Notify chain kgspSetCmdQueueHead_TU102 writes PGSP_QUEUE_HEAD(0)=0, NOT a ring cursor/SEC2 queue. 9 note Caller owns validated mapping views; process-fatal mapping faults are NOT crash-safe DMA containment. 10 global qtstate ulong 1 11 global qtepoch ulong 1 12 global qtboot ulong 1 13 global qtcmd ulong 1 14 global qtstat ulong 1 15 global qtbar long 1 16 global qttok ulong 1 17 global qtpend uchar 1 18 global qtrd ulong 1 19 note Deferred receive: state2 retains an immutable validated frame until explicit semantic completion. 20 global qthand ulong 1 21 global qthold ulong 1 22 fn qtcheck to bool 23 if ne get qtstate 0 1 24 ret false 25 end 26 if not mmwepoch get qtepoch 0 27 ret false 28 end 29 if ne get mmwst 0 MMWPUB 30 ret false 31 end 32 ret eq get qtboot 0 get bgen 0 33 end 34 fn qtlose to void 35 if and mmwepoch get qtepoch 0 eq get mmwst 0 MMWPUB 36 r = mmwquar get qtepoch 0 37 end 38 put qtstate 0 2 39 put rqdead 0 1 40 put bstate 0 12 41 end 42 note Explicit mechanism attachment; success means bound spans, never qualified/coherent/hardware-ready. 43 fn qtattach gen ulong bar long barsz ulong boot42 uint to long 44 if ne get qtstate 0 0 45 ret -6 46 end 47 cls = gpclass boot42 48 if and ne cls 1 ne cls 2 49 ret -95 50 end 51 if or not mmwepoch gen ne get mmwst 0 MMWPUB 52 ret -6 53 end 54 if or ne gen get arsepoch 0 ne get bgen 0 get arsboot 0 55 ret -6 56 end 57 if ne get bstate 0 4 58 ret -6 59 end 60 if or lt barsz add GPNOTIF 4 le bar 0 61 ret -1 62 end 63 if lt get mmws 0 RQQSZ 64 ret -1 65 end 66 c = get arcmd 0 67 s = get arstat 0 68 if gt c sub get mmws 0 RQQSZ 69 ret -1 70 end 71 if gt s sub get mmws 0 RQQSZ 72 ret -1 73 end 74 if ne rem c RQSLOT 0 75 ret -1 76 end 77 if ne rem s RQSLOT 0 78 ret -1 79 end 80 if lt c s 81 if gt add c RQQSZ s 82 ret -1 83 end 84 else 85 if gt add s RQQSZ c 86 ret -1 87 end 88 end 89 if not rqshape 0 90 ret -1 91 end 92 h = get mmwh 0 93 v = mapget h add c 16 4 94 if ne v rqget32 0 16 95 ret -1 96 end 97 v = mapget h add c 32 4 98 if ne v rqget32 0 32 99 ret -1 100 end 101 put qtepoch 0 gen 102 put qtboot 0 get bgen 0 103 put qtcmd 0 c 104 put qtstat 0 s 105 put qtbar 0 bar 106 put qtpend 0 0 107 put qtstate 0 1 108 ret 0 109 end 110 fn qtxcopy wr ulong e ulong to long 111 h = get mmwh 0 112 for i ulong e 113 slot = rem add wr i RQCOUNT 114 o = add get qtcmd 0 mul add slot 1 RQSLOT 115 r = mapwrite h o rqtmp mul i RQSLOT RQSLOT 116 if ne r long RQSLOT 117 ret -6 118 end 119 end 120 ret 0 121 end 122 fn qtpub wr ulong e ulong to long 123 p = rem add wr e RQCOUNT 124 ret mapset get mmwh 0 add get qtcmd 0 16 4 p 125 end 126 fn qtsend f ulong n ulong p ulong sync bool to long 127 if not qtcheck 128 ret -6 129 end 130 if ne get qtpend 0 0 131 ret -6 132 end 133 h = get mmwh 0 134 rd = mapget h add get qtstat 0 32 4 135 if ge rd RQCOUNT 136 qtlose 137 ret -1 138 end 139 r = mapread h get qtstat 0 rqstat 0 32 140 if ne r 32 141 qtlose 142 ret -6 143 end 144 if and ne get rqlink 0 0 not rqshape 1 145 qtlose 146 ret -1 147 end 148 rqput32 1 32 rd 149 r = rqprep f n p sync 150 if ne r 0 151 if ne r -2 152 qtlose 153 end 154 ret r 155 end 156 wr = get rqpwr 0 157 e = get rqpcnt 0 158 token = get rqptok 0 159 r = qtxcopy wr e 160 if ne r 0 161 qtlose 162 ret r 163 end 164 note Leading DSB SY of this exact aligned store orders copied slot bytes before pointer publication. 165 r = qtpub wr e 166 if ne r 0 167 qtlose 168 ret -6 169 end 170 r = rqcommit token 171 if ne r 0 172 qtlose 173 ret r 174 end 175 note Pointer was published: any later failure is uncertain, never unsent/retryable. 176 r = qtbell get qtbar 0 177 if ne r 0 178 qtlose 179 ret -6 180 end 181 ret 0 182 end 183 note Capture a bounded immutable prefix under one acquired producer cursor. No live reread while validating. 184 fn qtsnap to long 185 if not qtcheck 186 ret -6 187 end 188 if ne get qtpend 0 0 189 ret -6 190 end 191 if eq add get qttok 0 1 0 192 ret -6 193 end 194 h = get mmwh 0 195 s = get qtstat 0 196 wr = mapget h add s 16 4 197 r = mapread h s rqstat 0 32 198 if ne r 32 199 qtlose 200 ret -6 201 end 202 rqput32 1 16 wr 203 rd = rqget32 0 32 204 put qtrd 0 rd 205 put qttok 0 add get qttok 0 1 206 put qtpend 0 1 207 if or ge wr RQCOUNT ge rd RQCOUNT 208 ret 0 209 end 210 avail = rem sub add wr RQCOUNT rd RQCOUNT 211 if eq avail 0 212 ret 0 213 end 214 o = add RQSLOT mul rd RQSLOT 215 r = mapread h add s o rqstat o RQSLOT 216 if ne r long RQSLOT 217 qtlose 218 ret -6 219 end 220 e = rqget32 1 add o 40 221 if or eq e 0 or gt e 16 gt e avail 222 ret 0 223 end 224 for i ulong sub e 1 225 slot = rem add add rd i 1 RQCOUNT 226 o = mul add slot 1 RQSLOT 227 r = mapread h add s o rqstat o RQSLOT 228 if ne r long RQSLOT 229 qtlose 230 ret -6 231 end 232 end 233 ret 0 234 end 235 fn qtstage token ulong to long 236 if not qtcheck 237 ret -6 238 end 239 if or ne get qtpend 0 1 ne token get qttok 0 240 ret -6 241 end 242 if ne rqget32 0 32 get qtrd 0 243 qtlose 244 ret -6 245 end 246 put qtpend 0 2 247 put qthand 0 0 248 r = rqrecv 249 if lt r 0 250 qtlose 251 ret r 252 end 253 if eq r 0 254 put qtpend 0 0 255 ret 0 256 end 257 ret 1 258 end 259 fn qthandled token ulong to long 260 if not qtcheck 261 ret -6 262 end 263 if or ne get qtpend 0 2 ne token get qttok 0 264 ret -6 265 end 266 if ne get qthand 0 0 267 ret -6 268 end 269 put qthand 0 1 270 ret 0 271 end 272 fn qtfinish token ulong to long 273 if not qtcheck 274 ret -6 275 end 276 if or ne get qtpend 0 2 ne token get qttok 0 277 ret -6 278 end 279 if ne get qthand 0 1 280 ret -6 281 end 282 note From here a failed publication is uncertain: quarantine, never restore/retry the local cursor. 283 put qtpend 0 0 284 put qthand 0 0 285 note Leading DSB SY is FULL: capture loads complete before the consumer store permits peer slot reuse. 286 x = mapset get mmwh 0 add get qtcmd 0 32 4 rqget32 0 32 287 if ne x 0 288 qtlose 289 ret -6 290 end 291 ret 1 292 end 293 note Existing pull API preserves its validated-capture completion boundary. 294 note IRQ callers instead stage, execute semantic handling, mark handled, then finish. 295 fn qtaccept token ulong to long 296 r = qtstage token 297 if ne r 1 298 ret r 299 end 300 r = qthandled token 301 if ne r 0 302 qtlose 303 ret r 304 end 305 ret qtfinish token 306 end 307 fn bcanrst to bool 308 ret eq get qtstate 0 0 309 end 310 fn blost to void 311 qtlose 312 end 313 fn bemit f ulong n ulong p ulong sync bool to long 314 ret qtsend f n p sync 315 end 316 fn bpull to long 317 if ne get qthold 0 0 318 if and qtcheck and eq get qtpend 0 2 eq get qthand 0 0 319 ret 1 320 end 321 ret -6 322 end 323 r = qtsnap 324 if ne r 0 325 ret r 326 end 327 ret qtaccept get qttok 0 328 end