nvproxy: Clean up struct field tags.

Before this change, there were 2 places in which the driver struct names were
defined for nvproxy structs:
1. As struct field tags. The first field of structs had a tag `nvproxy:*`. This
   was kind of awkward. Such metadata is usually a struct comment.
2. In version.go while registering the struct with a name. Not all structs are
   defined in nvproxy (for example simple structs). In such cases, the driver
   struct name is directly assigned while registering struct info.

This change gets rid of (1). Most of the struct tags were `nvproxy:"same"`. Now
driverStructs() always infers the driver struct name using the nvproxy struct
name itself. The few cases where the nvproxy tag was needed, because driver
struct name was lower cased, were handled by defining driverStructWithName()
which allows specifying a different name. Now all driver struct names
definitions are in one place.

Along the way, also made the following fixes:
- For some reason, many structs defined in pkg/abi/nvgpu/frontend.go had
  camel-cased naming, while all other structs in pkg/abi/nvgpu/ctrl.go and
  pkg/abi/nvgpu/classes.go were named the same as their driver structs. The
  convention in the abi/* packages is to follow the kernel source naming.
  This is against Go sytle guide, but is more readable for gVisor purposes and
  has been a long accepted convention. This also makes the task of removing (1)
  easier. So renamed all such structs as per their driver names.
- A lot of code in pkg/sentry/devices/nvproxy/version.go was still referring to
  driver struct info as "struct names", even though it was representing more
  than just struct names. It also contains the reflect.Type of the struct which
  is used to compare the nvproxy struct layout to the driver struct layout.

PiperOrigin-RevId: 710648105
This commit is contained in:
Ayush Ranjan
2024-12-30 01:32:41 -08:00
committed by gVisor bot
parent 768db86931
commit b11efeaecd
13 changed files with 570 additions and 608 deletions
+28 -28
View File
@@ -93,7 +93,7 @@ const (
//
// +marshal
type NV2081_ALLOC_PARAMETERS struct {
Reserved uint32 `nvproxy:"same"`
Reserved uint32
}
// NV0005_ALLOC_PARAMETERS is the alloc params type for NV01_EVENT* classes
@@ -101,7 +101,7 @@ type NV2081_ALLOC_PARAMETERS struct {
//
// +marshal
type NV0005_ALLOC_PARAMETERS struct {
HParentClient Handle `nvproxy:"same"`
HParentClient Handle
HSrcResource Handle
HClass ClassID
NotifyIndex uint32
@@ -118,7 +118,7 @@ const (
//
// +marshal
type NV_MEMORY_VIRTUAL_ALLOCATION_PARAMS struct {
Offset uint64 `nvproxy:"same"`
Offset uint64
Limit uint64
HVASpace Handle
Pad0 [4]byte
@@ -129,7 +129,7 @@ type NV_MEMORY_VIRTUAL_ALLOCATION_PARAMS struct {
//
// +marshal
type NV0080_ALLOC_PARAMETERS struct {
DeviceID uint32 `nvproxy:"same"`
DeviceID uint32
HClientShare Handle
HTargetClient Handle
HTargetDevice Handle
@@ -147,7 +147,7 @@ type NV0080_ALLOC_PARAMETERS struct {
//
// +marshal
type NV2080_ALLOC_PARAMETERS struct {
SubDeviceID uint32 `nvproxy:"same"`
SubDeviceID uint32
}
// NV_MEMORY_ALLOCATION_PARAMS is the alloc params type for various NV*_MEMORY*
@@ -155,7 +155,7 @@ type NV2080_ALLOC_PARAMETERS struct {
//
// +marshal
type NV_MEMORY_ALLOCATION_PARAMS struct {
Owner uint32 `nvproxy:"same"`
Owner uint32
Type uint32
Flags uint32
Width uint32
@@ -185,16 +185,16 @@ type NV_MEMORY_ALLOCATION_PARAMS struct {
//
// +marshal
type NV_MEMORY_ALLOCATION_PARAMS_V545 struct {
NV_MEMORY_ALLOCATION_PARAMS `nvproxy:"NV_MEMORY_ALLOCATION_PARAMS"`
NumaNode int32
_ uint32
NV_MEMORY_ALLOCATION_PARAMS
NumaNode int32
_ uint32
}
// NV503B_BAR1_P2P_DMA_INFO from src/common/sdk/nvidia/inc/class/cl503b.h.
//
// +marshal
type NV503B_BAR1_P2P_DMA_INFO struct {
DmaAddress uint64 `nvproxy:"same"`
DmaAddress uint64
DmaSize uint64
}
@@ -203,7 +203,7 @@ type NV503B_BAR1_P2P_DMA_INFO struct {
//
// +marshal
type NV503B_ALLOC_PARAMETERS struct {
HSubDevice Handle `nvproxy:"same"`
HSubDevice Handle
HPeerSubDevice Handle
SubDevicePeerIDMask uint32
PeerSubDevicePeerIDMask uint32
@@ -221,7 +221,7 @@ type NV503B_ALLOC_PARAMETERS struct {
//
// +marshal
type NV503C_ALLOC_PARAMETERS struct {
Flags uint32 `nvproxy:"same"`
Flags uint32
}
// NV83DE_ALLOC_PARAMETERS is the alloc params type for GT200_DEBUGGER,
@@ -229,7 +229,7 @@ type NV503C_ALLOC_PARAMETERS struct {
//
// +marshal
type NV83DE_ALLOC_PARAMETERS struct {
HDebuggerClient_Obsolete Handle `nvproxy:"same"`
HDebuggerClient_Obsolete Handle
HAppClient Handle
HClass3DObject Handle
}
@@ -239,7 +239,7 @@ type NV83DE_ALLOC_PARAMETERS struct {
//
// +marshal
type NV_CTXSHARE_ALLOCATION_PARAMETERS struct {
HVASpace Handle `nvproxy:"same"`
HVASpace Handle
Flags uint32
SubctxID uint32
}
@@ -249,7 +249,7 @@ type NV_CTXSHARE_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV_VASPACE_ALLOCATION_PARAMETERS struct {
Index uint32 `nvproxy:"same"`
Index uint32
Flags uint32
VASize uint64
VAStartInternal uint64
@@ -264,7 +264,7 @@ type NV_VASPACE_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS struct {
HObjectError Handle `nvproxy:"same"`
HObjectError Handle
HObjectECCError Handle
HVASpace Handle
EngineType uint32
@@ -277,7 +277,7 @@ type NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV_MEMORY_DESC_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Size uint64
AddressSpace uint32
CacheAttrib uint32
@@ -289,7 +289,7 @@ type NV_MEMORY_DESC_PARAMS struct {
//
// +marshal
type NV_CHANNEL_ALLOC_PARAMS struct {
HObjectError Handle `nvproxy:"same"`
HObjectError Handle
HObjectBuffer Handle
GPFIFOOffset uint64
GPFIFOEntries uint32
@@ -323,7 +323,7 @@ type NV_CHANNEL_ALLOC_PARAMS struct {
//
// +marshal
type NVB0B5_ALLOCATION_PARAMETERS struct {
Version uint32 `nvproxy:"same"`
Version uint32
EngineType uint32
}
@@ -332,7 +332,7 @@ type NVB0B5_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV_GR_ALLOCATION_PARAMETERS struct {
Version uint32 `nvproxy:"same"`
Version uint32
Flags uint32
Size uint32
Caps uint32
@@ -343,7 +343,7 @@ type NV_GR_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV_HOPPER_USERMODE_A_PARAMS struct {
Bar1Mapping uint8 `nvproxy:"same"`
Bar1Mapping uint8
Priv uint8
}
@@ -352,7 +352,7 @@ type NV_HOPPER_USERMODE_A_PARAMS struct {
//
// +marshal
type NV9072_ALLOCATION_PARAMETERS struct {
LogicalHeadID uint32 `nvproxy:"same"`
LogicalHeadID uint32
DisplayMask uint32
Caps uint32
}
@@ -362,7 +362,7 @@ type NV9072_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV00DE_ALLOC_PARAMETERS struct {
Reserved uint32 `nvproxy:"same"`
Reserved uint32
}
// NV00DE_ALLOC_PARAMETERS_V545 is the updated version of
@@ -370,7 +370,7 @@ type NV00DE_ALLOC_PARAMETERS struct {
//
// +marshal
type NV00DE_ALLOC_PARAMETERS_V545 struct {
PolledDataMask uint64 `nvproxy:"NV00DE_ALLOC_PARAMETERS"`
PolledDataMask uint64
}
// +marshal
@@ -385,7 +385,7 @@ type nv00f8Map struct {
//
// +marshal
type NV00F8_ALLOCATION_PARAMETERS struct {
Alignment uint64 `nvproxy:"same"`
Alignment uint64
AllocSize uint64
PageSize uint64
AllocFlags uint32
@@ -412,7 +412,7 @@ type NV_EXPORT_MEM_PACKET struct {
//
// +marshal
type NV00FD_ALLOCATION_PARAMETERS struct {
Alignment uint64 `nvproxy:"same"`
Alignment uint64
AllocSize uint64
PageSize uint32
AllocFlags uint32
@@ -426,7 +426,7 @@ type NV00FD_ALLOCATION_PARAMETERS struct {
//
// +marshal
type NV00FD_ALLOCATION_PARAMETERS_V545 struct {
ExpPacket NV_EXPORT_MEM_PACKET `nvproxy:"NV00FD_ALLOCATION_PARAMETERS"`
ExpPacket NV_EXPORT_MEM_PACKET
Index uint16
_ [6]byte
NV00FD_ALLOCATION_PARAMETERS
@@ -437,5 +437,5 @@ type NV00FD_ALLOCATION_PARAMETERS_V545 struct {
//
// +marshal
type NV_CONFIDENTIAL_COMPUTE_ALLOC_PARAMS struct {
Handle Handle `nvproxy:"same"`
Handle Handle
}
+16 -16
View File
@@ -86,7 +86,7 @@ const (
//
// +marshal
type NV0000_CTRL_GPU_GET_ID_INFO_PARAMS struct {
GpuID uint32 `nvproxy:"same"`
GpuID uint32
GpuFlags uint32
DeviceInstance uint32
SubDeviceInstance uint32
@@ -120,7 +120,7 @@ const (
//
// +marshal
type NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS struct {
GpuIDs [NV0000_CTRL_SYSTEM_MAX_ATTACHED_GPUS]uint32 `nvproxy:"same"`
GpuIDs [NV0000_CTRL_SYSTEM_MAX_ATTACHED_GPUS]uint32
GpuCount uint32
P2PCaps uint32
P2POptimalReadCEs uint32
@@ -135,8 +135,8 @@ type NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS struct {
//
// +marshal
type NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS_V550 struct {
NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS `nvproxy:"NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS"`
BusEgmPeerIDs P64
NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS
BusEgmPeerIDs P64
}
// From src/common/sdk/nvidia/inc/ctrl/ctrl0000/ctrl0000unix.h:
@@ -149,7 +149,7 @@ const (
// +marshal
type NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS struct {
FD int32 `nvproxy:"same"`
FD int32
DeviceInstance uint32
MaxObjects uint16
Metadata [NV0000_OS_UNIX_EXPORT_OBJECT_FD_BUFFER_SIZE]uint8
@@ -168,7 +168,7 @@ func (p *NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS) SetFrontendFD(fd int
// +marshal
type NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS_V545 struct {
FD int32 `nvproxy:"NV0000_CTRL_OS_UNIX_GET_EXPORT_OBJECT_INFO_PARAMS"`
FD int32
DeviceInstance uint32
GpuInstanceID uint32
MaxObjects uint16
@@ -194,7 +194,7 @@ type NV0000_CTRL_OS_UNIX_EXPORT_OBJECT struct {
// +marshal
type NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS struct {
Object NV0000_CTRL_OS_UNIX_EXPORT_OBJECT `nvproxy:"same"`
Object NV0000_CTRL_OS_UNIX_EXPORT_OBJECT
FD int32
Flags uint32
}
@@ -211,7 +211,7 @@ func (p *NV0000_CTRL_OS_UNIX_EXPORT_OBJECT_TO_FD_PARAMS) SetFrontendFD(fd int32)
// +marshal
type NV0000_CTRL_OS_UNIX_IMPORT_OBJECT_FROM_FD_PARAMS struct {
FD int32 `nvproxy:"same"`
FD int32
Object NV0000_CTRL_OS_UNIX_EXPORT_OBJECT
}
@@ -227,7 +227,7 @@ func (p *NV0000_CTRL_OS_UNIX_IMPORT_OBJECT_FROM_FD_PARAMS) SetFrontendFD(fd int3
// +marshal
type NV0000_CTRL_SYSTEM_GET_BUILD_VERSION_PARAMS struct {
SizeOfStrings uint32 `nvproxy:"same"`
SizeOfStrings uint32
Pad [4]byte
PDriverVersionBuffer P64
PVersionBuffer P64
@@ -262,7 +262,7 @@ const (
// +marshal
type NV0080_CTRL_FIFO_GET_CHANNELLIST_PARAMS struct {
NumChannels uint32 `nvproxy:"same"`
NumChannels uint32
Pad [4]byte
PChannelHandleList P64
PChannelList P64
@@ -309,7 +309,7 @@ type NV0080_CTRL_GET_CAPS_PARAMS struct {
// +marshal
type NV0080_CTRL_GR_ROUTE_INFO struct {
Flags uint32 `nvproxy:"same"`
Flags uint32
Pad [4]byte
Route uint64
}
@@ -377,7 +377,7 @@ const (
// +marshal
type NV00FD_CTRL_ATTACH_GPU_PARAMS struct {
HSubDevice Handle `nvproxy:"same"`
HSubDevice Handle
Flags uint32
DevDescriptor uint64
}
@@ -431,7 +431,7 @@ const (
// +marshal
type NV2080_CTRL_FIFO_DISABLE_CHANNELS_PARAMS struct {
BDisable uint8 `nvproxy:"same"`
BDisable uint8
Pad1 [3]byte
NumChannels uint32
BOnlyDisableScheduling uint8
@@ -495,8 +495,8 @@ const (
// +marshal
type NV2080_CTRL_GR_GET_INFO_PARAMS struct {
NvxxxCtrlXxxGetInfoParams `nvproxy:"same"`
GRRouteInfo NV0080_CTRL_GR_ROUTE_INFO
NvxxxCtrlXxxGetInfoParams
GRRouteInfo NV0080_CTRL_GR_ROUTE_INFO
}
// ListSize implements HasCtrlInfoList.ListSize.
@@ -555,7 +555,7 @@ const (
// +marshal
type NV503C_CTRL_REGISTER_VA_SPACE_PARAMS struct {
HVASpace Handle `nvproxy:"same"`
HVASpace Handle
Pad [4]byte
VASpaceToken uint64
}
+99 -103
View File
@@ -63,7 +63,7 @@ const (
//
// +marshal
type IoctlRegisterFD struct {
CtlFD int32 `nvproxy:"nv_ioctl_register_fd_t"`
CtlFD int32
}
// GetStatus implements HasStatus.GetStatus.
@@ -79,7 +79,7 @@ func (p *IoctlRegisterFD) GetStatus() uint32 {
//
// +marshal
type IoctlAllocOSEvent struct {
HClient Handle `nvproxy:"nv_ioctl_alloc_os_event_t"`
HClient Handle
HDevice Handle
FD uint32
Status uint32
@@ -104,7 +104,7 @@ func (p *IoctlAllocOSEvent) GetStatus() uint32 {
//
// +marshal
type IoctlFreeOSEvent struct {
HClient Handle `nvproxy:"nv_ioctl_free_os_event_t"`
HClient Handle
HDevice Handle
FD uint32
Status uint32
@@ -129,7 +129,7 @@ func (p *IoctlFreeOSEvent) GetStatus() uint32 {
//
// +marshal
type RMAPIVersion struct {
Cmd uint32 `nvproxy:"nv_ioctl_rm_api_version_t"`
Cmd uint32
Reply uint32
VersionString [64]byte
}
@@ -146,7 +146,7 @@ func (p *RMAPIVersion) GetStatus() uint32 {
//
// +marshal
type IoctlSysParams struct {
MemblockSize uint64 `nvproxy:"nv_ioctl_sys_params_t"`
MemblockSize uint64
}
// GetStatus implements HasStatus.GetStatus.
@@ -161,7 +161,7 @@ func (p *IoctlSysParams) GetStatus() uint32 {
//
// +marshal
type IoctlWaitOpenComplete struct {
Rc int32 `nvproxy:"nv_ioctl_wait_open_complete_t"`
Rc int32
AdapterStatus uint32
}
@@ -174,7 +174,7 @@ func (p *IoctlWaitOpenComplete) GetStatus() uint32 {
//
// +marshal
type IoctlNVOS02ParametersWithFD struct {
Params NVOS02Parameters `nvproxy:"nv_ioctl_nvos02_parameters_with_fd"`
Params NVOS02_PARAMETERS
FD int32
Pad0 [4]byte
}
@@ -185,8 +185,8 @@ func (p *IoctlNVOS02ParametersWithFD) GetStatus() uint32 {
}
// +marshal
type NVOS02Parameters struct {
HRoot Handle `nvproxy:"NVOS02_PARAMETERS"`
type NVOS02_PARAMETERS struct {
HRoot Handle
HObjectParent Handle
HObjectNew Handle
HClass ClassID
@@ -209,18 +209,18 @@ const (
NVOS02_FLAGS_MAPPING_NO_MAP = 0x00000001
)
// NVOS00Parameters is the parameter type for NV_ESC_RM_FREE.
// NVOS00_PARAMETERS is the parameter type for NV_ESC_RM_FREE.
//
// +marshal
type NVOS00Parameters struct {
HRoot Handle `nvproxy:"NVOS00_PARAMETERS"`
type NVOS00_PARAMETERS struct {
HRoot Handle
HObjectParent Handle
HObjectOld Handle
Status uint32
}
// GetStatus implements HasStatus.GetStatus.
func (p *NVOS00Parameters) GetStatus() uint32 {
func (p *NVOS00_PARAMETERS) GetStatus() uint32 {
return p.Status
}
@@ -232,8 +232,8 @@ type RmAllocParamType interface {
GetPRightsRequested() P64
SetPAllocParms(p P64)
SetPRightsRequested(p P64)
FromOS64(other NVOS64Parameters)
ToOS64() NVOS64Parameters
FromOS64(other NVOS64_PARAMETERS)
ToOS64() NVOS64_PARAMETERS
GetPointer() uintptr
HasStatus
marshal.Marshallable
@@ -243,16 +243,16 @@ type RmAllocParamType interface {
// RmAllocParamType based on passed parameters.
func GetRmAllocParamObj(isNVOS64 bool) RmAllocParamType {
if isNVOS64 {
return &NVOS64Parameters{}
return &NVOS64_PARAMETERS{}
}
return &NVOS21Parameters{}
return &NVOS21_PARAMETERS{}
}
// NVOS21Parameters is one possible parameter type for NV_ESC_RM_ALLOC.
// NVOS21_PARAMETERS is one possible parameter type for NV_ESC_RM_ALLOC.
//
// +marshal
type NVOS21Parameters struct {
HRoot Handle `nvproxy:"NVOS21_PARAMETERS"`
type NVOS21_PARAMETERS struct {
HRoot Handle
HObjectParent Handle
HObjectNew Handle
HClass ClassID
@@ -262,30 +262,30 @@ type NVOS21Parameters struct {
}
// GetHClass implements RmAllocParamType.GetHClass.
func (n *NVOS21Parameters) GetHClass() ClassID {
func (n *NVOS21_PARAMETERS) GetHClass() ClassID {
return n.HClass
}
// GetPAllocParms implements RmAllocParamType.GetPAllocParms.
func (n *NVOS21Parameters) GetPAllocParms() P64 {
func (n *NVOS21_PARAMETERS) GetPAllocParms() P64 {
return n.PAllocParms
}
// GetPRightsRequested implements RmAllocParamType.GetPRightsRequested.
func (n *NVOS21Parameters) GetPRightsRequested() P64 {
func (n *NVOS21_PARAMETERS) GetPRightsRequested() P64 {
return 0
}
// SetPAllocParms implements RmAllocParamType.SetPAllocParms.
func (n *NVOS21Parameters) SetPAllocParms(p P64) { n.PAllocParms = p }
func (n *NVOS21_PARAMETERS) SetPAllocParms(p P64) { n.PAllocParms = p }
// SetPRightsRequested implements RmAllocParamType.SetPRightsRequested.
func (n *NVOS21Parameters) SetPRightsRequested(p P64) {
func (n *NVOS21_PARAMETERS) SetPRightsRequested(p P64) {
panic("impossible")
}
// FromOS64 implements RmAllocParamType.FromOS64.
func (n *NVOS21Parameters) FromOS64(other NVOS64Parameters) {
func (n *NVOS21_PARAMETERS) FromOS64(other NVOS64_PARAMETERS) {
n.HRoot = other.HRoot
n.HObjectParent = other.HObjectParent
n.HObjectNew = other.HObjectNew
@@ -296,8 +296,8 @@ func (n *NVOS21Parameters) FromOS64(other NVOS64Parameters) {
}
// ToOS64 implements RmAllocParamType.ToOS64.
func (n *NVOS21Parameters) ToOS64() NVOS64Parameters {
return NVOS64Parameters{
func (n *NVOS21_PARAMETERS) ToOS64() NVOS64_PARAMETERS {
return NVOS64_PARAMETERS{
HRoot: n.HRoot,
HObjectParent: n.HObjectParent,
HObjectNew: n.HObjectNew,
@@ -309,15 +309,15 @@ func (n *NVOS21Parameters) ToOS64() NVOS64Parameters {
}
// GetStatus implements RmAllocParamType.GetStatus.
func (n *NVOS21Parameters) GetStatus() uint32 {
func (n *NVOS21_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS55Parameters is the parameter type for NV_ESC_RM_DUP_OBJECT.
// NVOS55_PARAMETERS is the parameter type for NV_ESC_RM_DUP_OBJECT.
//
// +marshal
type NVOS55Parameters struct {
HClient Handle `nvproxy:"NVOS55_PARAMETERS"`
type NVOS55_PARAMETERS struct {
HClient Handle
HParent Handle
HObject Handle
HClientSrc Handle
@@ -327,31 +327,30 @@ type NVOS55Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS55Parameters) GetStatus() uint32 {
func (n *NVOS55_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS57Parameters is the parameter type for NV_ESC_RM_SHARE.
// NVOS57_PARAMETERS is the parameter type for NV_ESC_RM_SHARE.
//
// +marshal
type NVOS57Parameters struct {
HClient Handle `nvproxy:"NVOS57_PARAMETERS"`
type NVOS57_PARAMETERS struct {
HClient Handle
HObject Handle
SharePolicy RS_SHARE_POLICY
Status uint32
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS57Parameters) GetStatus() uint32 {
func (n *NVOS57_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS30Parameters is NVOS30_PARAMETERS, the parameter type for
// NV_ESC_RM_IDLE_CHANNELS.
// NVOS30_PARAMETERS is the parameter type for NV_ESC_RM_IDLE_CHANNELS.
//
// +marshal
type NVOS30Parameters struct {
Client Handle `nvproxy:"NVOS30_PARAMETERS"`
type NVOS30_PARAMETERS struct {
Client Handle
Device Handle
Channel Handle
NumChannels uint32
@@ -367,15 +366,15 @@ type NVOS30Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS30Parameters) GetStatus() uint32 {
func (n *NVOS30_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS32Parameters is the parameter type for NV_ESC_RM_VID_HEAP_CONTROL.
// NVOS32_PARAMETERS is the parameter type for NV_ESC_RM_VID_HEAP_CONTROL.
//
// +marshal
type NVOS32Parameters struct {
HRoot Handle `nvproxy:"NVOS32_PARAMETERS"`
type NVOS32_PARAMETERS struct {
HRoot Handle
HObjectParent Handle
Function uint32
HVASpace Handle
@@ -388,7 +387,7 @@ type NVOS32Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS32Parameters) GetStatus() uint32 {
func (n *NVOS32_PARAMETERS) GetStatus() uint32 {
return n.Status
}
@@ -448,7 +447,7 @@ const (
//
// +marshal
type IoctlNVOS33ParametersWithFD struct {
Params NVOS33Parameters `nvproxy:"nv_ioctl_nvos33_parameters_with_fd"`
Params NVOS33_PARAMETERS
FD int32
Pad0 [4]byte
}
@@ -459,8 +458,8 @@ func (p *IoctlNVOS33ParametersWithFD) GetStatus() uint32 {
}
// +marshal
type NVOS33Parameters struct {
HClient Handle `nvproxy:"NVOS33_PARAMETERS"`
type NVOS33_PARAMETERS struct {
HClient Handle
HDevice Handle
HMemory Handle
Pad0 [4]byte
@@ -471,11 +470,11 @@ type NVOS33Parameters struct {
Flags uint32
}
// NVOS34Parameters is the parameter type for NV_ESC_RM_UNMAP_MEMORY.
// NVOS34_PARAMETERS is the parameter type for NV_ESC_RM_UNMAP_MEMORY.
//
// +marshal
type NVOS34Parameters struct {
HClient Handle `nvproxy:"NVOS34_PARAMETERS"`
type NVOS34_PARAMETERS struct {
HClient Handle
HDevice Handle
HMemory Handle
Pad0 [4]byte
@@ -485,16 +484,15 @@ type NVOS34Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS34Parameters) GetStatus() uint32 {
func (n *NVOS34_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS39Parameters is NVOS39_PARAMETERS, the parameter type for
// NV_ESC_RM_ALLOC_CONTEXT_DMA2.
// NVOS39_PARAMETERS is the parameter type for NV_ESC_RM_ALLOC_CONTEXT_DMA2.
//
// +marshal
type NVOS39Parameters struct {
HObjectParent Handle `nvproxy:"NVOS39_PARAMETERS"`
type NVOS39_PARAMETERS struct {
HObjectParent Handle
HSubDevice Handle
HObjectNew Handle
HClass ClassID
@@ -509,16 +507,15 @@ type NVOS39Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS39Parameters) GetStatus() uint32 {
func (n *NVOS39_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS46Parameters is NVOS46_PARAMETERS, the parameter type for
// NV_ESC_RM_MAP_MEMORY_DMA.
// NVOS46_PARAMETERS is the parameter type for NV_ESC_RM_MAP_MEMORY_DMA.
//
// +marshal
type NVOS46Parameters struct {
Client Handle `nvproxy:"NVOS46_PARAMETERS"`
type NVOS46_PARAMETERS struct {
Client Handle
Device Handle
Dma Handle
Memory Handle
@@ -532,16 +529,15 @@ type NVOS46Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS46Parameters) GetStatus() uint32 {
func (n *NVOS46_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS47Parameters is NVOS47_PARAMETERS, the parameter type for
// NV_ESC_RM_UNMAP_MEMORY_DMA.
// NVOS47_PARAMETERS is the parameter type for NV_ESC_RM_UNMAP_MEMORY_DMA.
//
// +marshal
type NVOS47Parameters struct {
Client Handle `nvproxy:"NVOS47_PARAMETERS"`
type NVOS47_PARAMETERS struct {
Client Handle
Device Handle
Dma Handle
Memory Handle
@@ -553,16 +549,16 @@ type NVOS47Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS47Parameters) GetStatus() uint32 {
func (n *NVOS47_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS47ParametersV550 is the updated version of NVOS47Parameters since
// NVOS47_PARAMETERS_V550 is the updated version of NVOS47_PARAMETERS since
// 550.54.04.
//
// +marshal
type NVOS47ParametersV550 struct {
Client Handle `nvproxy:"NVOS47_PARAMETERS"`
type NVOS47_PARAMETERS_V550 struct {
Client Handle
Device Handle
Dma Handle
Memory Handle
@@ -575,15 +571,15 @@ type NVOS47ParametersV550 struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS47ParametersV550) GetStatus() uint32 {
func (n *NVOS47_PARAMETERS_V550) GetStatus() uint32 {
return n.Status
}
// NVOS54Parameters is the parameter type for NV_ESC_RM_CONTROL.
// NVOS54_PARAMETERS is the parameter type for NV_ESC_RM_CONTROL.
//
// +marshal
type NVOS54Parameters struct {
HClient Handle `nvproxy:"NVOS54_PARAMETERS"`
type NVOS54_PARAMETERS struct {
HClient Handle
HObject Handle
Cmd uint32
Flags uint32
@@ -593,15 +589,15 @@ type NVOS54Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS54Parameters) GetStatus() uint32 {
func (n *NVOS54_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS56Parameters is the parameter type for NV_ESC_RM_UPDATE_DEVICE_MAPPING_INFO.
// NVOS56_PARAMETERS is the parameter type for NV_ESC_RM_UPDATE_DEVICE_MAPPING_INFO.
//
// +marshal
type NVOS56Parameters struct {
HClient Handle `nvproxy:"NVOS56_PARAMETERS"`
type NVOS56_PARAMETERS struct {
HClient Handle
HDevice Handle
HMemory Handle
Pad0 [4]byte
@@ -612,16 +608,16 @@ type NVOS56Parameters struct {
}
// GetStatus implements HasStatus.GetStatus.
func (n *NVOS56Parameters) GetStatus() uint32 {
func (n *NVOS56_PARAMETERS) GetStatus() uint32 {
return n.Status
}
// NVOS64Parameters is one possible parameter type for NV_ESC_RM_ALLOC.
// NVOS64_PARAMETERS is one possible parameter type for NV_ESC_RM_ALLOC.
//
// +marshal
// +stateify savable
type NVOS64Parameters struct {
HRoot Handle `nvproxy:"NVOS64_PARAMETERS"`
type NVOS64_PARAMETERS struct {
HRoot Handle
HObjectParent Handle
HObjectNew Handle
HClass ClassID
@@ -634,34 +630,34 @@ type NVOS64Parameters struct {
}
// GetHClass implements RmAllocParamType.GetHClass.
func (n *NVOS64Parameters) GetHClass() ClassID {
func (n *NVOS64_PARAMETERS) GetHClass() ClassID {
return n.HClass
}
// GetPAllocParms implements RmAllocParamType.GetPAllocParms.
func (n *NVOS64Parameters) GetPAllocParms() P64 {
func (n *NVOS64_PARAMETERS) GetPAllocParms() P64 {
return n.PAllocParms
}
// GetPRightsRequested implements RmAllocParamType.GetPRightsRequested.
func (n *NVOS64Parameters) GetPRightsRequested() P64 {
func (n *NVOS64_PARAMETERS) GetPRightsRequested() P64 {
return n.PRightsRequested
}
// SetPAllocParms implements RmAllocParamType.SetPAllocParms.
func (n *NVOS64Parameters) SetPAllocParms(p P64) { n.PAllocParms = p }
func (n *NVOS64_PARAMETERS) SetPAllocParms(p P64) { n.PAllocParms = p }
// SetPRightsRequested implements RmAllocParamType.SetPRightsRequested.
func (n *NVOS64Parameters) SetPRightsRequested(p P64) { n.PRightsRequested = p }
func (n *NVOS64_PARAMETERS) SetPRightsRequested(p P64) { n.PRightsRequested = p }
// FromOS64 implements RmAllocParamType.FromOS64.
func (n *NVOS64Parameters) FromOS64(other NVOS64Parameters) { *n = other }
func (n *NVOS64_PARAMETERS) FromOS64(other NVOS64_PARAMETERS) { *n = other }
// ToOS64 implements RmAllocParamType.ToOS64.
func (n *NVOS64Parameters) ToOS64() NVOS64Parameters { return *n }
func (n *NVOS64_PARAMETERS) ToOS64() NVOS64_PARAMETERS { return *n }
// GetStatus implements RmAllocParamType.GetStatus.
func (n *NVOS64Parameters) GetStatus() uint32 {
func (n *NVOS64_PARAMETERS) GetStatus() uint32 {
return n.Status
}
@@ -682,17 +678,17 @@ var (
SizeofIoctlSysParams = uint32((*IoctlSysParams)(nil).SizeBytes())
SizeofIoctlWaitOpenComplete = uint32((*IoctlWaitOpenComplete)(nil).SizeBytes())
SizeofIoctlNVOS02ParametersWithFD = uint32((*IoctlNVOS02ParametersWithFD)(nil).SizeBytes())
SizeofNVOS00Parameters = uint32((*NVOS00Parameters)(nil).SizeBytes())
SizeofNVOS21Parameters = uint32((*NVOS21Parameters)(nil).SizeBytes())
SizeofNVOS00Parameters = uint32((*NVOS00_PARAMETERS)(nil).SizeBytes())
SizeofNVOS21Parameters = uint32((*NVOS21_PARAMETERS)(nil).SizeBytes())
SizeofIoctlNVOS33ParametersWithFD = uint32((*IoctlNVOS33ParametersWithFD)(nil).SizeBytes())
SizeofNVOS30Parameters = uint32((*NVOS30Parameters)(nil).SizeBytes())
SizeofNVOS32Parameters = uint32((*NVOS32Parameters)(nil).SizeBytes())
SizeofNVOS34Parameters = uint32((*NVOS34Parameters)(nil).SizeBytes())
SizeofNVOS39Parameters = uint32((*NVOS39Parameters)(nil).SizeBytes())
SizeofNVOS46Parameters = uint32((*NVOS46Parameters)(nil).SizeBytes())
SizeofNVOS54Parameters = uint32((*NVOS54Parameters)(nil).SizeBytes())
SizeofNVOS55Parameters = uint32((*NVOS55Parameters)(nil).SizeBytes())
SizeofNVOS56Parameters = uint32((*NVOS56Parameters)(nil).SizeBytes())
SizeofNVOS57Parameters = uint32((*NVOS57Parameters)(nil).SizeBytes())
SizeofNVOS64Parameters = uint32((*NVOS64Parameters)(nil).SizeBytes())
SizeofNVOS30Parameters = uint32((*NVOS30_PARAMETERS)(nil).SizeBytes())
SizeofNVOS32Parameters = uint32((*NVOS32_PARAMETERS)(nil).SizeBytes())
SizeofNVOS34Parameters = uint32((*NVOS34_PARAMETERS)(nil).SizeBytes())
SizeofNVOS39Parameters = uint32((*NVOS39_PARAMETERS)(nil).SizeBytes())
SizeofNVOS46Parameters = uint32((*NVOS46_PARAMETERS)(nil).SizeBytes())
SizeofNVOS54Parameters = uint32((*NVOS54_PARAMETERS)(nil).SizeBytes())
SizeofNVOS55Parameters = uint32((*NVOS55_PARAMETERS)(nil).SizeBytes())
SizeofNVOS56Parameters = uint32((*NVOS56_PARAMETERS)(nil).SizeBytes())
SizeofNVOS57Parameters = uint32((*NVOS57_PARAMETERS)(nil).SizeBytes())
SizeofNVOS64Parameters = uint32((*NVOS64_PARAMETERS)(nil).SizeBytes())
)
+2 -2
View File
@@ -17,11 +17,11 @@ package nvgpu
import "unsafe"
// GetPointer implements RmAllocParamType.GetPointer.
func (n *NVOS21Parameters) GetPointer() uintptr {
func (n *NVOS21_PARAMETERS) GetPointer() uintptr {
return uintptr(unsafe.Pointer(n))
}
// GetPointer implements RmAllocParamType.GetPointer.
func (n *NVOS64Parameters) GetPointer() uintptr {
func (n *NVOS64_PARAMETERS) GetPointer() uintptr {
return uintptr(unsafe.Pointer(n))
}
+1 -1
View File
@@ -32,7 +32,7 @@ const (
// +marshal
// +stateify savable
type Handle struct {
Val uint32 `nvproxy:"NvHandle"`
Val uint32
}
// String implements fmt.Stringer.String.
+33 -33
View File
@@ -53,7 +53,7 @@ const (
// +marshal
type UVM_INITIALIZE_PARAMS struct {
Flags uint64 `nvproxy:"same"`
Flags uint64
RMStatus uint32
Pad0 [4]byte
}
@@ -70,7 +70,7 @@ const (
// +marshal
type UVM_CREATE_RANGE_GROUP_PARAMS struct {
RangeGroupID uint64 `nvproxy:"same"`
RangeGroupID uint64
RMStatus uint32
Pad0 [4]byte
}
@@ -82,7 +82,7 @@ func (p *UVM_CREATE_RANGE_GROUP_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_DESTROY_RANGE_GROUP_PARAMS struct {
RangeGroupID uint64 `nvproxy:"same"`
RangeGroupID uint64
RMStatus uint32
Pad0 [4]byte
}
@@ -94,7 +94,7 @@ func (p *UVM_DESTROY_RANGE_GROUP_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_REGISTER_GPU_VASPACE_PARAMS struct {
GPUUUID NvUUID `nvproxy:"same"`
GPUUUID NvUUID
RMCtrlFD int32
HClient Handle
HVASpace Handle
@@ -118,7 +118,7 @@ func (p *UVM_REGISTER_GPU_VASPACE_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_UNREGISTER_GPU_VASPACE_PARAMS struct {
GPUUUID NvUUID `nvproxy:"same"`
GPUUUID NvUUID
RMStatus uint32
}
@@ -129,7 +129,7 @@ func (p *UVM_UNREGISTER_GPU_VASPACE_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_REGISTER_CHANNEL_PARAMS struct {
GPUUUID NvUUID `nvproxy:"same"`
GPUUUID NvUUID
RMCtrlFD int32
HClient Handle
HChannel Handle
@@ -157,7 +157,7 @@ func (p *UVM_REGISTER_CHANNEL_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_UNREGISTER_CHANNEL_PARAMS struct {
GPUUUID NvUUID `nvproxy:"same"`
GPUUUID NvUUID
HClient Handle
HChannel Handle
RMStatus uint32
@@ -170,7 +170,7 @@ func (p *UVM_UNREGISTER_CHANNEL_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_ENABLE_PEER_ACCESS_PARAMS struct {
GPUUUIDA NvUUID `nvproxy:"same"`
GPUUUIDA NvUUID
GPUUUIDB NvUUID
RMStatus uint32
}
@@ -182,7 +182,7 @@ func (p *UVM_ENABLE_PEER_ACCESS_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_DISABLE_PEER_ACCESS_PARAMS struct {
GPUUUIDA NvUUID `nvproxy:"same"`
GPUUUIDA NvUUID
GPUUUIDB NvUUID
RMStatus uint32
}
@@ -194,7 +194,7 @@ func (p *UVM_DISABLE_PEER_ACCESS_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_SET_RANGE_GROUP_PARAMS struct {
RangeGroupID uint64 `nvproxy:"same"`
RangeGroupID uint64
RequestedBase uint64
Length uint64
RMStatus uint32
@@ -208,7 +208,7 @@ func (p *UVM_SET_RANGE_GROUP_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_MAP_EXTERNAL_ALLOCATION_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
Offset uint64
PerGPUAttributes [UVM_MAX_GPUS]UvmGpuMappingAttributes
@@ -236,7 +236,7 @@ func (p *UVM_MAP_EXTERNAL_ALLOCATION_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_MAP_EXTERNAL_ALLOCATION_PARAMS_V550 struct {
Base uint64 `nvproxy:"UVM_MAP_EXTERNAL_ALLOCATION_PARAMS"`
Base uint64
Length uint64
Offset uint64
PerGPUAttributes [UVM_MAX_GPUS_V2]UvmGpuMappingAttributes
@@ -264,7 +264,7 @@ func (p *UVM_MAP_EXTERNAL_ALLOCATION_PARAMS_V550) GetStatus() uint32 {
// +marshal
type UVM_FREE_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
RMStatus uint32
Pad0 [4]byte
@@ -277,7 +277,7 @@ func (p *UVM_FREE_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_REGISTER_GPU_PARAMS struct {
GPUUUID NvUUID `nvproxy:"same"`
GPUUUID NvUUID
NumaEnabled uint8
Pad [3]byte
NumaNodeID int32
@@ -304,7 +304,7 @@ func (p *UVM_REGISTER_GPU_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_UNREGISTER_GPU_PARAMS struct {
GPUUUID NvUUID `nvproxy:"same"`
GPUUUID NvUUID
RMStatus uint32
}
@@ -315,7 +315,7 @@ func (p *UVM_UNREGISTER_GPU_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_PAGEABLE_MEM_ACCESS_PARAMS struct {
PageableMemAccess uint8 `nvproxy:"same"`
PageableMemAccess uint8
Pad [3]byte
RMStatus uint32
}
@@ -327,7 +327,7 @@ func (p *UVM_PAGEABLE_MEM_ACCESS_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_SET_PREFERRED_LOCATION_PARAMS struct {
RequestedBase uint64 `nvproxy:"same"`
RequestedBase uint64
Length uint64
PreferredLocation NvUUID
RMStatus uint32
@@ -341,7 +341,7 @@ func (p *UVM_SET_PREFERRED_LOCATION_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_SET_PREFERRED_LOCATION_PARAMS_V550 struct {
RequestedBase uint64 `nvproxy:"UVM_SET_PREFERRED_LOCATION_PARAMS"`
RequestedBase uint64
Length uint64
PreferredLocation NvUUID
PreferredCPUNumaNode int32
@@ -355,7 +355,7 @@ func (p *UVM_SET_PREFERRED_LOCATION_PARAMS_V550) GetStatus() uint32 {
// +marshal
type UVM_UNSET_PREFERRED_LOCATION_PARAMS struct {
RequestedBase uint64 `nvproxy:"same"`
RequestedBase uint64
Length uint64
RMStatus uint32
Pad0 [4]byte
@@ -368,7 +368,7 @@ func (p *UVM_UNSET_PREFERRED_LOCATION_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_DISABLE_READ_DUPLICATION_PARAMS struct {
RequestedBase uint64 `nvproxy:"same"`
RequestedBase uint64
Length uint64
RMStatus uint32
Pad0 [4]byte
@@ -381,7 +381,7 @@ func (p *UVM_DISABLE_READ_DUPLICATION_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_UNSET_ACCESSED_BY_PARAMS struct {
RequestedBase uint64 `nvproxy:"same"`
RequestedBase uint64
Length uint64
AccessedByUUID NvUUID
RMStatus uint32
@@ -395,7 +395,7 @@ func (p *UVM_UNSET_ACCESSED_BY_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_MIGRATE_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
DestinationUUID NvUUID
Flags uint32
@@ -419,7 +419,7 @@ func (p *UVM_MIGRATE_PARAMS) GetStatus() uint32 {
//
// +marshal
type UVM_MIGRATE_PARAMS_V550 struct {
Base uint64 `nvproxy:"UVM_MIGRATE_PARAMS"`
Base uint64
Length uint64
DestinationUUID NvUUID
Flags uint32
@@ -440,7 +440,7 @@ func (p *UVM_MIGRATE_PARAMS_V550) GetStatus() uint32 {
// +marshal
type UVM_MIGRATE_RANGE_GROUP_PARAMS struct {
RangeGroupID uint64 `nvproxy:"same"`
RangeGroupID uint64
DestinationUUID NvUUID
RMStatus uint32
Pad0 [4]byte
@@ -453,7 +453,7 @@ func (p *UVM_MIGRATE_RANGE_GROUP_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_TOOLS_READ_PROCESS_MEMORY_PARAMS struct {
Buffer uint64 `nvproxy:"same"`
Buffer uint64
Size uint64
TargetVA uint64
BytesRead uint64
@@ -463,7 +463,7 @@ type UVM_TOOLS_READ_PROCESS_MEMORY_PARAMS struct {
// +marshal
type UVM_TOOLS_WRITE_PROCESS_MEMORY_PARAMS struct {
Buffer uint64 `nvproxy:"same"`
Buffer uint64
Size uint64
TargetVA uint64
BytesWritten uint64
@@ -473,7 +473,7 @@ type UVM_TOOLS_WRITE_PROCESS_MEMORY_PARAMS struct {
// +marshal
type UVM_MAP_DYNAMIC_PARALLELISM_REGION_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
GPUUUID NvUUID
RMStatus uint32
@@ -487,7 +487,7 @@ func (p *UVM_MAP_DYNAMIC_PARALLELISM_REGION_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_UNMAP_EXTERNAL_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
GPUUUID NvUUID
RMStatus uint32
@@ -501,7 +501,7 @@ func (p *UVM_UNMAP_EXTERNAL_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_ALLOC_SEMAPHORE_POOL_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
PerGPUAttributes [UVM_MAX_GPUS]UvmGpuMappingAttributes
GPUAttributesCount uint64
@@ -516,7 +516,7 @@ func (p *UVM_ALLOC_SEMAPHORE_POOL_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_ALLOC_SEMAPHORE_POOL_PARAMS_V550 struct {
Base uint64 `nvproxy:"UVM_ALLOC_SEMAPHORE_POOL_PARAMS"`
Base uint64
Length uint64
PerGPUAttributes [UVM_MAX_GPUS_V2]UvmGpuMappingAttributes
GPUAttributesCount uint64
@@ -531,7 +531,7 @@ func (p *UVM_ALLOC_SEMAPHORE_POOL_PARAMS_V550) GetStatus() uint32 {
// +marshal
type UVM_VALIDATE_VA_RANGE_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
RMStatus uint32
Pad0 [4]byte
@@ -544,7 +544,7 @@ func (p *UVM_VALIDATE_VA_RANGE_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_CREATE_EXTERNAL_RANGE_PARAMS struct {
Base uint64 `nvproxy:"same"`
Base uint64
Length uint64
RMStatus uint32
Pad0 [4]byte
@@ -557,7 +557,7 @@ func (p *UVM_CREATE_EXTERNAL_RANGE_PARAMS) GetStatus() uint32 {
// +marshal
type UVM_MM_INITIALIZE_PARAMS struct {
UvmFD int32 `nvproxy:"same"`
UvmFD int32
RMStatus uint32
}
+35 -35
View File
@@ -397,7 +397,7 @@ func frontendIoctlHasFD[Params any, PtrParams hasFrontendFDAndStatusPtr[Params]]
}
func rmAllocContextDMA2(fi *frontendIoctlState) (uintptr, error) {
var ioctlParams nvgpu.NVOS39Parameters
var ioctlParams nvgpu.NVOS39_PARAMETERS
if fi.ioctlParamsSize != nvgpu.SizeofNVOS39Parameters {
return 0, linuxerr.EINVAL
}
@@ -627,7 +627,7 @@ func rmAllocOSDescriptor(fi *frontendIoctlState, ioctlParams *nvgpu.IoctlNVOS02P
}
func rmDupObject(fi *frontendIoctlState) (uintptr, error) {
var ioctlParams nvgpu.NVOS55Parameters
var ioctlParams nvgpu.NVOS55_PARAMETERS
if fi.ioctlParamsSize != nvgpu.SizeofNVOS55Parameters {
return 0, linuxerr.EINVAL
}
@@ -653,7 +653,7 @@ func rmDupObject(fi *frontendIoctlState) (uintptr, error) {
}
func rmFree(fi *frontendIoctlState) (uintptr, error) {
var ioctlParams nvgpu.NVOS00Parameters
var ioctlParams nvgpu.NVOS00_PARAMETERS
if fi.ioctlParamsSize != nvgpu.SizeofNVOS00Parameters {
return 0, linuxerr.EINVAL
}
@@ -678,7 +678,7 @@ func rmFree(fi *frontendIoctlState) (uintptr, error) {
}
func rmControl(fi *frontendIoctlState) (uintptr, error) {
var ioctlParams nvgpu.NVOS54Parameters
var ioctlParams nvgpu.NVOS54_PARAMETERS
if fi.ioctlParamsSize != nvgpu.SizeofNVOS54Parameters {
return 0, linuxerr.EINVAL
}
@@ -729,7 +729,7 @@ func rmControl(fi *frontendIoctlState) (uintptr, error) {
return result, err
}
func rmControlSimple(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func rmControlSimple(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
if ioctlParams.ParamsSize == 0 {
if ioctlParams.Params != 0 {
return 0, linuxerr.EINVAL
@@ -754,13 +754,13 @@ func rmControlSimple(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters
return n, nil
}
func ctrlCmdFailWithStatus(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters, status uint32) error {
func ctrlCmdFailWithStatus(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS, status uint32) error {
ioctlParams.Status = status
_, err := ioctlParams.CopyOut(fi.t, fi.ioctlParamsAddr)
return err
}
func ctrlHasFrontendFD[Params any, PtrParams hasFrontendFDPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlHasFrontendFD[Params any, PtrParams hasFrontendFDPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParamsValue Params
ctrlParams := PtrParams(&ctrlParamsValue)
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
@@ -793,7 +793,7 @@ func ctrlHasFrontendFD[Params any, PtrParams hasFrontendFDPtr[Params]](fi *front
return n, nil
}
func ctrlMemoryMulticastFabricAttachGPU(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlMemoryMulticastFabricAttachGPU(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV00FD_CTRL_ATTACH_GPU_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -841,7 +841,7 @@ func rmapiParamsSizeCheck(numElems uint32, sizeOfElem uint32) bool {
return uint64(numElems)*uint64(sizeOfElem) <= nvgpu.RMAPI_PARAM_COPY_MAX_PARAMS_SIZE
}
func ctrlClientSystemGetBuildVersion(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlClientSystemGetBuildVersion(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV0000_CTRL_SYSTEM_GET_BUILD_VERSION_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -879,7 +879,7 @@ func ctrlClientSystemGetBuildVersion(fi *frontendIoctlState, ioctlParams *nvgpu.
return n, nil
}
func ctrlGetNvU32List(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlGetNvU32List(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.RmapiParamNvU32List
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -903,7 +903,7 @@ func ctrlGetNvU32List(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameter
return ctrlGetNvU32ListInvoke(fi, ioctlParams, &ctrlParams, list)
}
func ctrlDevGetCaps(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlDevGetCaps(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV0080_CTRL_GET_CAPS_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -921,7 +921,7 @@ func ctrlDevGetCaps(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters)
return ctrlDevGRGetCapsInvoke(fi, ioctlParams, &ctrlParams, capsTbl)
}
func ctrlRegisterVASpace(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlRegisterVASpace(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV503C_CTRL_REGISTER_VA_SPACE_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -946,7 +946,7 @@ func ctrlRegisterVASpace(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parame
return n, nil
}
func ctrlSubdevFIFODisableChannels(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlSubdevFIFODisableChannels(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV2080_CTRL_FIFO_DISABLE_CHANNELS_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -971,7 +971,7 @@ func ctrlSubdevFIFODisableChannels(fi *frontendIoctlState, ioctlParams *nvgpu.NV
return n, nil
}
func ctrlGpuGetIDInfo(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlGpuGetIDInfo(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV0000_CTRL_GPU_GET_ID_INFO_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -1048,7 +1048,7 @@ func rmAlloc(fi *frontendIoctlState) (uintptr, error) {
}
// See src/nvidia/src/kernel/rmapi/alloc_free.c:_fixupAllocParams().
func fixupHClass(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters) error {
func fixupHClass(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS) error {
// "NV01_EVENT isn't a valid class to allocate so overwrite it with the
// subclass from the event params."
if ioctlParams.HClass == nvgpu.NV01_EVENT {
@@ -1072,17 +1072,17 @@ func fixupHClass(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters) er
//
// Unlike frontendIoctlSimple and rmControlSimple, rmAllocSimple requires the
// parameter type since the parameter's size is otherwise unknown.
func rmAllocSimple[Params any, PtrParams marshalPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
func rmAllocSimple[Params any, PtrParams marshalPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams[Params, PtrParams](fi, ioctlParams, isNVOS64, addSimpleObjDepParentLocked)
}
// addSimpleObjDepParentLocked implements rmAllocInvoke.addObjLocked for
// classes that require no special handling and depend only on their parents.
func addSimpleObjDepParentLocked[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params) {
func addSimpleObjDepParentLocked[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params) {
fi.fd.dev.nvp.objAdd(fi.ctx, ioctlParams.HRoot, ioctlParams.HObjectNew, ioctlParams.HClass, newRmAllocObject(fi.fd, ioctlParams, rightsRequested, allocParams), ioctlParams.HObjectParent)
}
func rmAllocSimpleParams[Params any, PtrParams marshalPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool, objAddLocked func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params)) (uintptr, error) {
func rmAllocSimpleParams[Params any, PtrParams marshalPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool, objAddLocked func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params)) (uintptr, error) {
if ioctlParams.PAllocParms == 0 {
return rmAllocInvoke[Params](fi, ioctlParams, nil, isNVOS64, objAddLocked)
}
@@ -1108,12 +1108,12 @@ func rmAllocSimpleParams[Params any, PtrParams marshalPtr[Params]](fi *frontendI
return n, nil
}
func rmAllocNoParams(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
func rmAllocNoParams(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocInvoke[byte](fi, ioctlParams, nil, isNVOS64, addSimpleObjDepParentLocked)
}
func rmAllocRootClient(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.Handle) {
func rmAllocRootClient(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.Handle) {
fi.fd.dev.nvp.objAdd(fi.ctx, ioctlParams.HRoot, ioctlParams.HObjectNew, ioctlParams.HClass, newRootClient(fi.fd, ioctlParams, rightsRequested, allocParams), nvgpu.Handle{Val: nvgpu.NV01_NULL_OBJECT} /* parentH */)
if fi.fd.clients == nil {
fi.fd.clients = make(map[nvgpu.Handle]struct{})
@@ -1122,7 +1122,7 @@ func rmAllocRootClient(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Paramete
})
}
func rmAllocEventOSEvent(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
func rmAllocEventOSEvent(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
var allocParams nvgpu.NV0005_ALLOC_PARAMETERS
if _, err := allocParams.CopyIn(fi.t, addrFromP64(ioctlParams.PAllocParms)); err != nil {
return 0, err
@@ -1139,7 +1139,7 @@ func rmAllocEventOSEvent(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parame
origData := allocParams.Data
allocParams.Data = nvgpu.P64(uint64(eventFile.hostFD))
n, err := rmAllocInvoke(fi, ioctlParams, &allocParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV0005_ALLOC_PARAMETERS) {
n, err := rmAllocInvoke(fi, ioctlParams, &allocParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV0005_ALLOC_PARAMETERS) {
fi.fd.dev.nvp.objAdd(fi.ctx, ioctlParams.HRoot, ioctlParams.HObjectNew, ioctlParams.HClass, &miscObject{}, ioctlParams.HObjectParent)
})
if err != nil {
@@ -1153,8 +1153,8 @@ func rmAllocEventOSEvent(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parame
return n, nil
}
func rmAllocMemoryVirtual(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_MEMORY_VIRTUAL_ALLOCATION_PARAMS) {
func rmAllocMemoryVirtual(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_MEMORY_VIRTUAL_ALLOCATION_PARAMS) {
// See
// src/nvidia/src/kernel/mem_mgr/virt_mem_range.c:vmrangeConstruct_IMPL()
// => refAddDependant().
@@ -1169,8 +1169,8 @@ func rmAllocMemoryVirtual(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Param
})
}
func rmAllocSMDebuggerSession(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV83DE_ALLOC_PARAMETERS) {
func rmAllocSMDebuggerSession(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV83DE_ALLOC_PARAMETERS) {
// Compare
// src/nvidia/src/kernel/gpu/gr/kernel_sm_debugger_session.c:ksmdbgssnConstruct_IMPL()
// => _ShareDebugger() => sessionAddDependency/sessionAddDependant();
@@ -1180,8 +1180,8 @@ func rmAllocSMDebuggerSession(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64P
})
}
func rmAllocChannelGroup(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS) {
func rmAllocChannelGroup(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS) {
// See
// src/nvidia/src/kernel/gpu/fifo/kernel_channel_group_api.c:kchangrpapiConstruct_IMPL()
// => refAddDependant().
@@ -1198,8 +1198,8 @@ func rmAllocChannelGroup(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parame
})
}
func rmAllocChannel(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_CHANNEL_ALLOC_PARAMS) {
func rmAllocChannel(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_CHANNEL_ALLOC_PARAMS) {
// See
// src/nvidia/src/kernel/gpu/fifo/kernel_channel.c:kchannelConstruct_IMPL()
// => refAddDependant(). The channel's parent may be a device or
@@ -1212,8 +1212,8 @@ func rmAllocChannel(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters,
})
}
func rmAllocContextShare(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_CTXSHARE_ALLOCATION_PARAMETERS) {
func rmAllocContextShare(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
return rmAllocSimpleParams(fi, ioctlParams, isNVOS64, func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.NV_CTXSHARE_ALLOCATION_PARAMETERS) {
// See
// src/nvidia/src/kernel/gpu/fifo/kernel_ctxshare.c:kctxshareapiConstruct_IMPL()
// => refAddDependant(). The context share's parent is the channel
@@ -1226,7 +1226,7 @@ func rmAllocContextShare(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parame
// See src/nvidia/interface/deprecated/rmapi_deprecated_misc.c:RmDeprecatedIdleChannels().
func rmIdleChannels(fi *frontendIoctlState) (uintptr, error) {
var ioctlParams nvgpu.NVOS30Parameters
var ioctlParams nvgpu.NVOS30_PARAMETERS
if fi.ioctlParamsSize != nvgpu.SizeofNVOS30Parameters {
return 0, linuxerr.EINVAL
}
@@ -1270,7 +1270,7 @@ func rmIdleChannels(fi *frontendIoctlState) (uintptr, error) {
}
func rmVidHeapControl(fi *frontendIoctlState) (uintptr, error) {
var ioctlParams nvgpu.NVOS32Parameters
var ioctlParams nvgpu.NVOS32_PARAMETERS
if fi.ioctlParamsSize != nvgpu.SizeofNVOS32Parameters {
return 0, linuxerr.EINVAL
}
+11 -11
View File
@@ -46,7 +46,7 @@ func frontendIoctlBytesInvoke(fi *frontendIoctlState, sentryParams *byte) (uintp
return n, nil
}
func rmControlInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters, ctrlParams *Params) (uintptr, error) {
func rmControlInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS, ctrlParams *Params) (uintptr, error) {
defer runtime.KeepAlive(ctrlParams) // since we convert to non-pointer-typed P64
origParams := ioctlParams.Params
ioctlParams.Params = p64FromPtr(unsafe.Pointer(ctrlParams))
@@ -61,7 +61,7 @@ func rmControlInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS
return n, nil
}
func ctrlClientSystemGetBuildVersionInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters, ctrlParams *nvgpu.NV0000_CTRL_SYSTEM_GET_BUILD_VERSION_PARAMS, driverVersionBuf, versionBuf, titleBuf *byte) (uintptr, error) {
func ctrlClientSystemGetBuildVersionInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS, ctrlParams *nvgpu.NV0000_CTRL_SYSTEM_GET_BUILD_VERSION_PARAMS, driverVersionBuf, versionBuf, titleBuf *byte) (uintptr, error) {
// *Buf arguments don't need runtime.KeepAlive() since our caller
// ctrlClientSystemGetBuildVersion() copies them out, keeping them alive
// during this function.
@@ -84,7 +84,7 @@ func ctrlClientSystemGetBuildVersionInvoke(fi *frontendIoctlState, ioctlParams *
return n, nil
}
func ctrlIoctlHasInfoList[Params any, PtrParams hasCtrlInfoListPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlIoctlHasInfoList[Params any, PtrParams hasCtrlInfoListPtr[Params]](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParamsValue Params
ctrlParams := PtrParams(&ctrlParamsValue)
@@ -129,7 +129,7 @@ func ctrlIoctlHasInfoList[Params any, PtrParams hasCtrlInfoListPtr[Params]](fi *
return n, nil
}
func ctrlGetNvU32ListInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters, ctrlParams *nvgpu.RmapiParamNvU32List, list []uint32) (uintptr, error) {
func ctrlGetNvU32ListInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS, ctrlParams *nvgpu.RmapiParamNvU32List, list []uint32) (uintptr, error) {
origList := ctrlParams.List
ctrlParams.List = p64FromPtr(unsafe.Pointer(&list[0]))
n, err := rmControlInvoke(fi, ioctlParams, ctrlParams)
@@ -146,7 +146,7 @@ func ctrlGetNvU32ListInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Par
return n, nil
}
func ctrlDevGRGetCapsInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters, ctrlParams *nvgpu.NV0080_CTRL_GET_CAPS_PARAMS, capsTbl []byte) (uintptr, error) {
func ctrlDevGRGetCapsInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS, ctrlParams *nvgpu.NV0080_CTRL_GET_CAPS_PARAMS, capsTbl []byte) (uintptr, error) {
origCapsTbl := ctrlParams.CapsTbl
ctrlParams.CapsTbl = p64FromPtr(unsafe.Pointer(&capsTbl[0]))
n, err := rmControlInvoke(fi, ioctlParams, ctrlParams)
@@ -163,7 +163,7 @@ func ctrlDevGRGetCapsInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Par
return n, nil
}
func ctrlDevFIFOGetChannelList(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlDevFIFOGetChannelList(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV0080_CTRL_FIFO_GET_CHANNELLIST_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -227,7 +227,7 @@ func ctrlClientSystemGetP2PCapsInitializeArray(origArr nvgpu.P64, gpuCount uint3
return p64FromPtr(unsafe.Pointer(&arr[0])), arr, true
}
func ctrlClientSystemGetP2PCaps(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlClientSystemGetP2PCaps(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -257,7 +257,7 @@ func ctrlClientSystemGetP2PCaps(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS5
return n, err
}
func ctrlClientSystemGetP2PCapsV550(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54Parameters) (uintptr, error) {
func ctrlClientSystemGetP2PCapsV550(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
var ctrlParams nvgpu.NV0000_CTRL_SYSTEM_GET_P2P_CAPS_PARAMS_V550
if ctrlParams.SizeBytes() != int(ioctlParams.ParamsSize) {
return 0, linuxerr.EINVAL
@@ -299,7 +299,7 @@ func ctrlClientSystemGetP2PCapsV550(fi *frontendIoctlState, ioctlParams *nvgpu.N
return n, err
}
func rmAllocInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, allocParams *Params, isNVOS64 bool, addObjLocked func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params)) (uintptr, error) {
func rmAllocInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, allocParams *Params, isNVOS64 bool, addObjLocked func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params)) (uintptr, error) {
defer runtime.KeepAlive(allocParams) // since we convert to non-pointer-typed P64
// Temporarily replace application pointers with sentry pointers.
@@ -348,7 +348,7 @@ func rmAllocInvoke[Params any](fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64
return n, nil
}
func rmIdleChannelsInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS30Parameters, clientsBuf, devicesBuf, channelsBuf *byte) (uintptr, error) {
func rmIdleChannelsInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS30_PARAMETERS, clientsBuf, devicesBuf, channelsBuf *byte) (uintptr, error) {
origClients := ioctlParams.Clients
origDevices := ioctlParams.Devices
origChannels := ioctlParams.Channels
@@ -368,7 +368,7 @@ func rmIdleChannelsInvoke(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS30Param
return n, nil
}
func rmVidHeapControlAllocSize(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS32Parameters) (uintptr, error) {
func rmVidHeapControlAllocSize(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS32_PARAMETERS) (uintptr, error) {
allocSizeParams := (*nvgpu.NVOS32AllocSize)(unsafe.Pointer(&ioctlParams.Data))
origAddress := allocSizeParams.Address
var addr uint64
+6 -6
View File
@@ -67,14 +67,14 @@ func (h frontendIoctlHandler) handle(fi *frontendIoctlState) (uintptr, error) {
type controlCmdHandler struct {
// handler is the function to call if a capability in capSet is enabled.
handler func(*frontendIoctlState, *nvgpu.NVOS54Parameters) (uintptr, error)
handler func(*frontendIoctlState, *nvgpu.NVOS54_PARAMETERS) (uintptr, error)
// capSet is a bitmask of capabilities that this handler is available for.
capSet nvconf.DriverCaps
}
// ctrlHandler returns a controlCmdHandler that wraps the given function.
// The handler will be called if any of the given capabilities are enabled.
func ctrlHandler(handler func(*frontendIoctlState, *nvgpu.NVOS54Parameters) (uintptr, error), caps nvconf.DriverCaps) controlCmdHandler {
func ctrlHandler(handler func(*frontendIoctlState, *nvgpu.NVOS54_PARAMETERS) (uintptr, error), caps nvconf.DriverCaps) controlCmdHandler {
return controlCmdHandler{
handler: handler,
capSet: caps,
@@ -85,7 +85,7 @@ func ctrlHandler(handler func(*frontendIoctlState, *nvgpu.NVOS54Parameters) (uin
// Returns errMissingCapability if the caller is missing the required
// capabilities for this handler.
// Returns errUndefinedHandler if the handler does not exist.
func (h controlCmdHandler) handle(fi *frontendIoctlState, params *nvgpu.NVOS54Parameters) (uintptr, error) {
func (h controlCmdHandler) handle(fi *frontendIoctlState, params *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
if h.handler == nil {
return 0, &errUndefinedHandler
}
@@ -97,14 +97,14 @@ func (h controlCmdHandler) handle(fi *frontendIoctlState, params *nvgpu.NVOS54Pa
type allocationClassHandler struct {
// handler is the function to call if a capability in capSet is enabled.
handler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error)
handler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error)
// capSet is a bitmask of capabilities that this handler is available for.
capSet nvconf.DriverCaps
}
// allocHandler returns a allocationClassHandler that wraps the given function.
// The handler will be called if any of the given capabilities are enabled.
func allocHandler(handler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error), caps nvconf.DriverCaps) allocationClassHandler {
func allocHandler(handler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error), caps nvconf.DriverCaps) allocationClassHandler {
return allocationClassHandler{
handler: handler,
capSet: caps,
@@ -115,7 +115,7 @@ func allocHandler(handler func(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64
// Returns errMissingCapability if the caller is missing the required
// capabilities for this handler.
// Returns errUndefinedHandler if the handler does not exist.
func (h allocationClassHandler) handle(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64Parameters, isNVOS64 bool) (uintptr, error) {
func (h allocationClassHandler) handle(fi *frontendIoctlState, ioctlParams *nvgpu.NVOS64_PARAMETERS, isNVOS64 bool) (uintptr, error) {
if h.handler == nil {
return 0, &errUndefinedHandler
}
+9 -9
View File
@@ -51,25 +51,25 @@ func TestABIStructNamesInSync(t *testing.T) {
for version, abiCons := range abis {
t.Run(version.String(), func(t *testing.T) {
abi := abiCons.cons()
structNames := abi.getStructNames()
structNames := abi.getStructs()
for ioctl := range abi.frontendIoctl {
if _, ok := structNames.frontendNames[ioctl]; !ok {
if _, ok := structNames.frontendStructs[ioctl]; !ok {
t.Errorf("Frontend ioctl %#x not found in struct names for version %v", ioctl, version.String())
}
}
for ioctl := range abi.uvmIoctl {
if _, ok := structNames.uvmNames[ioctl]; !ok {
if _, ok := structNames.uvmStructs[ioctl]; !ok {
t.Errorf("UVM ioctl %#x not found in struct names for version %v", ioctl, version.String())
}
}
for ioctl := range abi.controlCmd {
if _, ok := structNames.controlNames[ioctl]; !ok {
if _, ok := structNames.controlStructs[ioctl]; !ok {
t.Errorf("Control command %#x not found in struct names for version %v", ioctl, version.String())
}
}
for ioctl := range abi.allocationClass {
if _, ok := structNames.allocationNames[ioctl]; !ok {
if _, ok := structNames.allocationStructs[ioctl]; !ok {
t.Errorf("Alloc class %#x not found in struct names for version %v", ioctl, version.String())
}
}
@@ -159,14 +159,14 @@ func TestHandlers(t *testing.T) {
t.Run("control command", func(t *testing.T) {
type controlCmdInput struct {
fi *frontendIoctlState
params *nvgpu.NVOS54Parameters
params *nvgpu.NVOS54_PARAMETERS
}
testHandler(
t,
func(handler controlCmdHandler, input controlCmdInput) (uintptr, error) {
return handler.handle(input.fi, input.params)
},
ctrlHandler(func(*frontendIoctlState, *nvgpu.NVOS54Parameters) (uintptr, error) {
ctrlHandler(func(*frontendIoctlState, *nvgpu.NVOS54_PARAMETERS) (uintptr, error) {
return 42, nil
}, capCompute),
controlCmdInput{fi: capComputeState},
@@ -176,7 +176,7 @@ func TestHandlers(t *testing.T) {
t.Run("allocation class", func(t *testing.T) {
type allocClassInput struct {
fi *frontendIoctlState
ioctlParams *nvgpu.NVOS64Parameters
ioctlParams *nvgpu.NVOS64_PARAMETERS
isNVOS64 bool
}
testHandler(
@@ -184,7 +184,7 @@ func TestHandlers(t *testing.T) {
func(handler allocationClassHandler, input allocClassInput) (uintptr, error) {
return handler.handle(input.fi, input.ioctlParams, input.isNVOS64)
},
allocHandler(func(*frontendIoctlState, *nvgpu.NVOS64Parameters, bool) (uintptr, error) {
allocHandler(func(*frontendIoctlState, *nvgpu.NVOS64_PARAMETERS, bool) (uintptr, error) {
return 42, nil
}, capCompute),
allocClassInput{fi: capComputeState},
+4 -4
View File
@@ -282,12 +282,12 @@ func (nvp *nvproxy) enqueueCleanup(f func()) {
// +stateify savable
type capturedRmAllocParams struct {
fd *frontendFD
ioctlParams nvgpu.NVOS64Parameters
ioctlParams nvgpu.NVOS64_PARAMETERS
rightsRequested nvgpu.RS_ACCESS_MASK
allocParams []byte
}
func captureRmAllocParams[Params any](fd *frontendFD, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params) capturedRmAllocParams {
func captureRmAllocParams[Params any](fd *frontendFD, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params) capturedRmAllocParams {
var allocParamsBuf []byte
if allocParams != nil {
if allocParamsMarshal, ok := any(allocParams).(marshal.Marshallable); ok {
@@ -316,7 +316,7 @@ type rmAllocObject struct {
params capturedRmAllocParams
}
func newRmAllocObject[Params any](fd *frontendFD, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params) *rmAllocObject {
func newRmAllocObject[Params any](fd *frontendFD, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *Params) *rmAllocObject {
return &rmAllocObject{
params: captureRmAllocParams(fd, ioctlParams, rightsRequested, allocParams),
}
@@ -351,7 +351,7 @@ type rootClient struct {
params capturedRmAllocParams
}
func newRootClient(fd *frontendFD, ioctlParams *nvgpu.NVOS64Parameters, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.Handle) *rootClient {
func newRootClient(fd *frontendFD, ioctlParams *nvgpu.NVOS64_PARAMETERS, rightsRequested nvgpu.RS_ACCESS_MASK, allocParams *nvgpu.Handle) *rootClient {
return &rootClient{
resources: make(map[nvgpu.Handle]*object),
params: captureRmAllocParams(fd, ioctlParams, rightsRequested, allocParams),
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -260,7 +260,7 @@ func ParseIoctlOutput(ioctl *pb.Ioctl) (Ioctl, error) {
if uint32(len(data)) != nvgpu.SizeofNVOS54Parameters {
return parsedIoctl, fmt.Errorf("unexpected number of bytes")
}
var ioctlParams nvgpu.NVOS54Parameters
var ioctlParams nvgpu.NVOS54_PARAMETERS
ioctlParams.UnmarshalBytes(data)
parsedIoctl.class = control