Add NV50_P2P allocation class support in nvproxy.

Updates #9827.

PiperOrigin-RevId: 596766912
This commit is contained in:
Ayush Ranjan
2024-01-08 19:22:29 -08:00
committed by gVisor bot
parent 892bfa18ce
commit 98df07c3cd
2 changed files with 37 additions and 0 deletions
+35
View File
@@ -25,6 +25,7 @@ const (
NV01_DEVICE_0 = 0x00000080
NV_MEMORY_FABRIC = 0x000000f8
NV20_SUBDEVICE_0 = 0x00002080
NV50_P2P = 0x0000503b
NV50_THIRD_PARTY_P2P = 0x0000503c
GT200_DEBUGGER = 0x000083de
GF100_SUBDEVICE_MASTER = 0x000090e6
@@ -85,6 +86,40 @@ type NV2080_ALLOC_PARAMETERS struct {
SubDeviceID 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
type NV503B_BAR1_P2P_DMA_INFO struct {
DmaAddress uint64
DmaSize uint64
}
// NV503B_ALLOC_PARAMETERS_V535 is the updated version of
// NV503B_ALLOC_PARAMETERS since 535.43.02.
//
// +marshal
type NV503B_ALLOC_PARAMETERS_V535 struct {
NV503B_ALLOC_PARAMETERS
SubDeviceEgmPeerIDMask uint32
PeerSubDeviceEgmPeerIDMask uint32
L2pBar1P2PDmaInfo NV503B_BAR1_P2P_DMA_INFO
P2lBar1P2PDmaInfo NV503B_BAR1_P2P_DMA_INFO
}
// NV503C_ALLOC_PARAMETERS is the alloc params type for NV50_THIRD_PARTY_P2P,
// from src/common/sdk/nvidia/inc/class/cl503c.h.
//
+2
View File
@@ -282,6 +282,7 @@ func Init() {
nvgpu.NV01_EVENT_OS_EVENT: rmAllocEventOSEvent,
nvgpu.NV01_DEVICE_0: rmAllocSimple[nvgpu.NV0080_ALLOC_PARAMETERS],
nvgpu.NV20_SUBDEVICE_0: rmAllocSimple[nvgpu.NV2080_ALLOC_PARAMETERS],
nvgpu.NV50_P2P: rmAllocSimple[nvgpu.NV503B_ALLOC_PARAMETERS],
nvgpu.NV50_THIRD_PARTY_P2P: rmAllocSimple[nvgpu.NV503C_ALLOC_PARAMETERS],
nvgpu.GT200_DEBUGGER: rmAllocSimple[nvgpu.NV83DE_ALLOC_PARAMETERS],
nvgpu.FERMI_CONTEXT_SHARE_A: rmAllocSimple[nvgpu.NV_CTXSHARE_ALLOCATION_PARAMETERS],
@@ -322,6 +323,7 @@ func Init() {
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