diff options
Diffstat (limited to 'kernel/gsp_rm_emulation.c')
| -rw-r--r-- | kernel/gsp_rm_emulation.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/kernel/gsp_rm_emulation.c b/kernel/gsp_rm_emulation.c index 1f029b1..c2b306a 100644 --- a/kernel/gsp_rm_emulation.c +++ b/kernel/gsp_rm_emulation.c @@ -1065,6 +1065,40 @@ static void gsp_rm_handle_ce_get_fault_method_buffer_size( } /* + * INTERNAL_GMMU_GET_STATIC_INFO (0x20800a59) + * + * The guest asks GSP-RM (us) for the GMMU static info; kgmmu. pStaticInfo-> + * replayableFaultBufferSize feeds kgmmuFaultBufferReplayableAllocate (called + * from faultbufConstruct when UVM opens the device). Zero -> 0-page alloc -> + * NV_ERR_NO_MEMORY -> faultbufConstruct fails and cuInit aborts. + * params: replayableFaultBufferSize(4) + replayableShadowFaultBufferMetadata + * Size(4) + nonReplayableFaultBufferSize(4) + nonReplayableShadowFaultBuffer + * MetadataSize(4). Shadow metadata is only used with confidential computing, + * so it stays 0. + */ +static void gsp_rm_handle_gmmu_get_static_info(struct gsp_emu_context *ctx, + u32 sequence, + u32 *out_status, + u8 *out_params, + u32 *out_params_size) +{ + u32 replay = TU104_GMMU_REPLAYABLE_FAULT_BUFFER_SIZE; + u32 nonreplay = TU104_GMMU_NONREPLAYABLE_FAULT_BUFFER_SIZE; + u32 zero = 0; + + memcpy(out_params + 0, &replay, 4); + memcpy(out_params + 4, &zero, 4); + memcpy(out_params + 8, &nonreplay, 4); + memcpy(out_params + 12, &zero, 4); + + *out_params_size = 16; + *out_status = 0; + + nv_vgpu_info(ctx->vgpu, "GSPRM: GMMU_GET_STATIC_INFO -> replayFaultBuf=0x%x nonReplayFaultBuf=0x%x", + replay, nonreplay); +} + +/* * STATIC_KGR_GET_GLOBAL_SM_ORDER (0x20800a22) * * kgrStaticInit copies globalSmOrder[grIdx] into the GR engine's static @@ -1548,6 +1582,12 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, reply + GSP_RM_CTRL_HDR_SIZE, &out_params_size); break; + case TU104_CTRL_INTERNAL_GMMU_GET_STATIC_INFO: + gsp_rm_handle_gmmu_get_static_info(ctx, sequence, + &out_status, + reply + GSP_RM_CTRL_HDR_SIZE, &out_params_size); + break; + case TU104_CTRL_STATIC_KGR_GET_GLOBAL_SM_ORDER: gsp_rm_handle_kgr_get_global_sm_order(ctx, sequence, &out_status, |
