aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
diff options
context:
space:
mode:
authorTrigger Huang <trigger.huang@amd.com>2017-04-17 08:50:18 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-04-28 17:32:46 -0400
commite3c5e9826d60630236de105c05e7a58f12c45ab5 (patch)
tree4744dcbe1056d3eff2483644183dc3de4d06af74 /drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
parente0b2f8cff15b2d20a427c381247a8ff6bb28d21e (diff)
drm/amdgpu: Destroy psp ring in hw_fini
Fix issue that PSP initialization will fail if reload amdgpu module. That's because the PSP ring must be destroyed to be ready for the next time PSP initialization. Changes in v2: - Move psp_ring_destroy before all BOs free (suggested by Ray Huang). Changes in v3: - Check firmware load type, if it is not PSP, we should do nothing in fw_fini(), and of course will not destroy PSP ring too (suggested by Ray Huang). Signed-off-by: Trigger Huang <trigger.huang@amd.com> Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 19180aaa8bf2..1e380fe29b5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -56,6 +56,7 @@ static int psp_sw_init(void *handle)
56 psp->prep_cmd_buf = psp_v3_1_prep_cmd_buf; 56 psp->prep_cmd_buf = psp_v3_1_prep_cmd_buf;
57 psp->ring_init = psp_v3_1_ring_init; 57 psp->ring_init = psp_v3_1_ring_init;
58 psp->ring_create = psp_v3_1_ring_create; 58 psp->ring_create = psp_v3_1_ring_create;
59 psp->ring_destroy = psp_v3_1_ring_destroy;
59 psp->cmd_submit = psp_v3_1_cmd_submit; 60 psp->cmd_submit = psp_v3_1_cmd_submit;
60 psp->compare_sram_data = psp_v3_1_compare_sram_data; 61 psp->compare_sram_data = psp_v3_1_compare_sram_data;
61 psp->smu_reload_quirk = psp_v3_1_smu_reload_quirk; 62 psp->smu_reload_quirk = psp_v3_1_smu_reload_quirk;
@@ -411,8 +412,12 @@ static int psp_hw_fini(void *handle)
411 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 412 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
412 struct psp_context *psp = &adev->psp; 413 struct psp_context *psp = &adev->psp;
413 414
414 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) 415 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
415 amdgpu_ucode_fini_bo(adev); 416 return 0;
417
418 amdgpu_ucode_fini_bo(adev);
419
420 psp_ring_destroy(psp, PSP_RING_TYPE__KM);
416 421
417 if (psp->tmr_buf) 422 if (psp->tmr_buf)
418 amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); 423 amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);