From a6c9177ad1130636a497bad5c38f8b39f1966b30 Mon Sep 17 00:00:00 2001 From: JPikachu Date: Tue, 8 Apr 2025 12:12:58 +0100 Subject: [PATCH] Implement additions to nvdr services Fixes log error: "[ 41.472933] Debug core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp:operator():81: Assertion Failed! Unimplemented ioctl=C0084713" Credit: Antique - Sudachi dev, for the base Implementation and Citron for slight additions. --- .../service/nvdrv/devices/nvhost_ctrl_gpu.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index ddd85678b2..af110c2148 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -45,6 +45,8 @@ NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span return WrapFixed(this, &nvhost_ctrl_gpu::GetActiveSlotMask, input, output); case 0x1c: return WrapFixed(this, &nvhost_ctrl_gpu::GetGpuTime, input, output); + case 0x13: + return WrapFixed(this, &nvhost_ctrl_gpu::GetTpcMasks2, input, output); default: break; } @@ -71,6 +73,23 @@ NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span case 0x6: return WrapFixedInlOut(this, &nvhost_ctrl_gpu::GetTPCMasks3, input, output, inline_output); + case 0x13: { + // NVGPU_GPU_IOCTL_NUM_VSMS + struct Parameters { + u32 num_vsms; // Output: number of SM units + u32 reserved; // Output: reserved/padding + }; + static_assert(sizeof(Parameters) == 8, "Parameters is incorrect size"); + + // The Tegra X1 used in Switch has 2 SM units + Parameters params{ + .num_vsms = 2, + .reserved = 0 + }; + + std::memcpy(output.data(), ¶ms, sizeof(Parameters)); + return NvResult::Success; + } default: break; } @@ -78,7 +97,8 @@ NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span default: break; } - UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); + UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}, group={:01X}, command={:01X}", command.raw, + command.group, command.cmd); return NvResult::NotImplemented; }