drm/radeon/kms: wait for cp idle before stopping it.
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/gpu/drm/radeon/r100.c | 18 ++++++++++++ drivers/gpu/drm/radeon/r100d.h | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r100.c +18 -0
@@ -490,6 +490,21 @@ int r100_copy_blit(struct radeon_device *rdev,/* * CP */ +static int r100_cp_wait_for_idle (struct radeon_device *rdev) +{ +unsigned i; +u32 tmp; + +for (i =0 ; i < rdev->usec_timeout; i++) { + tmp =RREG32 (R_000E40_RBBM_STATUS ); +if (!G_000E40_CP_CMDSTRM_BUSY (tmp)) { +return 0 ; + } +udelay (1 ); + } +return -1 ; +} +void r100_ring_start (struct radeon_device *rdev) {int r;
@@ -718,6 +733,9 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size)void r100_cp_fini (struct radeon_device *rdev) { +if (r100_cp_wait_for_idle (rdev)) { +DRM_ERROR ("Wait for CP idle timeout, shutting down CP.\n" ); + }/* Disable ring */ r100_cp_disable (rdev);radeon_ring_fini (rdev);
drivers/gpu/drm/radeon/r100d.h +60 -0
64 lines not on this page · raw message
Signature · 1 line
1.6.4.1