Skip to content

Commit

Permalink
Add NV_MEMORY_FABRIC to nvproxy.
Browse files Browse the repository at this point in the history
Fixes #9372

PiperOrigin-RevId: 567816690
  • Loading branch information
milantracy authored and gvisor-bot committed Sep 23, 2023
1 parent b5dea0e commit e81e0c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/abi/nvgpu/classes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
NV01_MEMORY_SYSTEM_OS_DESCRIPTOR = 0x00000071
NV01_EVENT_OS_EVENT = 0x00000079
NV01_DEVICE_0 = 0x00000080
NV_MEMORY_FABRIC = 0x000000f8
NV20_SUBDEVICE_0 = 0x00002080
NV50_THIRD_PARTY_P2P = 0x0000503c
GT200_DEBUGGER = 0x000083de
Expand Down Expand Up @@ -220,3 +221,22 @@ type NV_HOPPER_USERMODE_A_PARAMS struct {
Bar1Mapping uint8
Priv uint8
}

// +marshal
type nv00f8Map struct {
offset uint64
hVidMem Handle
flags uint32
}

// NV00F8_ALLOCATION_PARAMETERS is the alloc param type for NV_MEMORY_FABRIC,
// from src/common/sdk/nvidia/inc/class/cl00f8.h
//
// +marshal
type NV00F8_ALLOCATION_PARAMETERS struct {
Alignment uint64
AllocSize uint64
PageSize uint32
AllocFlags uint32
Map nv00f8Map
}
2 changes: 2 additions & 0 deletions pkg/sentry/devices/nvproxy/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,8 @@ func rmAlloc(fi *frontendIoctlState) (uintptr, error) {
return rmAllocSimple[nvgpu.NV_HOPPER_USERMODE_A_PARAMS](fi, &ioctlParams, isNVOS64)
case nvgpu.GF100_SUBDEVICE_MASTER, nvgpu.VOLTA_USERMODE_A, nvgpu.TURING_USERMODE_A:
return rmAllocNoParams(fi, &ioctlParams, isNVOS64)
case nvgpu.NV_MEMORY_FABRIC:
return rmAllocSimple[nvgpu.NV00F8_ALLOCATION_PARAMETERS](fi, &ioctlParams, isNVOS64)
default:
fi.ctx.Warningf("nvproxy: unknown allocation class %#08x", ioctlParams.HClass)
return 0, linuxerr.EINVAL
Expand Down

0 comments on commit e81e0c7

Please sign in to comment.