github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/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_ROOT_CLIENT = 0x00000041 23 NV01_MEMORY_SYSTEM_OS_DESCRIPTOR = 0x00000071 24 NV01_EVENT_OS_EVENT = 0x00000079 25 NV01_DEVICE_0 = 0x00000080 26 NV_MEMORY_FABRIC = 0x000000f8 27 NV20_SUBDEVICE_0 = 0x00002080 28 NV50_THIRD_PARTY_P2P = 0x0000503c 29 GT200_DEBUGGER = 0x000083de 30 GF100_SUBDEVICE_MASTER = 0x000090e6 31 FERMI_CONTEXT_SHARE_A = 0x00009067 32 FERMI_VASPACE_A = 0x000090f1 33 KEPLER_CHANNEL_GROUP_A = 0x0000a06c 34 VOLTA_USERMODE_A = 0x0000c361 35 VOLTA_CHANNEL_GPFIFO_A = 0x0000c36f 36 TURING_USERMODE_A = 0x0000c461 37 TURING_CHANNEL_GPFIFO_A = 0x0000c46f 38 AMPERE_CHANNEL_GPFIFO_A = 0x0000c56f 39 TURING_DMA_COPY_A = 0x0000c5b5 40 TURING_COMPUTE_A = 0x0000c5c0 41 HOPPER_USERMODE_A = 0x0000c661 42 AMPERE_DMA_COPY_A = 0x0000c6b5 43 AMPERE_COMPUTE_A = 0x0000c6c0 44 AMPERE_DMA_COPY_B = 0x0000c7b5 45 AMPERE_COMPUTE_B = 0x0000c7c0 46 HOPPER_DMA_COPY_A = 0x0000c8b5 47 ADA_COMPUTE_A = 0x0000c9c0 48 HOPPER_COMPUTE_A = 0x0000cbc0 49 ) 50 51 // Class handles for older generations that are not supported by the open source 52 // driver. Volta was the last such generation. These are defined in files under 53 // src/common/sdk/nvidia/inc/class/. 54 const ( 55 VOLTA_COMPUTE_A = 0x0000c3c0 56 VOLTA_DMA_COPY_A = 0x0000c3b5 57 ) 58 59 // NV0005_ALLOC_PARAMETERS is the alloc params type for NV01_EVENT_OS_EVENT, 60 // from src/common/sdk/nvidia/inc/class/cl0005.h. 61 // 62 // +marshal 63 type NV0005_ALLOC_PARAMETERS struct { 64 HParentClient Handle 65 HSrcResource Handle 66 HClass uint32 67 NotifyIndex uint32 68 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() 69 } 70 71 // NV0080_ALLOC_PARAMETERS is the alloc params type for NV01_DEVICE_0, from 72 // src/common/sdk/nvidia/inc/class/cl0080.h. 73 // 74 // +marshal 75 type NV0080_ALLOC_PARAMETERS struct { 76 DeviceID uint32 77 HClientShare Handle 78 HTargetClient Handle 79 HTargetDevice Handle 80 Flags uint32 81 Pad0 [4]byte 82 VASpaceSize uint64 83 VAStartInternal uint64 84 VALimitInternal uint64 85 VAMode uint32 86 Pad1 [4]byte 87 } 88 89 // NV2080_ALLOC_PARAMETERS is the alloc params type for NV20_SUBDEVICE_0, from 90 // src/common/sdk/nvidia/inc/class/cl2080.h. 91 // 92 // +marshal 93 type NV2080_ALLOC_PARAMETERS struct { 94 SubDeviceID uint32 95 } 96 97 // NV503C_ALLOC_PARAMETERS is the alloc params type for NV50_THIRD_PARTY_P2P, 98 // from src/common/sdk/nvidia/inc/class/cl503c.h. 99 // 100 // +marshal 101 type NV503C_ALLOC_PARAMETERS struct { 102 Flags uint32 103 } 104 105 // NV83DE_ALLOC_PARAMETERS is the alloc params type for GT200_DEBUGGER, 106 // from src/common/sdk/nvidia/inc/class/cl83de.h. 107 // 108 // +marshal 109 type NV83DE_ALLOC_PARAMETERS struct { 110 HDebuggerClient_Obsolete Handle 111 HAppClient Handle 112 HClass3DObject Handle 113 } 114 115 // NV_CTXSHARE_ALLOCATION_PARAMETERS is the alloc params type for 116 // FERMI_CONTEXT_SHARE_A, from src/common/sdk/nvidia/inc/nvos.h. 117 // 118 // +marshal 119 type NV_CTXSHARE_ALLOCATION_PARAMETERS struct { 120 HVASpace Handle 121 Flags uint32 122 SubctxID uint32 123 } 124 125 // NV_VASPACE_ALLOCATION_PARAMETERS is the alloc params type for 126 // FERMI_VASPACE_A, from src/common/sdk/nvidia/inc/nvos.h. 127 // 128 // +marshal 129 type NV_VASPACE_ALLOCATION_PARAMETERS struct { 130 Index uint32 131 Flags uint32 132 VASize uint64 133 VAStartInternal uint64 134 VALimitInternal uint64 135 BigPageSize uint32 136 Pad0 [4]byte 137 VABase uint64 138 } 139 140 // NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS is the alloc params type for 141 // KEPLER_CHANNEL_GROUP_A, from src/common/sdk/nvidia/inc/nvos.h. 142 // 143 // +marshal 144 type NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS struct { 145 HObjectError Handle 146 HObjectECCError Handle 147 HVASpace Handle 148 EngineType uint32 149 BIsCallingContextVgpuPlugin uint8 150 Pad0 [3]byte 151 } 152 153 // NV_MEMORY_DESC_PARAMS is from 154 // src/common/sdk/nvidia/inc/alloc/alloc_channel.h. 155 // 156 // +marshal 157 type NV_MEMORY_DESC_PARAMS struct { 158 Base uint64 159 Size uint64 160 AddressSpace uint32 161 CacheAttrib uint32 162 } 163 164 // NV_CHANNEL_ALLOC_PARAMS is the alloc params type for TURING_CHANNEL_GPFIFO_A 165 // and AMPERE_CHANNEL_GPFIFO_A, from 166 // src/common/sdk/nvidia/inc/alloc/alloc_channel.h. 167 // 168 // +marshal 169 type NV_CHANNEL_ALLOC_PARAMS struct { 170 HObjectError Handle 171 HObjectBuffer Handle 172 GPFIFOOffset uint64 173 GPFIFOEntries uint32 174 Flags uint32 175 HContextShare Handle 176 HVASpace Handle 177 HUserdMemory [NV_MAX_SUBDEVICES]Handle 178 UserdOffset [NV_MAX_SUBDEVICES]uint64 179 EngineType uint32 180 CID uint32 181 SubDeviceID uint32 182 HObjectECCError Handle 183 InstanceMem NV_MEMORY_DESC_PARAMS 184 UserdMem NV_MEMORY_DESC_PARAMS 185 RamfcMem NV_MEMORY_DESC_PARAMS 186 MthdbufMem NV_MEMORY_DESC_PARAMS 187 HPhysChannelGroup Handle 188 InternalFlags uint32 189 ErrorNotifierMem NV_MEMORY_DESC_PARAMS 190 ECCErrorNotifierMem NV_MEMORY_DESC_PARAMS 191 ProcessID uint32 192 SubProcessID uint32 193 } 194 195 // NVB0B5_ALLOCATION_PARAMETERS is the alloc param type for TURING_DMA_COPY_A, 196 // AMPERE_DMA_COPY_A, and AMPERE_DMA_COPY_B from 197 // src/common/sdk/nvidia/inc/class/clb0b5sw.h. 198 // 199 // +marshal 200 type NVB0B5_ALLOCATION_PARAMETERS struct { 201 Version uint32 202 EngineType uint32 203 } 204 205 // NV_GR_ALLOCATION_PARAMETERS is the alloc param type for TURING_COMPUTE_A, 206 // AMPERE_COMPUTE_A, and ADA_COMPUTE_A, from src/common/sdk/nvidia/inc/nvos.h. 207 // 208 // +marshal 209 type NV_GR_ALLOCATION_PARAMETERS struct { 210 Version uint32 211 Flags uint32 212 Size uint32 213 Caps uint32 214 } 215 216 // NV_HOPPER_USERMODE_A_PARAMS is the alloc param type for HOPPER_USERMODE_A, 217 // from src/common/sdk/nvidia/inc/nvos.h. 218 // 219 // +marshal 220 type NV_HOPPER_USERMODE_A_PARAMS struct { 221 Bar1Mapping uint8 222 Priv uint8 223 } 224 225 // +marshal 226 type nv00f8Map struct { 227 offset uint64 228 hVidMem Handle 229 flags uint32 230 } 231 232 // NV00F8_ALLOCATION_PARAMETERS is the alloc param type for NV_MEMORY_FABRIC, 233 // from src/common/sdk/nvidia/inc/class/cl00f8.h 234 // 235 // +marshal 236 type NV00F8_ALLOCATION_PARAMETERS struct { 237 Alignment uint64 238 AllocSize uint64 239 PageSize uint32 240 AllocFlags uint32 241 Map nv00f8Map 242 }