1. 27 Jul, 2024 28 commits
  2. 25 Jul, 2024 8 commits
  3. 24 Jul, 2024 4 commits
    • Philip Yang's avatar
      drm/amdkfd: Validate queue cwsr area and eop buffer size · 629568d2
      Philip Yang authored
      When creating KFD user compute queue, check if queue eop buffer size,
      cwsr area size, ctl stack size equal to the size of KFD node
      properities.
      
      Check the entire cwsr area which may split into multiple svm ranges
      aligned to granularity boundary.
      Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
      Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      629568d2
    • Philip Yang's avatar
      drm/amdkfd: Store queue cwsr area size to node properties · 517fff22
      Philip Yang authored
      Use the queue eop buffer size, cwsr area size, ctl stack size
      calculation from Thunk, store the value to KFD node properties.
      
      Those will be used to validate queue eop buffer size, cwsr area size,
      ctl stack size when creating KFD user compute queue.
      
      Those will be exposed to user space via sysfs KFD node properties, to
      remove the duplicate calculation code from Thunk.
      Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
      Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      517fff22
    • ZhenGuo Yin's avatar
      drm/amdgpu: reset vm state machine after gpu reset(vram lost) · 47c0388b
      ZhenGuo Yin authored
      [Why]
      Page table of compute VM in the VRAM will lost after gpu reset.
      VRAM won't be restored since compute VM has no shadows.
      
      [How]
      Use higher 32-bit of vm->generation to record a vram_lost_counter.
      Reset the VM state machine when vm->genertaion is not equal to
      the new generation token.
      
      v2: Check vm->generation instead of calling drm_sched_entity_error
      in amdgpu_vm_validate.
      v3: Use new generation token instead of vram_lost_counter for check.
      Signed-off-by: default avatarZhenGuo Yin <zhenguo.yin@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      47c0388b
    • Srinivasan Shanmugam's avatar
      drm/amd/display: Add null check for set_output_gamma in dcn30_set_output_transfer_func · 08ae395e
      Srinivasan Shanmugam authored
      This commit adds a null check for the set_output_gamma function pointer
      in the  dcn30_set_output_transfer_func function. Previously,
      set_output_gamma was being checked for nullity at line 386, but then it
      was being dereferenced without any nullity check at line 401. This
      could potentially lead to a null pointer dereference error if
      set_output_gamma is indeed null.
      
      To fix this, we now ensure that set_output_gamma is not null before
      dereferencing it. We do this by adding a nullity check for
      set_output_gamma before the call to set_output_gamma at line 401. If
      set_output_gamma is null, we log an error message and do not call the
      function.
      
      This fix prevents a potential null pointer dereference error.
      
      drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:401 dcn30_set_output_transfer_func()
      error: we previously assumed 'mpc->funcs->set_output_gamma' could be null (see line 386)
      
      drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c
          373 bool dcn30_set_output_transfer_func(struct dc *dc,
          374                                 struct pipe_ctx *pipe_ctx,
          375                                 const struct dc_stream_state *stream)
          376 {
          377         int mpcc_id = pipe_ctx->plane_res.hubp->inst;
          378         struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
          379         const struct pwl_params *params = NULL;
          380         bool ret = false;
          381
          382         /* program OGAM or 3DLUT only for the top pipe*/
          383         if (pipe_ctx->top_pipe == NULL) {
          384                 /*program rmu shaper and 3dlut in MPC*/
          385                 ret = dcn30_set_mpc_shaper_3dlut(pipe_ctx, stream);
          386                 if (ret == false && mpc->funcs->set_output_gamma) {
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If this is NULL
      
          387                         if (stream->out_transfer_func.type == TF_TYPE_HWPWL)
          388                                 params = &stream->out_transfer_func.pwl;
          389                         else if (pipe_ctx->stream->out_transfer_func.type ==
          390                                         TF_TYPE_DISTRIBUTED_POINTS &&
          391                                         cm3_helper_translate_curve_to_hw_format(
          392                                         &stream->out_transfer_func,
          393                                         &mpc->blender_params, false))
          394                                 params = &mpc->blender_params;
          395                          /* there are no ROM LUTs in OUTGAM */
          396                         if (stream->out_transfer_func.type == TF_TYPE_PREDEFINED)
          397                                 BREAK_TO_DEBUGGER();
          398                 }
          399         }
          400
      --> 401         mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Then it will crash
      
          402         return ret;
          403 }
      
      Fixes: d99f1387 ("drm/amd/display: Add DCN3 HWSEQ")
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Cc: Tom Chung <chiahsuan.chung@amd.com>
      Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Cc: Roman Li <roman.li@amd.com>
      Cc: Hersen Wu <hersenxs.wu@amd.com>
      Cc: Alex Hung <alex.hung@amd.com>
      Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarTom Chung <chiahsuan.chung@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      08ae395e