github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/abi/nvgpu/nvgpu.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 tracks the ABI of the Nvidia GPU Linux kernel driver: 16 // https://github.com/NVIDIA/open-gpu-kernel-modules 17 package nvgpu 18 19 // Device numbers. 20 const ( 21 NV_MAJOR_DEVICE_NUMBER = 195 // from kernel-open/common/inc/nv.h 22 NV_CONTROL_DEVICE_MINOR = 255 // from kernel-open/common/inc/nv-linux.h 23 NVIDIA_UVM_PRIMARY_MINOR_NUMBER = 0 // from kernel-open/nvidia-uvm/uvm_common.h 24 ) 25 26 // Handle is NvHandle, from src/common/sdk/nvidia/inc/nvtypes.h. 27 // 28 // +marshal 29 type Handle struct { 30 Val uint32 31 } 32 33 // P64 is NvP64, from src/common/sdk/nvidia/inc/nvtypes.h. 34 // 35 // +marshal 36 type P64 uint64 37 38 // From src/common/sdk/nvidia/inc/nvlimits.h: 39 const ( 40 NV_MAX_DEVICES = 32 41 NV_MAX_SUBDEVICES = 8 42 ) 43 44 // RS_ACCESS_MASK is RS_ACCESS_MASK, from 45 // src/common/sdk/nvidia/inc/rs_access.h. 46 // 47 // +marshal 48 type RS_ACCESS_MASK struct { 49 Limbs [SDK_RS_ACCESS_MAX_LIMBS]uint32 // RsAccessLimb 50 } 51 52 const SDK_RS_ACCESS_MAX_LIMBS = 1 53 54 // RS_SHARE_POLICY is RS_SHARE_POLICY, from 55 // src/common/sdk/nvidia/inc/rs_access.h. 56 // 57 // +marshal 58 type RS_SHARE_POLICY struct { 59 Target uint32 60 AccessMask RS_ACCESS_MASK 61 Type uint16 62 Action uint8 63 Pad [1]byte 64 }