diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-08 05:44:31 -0500 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-08 05:44:31 -0500 |
| commit | 5e6cd3cf5df1ab61208848866c30c29ce8907530 (patch) | |
| tree | 414e60295b35ffe5bd0b5d9dcc84324a9d2b1bd6 | |
| parent | 2089f26f66626647c2e952cc1a758ef10930a58a (diff) | |
| download | open-iov-5e6cd3cf5df1ab61208848866c30c29ce8907530.tar.gz open-iov-5e6cd3cf5df1ab61208848866c30c29ce8907530.zip | |
vgsp-rm: report TU104 GR identity in KGR_GET_INFO (SM_VERSION 7.5)
nv3dAllocDevice reads SM_VERSION (GR info index 0x0c) through the 3D
library; with the emulated KGR reply leaving it 0 it gets
SM_VERSION_NONE, GetSpaVersion fails, nvHsAllocDevice returns FALSE
silently and nvidia-drm reports 'Failed to allocate NvKmsKapiDevice'
(r1626 gdb: nvHsAllocDevice -> nvHs3dAllocDevice -> nv3dAllocDevice).
Fill SM_VERSION=0x705 (7.5) plus MAX_WARPS_PER_SM=64,
MAX_THREADS_PER_WARP=32 and THREAD_STACK_SCALING_FACTOR=1.
| -rw-r--r-- | kernel/gsp_rm_emulation.c | 12 | ||||
| -rw-r--r-- | kernel/gsp_rm_tu104.h | 18 |
2 files changed, 30 insertions, 0 deletions
diff --git a/kernel/gsp_rm_emulation.c b/kernel/gsp_rm_emulation.c index 3157a24..b05ee3d 100644 --- a/kernel/gsp_rm_emulation.c +++ b/kernel/gsp_rm_emulation.c @@ -2671,6 +2671,18 @@ static void gsp_rm_handle_kgr_get_info(struct gsp_emu_context *ctx, info->infoList[TU104_GR_INFO_IDX_MAX_LEGACY_SUBCONTEXT_COUNT].data = TU104_MAX_SUBCONTEXT_COUNT; info->infoList[TU104_GR_INFO_IDX_MAX_PER_ENGINE_SUBCONTEXT_COUNT].data = TU104_MAX_SUBCONTEXT_COUNT; + /* + * GR identity for the nvidia-3d library. SM_VERSION in particular + * gates nv3dAllocDevice (GetSpaVersion -> FALSE on + * SM_VERSION_NONE), which makes nvHsAllocDevice fail silently and + * nvidia-drm report "Failed to allocate NvKmsKapiDevice". + */ + info->infoList[TU104_GR_INFO_IDX_SM_VERSION].data = TU104_GR_INFO_SM_VERSION_7_5; + info->infoList[TU104_GR_INFO_IDX_MAX_WARPS_PER_SM].data = TU104_MAX_WARPS_PER_SM; + info->infoList[TU104_GR_INFO_IDX_MAX_THREADS_PER_WARP].data = TU104_MAX_THREADS_PER_WARP; + info->infoList[TU104_GR_INFO_IDX_THREAD_STACK_SCALING_FACTOR].data = + TU104_THREAD_STACK_SCALING_FACTOR; + *out_params_size = TU104_GR_INFO_MAX_ENGINES * sizeof(struct tu104_gr_static_info); *out_status = 0; diff --git a/kernel/gsp_rm_tu104.h b/kernel/gsp_rm_tu104.h index d0850f2..033014b 100644 --- a/kernel/gsp_rm_tu104.h +++ b/kernel/gsp_rm_tu104.h @@ -985,7 +985,11 @@ struct tu104_gr_static_info { /* infoList indices we populate (ctrl0080gr.h) */ #define TU104_GR_INFO_IDX_SHADER_PIPE_COUNT 0x07 +#define TU104_GR_INFO_IDX_THREAD_STACK_SCALING_FACTOR 0x08 #define TU104_GR_INFO_IDX_SHADER_PIPE_SUB_COUNT 0x09 +#define TU104_GR_INFO_IDX_SM_VERSION 0x0c +#define TU104_GR_INFO_IDX_MAX_WARPS_PER_SM 0x0d +#define TU104_GR_INFO_IDX_MAX_THREADS_PER_WARP 0x0e #define TU104_GR_INFO_IDX_LITTER_NUM_GPCS 0x14 #define TU104_GR_INFO_IDX_LITTER_NUM_TPC_PER_GPC 0x17 #define TU104_GR_INFO_IDX_GPU_CORE_COUNT 0x1d @@ -1010,6 +1014,20 @@ struct tu104_gr_static_info { /* TU104 max subcontexts (NV_PGRAPH_PRI_FE_CHIP_DEF_INFO_MAX_VEID_COUNT_INIT) */ #define TU104_MAX_SUBCONTEXT_COUNT 64 +/* + * GR identity values the nvidia-3d library reads through GR_GET_INFO. + * SM_VERSION must be NV2080_CTRL_GR_INFO_SM_VERSION_7_5 (0x705): the 3D + * device allocation maps the SM version through a table and returns FALSE + * when it reads SM_VERSION_NONE (0). On the guest that surfaces as + * nvHsAllocDevice -> nvHs3dAllocDevice failing silently, and nvidia-drm + * reports "Failed to allocate NvKmsKapiDevice" (r1626 gdb: after_hs + * rax=0x0, hs_hs3d_fail_block). Warps/threads are the TU104 limits. + */ +#define TU104_GR_INFO_SM_VERSION_7_5 0x00000705 +#define TU104_MAX_WARPS_PER_SM 64 +#define TU104_MAX_THREADS_PER_WARP 32 +#define TU104_THREAD_STACK_SCALING_FACTOR 1 + /* NV2080_CTRL_INTERNAL_STATIC_GR_FLOORSWEEPING_MASKS (ctrl2080internal.h) * + STATIC_KGR_GET_FLOORSWEEPING_MASKS cmd = 0x20800a26. * Driver computes numGpcs from floorsweepingMasks.gpcMask - zero kills |
