Skip to content

Commit 38794a5

Browse files
committed
Merge tag 'amd-drm-fixes-5.8-2020-07-09' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
amd-drm-fixes-5.8-2020-07-09: amdgpu: - Fix a suspend/resume issue with PSP - Backlight fix for Renoir - Fix for gpu recovery debugging radeon: - Fix a double free in error path Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 1328af8 + f4892c3 commit 38794a5

File tree

4 files changed

+65
-10
lines changed

4 files changed

+65
-10
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
3737

3838
memset(&ti, 0, sizeof(struct amdgpu_task_info));
3939

40-
if (amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
40+
if (amdgpu_gpu_recovery &&
41+
amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
4142
DRM_ERROR("ring %s timeout, but soft recovered\n",
4243
s_job->sched->name);
4344
return;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,52 @@ static int psp_tmr_load(struct psp_context *psp)
372372
return ret;
373373
}
374374

375+
static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp,
376+
struct psp_gfx_cmd_resp *cmd)
377+
{
378+
if (amdgpu_sriov_vf(psp->adev))
379+
cmd->cmd_id = GFX_CMD_ID_DESTROY_VMR;
380+
else
381+
cmd->cmd_id = GFX_CMD_ID_DESTROY_TMR;
382+
}
383+
384+
static int psp_tmr_unload(struct psp_context *psp)
385+
{
386+
int ret;
387+
struct psp_gfx_cmd_resp *cmd;
388+
389+
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
390+
if (!cmd)
391+
return -ENOMEM;
392+
393+
psp_prep_tmr_unload_cmd_buf(psp, cmd);
394+
DRM_INFO("free PSP TMR buffer\n");
395+
396+
ret = psp_cmd_submit_buf(psp, NULL, cmd,
397+
psp->fence_buf_mc_addr);
398+
399+
kfree(cmd);
400+
401+
return ret;
402+
}
403+
404+
static int psp_tmr_terminate(struct psp_context *psp)
405+
{
406+
int ret;
407+
void *tmr_buf;
408+
void **pptr;
409+
410+
ret = psp_tmr_unload(psp);
411+
if (ret)
412+
return ret;
413+
414+
/* free TMR memory buffer */
415+
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
416+
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
417+
418+
return 0;
419+
}
420+
375421
static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd,
376422
uint64_t asd_mc, uint32_t size)
377423
{
@@ -1779,8 +1825,6 @@ static int psp_hw_fini(void *handle)
17791825
{
17801826
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
17811827
struct psp_context *psp = &adev->psp;
1782-
void *tmr_buf;
1783-
void **pptr;
17841828

17851829
if (psp->adev->psp.ta_fw) {
17861830
psp_ras_terminate(psp);
@@ -1790,10 +1834,9 @@ static int psp_hw_fini(void *handle)
17901834

17911835
psp_asd_unload(psp);
17921836

1837+
psp_tmr_terminate(psp);
17931838
psp_ring_destroy(psp, PSP_RING_TYPE__KM);
17941839

1795-
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
1796-
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
17971840
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
17981841
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
17991842
amdgpu_bo_free_kernel(&psp->fence_buf_bo,
@@ -1840,6 +1883,18 @@ static int psp_suspend(void *handle)
18401883
}
18411884
}
18421885

1886+
ret = psp_asd_unload(psp);
1887+
if (ret) {
1888+
DRM_ERROR("Failed to unload asd\n");
1889+
return ret;
1890+
}
1891+
1892+
ret = psp_tmr_terminate(psp);
1893+
if (ret) {
1894+
DRM_ERROR("Falied to terminate tmr\n");
1895+
return ret;
1896+
}
1897+
18431898
ret = psp_ring_stop(psp, PSP_RING_TYPE__KM);
18441899
if (ret) {
18451900
DRM_ERROR("PSP ring stop failed\n");

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ static int dm_late_init(void *handle)
13581358
struct dmcu *dmcu = NULL;
13591359
bool ret;
13601360

1361-
if (!adev->dm.fw_dmcu)
1361+
if (!adev->dm.fw_dmcu && !adev->dm.dmub_fw)
13621362
return detect_mst_link_for_all_connectors(adev->ddev);
13631363

13641364
dmcu = adev->dm.dc->res_pool->dmcu;

drivers/gpu/drm/radeon/ci_dpm.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5563,6 +5563,7 @@ static int ci_parse_power_table(struct radeon_device *rdev)
55635563
if (!rdev->pm.dpm.ps)
55645564
return -ENOMEM;
55655565
power_state_offset = (u8 *)state_array->states;
5566+
rdev->pm.dpm.num_ps = 0;
55665567
for (i = 0; i < state_array->ucNumEntries; i++) {
55675568
u8 *idx;
55685569
power_state = (union pplib_power_state *)power_state_offset;
@@ -5572,10 +5573,8 @@ static int ci_parse_power_table(struct radeon_device *rdev)
55725573
if (!rdev->pm.power_state[i].clock_info)
55735574
return -EINVAL;
55745575
ps = kzalloc(sizeof(struct ci_ps), GFP_KERNEL);
5575-
if (ps == NULL) {
5576-
kfree(rdev->pm.dpm.ps);
5576+
if (ps == NULL)
55775577
return -ENOMEM;
5578-
}
55795578
rdev->pm.dpm.ps[i].ps_priv = ps;
55805579
ci_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i],
55815580
non_clock_info,
@@ -5597,8 +5596,8 @@ static int ci_parse_power_table(struct radeon_device *rdev)
55975596
k++;
55985597
}
55995598
power_state_offset += 2 + power_state->v2.ucNumDPMLevels;
5599+
rdev->pm.dpm.num_ps = i + 1;
56005600
}
5601-
rdev->pm.dpm.num_ps = state_array->ucNumEntries;
56025601

56035602
/* fill in the vce power states */
56045603
for (i = 0; i < RADEON_MAX_VCE_LEVELS; i++) {

0 commit comments

Comments
 (0)