aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2017-10-18 05:19:42 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-10-19 15:27:16 -0400
commit6e13bdf6b2d71ab2366a9f87c99d11963aed3bad (patch)
tree6e4b7e06efc6b5cda96866fb0b0cf157e6f60654 /drivers/gpu/drm/amd
parent09da3c0e5b407eab205f6783bb17b5793da8be79 (diff)
drm/amdgpu: fix regresstion on SR-IOV gpu reset failed
fw ucode is corrupted after vf flr by PSP so ucode_init() is a must in psp_hw_init othewise KIQ/KCQ enabling will fail Revert "drm/amdgpu: refine code delete duplicated error handling" This reverts commit e57b87ff828f95efe992468e6d18c2c059b27aa9. Revert "drm/amdgpu: move amdgpu_ucode_init_bo to amdgpu_device.c" This reverts commit 815b8f8595148d06a64d2ce4282e8e80dfcb02f1. Reviewed-by: Monk Liu <monk.liu@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c9
3 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 9cdaba4af216..0731b4f9b25c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1679,7 +1679,6 @@ static int amdgpu_init(struct amdgpu_device *adev)
1679 return r; 1679 return r;
1680 } 1680 }
1681 adev->ip_blocks[i].status.sw = true; 1681 adev->ip_blocks[i].status.sw = true;
1682
1683 /* need to do gmc hw init early so we can allocate gpu mem */ 1682 /* need to do gmc hw init early so we can allocate gpu mem */
1684 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { 1683 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
1685 r = amdgpu_vram_scratch_init(adev); 1684 r = amdgpu_vram_scratch_init(adev);
@@ -1710,11 +1709,6 @@ static int amdgpu_init(struct amdgpu_device *adev)
1710 } 1709 }
1711 } 1710 }
1712 1711
1713 mutex_lock(&adev->firmware.mutex);
1714 if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT)
1715 amdgpu_ucode_init_bo(adev);
1716 mutex_unlock(&adev->firmware.mutex);
1717
1718 for (i = 0; i < adev->num_ip_blocks; i++) { 1712 for (i = 0; i < adev->num_ip_blocks; i++) {
1719 if (!adev->ip_blocks[i].status.sw) 1713 if (!adev->ip_blocks[i].status.sw)
1720 continue; 1714 continue;
@@ -1850,8 +1844,6 @@ static int amdgpu_fini(struct amdgpu_device *adev)
1850 1844
1851 adev->ip_blocks[i].status.hw = false; 1845 adev->ip_blocks[i].status.hw = false;
1852 } 1846 }
1853 if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT)
1854 amdgpu_ucode_fini_bo(adev);
1855 1847
1856 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1848 for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
1857 if (!adev->ip_blocks[i].status.sw) 1849 if (!adev->ip_blocks[i].status.sw)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
index 3b42f407971d..5f5aa5fddc16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
@@ -145,6 +145,8 @@ static int amdgpu_pp_hw_init(void *handle)
145 int ret = 0; 145 int ret = 0;
146 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 146 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
147 147
148 if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
149 amdgpu_ucode_init_bo(adev);
148 150
149 if (adev->powerplay.ip_funcs->hw_init) 151 if (adev->powerplay.ip_funcs->hw_init)
150 ret = adev->powerplay.ip_funcs->hw_init( 152 ret = adev->powerplay.ip_funcs->hw_init(
@@ -162,6 +164,9 @@ static int amdgpu_pp_hw_fini(void *handle)
162 ret = adev->powerplay.ip_funcs->hw_fini( 164 ret = adev->powerplay.ip_funcs->hw_fini(
163 adev->powerplay.pp_handle); 165 adev->powerplay.pp_handle);
164 166
167 if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
168 amdgpu_ucode_fini_bo(adev);
169
165 return ret; 170 return ret;
166} 171}
167 172
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index f1035a689d35..447d446b5015 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -411,6 +411,13 @@ static int psp_hw_init(void *handle)
411 return 0; 411 return 0;
412 412
413 mutex_lock(&adev->firmware.mutex); 413 mutex_lock(&adev->firmware.mutex);
414 /*
415 * This sequence is just used on hw_init only once, no need on
416 * resume.
417 */
418 ret = amdgpu_ucode_init_bo(adev);
419 if (ret)
420 goto failed;
414 421
415 ret = psp_load_fw(adev); 422 ret = psp_load_fw(adev);
416 if (ret) { 423 if (ret) {
@@ -435,6 +442,8 @@ static int psp_hw_fini(void *handle)
435 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) 442 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
436 return 0; 443 return 0;
437 444
445 amdgpu_ucode_fini_bo(adev);
446
438 psp_ring_destroy(psp, PSP_RING_TYPE__KM); 447 psp_ring_destroy(psp, PSP_RING_TYPE__KM);
439 448
440 amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); 449 amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);