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-gpu-driver/blob/main/chan/params.om # omega-gpu-driver aien-dev/omega-gpu-driver Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-gpu-driver / chan / params.om` 300 lines ยท 9436 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_COMPUTE_B 0xcec0 26 const PACROOT ulong 0 27 const PACDEV ulong 128 28 const PACSUB ulong 8320 29 const PACVAS ulong 37105 30 const PACTSG ulong 41068 31 const PACCTX ulong 36967 32 const PACGPF ulong 51567 33 const PACCMP ulong 52928 34 note controls: NVA06C_CTRL_CMD_GPFIFO_SCHEDULE 0xa06c0101 (ctrla06c.h:97), 35 note NV2080_CTRL_CMD_INTERNAL_STATIC_KGR_GET_INFO 0x20800a2a (ctrl2080internal.h:422) 36 const PACMSCH ulong `2691432705` 37 const PACMGRI ulong `545262122` 38 note NV2080_ENGINE_TYPE_GRAPHICS 0x1, NV_CTXSHARE_ALLOCATION_FLAGS_SUBCONTEXT_ASYNC 0x1 39 const PAENGGR ulong 1 40 const PACTXAS ulong 1 41 note record sizes (sizeof on the 580.173.02 headers) 42 const PASZROOT ulong 120 43 const PASZDEV ulong 56 44 const PASZSUB ulong 4 45 const PASZVAS ulong 56 46 const PASZTSG ulong 20 47 const PASZCTX ulong 12 48 const PASZCHAN ulong 368 49 const PASZSCH ulong 3 50 const PASZSPD ulong 48 51 const PASZUPD ulong 16 52 note GR info reply: 8 engines x 0x3a entries x 8 bytes = 3712; one engine is 58 x 8 = 464 bytes; 53 note SM_VERSION is index 0xC, its data word at 12 x 8 + 4 = 100 54 const PAGRSZ ulong 3712 55 const PAGRENG ulong 464 56 const PAGRMAX ulong 8 57 const PASMOFF ulong 100 58 note NVOS04 channel flags: clear USERD_INDEX_VALUE 10:8, USERD_INDEX_FIXED 11, USERD_INDEX_PAGE_VALUE 59 note 20:12 and USERD_INDEX_PAGE_FIXED 21 (mask 0xFFC000FF), then set PAGE_FIXED (1 << 21) 60 const PAFLMSK ulong `4290773247` 61 const PAPGFIX ulong `2097152` 62 text PANAME "aien-ogd" 63 global pabuf uchar 4096 64 global palen ulong 1 65 global pain ulong 48 66 global pareply uchar 4096 67 fn paclr n ulong to void 68 for i ulong 4096 69 put pabuf i 0 70 end 71 put palen 0 n 72 end 73 fn paput32 o ulong v ulong to void 74 for i ulong 4 75 put pabuf add o i uchar and shr v mul i 8 255 76 end 77 end 78 fn paput64 o ulong v ulong to void 79 for i ulong 8 80 put pabuf add o i uchar and shr v mul i 8 255 81 end 82 end 83 fn paget32 o ulong to ulong 84 v = ulong 0 85 for i ulong 4 86 v = or shl v 8 ulong get pareply add o sub 3 i 87 end 88 ret v 89 end 90 fn paf4 a ulong b ulong c ulong d ulong to bool 91 ret and and le a PAU32 le b PAU32 and le c PAU32 le d PAU32 92 end 93 note NV0000_ALLOC_PARAMETERS: hClient 0, processID 4, processName[100] 8 ("aien-ogd", NUL padded), 94 note pOsPidInfo 112 (0) 95 fn paroot hcli ulong pid ulong to long 96 if not paf4 hcli pid 0 0 97 ret PAEFIT 98 end 99 paclr PASZROOT 100 paput32 0 hcli 101 paput32 4 pid 102 for i ulong len PANAME 103 put pabuf add 8 i get PANAME i 104 end 105 ret long PASZROOT 106 end 107 note NV0080_ALLOC_PARAMETERS: deviceId 0, hClientShare 4, hTargetClient 8 (0), hTargetDevice 12 (0), 108 note flags 16, vaSpaceSize 24, vaStartInternal 32 (0), vaLimitInternal 40 (0), vaMode 48 109 fn padevice devid ulong hshare ulong flags ulong vamode ulong vasize ulong to long 110 if not paf4 devid hshare flags vamode 111 ret PAEFIT 112 end 113 paclr PASZDEV 114 paput32 0 devid 115 paput32 4 hshare 116 paput32 16 flags 117 paput64 24 vasize 118 paput32 48 vamode 119 ret long PASZDEV 120 end 121 note NV2080_ALLOC_PARAMETERS: subDeviceId 0 122 fn pasubdev subid ulong to long 123 if gt subid PAU32 124 ret PAEFIT 125 end 126 paclr PASZSUB 127 paput32 0 subid 128 ret long PASZSUB 129 end 130 note NV_VASPACE_ALLOCATION_PARAMETERS: index 0, flags 4, vaSize 8, vaStartInternal 16 (0), 131 note vaLimitInternal 24 (0), bigPageSize 32, vaBase 40, pasid 48 (0) 132 fn pavaspace index ulong flags ulong vasize ulong vabase ulong bigpg ulong to long 133 if not paf4 index flags bigpg 0 134 ret PAEFIT 135 end 136 paclr PASZVAS 137 paput32 0 index 138 paput32 4 flags 139 paput64 8 vasize 140 paput32 32 bigpg 141 paput64 40 vabase 142 ret long PASZVAS 143 end 144 note NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS: hObjectError 0, hObjectEccError 4, hVASpace 8, 145 note engineType 12, bIsCallingContextVgpuPlugin 16 (NV_FALSE) 146 fn patsg herr ulong hecc ulong hvas ulong eng ulong to long 147 if not paf4 herr hecc hvas eng 148 ret PAEFIT 149 end 150 paclr PASZTSG 151 paput32 0 herr 152 paput32 4 hecc 153 paput32 8 hvas 154 paput32 12 eng 155 ret long PASZTSG 156 end 157 note NV_CTXSHARE_ALLOCATION_PARAMETERS: hVASpace 0, flags 4, subctxId 8 158 fn pactxsh hvas ulong flags ulong subctx ulong to long 159 if not paf4 hvas flags subctx 0 160 ret PAEFIT 161 end 162 paclr PASZCTX 163 paput32 0 hvas 164 paput32 4 flags 165 paput32 8 subctx 166 ret long PASZCTX 167 end 168 note pain indices that hold NvU64 fields in the channel layout: gpFifoOffset 1, userdOffset[0] 7, 169 note base/size of the six NV_MEMORY_DESC_PARAMS (16,17 20,21 24,25 28,29 32,33 38,39) 170 fn pawide k ulong to bool 171 if or eq k 1 eq k 7 172 ret true 173 end 174 if and ge k 16 le k 35 175 ret lt rem sub k 16 4 2 176 end 177 ret or eq k 38 eq k 39 178 end 179 note NV_MEMORY_DESC_PARAMS at o from pain[k..k+3]: base 0, size 8, addressSpace 16, cacheAttrib 20 180 fn pamd o ulong k ulong to void 181 paput64 o get pain k 182 paput64 add o 8 get pain add k 1 183 paput32 add o 16 get pain add k 2 184 paput32 add o 20 get pain add k 3 185 end 186 note the GSP-client flag rewrite of kernel_channel.c:2814-2821: USERD_INDEX_FIXED false, 187 note USERD_INDEX_PAGE_FIXED true, USERD_INDEX_VALUE = chid % 8, USERD_INDEX_PAGE_VALUE = chid / 8 188 fn pachfl fl ulong chid ulong to ulong 189 v = or and fl PAFLMSK PAPGFIX 190 ret or v or shl rem chid 8 8 shl and div chid 8 511 12 191 end 192 note NV_CHANNEL_ALLOC_PARAMS (368 bytes) from pain: 193 note 0 hObjectError, 1 gpFifoOffset, 2 gpFifoEntries, 3 client flags, 4 hContextShare, 5 hVASpace, 194 note 6 hUserdMemory[0], 7 userdOffset[0], 8 engineType, 9 subDeviceId, 10 hObjectEccError, 195 note 11 hPhysChannelGroup, 12 error notifier type, 13 ECC error notifier type, 14 privilege level, 196 note 15 chid, 16-19 instanceMem, 20-23 userdMem, 24-27 ramfcMem, 28-31 mthdbufMem, 197 note 32-35 errorNotifierMem, 36 ProcessID, 37 SubProcessID, 38-41 eccErrorNotifierMem. 198 note hObjectBuffer, cid, hUserdMemory[1..7], userdOffset[1..7], the IVs, hmacNonce and tpcConfigID 199 note are 0. internalFlags = PRIVILEGE 1:0 | ERROR_NOTIFIER_TYPE 3:2 | ECC_ERROR_NOTIFIER_TYPE 5:4. 200 fn pachan to long 201 for k ulong 42 202 if and not pawide k gt get pain k PAU32 203 ret PAEFIT 204 end 205 end 206 if or or gt get pain 12 3 gt get pain 13 3 gt get pain 14 3 207 ret PAERANGE 208 end 209 chid = get pain 15 210 if gt chid PACHMAX 211 ret PAERANGE 212 end 213 paclr PASZCHAN 214 paput32 0 get pain 0 215 paput64 8 get pain 1 216 paput32 16 get pain 2 217 paput32 20 pachfl get pain 3 chid 218 paput32 24 get pain 4 219 paput32 28 get pain 5 220 paput32 32 get pain 6 221 paput64 64 get pain 7 222 paput32 128 get pain 8 223 paput32 136 get pain 9 224 paput32 140 get pain 10 225 pamd 144 16 226 pamd 168 20 227 pamd 192 24 228 pamd 216 28 229 paput32 240 get pain 11 230 paput32 244 or or get pain 14 shl get pain 12 2 shl get pain 13 4 231 pamd 248 32 232 pamd 272 38 233 paput32 296 get pain 36 234 paput32 300 get pain 37 235 ret long PASZCHAN 236 end 237 note NVA06C_CTRL_GPFIFO_SCHEDULE_PARAMS: bEnable 0, bSkipSubmit 1, bSkipEnable 2 (NvBool each) 238 fn pasched en ulong skipsub ulong skipen ulong to long 239 if or or gt en 1 gt skipsub 1 gt skipen 1 240 ret PAERANGE 241 end 242 paclr PASZSCH 243 put pabuf 0 uchar en 244 put pabuf 1 uchar skipsub 245 put pabuf 2 uchar skipen 246 ret long PASZSCH 247 end 248 note NV2080_CTRL_INTERNAL_STATIC_GR_GET_INFO_PARAMS request: all zero, GSP-RM fills the reply 249 fn pagrinfo to long 250 paclr PAGRSZ 251 ret long PAGRSZ 252 end 253 note SM_VERSION of engine eng from a GR_GET_INFO reply of n bytes copied into pareply: 254 note engineInfo[eng].infoList[0xC].data 255 fn pasmver eng ulong n ulong to long 256 if ne n PAGRSZ 257 ret PAELEN 258 end 259 if ge eng PAGRMAX 260 ret PAERANGE 261 end 262 ret long paget32 add mul eng PAGRENG PASMOFF 263 end 264 note rpc_set_page_directory_v1E_05 (48 bytes) from pain: 0 hClient 0, 1 hDevice 4, 2 pasid 8, 265 note params at 16: 3 physAddress 16, 4 numEntries 24, flags 28 = 5 APERTURE 1:0 (0..2) | 266 note 6 PRESERVE_PDES 2:2 (0..1), 7 hVASpace 32, 8 chId 36, 9 subDeviceId 40, 10 params.pasid 44 267 fn pasetpd to long 268 for k ulong 11 269 if and ne k 3 gt get pain k PAU32 270 ret PAEFIT 271 end 272 end 273 if or gt get pain 5 2 gt get pain 6 1 274 ret PAERANGE 275 end 276 paclr PASZSPD 277 paput32 0 get pain 0 278 paput32 4 get pain 1 279 paput32 8 get pain 2 280 paput64 16 get pain 3 281 paput32 24 get pain 4 282 paput32 28 or get pain 5 shl get pain 6 2 283 paput32 32 get pain 7 284 paput32 36 get pain 8 285 paput32 40 get pain 9 286 paput32 44 get pain 10 287 ret long PASZSPD 288 end 289 note rpc_unset_page_directory_v1E_05: hClient 0, hDevice 4, params at 8: hVASpace 8, subDeviceId 12 290 fn paunsetpd hcli ulong hdev ulong hvas ulong subdev ulong to long 291 if not paf4 hcli hdev hvas subdev 292 ret PAEFIT 293 end 294 paclr PASZUPD 295 paput32 0 hcli 296 paput32 4 hdev 297 paput32 8 hvas 298 paput32 12 subdev 299 ret long PASZUPD 300 end