mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Deprecate nvproxy support for driver versions <535.104.05.
See policy in https://gvisor.dev/docs/user_guide/gpu/#driver-versions. PiperOrigin-RevId: 615557658
This commit is contained in:
+13
-41
@@ -118,20 +118,6 @@ type NV_MEMORY_ALLOCATION_PARAMS struct {
|
||||
Tag uint32
|
||||
}
|
||||
|
||||
// NV503B_ALLOC_PARAMETERS is the alloc params type for NV50_P2P, from
|
||||
// src/common/sdk/nvidia/inc/class/cl503b.h.
|
||||
//
|
||||
// +marshal
|
||||
type NV503B_ALLOC_PARAMETERS struct {
|
||||
HSubDevice Handle
|
||||
HPeerSubDevice Handle
|
||||
SubDevicePeerIDMask uint32
|
||||
PeerSubDevicePeerIDMask uint32
|
||||
MailboxBar1Addr uint64
|
||||
MailboxTotalSize uint32
|
||||
Flags uint32
|
||||
}
|
||||
|
||||
// NV503B_BAR1_P2P_DMA_INFO from src/common/sdk/nvidia/inc/class/cl503b.h.
|
||||
//
|
||||
// +marshal
|
||||
@@ -140,12 +126,18 @@ type NV503B_BAR1_P2P_DMA_INFO struct {
|
||||
DmaSize uint64
|
||||
}
|
||||
|
||||
// NV503B_ALLOC_PARAMETERS_V535 is the updated version of
|
||||
// NV503B_ALLOC_PARAMETERS since 535.43.02.
|
||||
// NV503B_ALLOC_PARAMETERS is the alloc params type for NV50_P2P, from
|
||||
// src/common/sdk/nvidia/inc/class/cl503b.h.
|
||||
//
|
||||
// +marshal
|
||||
type NV503B_ALLOC_PARAMETERS_V535 struct {
|
||||
NV503B_ALLOC_PARAMETERS
|
||||
type NV503B_ALLOC_PARAMETERS struct {
|
||||
HSubDevice Handle
|
||||
HPeerSubDevice Handle
|
||||
SubDevicePeerIDMask uint32
|
||||
PeerSubDevicePeerIDMask uint32
|
||||
MailboxBar1Addr uint64
|
||||
MailboxTotalSize uint32
|
||||
Flags uint32
|
||||
SubDeviceEgmPeerIDMask uint32
|
||||
PeerSubDeviceEgmPeerIDMask uint32
|
||||
L2pBar1P2PDmaInfo NV503B_BAR1_P2P_DMA_INFO
|
||||
@@ -248,17 +240,9 @@ type NV_CHANNEL_ALLOC_PARAMS struct {
|
||||
ECCErrorNotifierMem NV_MEMORY_DESC_PARAMS
|
||||
ProcessID uint32
|
||||
SubProcessID uint32
|
||||
}
|
||||
|
||||
// NV_CHANNEL_ALLOC_PARAMS_V535 is the updated version of
|
||||
// NV_CHANNEL_ALLOC_PARAMS since 535.86.05.
|
||||
//
|
||||
// +marshal
|
||||
type NV_CHANNEL_ALLOC_PARAMS_V535 struct {
|
||||
NV_CHANNEL_ALLOC_PARAMS
|
||||
EncryptIv [CC_CHAN_ALLOC_IV_SIZE_DWORD]uint32
|
||||
DecryptIv [CC_CHAN_ALLOC_IV_SIZE_DWORD]uint32
|
||||
HmacNonce [CC_CHAN_ALLOC_NONCE_SIZE_DWORD]uint32
|
||||
EncryptIv [CC_CHAN_ALLOC_IV_SIZE_DWORD]uint32
|
||||
DecryptIv [CC_CHAN_ALLOC_IV_SIZE_DWORD]uint32
|
||||
HmacNonce [CC_CHAN_ALLOC_NONCE_SIZE_DWORD]uint32
|
||||
}
|
||||
|
||||
// NVB0B5_ALLOCATION_PARAMETERS is the alloc param type for TURING_DMA_COPY_A,
|
||||
@@ -303,18 +287,6 @@ type nv00f8Map struct {
|
||||
//
|
||||
// +marshal
|
||||
type NV00F8_ALLOCATION_PARAMETERS struct {
|
||||
Alignment uint64
|
||||
AllocSize uint64
|
||||
PageSize uint32
|
||||
AllocFlags uint32
|
||||
Map nv00f8Map
|
||||
}
|
||||
|
||||
// NV00F8_ALLOCATION_PARAMETERS_V535 is the updated version of
|
||||
// NV00F8_ALLOCATION_PARAMETERS since 535.43.02.
|
||||
//
|
||||
// +marshal
|
||||
type NV00F8_ALLOCATION_PARAMETERS_V535 struct {
|
||||
Alignment uint64
|
||||
AllocSize uint64
|
||||
PageSize uint64
|
||||
|
||||
+15
-134
@@ -143,24 +143,18 @@ type RmAllocParamType interface {
|
||||
GetPRightsRequested() P64
|
||||
SetPAllocParms(p P64)
|
||||
SetPRightsRequested(p P64)
|
||||
FromOS64V535(other NVOS64ParametersV535)
|
||||
ToOS64V535() NVOS64ParametersV535
|
||||
FromOS64(other NVOS64Parameters)
|
||||
ToOS64() NVOS64Parameters
|
||||
GetPointer() uintptr
|
||||
marshal.Marshallable
|
||||
}
|
||||
|
||||
// GetRmAllocParamObj returns the appropriate implementation of
|
||||
// RmAllocParamType based on passed parameters.
|
||||
func GetRmAllocParamObj(isNVOS64 bool, isV535 bool) RmAllocParamType {
|
||||
func GetRmAllocParamObj(isNVOS64 bool) RmAllocParamType {
|
||||
if isNVOS64 {
|
||||
if isV535 {
|
||||
return &NVOS64ParametersV535{}
|
||||
}
|
||||
return &NVOS64Parameters{}
|
||||
}
|
||||
if isV535 {
|
||||
return &NVOS21ParametersV535{}
|
||||
}
|
||||
return &NVOS21Parameters{}
|
||||
}
|
||||
|
||||
@@ -174,8 +168,8 @@ type NVOS21Parameters struct {
|
||||
HObjectNew Handle
|
||||
HClass uint32
|
||||
PAllocParms P64
|
||||
ParamsSize uint32
|
||||
Status uint32
|
||||
Pad0 [4]byte
|
||||
}
|
||||
|
||||
// GetPAllocParms implements RmAllocParamType.GetPAllocParms.
|
||||
@@ -196,62 +190,8 @@ func (n *NVOS21Parameters) SetPRightsRequested(p P64) {
|
||||
panic("impossible")
|
||||
}
|
||||
|
||||
// FromOS64V535 implements RmAllocParamType.FromOS64V535.
|
||||
func (n *NVOS21Parameters) FromOS64V535(other NVOS64ParametersV535) {
|
||||
n.HRoot = other.HRoot
|
||||
n.HObjectParent = other.HObjectParent
|
||||
n.HObjectNew = other.HObjectNew
|
||||
n.HClass = other.HClass
|
||||
n.PAllocParms = other.PAllocParms
|
||||
n.Status = other.Status
|
||||
}
|
||||
|
||||
// ToOS64V535 implements RmAllocParamType.ToOS64V535.
|
||||
func (n *NVOS21Parameters) ToOS64V535() NVOS64ParametersV535 {
|
||||
return NVOS64ParametersV535{
|
||||
HRoot: n.HRoot,
|
||||
HObjectParent: n.HObjectParent,
|
||||
HObjectNew: n.HObjectNew,
|
||||
HClass: n.HClass,
|
||||
PAllocParms: n.PAllocParms,
|
||||
Status: n.Status,
|
||||
}
|
||||
}
|
||||
|
||||
// NVOS21ParametersV535 is the updated version of NVOS21Parameters starting
|
||||
// from 535.43.02.
|
||||
//
|
||||
// +marshal
|
||||
type NVOS21ParametersV535 struct {
|
||||
HRoot Handle
|
||||
HObjectParent Handle
|
||||
HObjectNew Handle
|
||||
HClass uint32
|
||||
PAllocParms P64
|
||||
ParamsSize uint32
|
||||
Status uint32
|
||||
}
|
||||
|
||||
// GetPAllocParms implements RmAllocParamType.GetPAllocParms.
|
||||
func (n *NVOS21ParametersV535) GetPAllocParms() P64 {
|
||||
return n.PAllocParms
|
||||
}
|
||||
|
||||
// GetPRightsRequested implements RmAllocParamType.GetPRightsRequested.
|
||||
func (n *NVOS21ParametersV535) GetPRightsRequested() P64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// SetPAllocParms implements RmAllocParamType.SetPAllocParms.
|
||||
func (n *NVOS21ParametersV535) SetPAllocParms(p P64) { n.PAllocParms = p }
|
||||
|
||||
// SetPRightsRequested implements RmAllocParamType.SetPRightsRequested.
|
||||
func (n *NVOS21ParametersV535) SetPRightsRequested(p P64) {
|
||||
panic("impossible")
|
||||
}
|
||||
|
||||
// FromOS64V535 implements RmAllocParamType.FromOS64V535.
|
||||
func (n *NVOS21ParametersV535) FromOS64V535(other NVOS64ParametersV535) {
|
||||
// FromOS64 implements RmAllocParamType.FromOS64.
|
||||
func (n *NVOS21Parameters) FromOS64(other NVOS64Parameters) {
|
||||
n.HRoot = other.HRoot
|
||||
n.HObjectParent = other.HObjectParent
|
||||
n.HObjectNew = other.HObjectNew
|
||||
@@ -261,9 +201,9 @@ func (n *NVOS21ParametersV535) FromOS64V535(other NVOS64ParametersV535) {
|
||||
n.Status = other.Status
|
||||
}
|
||||
|
||||
// ToOS64V535 implements RmAllocParamType.ToOS64V535.
|
||||
func (n *NVOS21ParametersV535) ToOS64V535() NVOS64ParametersV535 {
|
||||
return NVOS64ParametersV535{
|
||||
// ToOS64 implements RmAllocParamType.ToOS64.
|
||||
func (n *NVOS21Parameters) ToOS64() NVOS64Parameters {
|
||||
return NVOS64Parameters{
|
||||
HRoot: n.HRoot,
|
||||
HObjectParent: n.HObjectParent,
|
||||
HObjectNew: n.HObjectNew,
|
||||
@@ -425,8 +365,10 @@ type NVOS64Parameters struct {
|
||||
HClass uint32
|
||||
PAllocParms P64
|
||||
PRightsRequested P64
|
||||
ParamsSize uint32
|
||||
Flags uint32
|
||||
Status uint32
|
||||
_ uint32
|
||||
}
|
||||
|
||||
// GetPAllocParms implements RmAllocParamType.GetPAllocParms.
|
||||
@@ -445,70 +387,11 @@ func (n *NVOS64Parameters) SetPAllocParms(p P64) { n.PAllocParms = p }
|
||||
// SetPRightsRequested implements RmAllocParamType.SetPRightsRequested.
|
||||
func (n *NVOS64Parameters) SetPRightsRequested(p P64) { n.PRightsRequested = p }
|
||||
|
||||
// FromOS64V535 implements RmAllocParamType.FromOS64V535.
|
||||
func (n *NVOS64Parameters) FromOS64V535(other NVOS64ParametersV535) {
|
||||
n.HRoot = other.HRoot
|
||||
n.HObjectParent = other.HObjectParent
|
||||
n.HObjectNew = other.HObjectNew
|
||||
n.HClass = other.HClass
|
||||
n.PAllocParms = other.PAllocParms
|
||||
n.PRightsRequested = other.PRightsRequested
|
||||
n.Flags = other.Flags
|
||||
n.Status = other.Status
|
||||
}
|
||||
// FromOS64 implements RmAllocParamType.FromOS64.
|
||||
func (n *NVOS64Parameters) FromOS64(other NVOS64Parameters) { *n = other }
|
||||
|
||||
// ToOS64V535 implements RmAllocParamType.ToOS64V535.
|
||||
func (n *NVOS64Parameters) ToOS64V535() NVOS64ParametersV535 {
|
||||
return NVOS64ParametersV535{
|
||||
HRoot: n.HRoot,
|
||||
HObjectParent: n.HObjectParent,
|
||||
HObjectNew: n.HObjectNew,
|
||||
HClass: n.HClass,
|
||||
PAllocParms: n.PAllocParms,
|
||||
PRightsRequested: n.PRightsRequested,
|
||||
Flags: n.Flags,
|
||||
Status: n.Status,
|
||||
}
|
||||
}
|
||||
|
||||
// NVOS64ParametersV535 is the updated version of NVOS64Parameters starting
|
||||
// from 535.43.02.
|
||||
//
|
||||
// +marshal
|
||||
type NVOS64ParametersV535 struct {
|
||||
HRoot Handle
|
||||
HObjectParent Handle
|
||||
HObjectNew Handle
|
||||
HClass uint32
|
||||
PAllocParms P64
|
||||
PRightsRequested P64
|
||||
ParamsSize uint32
|
||||
Flags uint32
|
||||
Status uint32
|
||||
_ uint32
|
||||
}
|
||||
|
||||
// GetPAllocParms implements RmAllocParamType.GetPAllocParms.
|
||||
func (n *NVOS64ParametersV535) GetPAllocParms() P64 {
|
||||
return n.PAllocParms
|
||||
}
|
||||
|
||||
// GetPRightsRequested implements RmAllocParamType.GetPRightsRequested.
|
||||
func (n *NVOS64ParametersV535) GetPRightsRequested() P64 {
|
||||
return n.PRightsRequested
|
||||
}
|
||||
|
||||
// SetPAllocParms implements RmAllocParamType.SetPAllocParms.
|
||||
func (n *NVOS64ParametersV535) SetPAllocParms(p P64) { n.PAllocParms = p }
|
||||
|
||||
// SetPRightsRequested implements RmAllocParamType.SetPRightsRequested.
|
||||
func (n *NVOS64ParametersV535) SetPRightsRequested(p P64) { n.PRightsRequested = p }
|
||||
|
||||
// FromOS64V535 implements RmAllocParamType.FromOS64V535.
|
||||
func (n *NVOS64ParametersV535) FromOS64V535(other NVOS64ParametersV535) { *n = other }
|
||||
|
||||
// ToOS64V535 implements RmAllocParamType.ToOS64V535.
|
||||
func (n *NVOS64ParametersV535) ToOS64V535() NVOS64ParametersV535 { return *n }
|
||||
// ToOS64 implements RmAllocParamType.ToOS64.
|
||||
func (n *NVOS64Parameters) ToOS64() NVOS64Parameters { return *n }
|
||||
|
||||
// Frontend ioctl parameter struct sizes.
|
||||
var (
|
||||
@@ -520,7 +403,6 @@ var (
|
||||
SizeofIoctlNVOS02ParametersWithFD = uint32((*IoctlNVOS02ParametersWithFD)(nil).SizeBytes())
|
||||
SizeofNVOS00Parameters = uint32((*NVOS00Parameters)(nil).SizeBytes())
|
||||
SizeofNVOS21Parameters = uint32((*NVOS21Parameters)(nil).SizeBytes())
|
||||
SizeofNVOS21ParametersV535 = uint32((*NVOS21ParametersV535)(nil).SizeBytes())
|
||||
SizeofIoctlNVOS33ParametersWithFD = uint32((*IoctlNVOS33ParametersWithFD)(nil).SizeBytes())
|
||||
SizeofNVOS55Parameters = uint32((*NVOS55Parameters)(nil).SizeBytes())
|
||||
SizeofNVOS57Parameters = uint32((*NVOS57Parameters)(nil).SizeBytes())
|
||||
@@ -529,5 +411,4 @@ var (
|
||||
SizeofNVOS54Parameters = uint32((*NVOS54Parameters)(nil).SizeBytes())
|
||||
SizeofNVOS56Parameters = uint32((*NVOS56Parameters)(nil).SizeBytes())
|
||||
SizeofNVOS64Parameters = uint32((*NVOS64Parameters)(nil).SizeBytes())
|
||||
SizeofNVOS64ParametersV535 = uint32((*NVOS64ParametersV535)(nil).SizeBytes())
|
||||
)
|
||||
|
||||
@@ -21,17 +21,7 @@ func (n *NVOS21Parameters) GetPointer() uintptr {
|
||||
return uintptr(unsafe.Pointer(n))
|
||||
}
|
||||
|
||||
// GetPointer implements RmAllocParamType.GetPointer.
|
||||
func (n *NVOS21ParametersV535) GetPointer() uintptr {
|
||||
return uintptr(unsafe.Pointer(n))
|
||||
}
|
||||
|
||||
// GetPointer implements RmAllocParamType.GetPointer.
|
||||
func (n *NVOS64Parameters) GetPointer() uintptr {
|
||||
return uintptr(unsafe.Pointer(n))
|
||||
}
|
||||
|
||||
// GetPointer implements RmAllocParamType.GetPointer.
|
||||
func (n *NVOS64ParametersV535) GetPointer() uintptr {
|
||||
return uintptr(unsafe.Pointer(n))
|
||||
}
|
||||
|
||||
@@ -63,5 +63,4 @@ go_test(
|
||||
name = "nvproxy_test",
|
||||
srcs = ["nvproxy_test.go"],
|
||||
library = ":nvproxy",
|
||||
deps = ["//pkg/abi/nvgpu"],
|
||||
)
|
||||
|
||||
@@ -652,30 +652,20 @@ func ctrlSubdevFIFODisableChannels(fi *frontendIoctlState, ioctlParams *nvgpu.NV
|
||||
|
||||
func rmAlloc(fi *frontendIoctlState) (uintptr, error) {
|
||||
var isNVOS64 bool
|
||||
if fi.fd.nvp.abi.useRmAllocParamsV535 {
|
||||
switch fi.ioctlParamsSize {
|
||||
case nvgpu.SizeofNVOS21ParametersV535:
|
||||
case nvgpu.SizeofNVOS64ParametersV535:
|
||||
isNVOS64 = true
|
||||
default:
|
||||
return 0, linuxerr.EINVAL
|
||||
}
|
||||
} else {
|
||||
switch fi.ioctlParamsSize {
|
||||
case nvgpu.SizeofNVOS21Parameters:
|
||||
case nvgpu.SizeofNVOS64Parameters:
|
||||
isNVOS64 = true
|
||||
default:
|
||||
return 0, linuxerr.EINVAL
|
||||
}
|
||||
switch fi.ioctlParamsSize {
|
||||
case nvgpu.SizeofNVOS21Parameters:
|
||||
case nvgpu.SizeofNVOS64Parameters:
|
||||
isNVOS64 = true
|
||||
default:
|
||||
return 0, linuxerr.EINVAL
|
||||
}
|
||||
// Copy in parameters and convert to NVOS64ParametersV535, which is a super
|
||||
// set of all parameter types we support.
|
||||
buf := nvgpu.GetRmAllocParamObj(isNVOS64, fi.fd.nvp.abi.useRmAllocParamsV535)
|
||||
buf := nvgpu.GetRmAllocParamObj(isNVOS64)
|
||||
if _, err := buf.CopyIn(fi.t, fi.ioctlParamsAddr); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
ioctlParams := buf.ToOS64V535()
|
||||
ioctlParams := buf.ToOS64()
|
||||
|
||||
// hClass determines the type of pAllocParms.
|
||||
if log.IsLogging(log.Debug) {
|
||||
@@ -696,8 +686,8 @@ func rmAlloc(fi *frontendIoctlState) (uintptr, error) {
|
||||
// src/nvidia/src/kernel/rmapi/alloc_free.c:serverAllocResourceUnderLock(),
|
||||
// when RsResInfoByExternalClassId() is null.
|
||||
ioctlParams.Status = nvgpu.NV_ERR_INVALID_CLASS
|
||||
outIoctlParams := nvgpu.GetRmAllocParamObj(isNVOS64, fi.fd.nvp.abi.useRmAllocParamsV535)
|
||||
outIoctlParams.FromOS64V535(ioctlParams)
|
||||
outIoctlParams := nvgpu.GetRmAllocParamObj(isNVOS64)
|
||||
outIoctlParams.FromOS64(ioctlParams)
|
||||
// Any copy-out error from
|
||||
// src/nvidia/src/kernel/rmapi/alloc_free.c:serverAllocApiCopyOut() is
|
||||
// discarded.
|
||||
@@ -709,7 +699,7 @@ func rmAlloc(fi *frontendIoctlState) (uintptr, error) {
|
||||
|
||||
// Unlike frontendIoctlSimple and rmControlSimple, rmAllocSimple requires the
|
||||
// parameter type since the parameter's size is otherwise unknown.
|
||||
func rmAllocSimple[Params any, PParams marshalPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64ParametersV535, isNVOS64 bool) (uintptr, error) {
|
||||
func rmAllocSimple[Params any, PParams marshalPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
|
||||
if ioctlParams.PAllocParms == 0 {
|
||||
return rmAllocInvoke[byte](fi, ioctlParams, nil, isNVOS64)
|
||||
}
|
||||
@@ -728,11 +718,11 @@ func rmAllocSimple[Params any, PParams marshalPtr[Params]](fi *frontendIoctlStat
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func rmAllocNoParams(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64ParametersV535, isNVOS64 bool) (uintptr, error) {
|
||||
func rmAllocNoParams(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
|
||||
return rmAllocInvoke[byte](fi, ioctlParams, nil, isNVOS64)
|
||||
}
|
||||
|
||||
func rmAllocEventOSEvent(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64ParametersV535, isNVOS64 bool) (uintptr, error) {
|
||||
func rmAllocEventOSEvent(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
|
||||
var allocParams nvgpu.NV0005_ALLOC_PARAMETERS
|
||||
if _, err := allocParams.CopyIn(fi.t, addrFromP64(ioctlParams.PAllocParms)); err != nil {
|
||||
return 0, err
|
||||
|
||||
@@ -176,11 +176,11 @@ func ctrlSubdevGRGetInfo(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parame
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func rmAllocInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64ParametersV535, allocParams *Params, isNVOS64 bool) (uintptr, error) {
|
||||
func rmAllocInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, allocParams *Params, isNVOS64 bool) (uintptr, error) {
|
||||
defer runtime.KeepAlive(allocParams) // since we convert to non-pointer-typed P64
|
||||
|
||||
sentryIoctlParams := nvgpu.GetRmAllocParamObj(isNVOS64, fi.fd.nvp.abi.useRmAllocParamsV535)
|
||||
sentryIoctlParams.FromOS64V535(*ioctlParams)
|
||||
sentryIoctlParams := nvgpu.GetRmAllocParamObj(isNVOS64)
|
||||
sentryIoctlParams.FromOS64(*ioctlParams)
|
||||
sentryIoctlParams.SetPAllocParms(p64FromPtr(unsafe.Pointer(allocParams)))
|
||||
var rightsRequested nvgpu.RS_ACCESS_MASK
|
||||
if ioctlParams.PRightsRequested != 0 {
|
||||
|
||||
@@ -16,8 +16,6 @@ package nvproxy
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/nvgpu"
|
||||
)
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
@@ -28,15 +26,6 @@ func TestInit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNVOS21ParamsSize(t *testing.T) {
|
||||
if nvgpu.SizeofNVOS21ParametersV535 != nvgpu.SizeofNVOS21Parameters {
|
||||
// We assume the size of NVOS21_PARAMETERS struct did not change between
|
||||
// V525 and V535. If this turns out to be false, a separate seccomp entry
|
||||
// needs to be added for the new size value.
|
||||
t.Errorf("SizeofNVOS21ParametersV535(%#08x) != SizeofNVOS21Parameters(%#08x)", nvgpu.SizeofNVOS21ParametersV535, nvgpu.SizeofNVOS21Parameters)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAllSupportedHashesPresent tests that all the supported versions in nvproxy have hash entries
|
||||
// in this tool's map. If you're here because of failures run:
|
||||
// `make sudo TARGETS=//tools/gpu:main ARGS="validate_checksum"`and fix mismatches.
|
||||
|
||||
@@ -66,16 +66,10 @@ func Filters() seccomp.SyscallRules {
|
||||
seccomp.NonNegativeFD{},
|
||||
seccomp.EqualTo(frontendIoctlCmd(nvgpu.NV_ESC_RM_ALLOC, nvgpu.SizeofNVOS21Parameters)),
|
||||
},
|
||||
// Note that we don't need to add one for NVOS21ParametersV535, because
|
||||
// SizeofNVOS21ParametersV535 == SizeofNVOS21Parameters. We test this.
|
||||
seccomp.PerArg{
|
||||
seccomp.NonNegativeFD{},
|
||||
seccomp.EqualTo(frontendIoctlCmd(nvgpu.NV_ESC_RM_ALLOC, nvgpu.SizeofNVOS64Parameters)),
|
||||
},
|
||||
seccomp.PerArg{
|
||||
seccomp.NonNegativeFD{},
|
||||
seccomp.EqualTo(frontendIoctlCmd(nvgpu.NV_ESC_RM_ALLOC, nvgpu.SizeofNVOS64ParametersV535)),
|
||||
},
|
||||
seccomp.PerArg{
|
||||
seccomp.NonNegativeFD{},
|
||||
seccomp.EqualTo(frontendIoctlCmd(nvgpu.NV_ESC_RM_DUP_OBJECT, nvgpu.SizeofNVOS55Parameters)),
|
||||
|
||||
@@ -95,7 +95,7 @@ func (v DriverVersion) isGreaterThan(other DriverVersion) bool {
|
||||
|
||||
type frontendIoctlHandler func(fi *frontendIoctlState) (uintptr, error)
|
||||
type controlCmdHandler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error)
|
||||
type allocationClassHandler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64ParametersV535, isNVOS64 bool) (uintptr, error)
|
||||
type allocationClassHandler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error)
|
||||
type uvmIoctlHandler func(ui *uvmIoctlState) (uintptr, error)
|
||||
|
||||
// A driverABIFunc constructs and returns a driverABI.
|
||||
@@ -126,8 +126,6 @@ type driverABI struct {
|
||||
uvmIoctl map[uint32]uvmIoctlHandler
|
||||
controlCmd map[uint32]controlCmdHandler
|
||||
allocationClass map[uint32]allocationClassHandler
|
||||
|
||||
useRmAllocParamsV535 bool
|
||||
}
|
||||
|
||||
// abis is a global map containing all supported Nvidia driver ABIs. This is
|
||||
@@ -151,9 +149,8 @@ func addDriverABI(major, minor, patch int, runfileChecksum string, cons driverAB
|
||||
// Init initializes abis global map.
|
||||
func Init() {
|
||||
abisOnce.Do(func() {
|
||||
v525_60_13Checksum := "dce1c184f9f038be72237ccd29c66bb151077f6037f1c158c83d582bd2dba8ca"
|
||||
v525_60_13 := addDriverABI(525, 60, 13, v525_60_13Checksum, func() *driverABI {
|
||||
// 525.60.13 is the earliest driver version supported by nvproxy. Since
|
||||
v535_104_05 := addDriverABI(535, 104, 05, "2f9d609d1da770beee757636635c46e7ed8253ade887b87c7a5482e33fcbedc9", func() *driverABI {
|
||||
// 535.104.05 is the earliest driver version supported by nvproxy. Since
|
||||
// there is no parent to inherit from, the driverABI needs to be constructed
|
||||
// with the entirety of the nvproxy functionality at this version.
|
||||
return &driverABI{
|
||||
@@ -195,6 +192,7 @@ func Init() {
|
||||
nvgpu.UVM_ALLOC_SEMAPHORE_POOL: uvmIoctlSimple[nvgpu.UVM_ALLOC_SEMAPHORE_POOL_PARAMS],
|
||||
nvgpu.UVM_VALIDATE_VA_RANGE: uvmIoctlSimple[nvgpu.UVM_VALIDATE_VA_RANGE_PARAMS],
|
||||
nvgpu.UVM_CREATE_EXTERNAL_RANGE: uvmIoctlSimple[nvgpu.UVM_CREATE_EXTERNAL_RANGE_PARAMS],
|
||||
nvgpu.UVM_MM_INITIALIZE: uvmMMInitialize,
|
||||
},
|
||||
controlCmd: map[uint32]controlCmdHandler{
|
||||
nvgpu.NV0000_CTRL_CMD_CLIENT_GET_ADDR_SPACE_TYPE: rmControlSimple,
|
||||
@@ -268,6 +266,7 @@ func Init() {
|
||||
nvgpu.NV90E6_CTRL_CMD_MASTER_GET_VIRTUAL_FUNCTION_ERROR_CONT_INTR_MASK: rmControlSimple,
|
||||
nvgpu.NVC36F_CTRL_GET_CLASS_ENGINEID: rmControlSimple,
|
||||
nvgpu.NVC36F_CTRL_CMD_GPFIFO_GET_WORK_SUBMIT_TOKEN: rmControlSimple,
|
||||
nvgpu.NV_CONF_COMPUTE_CTRL_CMD_SYSTEM_GET_CAPABILITIES: rmControlSimple,
|
||||
nvgpu.NVA06C_CTRL_CMD_GPFIFO_SCHEDULE: rmControlSimple,
|
||||
nvgpu.NVA06C_CTRL_CMD_SET_TIMESLICE: rmControlSimple,
|
||||
nvgpu.NVA06C_CTRL_CMD_PREEMPT: rmControlSimple,
|
||||
@@ -305,6 +304,7 @@ func Init() {
|
||||
nvgpu.AMPERE_COMPUTE_A: rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS],
|
||||
nvgpu.AMPERE_COMPUTE_B: rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS],
|
||||
nvgpu.ADA_COMPUTE_A: rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS],
|
||||
nvgpu.NV_CONFIDENTIAL_COMPUTE: rmAllocSimple[nvgpu.NV_CONFIDENTIAL_COMPUTE_ALLOC_PARAMS],
|
||||
nvgpu.HOPPER_COMPUTE_A: rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS],
|
||||
nvgpu.HOPPER_USERMODE_A: rmAllocSimple[nvgpu.NV_HOPPER_USERMODE_A_PARAMS],
|
||||
nvgpu.GF100_SUBDEVICE_MASTER: rmAllocNoParams,
|
||||
@@ -313,44 +313,9 @@ func Init() {
|
||||
}
|
||||
})
|
||||
|
||||
// 525.89.02 is an intermediate unqualified version from the main branch.
|
||||
v525_89_02 := v525_60_13
|
||||
|
||||
// The following versions do not exist on the main branch. They branched
|
||||
// off the main branch at 525.89.02.
|
||||
v525_105_17Checksum := "c635a21a282c9b53485f19ebb64a0f4b536a968b94d4d97629e0bc547a58142a"
|
||||
v525_105_17 := addDriverABI(525, 105, 17, v525_105_17Checksum, v525_89_02)
|
||||
v525_125_06Checksum := "b5275689f4a833c37a507717ac8f0ee2f1f5cd2b7e236ffa70aad8dfb7455b9d"
|
||||
_ = addDriverABI(525, 125, 06, v525_125_06Checksum, v525_105_17)
|
||||
|
||||
// 535.43.02 is an intermediate unqualified version from the main branch.
|
||||
v535_43_02 := func() *driverABI {
|
||||
abi := v525_89_02()
|
||||
abi.useRmAllocParamsV535 = true
|
||||
abi.controlCmd[nvgpu.NV_CONF_COMPUTE_CTRL_CMD_SYSTEM_GET_CAPABILITIES] = rmControlSimple
|
||||
abi.allocationClass[nvgpu.NV_CONFIDENTIAL_COMPUTE] = rmAllocSimple[nvgpu.NV_CONFIDENTIAL_COMPUTE_ALLOC_PARAMS]
|
||||
abi.allocationClass[nvgpu.NV50_P2P] = rmAllocSimple[nvgpu.NV503B_ALLOC_PARAMETERS_V535]
|
||||
abi.allocationClass[nvgpu.NV_MEMORY_FABRIC] = rmAllocSimple[nvgpu.NV00F8_ALLOCATION_PARAMETERS_V535]
|
||||
abi.uvmIoctl[nvgpu.UVM_MM_INITIALIZE] = uvmMMInitialize
|
||||
return abi
|
||||
}
|
||||
|
||||
v535_54_03Checksum := "454764f57ea1b9e19166a370f78be10e71f0626438fb197f726dc3caf05b4082"
|
||||
v535_54_03 := addDriverABI(535, 54, 03, v535_54_03Checksum, v535_43_02)
|
||||
// 535.86.05 is an intermediate unqualified version from the main branch.
|
||||
v535_86_05 := func() *driverABI {
|
||||
abi := v535_54_03()
|
||||
abi.allocationClass[nvgpu.TURING_CHANNEL_GPFIFO_A] = rmAllocSimple[nvgpu.NV_CHANNEL_ALLOC_PARAMS_V535]
|
||||
abi.allocationClass[nvgpu.AMPERE_CHANNEL_GPFIFO_A] = rmAllocSimple[nvgpu.NV_CHANNEL_ALLOC_PARAMS_V535]
|
||||
return abi
|
||||
}
|
||||
v535_104_05Checksum := "2f9d609d1da770beee757636635c46e7ed8253ade887b87c7a5482e33fcbedc9"
|
||||
v535_104_05 := addDriverABI(535, 104, 05, v535_104_05Checksum, v535_86_05)
|
||||
|
||||
// 535.104.12 does not exist on the main branch. It branched off the main
|
||||
// branch at 535.104.05.
|
||||
v535_104_12Checksum := "ffc2d89e233d2427edb1ff5f436028a94b3ef86e78f97e088e11d905c82e8001"
|
||||
_ = addDriverABI(535, 104, 12, v535_104_12Checksum, v535_104_05)
|
||||
_ = addDriverABI(535, 104, 12, "ffc2d89e233d2427edb1ff5f436028a94b3ef86e78f97e088e11d905c82e8001", v535_104_05)
|
||||
|
||||
// 535.113.01 is an intermediate unqualified version from the main branch.
|
||||
v535_113_01 := v535_104_05
|
||||
|
||||
Reference in New Issue
Block a user