Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 54 additions & 14 deletions pkg/abi/nvgpu/classes.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,49 +81,58 @@ const (
KEPLER_CHANNEL_GROUP_A = 0x0000a06c
NVENC_SW_SESSION = 0x0000a0bc
KEPLER_INLINE_TO_MEMORY_B = 0x0000a140
NVB8B0_VIDEO_DECODER = 0x0000b8b0
NVB8D1_VIDEO_NVJPG = 0x0000b8d1
NVB8FA_VIDEO_OFA = 0x0000b8fa
VOLTA_USERMODE_A = 0x0000c361
TURING_USERMODE_A = 0x0000c461
TURING_CHANNEL_GPFIFO_A = 0x0000c46f
NVB8B0_VIDEO_DECODER = 0x0000b8b0 // Hopper
NVC4B0_VIDEO_DECODER = 0x0000c4b0 // Turing
NVC6B0_VIDEO_DECODER = 0x0000c6b0 // Ampere
NVC7B0_VIDEO_DECODER = 0x0000c7b0 // Ampere
NVC9B0_VIDEO_DECODER = 0x0000c9b0 // Ada
NVCDB0_VIDEO_DECODER = 0x0000cdb0 // Blackwell
NVC4B0_VIDEO_DECODER = 0x0000c4b0
NVC4B7_VIDEO_ENCODER = 0x0000c4b7
NVC7B7_VIDEO_ENCODER = 0x0000c7b7
NVC9B7_VIDEO_ENCODER = 0x0000c9b7
NVCEB7_VIDEO_ENCODER = 0x0000ceb7
NVCFB7_VIDEO_ENCODER = 0x0000cfb7
NVD1B7_VIDEO_ENCODER = 0x0000d1b7
NVC4D1_VIDEO_NVJPG = 0x0000c4d1
AMPERE_CHANNEL_GPFIFO_A = 0x0000c56f
TURING_A = 0x0000c597
TURING_DMA_COPY_A = 0x0000c5b5
TURING_COMPUTE_A = 0x0000c5c0
HOPPER_USERMODE_A = 0x0000c661
BLACKWELL_USERMODE_A = 0x0000c761
AMPERE_A = 0x0000c697
NVC6B0_VIDEO_DECODER = 0x0000c6b0
AMPERE_DMA_COPY_A = 0x0000c6b5
AMPERE_COMPUTE_A = 0x0000c6c0
NVC6FA_VIDEO_OFA = 0x0000c6fa
BLACKWELL_USERMODE_A = 0x0000c761
NVC7B0_VIDEO_DECODER = 0x0000c7b0
AMPERE_DMA_COPY_B = 0x0000c7b5
NVC7B7_VIDEO_ENCODER = 0x0000c7b7
AMPERE_COMPUTE_B = 0x0000c7c0
NVC7FA_VIDEO_OFA = 0x0000c7fa
HOPPER_CHANNEL_GPFIFO_A = 0x0000c86f
HOPPER_DMA_COPY_A = 0x0000c8b5
BLACKWELL_CHANNEL_GPFIFO_A = 0x0000c96f
ADA_A = 0x0000c997
NVC9B0_VIDEO_DECODER = 0x0000c9b0
BLACKWELL_DMA_COPY_A = 0x0000c9b5
NVC9B7_VIDEO_ENCODER = 0x0000c9b7
ADA_COMPUTE_A = 0x0000c9c0
NVC9D1_VIDEO_NVJPG = 0x0000c9d1
NVC9FA_VIDEO_OFA = 0x0000c9fa
BLACKWELL_CHANNEL_GPFIFO_B = 0x0000ca6f
BLACKWELL_DMA_COPY_B = 0x0000cab5
ADA_A = 0x0000c997
ADA_COMPUTE_A = 0x0000c9c0
NV_CONFIDENTIAL_COMPUTE = 0x0000cb33
HOPPER_A = 0x0000cb97
HOPPER_SEC2_WORK_LAUNCH_A = 0x0000cba2
HOPPER_COMPUTE_A = 0x0000cbc0
BLACKWELL_INLINE_TO_MEMORY_A = 0x0000cd40
BLACKWELL_A = 0x0000cd97
NVCDB0_VIDEO_DECODER = 0x0000cdb0
BLACKWELL_COMPUTE_A = 0x0000cdc0
NVCDD1_VIDEO_NVJPG = 0x0000cdd1
NVCDFA_VIDEO_OFA = 0x0000cdfa
BLACKWELL_B = 0x0000ce97
NVCEB7_VIDEO_ENCODER = 0x0000ceb7
BLACKWELL_COMPUTE_B = 0x0000cec0
NVCFB7_VIDEO_ENCODER = 0x0000cfb7
NVD1B7_VIDEO_ENCODER = 0x0000d1b7
)

// From src/common/sdk/nvidia/inc/class/cl0000.h:
Expand Down Expand Up @@ -720,3 +729,34 @@ type NVA0BC_ALLOC_PARAMETERS struct {
Version uint32
HMem Handle
}

// NV_NVJPG_ALLOCATION_PARAMETERS is the alloc params type for
// NVxxD1_VIDEO_NVJPG classes, from src/common/sdk/nvidia/inc/nvos.h.
//
// +marshal
type NV_NVJPG_ALLOCATION_PARAMETERS struct {
_ structs.HostLayout
Size uint32
ProhibitMultipleInstances uint32
EngineInstance uint32
Comment thread
ayushr2 marked this conversation as resolved.
}

// NV_OFA_ALLOCATION_PARAMETERS is the alloc params type for
// NVxxFA_VIDEO_OFA classes, from src/common/sdk/nvidia/inc/nvos.h.
//
// +marshal
type NV_OFA_ALLOCATION_PARAMETERS struct {
_ structs.HostLayout
Size uint32
ProhibitMultipleInstances uint32
}

// NV_OFA_ALLOCATION_PARAMETERS_V545 is the updated version of
// NV_OFA_ALLOCATION_PARAMETERS since 545.23.06.
//
// +marshal
type NV_OFA_ALLOCATION_PARAMETERS_V545 struct {
_ structs.HostLayout
NV_OFA_ALLOCATION_PARAMETERS
EngineInstance uint32
}
26 changes: 26 additions & 0 deletions pkg/sentry/devices/nvproxy/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ func Init() {
nvgpu.NVC4B7_VIDEO_ENCODER: allocHandler(rmAllocSimple[nvgpu.NV_MSENC_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC7B7_VIDEO_ENCODER: allocHandler(rmAllocSimple[nvgpu.NV_MSENC_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC9B7_VIDEO_ENCODER: allocHandler(rmAllocSimple[nvgpu.NV_MSENC_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVB8D1_VIDEO_NVJPG: allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC4D1_VIDEO_NVJPG: allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC9D1_VIDEO_NVJPG: allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVB8FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC6FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC7FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.NVC9FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
nvgpu.AMPERE_CHANNEL_GPFIFO_A: allocHandler(rmAllocChannel, compUtil),
nvgpu.HOPPER_CHANNEL_GPFIFO_A: allocHandler(rmAllocChannel, compUtil),
nvgpu.TURING_A: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics),
Expand Down Expand Up @@ -679,6 +686,13 @@ func Init() {
nvgpu.NVC4B7_VIDEO_ENCODER: ioctlInfo("NVC4B7_VIDEO_ENCODER", nvgpu.NV_MSENC_ALLOCATION_PARAMETERS{}),
nvgpu.NVC7B7_VIDEO_ENCODER: ioctlInfo("NVC7B7_VIDEO_ENCODER", nvgpu.NV_MSENC_ALLOCATION_PARAMETERS{}),
nvgpu.NVC9B7_VIDEO_ENCODER: ioctlInfo("NVC9B7_VIDEO_ENCODER", nvgpu.NV_MSENC_ALLOCATION_PARAMETERS{}),
nvgpu.NVB8D1_VIDEO_NVJPG: ioctlInfo("NVB8D1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{}),
nvgpu.NVC4D1_VIDEO_NVJPG: ioctlInfo("NVC4D1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{}),
nvgpu.NVC9D1_VIDEO_NVJPG: ioctlInfo("NVC9D1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{}),
nvgpu.NVB8FA_VIDEO_OFA: ioctlInfo("NVB8FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
nvgpu.NVC6FA_VIDEO_OFA: ioctlInfo("NVC6FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
nvgpu.NVC7FA_VIDEO_OFA: ioctlInfo("NVC7FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
nvgpu.NVC9FA_VIDEO_OFA: ioctlInfo("NVC9FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
nvgpu.AMPERE_CHANNEL_GPFIFO_A: ioctlInfo("AMPERE_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{}),
nvgpu.HOPPER_CHANNEL_GPFIFO_A: ioctlInfo("HOPPER_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{}),
nvgpu.TURING_A: ioctlInfo("TURING_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{}),
Expand Down Expand Up @@ -732,6 +746,10 @@ func Init() {
abi.allocationClass[nvgpu.NV01_MEMORY_SYSTEM] = allocHandler(rmAllocSimple[nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545], compUtil)
abi.allocationClass[nvgpu.NV01_MEMORY_LOCAL_USER] = allocHandler(rmAllocSimple[nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545], compUtil)
abi.allocationClass[nvgpu.NV50_MEMORY_VIRTUAL] = allocHandler(rmAllocSimple[nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545], compUtil)
abi.allocationClass[nvgpu.NVB8FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
abi.allocationClass[nvgpu.NVC6FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
abi.allocationClass[nvgpu.NVC7FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
abi.allocationClass[nvgpu.NVC9FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)

prevGetInfo := abi.getInfo
abi.getInfo = func() *DriverABIInfo {
Expand All @@ -745,6 +763,10 @@ func Init() {
info.AllocationInfos[nvgpu.NV01_MEMORY_SYSTEM] = ioctlInfoWithStructName("NV01_MEMORY_SYSTEM", nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545{}, "NV_MEMORY_ALLOCATION_PARAMS")
info.AllocationInfos[nvgpu.NV01_MEMORY_LOCAL_USER] = ioctlInfoWithStructName("NV01_MEMORY_LOCAL_USER", nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545{}, "NV_MEMORY_ALLOCATION_PARAMS")
info.AllocationInfos[nvgpu.NV50_MEMORY_VIRTUAL] = ioctlInfoWithStructName("NV50_MEMORY_VIRTUAL", nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545{}, "NV_MEMORY_ALLOCATION_PARAMS")
info.AllocationInfos[nvgpu.NVB8FA_VIDEO_OFA] = ioctlInfoWithStructName("NVB8FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
info.AllocationInfos[nvgpu.NVC6FA_VIDEO_OFA] = ioctlInfoWithStructName("NVC6FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
info.AllocationInfos[nvgpu.NVC7FA_VIDEO_OFA] = ioctlInfoWithStructName("NVC7FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
info.AllocationInfos[nvgpu.NVC9FA_VIDEO_OFA] = ioctlInfoWithStructName("NVC9FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
return info
}

Expand Down Expand Up @@ -856,6 +878,8 @@ func Init() {
v560_28_03 := func() *driverABI {
abi := v555_42_02()
abi.allocationClass[nvgpu.NVCDB0_VIDEO_DECODER] = allocHandler(rmAllocSimple[nvgpu.NV_BSP_ALLOCATION_PARAMETERS], nvconf.CapVideo)
abi.allocationClass[nvgpu.NVCDD1_VIDEO_NVJPG] = allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo)
abi.allocationClass[nvgpu.NVCDFA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
abi.allocationClass[nvgpu.BLACKWELL_CHANNEL_GPFIFO_A] = allocHandler(rmAllocChannel, compUtil)
abi.allocationClass[nvgpu.BLACKWELL_DMA_COPY_A] = allocHandler(rmAllocSimple[nvgpu.NVB0B5_ALLOCATION_PARAMETERS], compUtil)
abi.allocationClass[nvgpu.BLACKWELL_A] = allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics)
Expand All @@ -867,6 +891,8 @@ func Init() {
abi.getInfo = func() *DriverABIInfo {
info := prevGetInfo()
info.AllocationInfos[nvgpu.NVCDB0_VIDEO_DECODER] = ioctlInfo("NVCDB0_VIDEO_DECODER", nvgpu.NV_BSP_ALLOCATION_PARAMETERS{})
info.AllocationInfos[nvgpu.NVCDD1_VIDEO_NVJPG] = ioctlInfo("NVCDD1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{})
info.AllocationInfos[nvgpu.NVCDFA_VIDEO_OFA] = ioctlInfoWithStructName("NVCDFA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
info.AllocationInfos[nvgpu.BLACKWELL_CHANNEL_GPFIFO_A] = ioctlInfo("BLACKWELL_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{})
info.AllocationInfos[nvgpu.BLACKWELL_DMA_COPY_A] = ioctlInfo("BLACKWELL_DMA_COPY_A", nvgpu.NVB0B5_ALLOCATION_PARAMETERS{})
info.AllocationInfos[nvgpu.BLACKWELL_A] = ioctlInfo("BLACKWELL_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{})
Expand Down