aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2018-10-09 01:55:49 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-10-10 15:48:52 -0400
commitc8963ea4ce1783034e1f9cf0d702fa490eb77836 (patch)
tree09cafe09785721ceba14450917a6461daeb5e5bf /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parenta2d31dc3cfab29f79c1cda2876d32b909ae26e25 (diff)
drm/amdgpu: Split amdgpu_ucode_init/fini_bo into two functions
1. one is for create/free bo when init/fini 2. one is for fill the bo before fw loading the ucode bo only need to be created when load driver and free when driver unload. when resume/reset, driver only need to re-fill the bo if the bo is allocated in vram. Suggested by Christian. v2: Return error when bo create failed. Reviewed-by: Alex Deucher <alexander.deucher@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/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94c92f5e11e0..680df0504f86 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1581,6 +1581,9 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
1581 } 1581 }
1582 } 1582 }
1583 1583
1584 r = amdgpu_ucode_create_bo(adev); /* create ucode bo when sw_init complete*/
1585 if (r)
1586 return r;
1584 for (i = 0; i < adev->num_ip_blocks; i++) { 1587 for (i = 0; i < adev->num_ip_blocks; i++) {
1585 if (!adev->ip_blocks[i].status.sw) 1588 if (!adev->ip_blocks[i].status.sw)
1586 continue; 1589 continue;
@@ -1803,6 +1806,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
1803 continue; 1806 continue;
1804 1807
1805 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { 1808 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
1809 amdgpu_ucode_free_bo(adev);
1806 amdgpu_free_static_csa(adev); 1810 amdgpu_free_static_csa(adev);
1807 amdgpu_device_wb_fini(adev); 1811 amdgpu_device_wb_fini(adev);
1808 amdgpu_device_vram_scratch_fini(adev); 1812 amdgpu_device_vram_scratch_fini(adev);