@@ -3762,7 +3762,7 @@ static int amdgpu_device_ip_resume_phase1(struct amdgpu_device *adev)
37623762 *
37633763 * @adev: amdgpu_device pointer
37643764 *
3765- * First resume function for hardware IPs. The list of all the hardware
3765+ * Second resume function for hardware IPs. The list of all the hardware
37663766 * IPs that make up the asic is walked and the resume callbacks are run for
37673767 * all blocks except COMMON, GMC, and IH. resume puts the hardware into a
37683768 * functional state after a suspend and updates the software state as
@@ -3780,6 +3780,7 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
37803780 if (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_COMMON ||
37813781 adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_GMC ||
37823782 adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_IH ||
3783+ adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_DCE ||
37833784 adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_PSP )
37843785 continue ;
37853786 r = amdgpu_ip_block_resume (& adev -> ip_blocks [i ]);
@@ -3790,6 +3791,36 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
37903791 return 0 ;
37913792}
37923793
3794+ /**
3795+ * amdgpu_device_ip_resume_phase3 - run resume for hardware IPs
3796+ *
3797+ * @adev: amdgpu_device pointer
3798+ *
3799+ * Third resume function for hardware IPs. The list of all the hardware
3800+ * IPs that make up the asic is walked and the resume callbacks are run for
3801+ * all DCE. resume puts the hardware into a functional state after a suspend
3802+ * and updates the software state as necessary. This function is also used
3803+ * for restoring the GPU after a GPU reset.
3804+ *
3805+ * Returns 0 on success, negative error code on failure.
3806+ */
3807+ static int amdgpu_device_ip_resume_phase3 (struct amdgpu_device * adev )
3808+ {
3809+ int i , r ;
3810+
3811+ for (i = 0 ; i < adev -> num_ip_blocks ; i ++ ) {
3812+ if (!adev -> ip_blocks [i ].status .valid || adev -> ip_blocks [i ].status .hw )
3813+ continue ;
3814+ if (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_DCE ) {
3815+ r = amdgpu_ip_block_resume (& adev -> ip_blocks [i ]);
3816+ if (r )
3817+ return r ;
3818+ }
3819+ }
3820+
3821+ return 0 ;
3822+ }
3823+
37933824/**
37943825 * amdgpu_device_ip_resume - run resume for hardware IPs
37953826 *
@@ -3819,6 +3850,13 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev)
38193850 if (adev -> mman .buffer_funcs_ring -> sched .ready )
38203851 amdgpu_ttm_set_buffer_funcs_status (adev , true);
38213852
3853+ if (r )
3854+ return r ;
3855+
3856+ amdgpu_fence_driver_hw_init (adev );
3857+
3858+ r = amdgpu_device_ip_resume_phase3 (adev );
3859+
38223860 return r ;
38233861}
38243862
@@ -4899,7 +4937,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)
48994937 dev_err (adev -> dev , "amdgpu_device_ip_resume failed (%d).\n" , r );
49004938 goto exit ;
49014939 }
4902- amdgpu_fence_driver_hw_init (adev );
49034940
49044941 if (!adev -> in_s0ix ) {
49054942 r = amdgpu_amdkfd_resume (adev , adev -> in_runpm );
@@ -5484,6 +5521,10 @@ int amdgpu_device_reinit_after_reset(struct amdgpu_reset_context *reset_context)
54845521 if (tmp_adev -> mman .buffer_funcs_ring -> sched .ready )
54855522 amdgpu_ttm_set_buffer_funcs_status (tmp_adev , true);
54865523
5524+ r = amdgpu_device_ip_resume_phase3 (tmp_adev );
5525+ if (r )
5526+ goto out ;
5527+
54875528 if (vram_lost )
54885529 amdgpu_device_fill_reset_magic (tmp_adev );
54895530
0 commit comments