From 50d3ab365146496ed4f09500833ca63d9f6c48f3 Mon Sep 17 00:00:00 2001 From: Botir Khaltaev Date: Fri, 28 Aug 2026 16:22:42 -0700 Subject: [PATCH] nvproxy: support AMPERE_B and GET_HS_CREDITS_MAPPING nvproxy denies NVIDIA resource-manager classes and control commands it does not already understand, instead of passing them through to the host driver. This PR allowlists two of those: - **AMPERE_B (`0xc797`).** Ampere GA10x allocates this graphics class instead of `AMPERE_A` (`0xc697`, GA100). The parameter blob is the same `NV_GR_ALLOCATION_PARAMETERS` structure. Without the class ID, the sentry logs `handler is undefined for allocation class 0xc797` and `vkCreateDevice` fails. Register it next to `AMPERE_A` under `CapGraphics`, same as `TURING_A`, `ADA_A`, and `HOPPER_A`. Not a video or compute class; no new driver capability. - **`NVB0CC_CTRL_CMD_GET_HS_CREDITS_MAPPING` (`0xb0cc0116`).** Nsight Compute on multi-chiplet GPUs issues this after `GET_CHIPLET_HS_CREDIT_POOL` (`0xb0cc0115`). Without it, the sentry logs `handler is undefined` and NCU fails to prepare the kernel. Register it on the 560.28.03 ABI node under `CapProfiling`, same as the other B0CC profiler commands. Assisted-by: Cursor ## Test plan - [x] `vkCreateDevice` / `vulkaninfo` on Ampere GA10x (class `0xc797`) succeeds instead of failing on an undefined allocation class - [x] `//pkg/sentry/devices/nvproxy:nvproxy_test` passes - [x] Nsight Compute and Nsight Systems write non-empty reports and exit 0 on training and LLM-serving workloads FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/14449 from botirkhaltaev:botir/nvproxy-ampere-b-and-ngx 3e69c51e1bb8f525f87c399575eff6094457b9dc PiperOrigin-RevId: 972845675 --- pkg/abi/nvgpu/classes.go | 1 + pkg/abi/nvgpu/ctrl.go | 1 + pkg/sentry/devices/nvproxy/version.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/pkg/abi/nvgpu/classes.go b/pkg/abi/nvgpu/classes.go index 579f0b93d8..2fd341b2f4 100644 --- a/pkg/abi/nvgpu/classes.go +++ b/pkg/abi/nvgpu/classes.go @@ -108,6 +108,7 @@ const ( AMPERE_COMPUTE_A = 0x0000c6c0 NVC6FA_VIDEO_OFA = 0x0000c6fa BLACKWELL_USERMODE_A = 0x0000c761 + AMPERE_B = 0x0000c797 NVC7B0_VIDEO_DECODER = 0x0000c7b0 AMPERE_DMA_COPY_B = 0x0000c7b5 NVC7B7_VIDEO_ENCODER = 0x0000c7b7 diff --git a/pkg/abi/nvgpu/ctrl.go b/pkg/abi/nvgpu/ctrl.go index fc07881b2b..e57d51e2ca 100644 --- a/pkg/abi/nvgpu/ctrl.go +++ b/pkg/abi/nvgpu/ctrl.go @@ -903,6 +903,7 @@ const ( NVB0CC_CTRL_CMD_GET_TOTAL_HS_CREDITS = 0xb0cc010d NVB0CC_CTRL_CMD_SET_HS_CREDITS = 0xb0cc010e NVB0CC_CTRL_CMD_GET_CHIPLET_HS_CREDIT_POOL = 0xb0cc0115 + NVB0CC_CTRL_CMD_GET_HS_CREDITS_MAPPING = 0xb0cc0116 NVB0CC_CTRL_CMD_RESERVE_CCU_PROF = 0xb0cc0119 NVB0CC_CTRL_CMD_POWER_REQUEST_FEATURES = 0xb0cc0301 NVB0CC_CTRL_CMD_POWER_RELEASE_FEATURES = 0xb0cc0302 diff --git a/pkg/sentry/devices/nvproxy/version.go b/pkg/sentry/devices/nvproxy/version.go index a196208a2b..61d262737d 100644 --- a/pkg/sentry/devices/nvproxy/version.go +++ b/pkg/sentry/devices/nvproxy/version.go @@ -466,6 +466,7 @@ func Init() { nvgpu.HOPPER_CHANNEL_GPFIFO_A: allocHandler(rmAllocChannel, compUtil), nvgpu.TURING_A: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics), nvgpu.AMPERE_A: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics), + nvgpu.AMPERE_B: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics), nvgpu.ADA_A: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics), nvgpu.HOPPER_A: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics), nvgpu.TURING_DMA_COPY_A: allocHandler(rmAllocSimple[nvgpu.NVB0B5_ALLOCATION_PARAMETERS], compUtil), @@ -794,6 +795,7 @@ func Init() { 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{}), nvgpu.AMPERE_A: ioctlInfo("AMPERE_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{}), + nvgpu.AMPERE_B: ioctlInfo("AMPERE_B", nvgpu.NV_GR_ALLOCATION_PARAMETERS{}), nvgpu.ADA_A: ioctlInfo("ADA_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{}), nvgpu.HOPPER_A: ioctlInfo("HOPPER_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{}), nvgpu.TURING_DMA_COPY_A: ioctlInfo("TURING_DMA_COPY_A", nvgpu.NVB0B5_ALLOCATION_PARAMETERS{}), @@ -990,6 +992,7 @@ func Init() { abi.controlCmd[nvgpu.NV2080_CTRL_CMD_NVLINK_GET_PLATFORM_INFO] = ctrlHandler(rmControlSimple, nvconf.CapFabricIMEXManagement) abi.controlCmd[nvgpu.NV2080_CTRL_CMD_BUS_GET_PCIE_CPL_ATOMICS_CAPS] = ctrlHandler(rmControlSimple, nvconf.CapGraphics) abi.controlCmd[nvgpu.NVB0CC_CTRL_CMD_GET_CHIPLET_HS_CREDIT_POOL] = ctrlHandler(rmControlSimple, nvconf.CapProfiling) + abi.controlCmd[nvgpu.NVB0CC_CTRL_CMD_GET_HS_CREDITS_MAPPING] = ctrlHandler(rmControlSimple, nvconf.CapProfiling) prevGetInfo := abi.getInfo abi.getInfo = func() *DriverABIInfo { info := prevGetInfo() @@ -1005,6 +1008,7 @@ func Init() { info.ControlInfos[nvgpu.NV2080_CTRL_CMD_NVLINK_GET_PLATFORM_INFO] = simpleIoctlInfo("NV2080_CTRL_CMD_NVLINK_GET_PLATFORM_INFO", "NV2080_CTRL_NVLINK_GET_PLATFORM_INFO_PARAMS") info.ControlInfos[nvgpu.NV2080_CTRL_CMD_BUS_GET_PCIE_CPL_ATOMICS_CAPS] = simpleIoctlInfo("NV2080_CTRL_CMD_BUS_GET_PCIE_CPL_ATOMICS_CAPS", "NV2080_CTRL_CMD_BUS_GET_PCIE_CPL_ATOMICS_CAPS_PARAMS") info.ControlInfos[nvgpu.NVB0CC_CTRL_CMD_GET_CHIPLET_HS_CREDIT_POOL] = simpleIoctlInfo("NVB0CC_CTRL_CMD_GET_CHIPLET_HS_CREDIT_POOL", "NVB0CC_CTRL_GET_CHIPLET_HS_CREDIT_POOL") + info.ControlInfos[nvgpu.NVB0CC_CTRL_CMD_GET_HS_CREDITS_MAPPING] = simpleIoctlInfo("NVB0CC_CTRL_CMD_GET_HS_CREDITS_MAPPING", "NVB0CC_CTRL_GET_HS_CREDITS_POOL_MAPPING_PARAMS") return info } return abi