github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/abi/nvgpu/classes.go (about) 1 // Copyright 2023 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package nvgpu 16 17 // Class handles, from src/nvidia/generated/g_allclasses.h. 18 const ( 19 NV01_ROOT = 0x00000000 20 NV01_ROOT_NON_PRIV = 0x00000001 21 NV01_MEMORY_SYSTEM = 0x0000003e 22 NV01_MEMORY_LOCAL_USER = 0x00000040 23 NV01_ROOT_CLIENT = 0x00000041 24 NV01_MEMORY_SYSTEM_OS_DESCRIPTOR = 0x00000071 25 NV01_EVENT_OS_EVENT = 0x00000079 26 NV01_DEVICE_0 = 0x00000080 27 NV_MEMORY_FABRIC = 0x000000f8 28 NV20_SUBDEVICE_0 = 0x00002080 29 NV50_MEMORY_VIRTUAL = 0x000050a0 30 NV50_P2P = 0x0000503b 31 NV50_THIRD_PARTY_P2P = 0x0000503c 32 GT200_DEBUGGER = 0x000083de 33 GF100_SUBDEVICE_MASTER = 0x000090e6 34 FERMI_CONTEXT_SHARE_A = 0x00009067 35 FERMI_VASPACE_A = 0x000090f1 36 KEPLER_CHANNEL_GROUP_A = 0x0000a06c 37 TURING_USERMODE_A = 0x0000c461 38 TURING_CHANNEL_GPFIFO_A = 0x0000c46f 39 AMPERE_CHANNEL_GPFIFO_A = 0x0000c56f 40 TURING_DMA_COPY_A = 0x0000c5b5 41 TURING_COMPUTE_A = 0x0000c5c0 42 HOPPER_USERMODE_A = 0x0000c661 43 AMPERE_DMA_COPY_A = 0x0000c6b5 44 AMPERE_COMPUTE_A = 0x0000c6c0 45 AMPERE_DMA_COPY_B = 0x0000c7b5 46 AMPERE_COMPUTE_B = 0x0000c7c0 47 HOPPER_DMA_COPY_A = 0x0000c8b5 48 ADA_COMPUTE_A = 0x0000c9c0 49 NV_CONFIDENTIAL_COMPUTE = 0x0000cb33 50 HOPPER_COMPUTE_A = 0x0000cbc0 51 ) 52 53 // NV0005_ALLOC_PARAMETERS is the alloc params type for NV01_EVENT_OS_EVENT, 54 // from src/common/sdk/nvidia/inc/class/cl0005.h. 55 // 56 // +marshal 57 type NV0005_ALLOC_PARAMETERS struct { 58 HParentClient Handle 59 HSrcResource Handle 60 HClass uint32 61 NotifyIndex uint32 62 Data P64 // actually FD for NV01_EVENT_OS_EVENT, see src/nvidia/src/kernel/rmapi/event.c:eventConstruct_IMPL() => src/nvidia/arch/nvalloc/unix/src/os.c:osUserHandleToKernelPtr() 63 } 64 65 // NV0080_ALLOC_PARAMETERS is the alloc params type for NV01_DEVICE_0, from 66 // src/common/sdk/nvidia/inc/class/cl0080.h. 67 // 68 // +marshal 69 type NV0080_ALLOC_PARAMETERS struct { 70 DeviceID uint32 71 HClientShare Handle 72 HTargetClient Handle 73 HTargetDevice Handle 74 Flags uint32 75 Pad0 [4]byte 76 VASpaceSize uint64 77 VAStartInternal uint64 78 VALimitInternal uint64 79 VAMode uint32 80 Pad1 [4]byte 81 } 82 83 // NV2080_ALLOC_PARAMETERS is the alloc params type for NV20_SUBDEVICE_0, from 84 // src/common/sdk/nvidia/inc/class/cl2080.h. 85 // 86 // +marshal 87 type NV2080_ALLOC_PARAMETERS struct { 88 SubDeviceID uint32 89 } 90 91 // NV_MEMORY_ALLOCATION_PARAMS is the alloc params type for various NV*_MEMORY* 92 // allocation classes, from src/common/sdk/nvidia/inc/nvos.h. 93 // 94 // +marshal 95 type NV_MEMORY_ALLOCATION_PARAMS struct { 96 Owner uint32 97 Type uint32 98 Flags uint32 99 Width uint32 100 Height uint32 101 Pitch int32 102 Attr uint32 103 Attr2 uint32 104 Format uint32 105 ComprCovg uint32 106 ZcullCovg uint32 107 _ uint32 108 RangeLo uint64 109 RangeHi uint64 110 Size uint64 111 Alignment uint64 112 Offset uint64 113 Limit uint64 114 Address P64 115 CtagOffset uint32 116 HVASpace Handle 117 InternalFlags uint32 118 Tag uint32 119 } 120 121 // NV503B_BAR1_P2P_DMA_INFO from src/common/sdk/nvidia/inc/class/cl503b.h. 122 // 123 // +marshal 124 type NV503B_BAR1_P2P_DMA_INFO struct { 125 DmaAddress uint64 126 DmaSize uint64 127 } 128 129 // NV503B_ALLOC_PARAMETERS is the alloc params type for NV50_P2P, from 130 // src/common/sdk/nvidia/inc/class/cl503b.h. 131 // 132 // +marshal 133 type NV503B_ALLOC_PARAMETERS struct { 134 HSubDevice Handle 135 HPeerSubDevice Handle 136 SubDevicePeerIDMask uint32 137 PeerSubDevicePeerIDMask uint32 138 MailboxBar1Addr uint64 139 MailboxTotalSize uint32 140 Flags uint32 141 SubDeviceEgmPeerIDMask uint32 142 PeerSubDeviceEgmPeerIDMask uint32 143 L2pBar1P2PDmaInfo NV503B_BAR1_P2P_DMA_INFO 144 P2lBar1P2PDmaInfo NV503B_BAR1_P2P_DMA_INFO 145 } 146 147 // NV503C_ALLOC_PARAMETERS is the alloc params type for NV50_THIRD_PARTY_P2P, 148 // from src/common/sdk/nvidia/inc/class/cl503c.h. 149 // 150 // +marshal 151 type NV503C_ALLOC_PARAMETERS struct { 152 Flags uint32 153 } 154 155 // NV83DE_ALLOC_PARAMETERS is the alloc params type for GT200_DEBUGGER, 156 // from src/common/sdk/nvidia/inc/class/cl83de.h. 157 // 158 // +marshal 159 type NV83DE_ALLOC_PARAMETERS struct { 160 HDebuggerClient_Obsolete Handle 161 HAppClient Handle 162 HClass3DObject Handle 163 } 164 165 // NV_CTXSHARE_ALLOCATION_PARAMETERS is the alloc params type for 166 // FERMI_CONTEXT_SHARE_A, from src/common/sdk/nvidia/inc/nvos.h. 167 // 168 // +marshal 169 type NV_CTXSHARE_ALLOCATION_PARAMETERS struct { 170 HVASpace Handle 171 Flags uint32 172 SubctxID uint32 173 } 174 175 // NV_VASPACE_ALLOCATION_PARAMETERS is the alloc params type for 176 // FERMI_VASPACE_A, from src/common/sdk/nvidia/inc/nvos.h. 177 // 178 // +marshal 179 type NV_VASPACE_ALLOCATION_PARAMETERS struct { 180 Index uint32 181 Flags uint32 182 VASize uint64 183 VAStartInternal uint64 184 VALimitInternal uint64 185 BigPageSize uint32 186 Pad0 [4]byte 187 VABase uint64 188 } 189 190 // NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS is the alloc params type for 191 // KEPLER_CHANNEL_GROUP_A, from src/common/sdk/nvidia/inc/nvos.h. 192 // 193 // +marshal 194 type NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS struct { 195 HObjectError Handle 196 HObjectECCError Handle 197 HVASpace Handle 198 EngineType uint32 199 BIsCallingContextVgpuPlugin uint8 200 Pad0 [3]byte 201 } 202 203 // NV_MEMORY_DESC_PARAMS is from 204 // src/common/sdk/nvidia/inc/alloc/alloc_channel.h. 205 // 206 // +marshal 207 type NV_MEMORY_DESC_PARAMS struct { 208 Base uint64 209 Size uint64 210 AddressSpace uint32 211 CacheAttrib uint32 212 } 213 214 // NV_CHANNEL_ALLOC_PARAMS is the alloc params type for TURING_CHANNEL_GPFIFO_A 215 // and AMPERE_CHANNEL_GPFIFO_A, from 216 // src/common/sdk/nvidia/inc/alloc/alloc_channel.h. 217 // 218 // +marshal 219 type NV_CHANNEL_ALLOC_PARAMS struct { 220 HObjectError Handle 221 HObjectBuffer Handle 222 GPFIFOOffset uint64 223 GPFIFOEntries uint32 224 Flags uint32 225 HContextShare Handle 226 HVASpace Handle 227 HUserdMemory [NV_MAX_SUBDEVICES]Handle 228 UserdOffset [NV_MAX_SUBDEVICES]uint64 229 EngineType uint32 230 CID uint32 231 SubDeviceID uint32 232 HObjectECCError Handle 233 InstanceMem NV_MEMORY_DESC_PARAMS 234 UserdMem NV_MEMORY_DESC_PARAMS 235 RamfcMem NV_MEMORY_DESC_PARAMS 236 MthdbufMem NV_MEMORY_DESC_PARAMS 237 HPhysChannelGroup Handle 238 InternalFlags uint32 239 ErrorNotifierMem NV_MEMORY_DESC_PARAMS 240 ECCErrorNotifierMem NV_MEMORY_DESC_PARAMS 241 ProcessID uint32 242 SubProcessID uint32 243 EncryptIv [CC_CHAN_ALLOC_IV_SIZE_DWORD]uint32 244 DecryptIv [CC_CHAN_ALLOC_IV_SIZE_DWORD]uint32 245 HmacNonce [CC_CHAN_ALLOC_NONCE_SIZE_DWORD]uint32 246 } 247 248 // NVB0B5_ALLOCATION_PARAMETERS is the alloc param type for TURING_DMA_COPY_A, 249 // AMPERE_DMA_COPY_A, and AMPERE_DMA_COPY_B from 250 // src/common/sdk/nvidia/inc/class/clb0b5sw.h. 251 // 252 // +marshal 253 type NVB0B5_ALLOCATION_PARAMETERS struct { 254 Version uint32 255 EngineType uint32 256 } 257 258 // NV_GR_ALLOCATION_PARAMETERS is the alloc param type for TURING_COMPUTE_A, 259 // AMPERE_COMPUTE_A, and ADA_COMPUTE_A, from src/common/sdk/nvidia/inc/nvos.h. 260 // 261 // +marshal 262 type NV_GR_ALLOCATION_PARAMETERS struct { 263 Version uint32 264 Flags uint32 265 Size uint32 266 Caps uint32 267 } 268 269 // NV_HOPPER_USERMODE_A_PARAMS is the alloc param type for HOPPER_USERMODE_A, 270 // from src/common/sdk/nvidia/inc/nvos.h. 271 // 272 // +marshal 273 type NV_HOPPER_USERMODE_A_PARAMS struct { 274 Bar1Mapping uint8 275 Priv uint8 276 } 277 278 // +marshal 279 type nv00f8Map struct { 280 offset uint64 281 hVidMem Handle 282 flags uint32 283 } 284 285 // NV00F8_ALLOCATION_PARAMETERS is the alloc param type for NV_MEMORY_FABRIC, 286 // from src/common/sdk/nvidia/inc/class/cl00f8.h. 287 // 288 // +marshal 289 type NV00F8_ALLOCATION_PARAMETERS struct { 290 Alignment uint64 291 AllocSize uint64 292 PageSize uint64 293 AllocFlags uint32 294 _ uint32 295 Map nv00f8Map 296 } 297 298 // NV_CONFIDENTIAL_COMPUTE_ALLOC_PARAMS is the alloc param type for 299 // NV_CONFIDENTIAL_COMPUTE, from src/common/sdk/nvidia/inc/class/clcb33.h. 300 // 301 // +marshal 302 type NV_CONFIDENTIAL_COMPUTE_ALLOC_PARAMS struct { 303 Handle Handle 304 _ uint32 305 }