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