Skip to content

Commit 1e902a6

Browse files
Xiaojie Yuanalexdeucher
authored andcommitted
drm/amdgpu/gfx10: explicitly wait for cp idle after halt/unhalt
50us is not enough to wait for cp ready after gpu reset on some navi asics. Signed-off-by: Xiaojie Yuan <[email protected]> Suggested-by: Jack Xiao <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 5e18d2b commit 1e902a6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ static int gfx_v10_0_wait_for_rlc_autoload_complete(struct amdgpu_device *adev)
24002400
return 0;
24012401
}
24022402

2403-
static void gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable)
2403+
static int gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable)
24042404
{
24052405
int i;
24062406
u32 tmp = RREG32_SOC15(GC, 0, mmCP_ME_CNTL);
@@ -2413,7 +2413,17 @@ static void gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable)
24132413
adev->gfx.gfx_ring[i].sched.ready = false;
24142414
}
24152415
WREG32_SOC15(GC, 0, mmCP_ME_CNTL, tmp);
2416-
udelay(50);
2416+
2417+
for (i = 0; i < adev->usec_timeout; i++) {
2418+
if (RREG32_SOC15(GC, 0, mmCP_STAT) == 0)
2419+
break;
2420+
udelay(1);
2421+
}
2422+
2423+
if (i >= adev->usec_timeout)
2424+
DRM_ERROR("failed to %s cp gfx\n", enable ? "unhalt" : "halt");
2425+
2426+
return 0;
24172427
}
24182428

24192429
static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev)

0 commit comments

Comments
 (0)