diff options
author | Jerome Glisse <jglisse@redhat.com> | 2009-09-09 16:23:45 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-09-09 20:12:41 -0400 |
commit | 45600232b3dbb97817c9e15de848c742901893e1 (patch) | |
tree | dc8953d21cfc3d48faedcabef87e62dee3242ee1 /drivers/gpu/drm/radeon/r100.c | |
parent | 5d93b135fc051be3740cbe55729fc7b86a7069d7 (diff) |
drm/radeon/kms: wait for cp idle before stopping it.
If we stop CP and that it's still processing thing GPU hang might
happen, this patch wait for CP idle (the wait can timeout) so we
can avoid shutting down CP at bad time. This is especialy usefull
when reseting the GPU as it seems GPU reset fails to properly reset
CP when the CP wasn't stop after being idle.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 5708c07ce733..938a6936d929 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -487,6 +487,21 @@ int r100_copy_blit(struct radeon_device *rdev, | |||
487 | /* | 487 | /* |
488 | * CP | 488 | * CP |
489 | */ | 489 | */ |
490 | static int r100_cp_wait_for_idle(struct radeon_device *rdev) | ||
491 | { | ||
492 | unsigned i; | ||
493 | u32 tmp; | ||
494 | |||
495 | for (i = 0; i < rdev->usec_timeout; i++) { | ||
496 | tmp = RREG32(R_000E40_RBBM_STATUS); | ||
497 | if (!G_000E40_CP_CMDSTRM_BUSY(tmp)) { | ||
498 | return 0; | ||
499 | } | ||
500 | udelay(1); | ||
501 | } | ||
502 | return -1; | ||
503 | } | ||
504 | |||
490 | void r100_ring_start(struct radeon_device *rdev) | 505 | void r100_ring_start(struct radeon_device *rdev) |
491 | { | 506 | { |
492 | int r; | 507 | int r; |
@@ -715,6 +730,9 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
715 | 730 | ||
716 | void r100_cp_fini(struct radeon_device *rdev) | 731 | void r100_cp_fini(struct radeon_device *rdev) |
717 | { | 732 | { |
733 | if (r100_cp_wait_for_idle(rdev)) { | ||
734 | DRM_ERROR("Wait for CP idle timeout, shutting down CP.\n"); | ||
735 | } | ||
718 | /* Disable ring */ | 736 | /* Disable ring */ |
719 | rdev->cp.ready = false; | 737 | rdev->cp.ready = false; |
720 | WREG32(RADEON_CP_CSQ_CNTL, 0); | 738 | WREG32(RADEON_CP_CSQ_CNTL, 0); |