@@ -924,32 +924,33 @@ static int amdgpu_device_asic_init(struct amdgpu_device *adev)
924924}
925925
926926/**
927- * amdgpu_device_vram_scratch_init - allocate the VRAM scratch page
927+ * amdgpu_device_mem_scratch_init - allocate the VRAM scratch page
928928 *
929929 * @adev: amdgpu_device pointer
930930 *
931931 * Allocates a scratch page of VRAM for use by various things in the
932932 * driver.
933933 */
934- static int amdgpu_device_vram_scratch_init (struct amdgpu_device * adev )
934+ static int amdgpu_device_mem_scratch_init (struct amdgpu_device * adev )
935935{
936- return amdgpu_bo_create_kernel (adev , AMDGPU_GPU_PAGE_SIZE ,
937- PAGE_SIZE , AMDGPU_GEM_DOMAIN_VRAM ,
938- & adev -> vram_scratch .robj ,
939- & adev -> vram_scratch .gpu_addr ,
940- (void * * )& adev -> vram_scratch .ptr );
936+ return amdgpu_bo_create_kernel (adev , AMDGPU_GPU_PAGE_SIZE , PAGE_SIZE ,
937+ AMDGPU_GEM_DOMAIN_VRAM |
938+ AMDGPU_GEM_DOMAIN_GTT ,
939+ & adev -> mem_scratch .robj ,
940+ & adev -> mem_scratch .gpu_addr ,
941+ (void * * )& adev -> mem_scratch .ptr );
941942}
942943
943944/**
944- * amdgpu_device_vram_scratch_fini - Free the VRAM scratch page
945+ * amdgpu_device_mem_scratch_fini - Free the VRAM scratch page
945946 *
946947 * @adev: amdgpu_device pointer
947948 *
948949 * Frees the VRAM scratch page.
949950 */
950- static void amdgpu_device_vram_scratch_fini (struct amdgpu_device * adev )
951+ static void amdgpu_device_mem_scratch_fini (struct amdgpu_device * adev )
951952{
952- amdgpu_bo_free_kernel (& adev -> vram_scratch .robj , NULL , NULL );
953+ amdgpu_bo_free_kernel (& adev -> mem_scratch .robj , NULL , NULL );
953954}
954955
955956/**
@@ -2390,9 +2391,9 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
23902391 if (amdgpu_sriov_vf (adev ))
23912392 amdgpu_virt_exchange_data (adev );
23922393
2393- r = amdgpu_device_vram_scratch_init (adev );
2394+ r = amdgpu_device_mem_scratch_init (adev );
23942395 if (r ) {
2395- DRM_ERROR ("amdgpu_vram_scratch_init failed %d\n" , r );
2396+ DRM_ERROR ("amdgpu_mem_scratch_init failed %d\n" , r );
23962397 goto init_failed ;
23972398 }
23982399 r = adev -> ip_blocks [i ].version -> funcs -> hw_init ((void * )adev );
@@ -2410,8 +2411,9 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
24102411 /* right after GMC hw init, we create CSA */
24112412 if (amdgpu_mcbp ) {
24122413 r = amdgpu_allocate_static_csa (adev , & adev -> virt .csa_obj ,
2413- AMDGPU_GEM_DOMAIN_VRAM ,
2414- AMDGPU_CSA_SIZE );
2414+ AMDGPU_GEM_DOMAIN_VRAM |
2415+ AMDGPU_GEM_DOMAIN_GTT ,
2416+ AMDGPU_CSA_SIZE );
24152417 if (r ) {
24162418 DRM_ERROR ("allocate CSA failed %d\n" , r );
24172419 goto init_failed ;
@@ -2581,9 +2583,10 @@ int amdgpu_device_set_cg_state(struct amdgpu_device *adev,
25812583 i = state == AMD_CG_STATE_GATE ? j : adev -> num_ip_blocks - j - 1 ;
25822584 if (!adev -> ip_blocks [i ].status .late_initialized )
25832585 continue ;
2584- /* skip CG for GFX on S0ix */
2586+ /* skip CG for GFX, SDMA on S0ix */
25852587 if (adev -> in_s0ix &&
2586- adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_GFX )
2588+ (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_GFX ||
2589+ adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_SDMA ))
25872590 continue ;
25882591 /* skip CG for VCE/UVD, it's handled specially */
25892592 if (adev -> ip_blocks [i ].version -> type != AMD_IP_BLOCK_TYPE_UVD &&
@@ -2617,9 +2620,10 @@ int amdgpu_device_set_pg_state(struct amdgpu_device *adev,
26172620 i = state == AMD_PG_STATE_GATE ? j : adev -> num_ip_blocks - j - 1 ;
26182621 if (!adev -> ip_blocks [i ].status .late_initialized )
26192622 continue ;
2620- /* skip PG for GFX on S0ix */
2623+ /* skip PG for GFX, SDMA on S0ix */
26212624 if (adev -> in_s0ix &&
2622- adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_GFX )
2625+ (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_GFX ||
2626+ adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_SDMA ))
26232627 continue ;
26242628 /* skip CG for VCE/UVD, it's handled specially */
26252629 if (adev -> ip_blocks [i ].version -> type != AMD_IP_BLOCK_TYPE_UVD &&
@@ -2871,7 +2875,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
28712875 amdgpu_ucode_free_bo (adev );
28722876 amdgpu_free_static_csa (& adev -> virt .csa_obj );
28732877 amdgpu_device_wb_fini (adev );
2874- amdgpu_device_vram_scratch_fini (adev );
2878+ amdgpu_device_mem_scratch_fini (adev );
28752879 amdgpu_ib_pool_fini (adev );
28762880 }
28772881
@@ -3027,6 +3031,12 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
30273031 adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_MES ))
30283032 continue ;
30293033
3034+ /* SDMA 5.x+ is part of GFX power domain so it's covered by GFXOFF */
3035+ if (adev -> in_s0ix &&
3036+ (adev -> ip_versions [SDMA0_HWIP ][0 ] >= IP_VERSION (5 , 0 , 0 )) &&
3037+ (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_SDMA ))
3038+ continue ;
3039+
30303040 /* XXX handle errors */
30313041 r = adev -> ip_blocks [i ].version -> funcs -> suspend (adev );
30323042 /* XXX handle errors */
@@ -3227,15 +3237,6 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32273237 return r ;
32283238 }
32293239 adev -> ip_blocks [i ].status .hw = true;
3230-
3231- if (adev -> in_s0ix && adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_SMC ) {
3232- /* disable gfxoff for IP resume. The gfxoff will be re-enabled in
3233- * amdgpu_device_resume() after IP resume.
3234- */
3235- amdgpu_gfx_off_ctrl (adev , false);
3236- DRM_DEBUG ("will disable gfxoff for re-initializing other blocks\n" );
3237- }
3238-
32393240 }
32403241
32413242 return 0 ;
@@ -4221,13 +4222,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
42214222 /* Make sure IB tests flushed */
42224223 flush_delayed_work (& adev -> delayed_init_work );
42234224
4224- if (adev -> in_s0ix ) {
4225- /* re-enable gfxoff after IP resume. This re-enables gfxoff after
4226- * it was disabled for IP resume in amdgpu_device_ip_resume_phase2().
4227- */
4228- amdgpu_gfx_off_ctrl (adev , true);
4229- DRM_DEBUG ("will enable gfxoff for the mission mode\n" );
4230- }
42314225 if (fbcon )
42324226 drm_fb_helper_set_suspend_unlocked (adev_to_drm (adev )-> fb_helper , false);
42334227
@@ -4608,11 +4602,6 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)
46084602 if (!amdgpu_ras_is_poison_mode_supported (adev ))
46094603 return true;
46104604
4611- if (!amdgpu_device_ip_check_soft_reset (adev )) {
4612- dev_info (adev -> dev ,"Timeout, but no hardware hang detected.\n" );
4613- return false;
4614- }
4615-
46164605 if (amdgpu_sriov_vf (adev ))
46174606 return true;
46184607
@@ -4737,7 +4726,8 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
47374726 if (!need_full_reset )
47384727 need_full_reset = amdgpu_device_ip_need_full_reset (adev );
47394728
4740- if (!need_full_reset && amdgpu_gpu_recovery ) {
4729+ if (!need_full_reset && amdgpu_gpu_recovery &&
4730+ amdgpu_device_ip_check_soft_reset (adev )) {
47414731 amdgpu_device_ip_pre_soft_reset (adev );
47424732 r = amdgpu_device_ip_soft_reset (adev );
47434733 amdgpu_device_ip_post_soft_reset (adev );
0 commit comments