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/chan/params.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 / chan / params.om` 332 lines ยท 10386 bytes Raw Blame History 1 note chan/params.om: the RM-alloc and RM-control parameter records the W5 "hello" chain forwards 2 note to GSP-RM (GSP_RM_ALLOC 103 / GSP_RM_CONTROL 76 carry them verbatim: rpcRmApiAlloc_GSP and 3 note rpcRmApiControl_GSP memcpy the caller's params) plus the two page-directory RPC bodies. 4 note Layout source of record: NVIDIA open-gpu-kernel-modules 580.173.02 (MIT), struct offsets and 5 note sizes printed by tests/params_ref.c from offsetof/sizeof on the NVIDIA headers and compared 6 note byte for byte by tests/params_diff.sh. Library unit, no main. Prefix pa. 7 note Every encoder zeroes pabuf, writes one record little-endian, sets palen and returns its size, 8 note or a negative error and leaves pabuf untouched: PAEFIT a value does not fit its field, 9 note PAERANGE a value outside the field's legal set, PAELEN a reply of the wrong length. 10 const PAOK long 0 11 const PAEFIT long -1 12 const PAERANGE long -2 13 const PAELEN long -3 14 note 0xFFFFFFFF 15 const PAU32 ulong `4294967295` 16 note channel ids are 12 bits (0xFFF) 17 const PACHMAX ulong 4095 18 note RPC function numbers (nvidia/inc/kernel/vgpu/rpc_global_enums.h:64,86,89,113) 19 const PARSETPD ulong 54 20 const PARCTRL ulong 76 21 const PARUNSPD ulong 79 22 const PARALLOC ulong 103 23 note classes: NV01_ROOT 0x0, NV01_DEVICE_0 0x80, NV20_SUBDEVICE_0 0x2080, FERMI_VASPACE_A 0x90f1, 24 note KEPLER_CHANNEL_GROUP_A 0xa06c, FERMI_CONTEXT_SHARE_A 0x9067, BLACKWELL_CHANNEL_GPFIFO_A 0xc96f, 25 note BLACKWELL_CHANNEL_GPFIFO_B 0xca6f, BLACKWELL_COMPUTE_B 0xcec0, VOLTA_USERMODE_A 0xc361, 26 note HOPPER_USERMODE_A 0xc661 27 const PACROOT ulong 0 28 const PACDEV ulong 128 29 const PACSUB ulong 8320 30 const PACVAS ulong 37105 31 const PACTSG ulong 41068 32 const PACCTX ulong 36967 33 const PACGPF ulong 51567 34 const PACGPFB ulong 51823 35 const PACCMP ulong 52928 36 const PACUMVA ulong 50017 37 const PACUMHA ulong 50785 38 note controls: NVA06C_CTRL_CMD_GPFIFO_SCHEDULE 0xa06c0101 (ctrla06c.h:97), 39 note NV2080_CTRL_CMD_INTERNAL_STATIC_KGR_GET_INFO 0x20800a2a (ctrl2080internal.h:422), 40 note NVC36F_CTRL_CMD_GPFIFO_GET_WORK_SUBMIT_TOKEN 0xc36f0108 (ctrlc36f.h) 41 const PACMSCH ulong `2691432705` 42 const PACMGRI ulong `545262122` 43 const PACMWST ulong `3278831880` 44 note NV2080_ENGINE_TYPE_GRAPHICS 0x1, NV_CTXSHARE_ALLOCATION_FLAGS_SUBCONTEXT_ASYNC 0x1 45 const PAENGGR ulong 1 46 const PACTXAS ulong 1 47 note record sizes (sizeof on the 580.173.02 headers) 48 const PASZROOT ulong 120 49 const PASZDEV ulong 56 50 const PASZSUB ulong 4 51 const PASZVAS ulong 56 52 const PASZTSG ulong 20 53 const PASZCTX ulong 12 54 const PASZCHAN ulong 368 55 const PASZSCH ulong 3 56 const PASZWST ulong 4 57 const PASZSPD ulong 48 58 const PASZUPD ulong 16 59 note GR info reply: 8 engines x 0x3a entries x 8 bytes = 3712; one engine is 58 x 8 = 464 bytes; 60 note SM_VERSION is index 0xC, its data word at 12 x 8 + 4 = 100 61 const PAGRSZ ulong 3712 62 const PAGRENG ulong 464 63 const PAGRMAX ulong 8 64 const PASMOFF ulong 100 65 note NVOS04 channel flags: clear USERD_INDEX_VALUE 10:8, USERD_INDEX_FIXED 11, USERD_INDEX_PAGE_VALUE 66 note 20:12 and USERD_INDEX_PAGE_FIXED 21 (mask 0xFFC000FF), then set PAGE_FIXED (1 << 21) 67 const PAFLMSK ulong `4290773247` 68 const PAPGFIX ulong `2097152` 69 text PANAME "aien-ogd" 70 global pabuf uchar 4096 71 global palen ulong 1 72 global pain ulong 48 73 global pareply uchar 4096 74 fn paclr n ulong to void 75 for i ulong 4096 76 put pabuf i 0 77 end 78 put palen 0 n 79 end 80 fn paput32 o ulong v ulong to void 81 for i ulong 4 82 put pabuf add o i uchar and shr v mul i 8 255 83 end 84 end 85 fn paput64 o ulong v ulong to void 86 for i ulong 8 87 put pabuf add o i uchar and shr v mul i 8 255 88 end 89 end 90 fn paget32 o ulong to ulong 91 v = ulong 0 92 for i ulong 4 93 v = or shl v 8 ulong get pareply add o sub 3 i 94 end 95 ret v 96 end 97 fn paf4 a ulong b ulong c ulong d ulong to bool 98 ret and and le a PAU32 le b PAU32 and le c PAU32 le d PAU32 99 end 100 note NV0000_ALLOC_PARAMETERS: hClient 0, processID 4, processName[100] 8 ("aien-ogd", NUL padded), 101 note pOsPidInfo 112 (0) 102 fn paroot hcli ulong pid ulong to long 103 if not paf4 hcli pid 0 0 104 ret PAEFIT 105 end 106 paclr PASZROOT 107 paput32 0 hcli 108 paput32 4 pid 109 for i ulong len PANAME 110 put pabuf add 8 i get PANAME i 111 end 112 ret long PASZROOT 113 end 114 note NV0080_ALLOC_PARAMETERS: deviceId 0, hClientShare 4, hTargetClient 8 (0), hTargetDevice 12 (0), 115 note flags 16, vaSpaceSize 24, vaStartInternal 32 (0), vaLimitInternal 40 (0), vaMode 48 116 fn padevice devid ulong hshare ulong flags ulong vamode ulong vasize ulong to long 117 if not paf4 devid hshare flags vamode 118 ret PAEFIT 119 end 120 paclr PASZDEV 121 paput32 0 devid 122 paput32 4 hshare 123 paput32 16 flags 124 paput64 24 vasize 125 paput32 48 vamode 126 ret long PASZDEV 127 end 128 note NV2080_ALLOC_PARAMETERS: subDeviceId 0 129 fn pasubdev subid ulong to long 130 if gt subid PAU32 131 ret PAEFIT 132 end 133 paclr PASZSUB 134 paput32 0 subid 135 ret long PASZSUB 136 end 137 note NV_VASPACE_ALLOCATION_PARAMETERS: index 0, flags 4, vaSize 8, vaStartInternal 16 (0), 138 note vaLimitInternal 24 (0), bigPageSize 32, vaBase 40, pasid 48 (0) 139 fn pavaspace index ulong flags ulong vasize ulong vabase ulong bigpg ulong to long 140 if not paf4 index flags bigpg 0 141 ret PAEFIT 142 end 143 paclr PASZVAS 144 paput32 0 index 145 paput32 4 flags 146 paput64 8 vasize 147 paput32 32 bigpg 148 paput64 40 vabase 149 ret long PASZVAS 150 end 151 note NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS: hObjectError 0, hObjectEccError 4, hVASpace 8, 152 note engineType 12, bIsCallingContextVgpuPlugin 16 (NV_FALSE) 153 fn patsg herr ulong hecc ulong hvas ulong eng ulong to long 154 if not paf4 herr hecc hvas eng 155 ret PAEFIT 156 end 157 paclr PASZTSG 158 paput32 0 herr 159 paput32 4 hecc 160 paput32 8 hvas 161 paput32 12 eng 162 ret long PASZTSG 163 end 164 note NV_CTXSHARE_ALLOCATION_PARAMETERS: hVASpace 0, flags 4, subctxId 8 165 fn pactxsh hvas ulong flags ulong subctx ulong to long 166 if not paf4 hvas flags subctx 0 167 ret PAEFIT 168 end 169 paclr PASZCTX 170 paput32 0 hvas 171 paput32 4 flags 172 paput32 8 subctx 173 ret long PASZCTX 174 end 175 note pain indices that hold NvU64 fields in the channel layout: gpFifoOffset 1, userdOffset[0] 7, 176 note base/size of the six NV_MEMORY_DESC_PARAMS (16,17 20,21 24,25 28,29 32,33 38,39) 177 fn pawide k ulong to bool 178 if or eq k 1 eq k 7 179 ret true 180 end 181 if and ge k 16 le k 35 182 ret lt rem sub k 16 4 2 183 end 184 ret or eq k 38 eq k 39 185 end 186 note NV_MEMORY_DESC_PARAMS at o from pain[k..k+3]: base 0, size 8, addressSpace 16, cacheAttrib 20 187 fn pamd o ulong k ulong to void 188 paput64 o get pain k 189 paput64 add o 8 get pain add k 1 190 paput32 add o 16 get pain add k 2 191 paput32 add o 20 get pain add k 3 192 end 193 note the GSP-client flag rewrite of kernel_channel.c:2814-2821: USERD_INDEX_FIXED false, 194 note USERD_INDEX_PAGE_FIXED true, USERD_INDEX_VALUE = chid % 8, USERD_INDEX_PAGE_VALUE = chid / 8 195 fn pachfl fl ulong chid ulong to ulong 196 v = or and fl PAFLMSK PAPGFIX 197 ret or v or shl rem chid 8 8 shl and div chid 8 511 12 198 end 199 note NV_CHANNEL_ALLOC_PARAMS (368 bytes) from pain: 200 note 0 hObjectError, 1 gpFifoOffset, 2 gpFifoEntries, 3 client flags, 4 hContextShare, 5 hVASpace, 201 note 6 hUserdMemory[0], 7 userdOffset[0], 8 engineType, 9 subDeviceId, 10 hObjectEccError, 202 note 11 hPhysChannelGroup, 12 error notifier type, 13 ECC error notifier type, 14 privilege level, 203 note 15 chid, 16-19 instanceMem, 20-23 userdMem, 24-27 ramfcMem, 28-31 mthdbufMem, 204 note 32-35 errorNotifierMem, 36 ProcessID, 37 SubProcessID, 38-41 eccErrorNotifierMem. 205 note hObjectBuffer, cid, hUserdMemory[1..7], userdOffset[1..7], the IVs, hmacNonce and tpcConfigID 206 note are 0. internalFlags = PRIVILEGE 1:0 | ERROR_NOTIFIER_TYPE 3:2 | ECC_ERROR_NOTIFIER_TYPE 5:4. 207 fn pachan to long 208 for k ulong 42 209 if and not pawide k gt get pain k PAU32 210 ret PAEFIT 211 end 212 end 213 if or or gt get pain 12 3 gt get pain 13 3 gt get pain 14 3 214 ret PAERANGE 215 end 216 chid = get pain 15 217 if gt chid PACHMAX 218 ret PAERANGE 219 end 220 paclr PASZCHAN 221 paput32 0 get pain 0 222 paput64 8 get pain 1 223 paput32 16 get pain 2 224 paput32 20 pachfl get pain 3 chid 225 paput32 24 get pain 4 226 paput32 28 get pain 5 227 paput32 32 get pain 6 228 paput64 64 get pain 7 229 paput32 128 get pain 8 230 paput32 136 get pain 9 231 paput32 140 get pain 10 232 pamd 144 16 233 pamd 168 20 234 pamd 192 24 235 pamd 216 28 236 paput32 240 get pain 11 237 paput32 244 or or get pain 14 shl get pain 12 2 shl get pain 13 4 238 pamd 248 32 239 pamd 272 38 240 paput32 296 get pain 36 241 paput32 300 get pain 37 242 ret long PASZCHAN 243 end 244 note NVA06C_CTRL_GPFIFO_SCHEDULE_PARAMS: bEnable 0, bSkipSubmit 1, bSkipEnable 2 (NvBool each) 245 fn pasched en ulong skipsub ulong skipen ulong to long 246 if or or gt en 1 gt skipsub 1 gt skipen 1 247 ret PAERANGE 248 end 249 paclr PASZSCH 250 put pabuf 0 uchar en 251 put pabuf 1 uchar skipsub 252 put pabuf 2 uchar skipen 253 ret long PASZSCH 254 end 255 note NV2080_CTRL_INTERNAL_STATIC_GR_GET_INFO_PARAMS request: all zero, GSP-RM fills the reply 256 fn pagrinfo to long 257 paclr PAGRSZ 258 ret long PAGRSZ 259 end 260 note SM_VERSION of engine eng from a GR_GET_INFO reply of n bytes copied into pareply: 261 note engineInfo[eng].infoList[0xC].data 262 fn pasmver eng ulong n ulong to long 263 if ne n PAGRSZ 264 ret PAELEN 265 end 266 if ge eng PAGRMAX 267 ret PAERANGE 268 end 269 ret long paget32 add mul eng PAGRENG PASMOFF 270 end 271 note rpc_set_page_directory_v1E_05 (48 bytes) from pain: 0 hClient 0, 1 hDevice 4, 2 pasid 8, 272 note params at 16: 3 physAddress 16, 4 numEntries 24, flags 28 = 5 APERTURE 1:0 (0..2) | 273 note 6 PRESERVE_PDES 2:2 (0..1), 7 hVASpace 32, 8 chId 36, 9 subDeviceId 40, 10 params.pasid 44 274 fn pasetpd to long 275 for k ulong 11 276 if and ne k 3 gt get pain k PAU32 277 ret PAEFIT 278 end 279 end 280 if or gt get pain 5 2 gt get pain 6 1 281 ret PAERANGE 282 end 283 paclr PASZSPD 284 paput32 0 get pain 0 285 paput32 4 get pain 1 286 paput32 8 get pain 2 287 paput64 16 get pain 3 288 paput32 24 get pain 4 289 paput32 28 or get pain 5 shl get pain 6 2 290 paput32 32 get pain 7 291 paput32 36 get pain 8 292 paput32 40 get pain 9 293 paput32 44 get pain 10 294 ret long PASZSPD 295 end 296 note rpc_unset_page_directory_v1E_05: hClient 0, hDevice 4, params at 8: hVASpace 8, subDeviceId 12 297 fn paunsetpd hcli ulong hdev ulong hvas ulong subdev ulong to long 298 if not paf4 hcli hdev hvas subdev 299 ret PAEFIT 300 end 301 paclr PASZUPD 302 paput32 0 hcli 303 paput32 4 hdev 304 paput32 8 hvas 305 paput32 12 subdev 306 ret long PASZUPD 307 end 308 note GB20B uses BLACKWELL_CHANNEL_GPFIFO_B (0xca6f) alongside GB10B BLACKWELL_CHANNEL_GPFIFO_A (0xc96f). 309 fn pacgpcls gb20b bool to ulong 310 if gb20b 311 ret PACGPFB 312 end 313 ret PACGPF 314 end 315 note Empty (0-byte) alloc params for BLACKWELL_COMPUTE_B (0xcec0) and VOLTA/HOPPER_USERMODE_A. 316 fn paempty to long 317 paclr 0 318 ret PAOK 319 end 320 note NVC36F_CTRL_CMD_GPFIFO_GET_WORK_SUBMIT_TOKEN request: 4 bytes initialized to 0xFFFFFFFF. 321 fn pawstreq to long 322 paclr PASZWST 323 paput32 0 PAU32 324 ret long PASZWST 325 end 326 note Decode workSubmitToken (u32 at +0) from a 4-byte GET_WORK_SUBMIT_TOKEN reply in pareply. 327 fn pawstdec n ulong to long 328 if ne n PASZWST 329 ret PAELEN 330 end 331 ret long paget32 0 332 end