Commit 38794a54 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'amd-drm-fixes-5.8-2020-07-09' of...

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: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200709185221.44895-1-alexander.deucher@amd.com
parents 1328af84 f4892c32
...@@ -37,7 +37,8 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job) ...@@ -37,7 +37,8 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)
memset(&ti, 0, sizeof(struct amdgpu_task_info)); memset(&ti, 0, sizeof(struct amdgpu_task_info));
if (amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) { if (amdgpu_gpu_recovery &&
amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {
DRM_ERROR("ring %s timeout, but soft recovered\n", DRM_ERROR("ring %s timeout, but soft recovered\n",
s_job->sched->name); s_job->sched->name);
return; return;
......
...@@ -372,6 +372,52 @@ static int psp_tmr_load(struct psp_context *psp) ...@@ -372,6 +372,52 @@ static int psp_tmr_load(struct psp_context *psp)
return ret; return ret;
} }
static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp,
struct psp_gfx_cmd_resp *cmd)
{
if (amdgpu_sriov_vf(psp->adev))
cmd->cmd_id = GFX_CMD_ID_DESTROY_VMR;
else
cmd->cmd_id = GFX_CMD_ID_DESTROY_TMR;
}
static int psp_tmr_unload(struct psp_context *psp)
{
int ret;
struct psp_gfx_cmd_resp *cmd;
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
if (!cmd)
return -ENOMEM;
psp_prep_tmr_unload_cmd_buf(psp, cmd);
DRM_INFO("free PSP TMR buffer\n");
ret = psp_cmd_submit_buf(psp, NULL, cmd,
psp->fence_buf_mc_addr);
kfree(cmd);
return ret;
}
static int psp_tmr_terminate(struct psp_context *psp)
{
int ret;
void *tmr_buf;
void **pptr;
ret = psp_tmr_unload(psp);
if (ret)
return ret;
/* free TMR memory buffer */
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
return 0;
}
static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd, static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd,
uint64_t asd_mc, uint32_t size) uint64_t asd_mc, uint32_t size)
{ {
...@@ -1779,8 +1825,6 @@ static int psp_hw_fini(void *handle) ...@@ -1779,8 +1825,6 @@ static int psp_hw_fini(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct psp_context *psp = &adev->psp; struct psp_context *psp = &adev->psp;
void *tmr_buf;
void **pptr;
if (psp->adev->psp.ta_fw) { if (psp->adev->psp.ta_fw) {
psp_ras_terminate(psp); psp_ras_terminate(psp);
...@@ -1790,10 +1834,9 @@ static int psp_hw_fini(void *handle) ...@@ -1790,10 +1834,9 @@ static int psp_hw_fini(void *handle)
psp_asd_unload(psp); psp_asd_unload(psp);
psp_tmr_terminate(psp);
psp_ring_destroy(psp, PSP_RING_TYPE__KM); psp_ring_destroy(psp, PSP_RING_TYPE__KM);
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
amdgpu_bo_free_kernel(&psp->fw_pri_bo, amdgpu_bo_free_kernel(&psp->fw_pri_bo,
&psp->fw_pri_mc_addr, &psp->fw_pri_buf); &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
amdgpu_bo_free_kernel(&psp->fence_buf_bo, amdgpu_bo_free_kernel(&psp->fence_buf_bo,
...@@ -1840,6 +1883,18 @@ static int psp_suspend(void *handle) ...@@ -1840,6 +1883,18 @@ static int psp_suspend(void *handle)
} }
} }
ret = psp_asd_unload(psp);
if (ret) {
DRM_ERROR("Failed to unload asd\n");
return ret;
}
ret = psp_tmr_terminate(psp);
if (ret) {
DRM_ERROR("Falied to terminate tmr\n");
return ret;
}
ret = psp_ring_stop(psp, PSP_RING_TYPE__KM); ret = psp_ring_stop(psp, PSP_RING_TYPE__KM);
if (ret) { if (ret) {
DRM_ERROR("PSP ring stop failed\n"); DRM_ERROR("PSP ring stop failed\n");
......
...@@ -1358,7 +1358,7 @@ static int dm_late_init(void *handle) ...@@ -1358,7 +1358,7 @@ static int dm_late_init(void *handle)
struct dmcu *dmcu = NULL; struct dmcu *dmcu = NULL;
bool ret; bool ret;
if (!adev->dm.fw_dmcu) if (!adev->dm.fw_dmcu && !adev->dm.dmub_fw)
return detect_mst_link_for_all_connectors(adev->ddev); return detect_mst_link_for_all_connectors(adev->ddev);
dmcu = adev->dm.dc->res_pool->dmcu; dmcu = adev->dm.dc->res_pool->dmcu;
......
...@@ -5563,6 +5563,7 @@ static int ci_parse_power_table(struct radeon_device *rdev) ...@@ -5563,6 +5563,7 @@ static int ci_parse_power_table(struct radeon_device *rdev)
if (!rdev->pm.dpm.ps) if (!rdev->pm.dpm.ps)
return -ENOMEM; return -ENOMEM;
power_state_offset = (u8 *)state_array->states; power_state_offset = (u8 *)state_array->states;
rdev->pm.dpm.num_ps = 0;
for (i = 0; i < state_array->ucNumEntries; i++) { for (i = 0; i < state_array->ucNumEntries; i++) {
u8 *idx; u8 *idx;
power_state = (union pplib_power_state *)power_state_offset; power_state = (union pplib_power_state *)power_state_offset;
...@@ -5572,10 +5573,8 @@ static int ci_parse_power_table(struct radeon_device *rdev) ...@@ -5572,10 +5573,8 @@ static int ci_parse_power_table(struct radeon_device *rdev)
if (!rdev->pm.power_state[i].clock_info) if (!rdev->pm.power_state[i].clock_info)
return -EINVAL; return -EINVAL;
ps = kzalloc(sizeof(struct ci_ps), GFP_KERNEL); ps = kzalloc(sizeof(struct ci_ps), GFP_KERNEL);
if (ps == NULL) { if (ps == NULL)
kfree(rdev->pm.dpm.ps);
return -ENOMEM; return -ENOMEM;
}
rdev->pm.dpm.ps[i].ps_priv = ps; rdev->pm.dpm.ps[i].ps_priv = ps;
ci_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i], ci_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i],
non_clock_info, non_clock_info,
...@@ -5597,8 +5596,8 @@ static int ci_parse_power_table(struct radeon_device *rdev) ...@@ -5597,8 +5596,8 @@ static int ci_parse_power_table(struct radeon_device *rdev)
k++; k++;
} }
power_state_offset += 2 + power_state->v2.ucNumDPMLevels; power_state_offset += 2 + power_state->v2.ucNumDPMLevels;
rdev->pm.dpm.num_ps = i + 1;
} }
rdev->pm.dpm.num_ps = state_array->ucNumEntries;
/* fill in the vce power states */ /* fill in the vce power states */
for (i = 0; i < RADEON_MAX_VCE_LEVELS; i++) { for (i = 0; i < RADEON_MAX_VCE_LEVELS; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment