@@ -1568,7 +1568,7 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
15681568 * @pdev: pci dev pointer
15691569 * @state: vga_switcheroo state
15701570 *
1571- * Callback for the switcheroo driver. Suspends or resumes the
1571+ * Callback for the switcheroo driver. Suspends or resumes
15721572 * the asics before or after it is powered up using ACPI methods.
15731573 */
15741574static void amdgpu_switcheroo_set_state (struct pci_dev * pdev ,
@@ -2397,7 +2397,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
23972397 adev -> ip_blocks [i ].status .hw = true;
23982398
23992399 /* right after GMC hw init, we create CSA */
2400- if (amdgpu_mcbp || amdgpu_sriov_vf ( adev ) ) {
2400+ if (amdgpu_mcbp ) {
24012401 r = amdgpu_allocate_static_csa (adev , & adev -> virt .csa_obj ,
24022402 AMDGPU_GEM_DOMAIN_VRAM ,
24032403 AMDGPU_CSA_SIZE );
@@ -3210,6 +3210,15 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32103210 return r ;
32113211 }
32123212 adev -> ip_blocks [i ].status .hw = true;
3213+
3214+ if (adev -> in_s0ix && adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_SMC ) {
3215+ /* disable gfxoff for IP resume. The gfxoff will be re-enabled in
3216+ * amdgpu_device_resume() after IP resume.
3217+ */
3218+ amdgpu_gfx_off_ctrl (adev , false);
3219+ DRM_DEBUG ("will disable gfxoff for re-initializing other blocks\n" );
3220+ }
3221+
32133222 }
32143223
32153224 return 0 ;
@@ -4051,15 +4060,18 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
40514060 * at suspend time.
40524061 *
40534062 */
4054- static void amdgpu_device_evict_resources (struct amdgpu_device * adev )
4063+ static int amdgpu_device_evict_resources (struct amdgpu_device * adev )
40554064{
4065+ int ret ;
4066+
40564067 /* No need to evict vram on APUs for suspend to ram or s2idle */
40574068 if ((adev -> in_s3 || adev -> in_s0ix ) && (adev -> flags & AMD_IS_APU ))
4058- return ;
4069+ return 0 ;
40594070
4060- if (amdgpu_ttm_evict_resources (adev , TTM_PL_VRAM ))
4071+ ret = amdgpu_ttm_evict_resources (adev , TTM_PL_VRAM );
4072+ if (ret )
40614073 DRM_WARN ("evicting device resources failed\n" );
4062-
4074+ return ret ;
40634075}
40644076
40654077/*
@@ -4109,7 +4121,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
41094121 if (!adev -> in_s0ix )
41104122 amdgpu_amdkfd_suspend (adev , adev -> in_runpm );
41114123
4112- amdgpu_device_evict_resources (adev );
4124+ r = amdgpu_device_evict_resources (adev );
4125+ if (r )
4126+ return r ;
41134127
41144128 amdgpu_fence_driver_hw_fini (adev );
41154129
@@ -4183,8 +4197,17 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
41834197 }
41844198
41854199 /* Make sure IB tests flushed */
4200+ if (amdgpu_sriov_vf (adev ))
4201+ amdgpu_irq_gpu_reset_resume_helper (adev );
41864202 flush_delayed_work (& adev -> delayed_init_work );
41874203
4204+ if (adev -> in_s0ix ) {
4205+ /* re-enable gfxoff after IP resume. This re-enables gfxoff after
4206+ * it was disabled for IP resume in amdgpu_device_ip_resume_phase2().
4207+ */
4208+ amdgpu_gfx_off_ctrl (adev , true);
4209+ DRM_DEBUG ("will enable gfxoff for the mission mode\n" );
4210+ }
41884211 if (fbcon )
41894212 drm_fb_helper_set_suspend_unlocked (adev_to_drm (adev )-> fb_helper , false);
41904213
@@ -5381,7 +5404,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
53815404 drm_sched_start (& ring -> sched , !tmp_adev -> asic_reset_res );
53825405 }
53835406
5384- if (adev -> enable_mes )
5407+ if (adev -> enable_mes && adev -> ip_versions [ GC_HWIP ][ 0 ] != IP_VERSION ( 11 , 0 , 3 ) )
53855408 amdgpu_mes_self_test (tmp_adev );
53865409
53875410 if (!drm_drv_uses_atomic_modeset (adev_to_drm (tmp_adev )) && !job_signaled ) {
0 commit comments