diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2013-04-09 10:13:22 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-04-11 09:22:04 -0400 |
commit | cedb655a3a7764c3fd946077944383c9e0e68dd4 (patch) | |
tree | 60af8b9cb083ff6c0f4707afe84e0edf87d135a2 /drivers | |
parent | 55b615aec66d88a0c5dbb9fc026dbdd3b0c121d2 (diff) |
drm/radeon: handle broken disabled rb mask gracefully
If the disabled rb mask register is not properly initialized
program a sane default based on the number of RBs for the
asic. This avoids a potential divide by 0 when calculating
the backend mask.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/ni.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index cd7951060afd..b114252e7810 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2261,6 +2261,14 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2261 | } | 2261 | } |
2262 | /* enabled rb are just the one not disabled :) */ | 2262 | /* enabled rb are just the one not disabled :) */ |
2263 | disabled_rb_mask = tmp; | 2263 | disabled_rb_mask = tmp; |
2264 | tmp = 0; | ||
2265 | for (i = 0; i < rdev->config.evergreen.max_backends; i++) | ||
2266 | tmp |= (1 << i); | ||
2267 | /* if all the backends are disabled, fix it up here */ | ||
2268 | if ((disabled_rb_mask & tmp) == tmp) { | ||
2269 | for (i = 0; i < rdev->config.evergreen.max_backends; i++) | ||
2270 | disabled_rb_mask &= ~(1 << i); | ||
2271 | } | ||
2264 | 2272 | ||
2265 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); | 2273 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); |
2266 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); | 2274 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index a23503e16083..78aead0ada7b 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -615,6 +615,14 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
615 | } | 615 | } |
616 | /* enabled rb are just the one not disabled :) */ | 616 | /* enabled rb are just the one not disabled :) */ |
617 | disabled_rb_mask = tmp; | 617 | disabled_rb_mask = tmp; |
618 | tmp = 0; | ||
619 | for (i = 0; i < (rdev->config.cayman.max_backends_per_se * rdev->config.cayman.max_shader_engines); i++) | ||
620 | tmp |= (1 << i); | ||
621 | /* if all the backends are disabled, fix it up here */ | ||
622 | if ((disabled_rb_mask & tmp) == tmp) { | ||
623 | for (i = 0; i < (rdev->config.cayman.max_backends_per_se * rdev->config.cayman.max_shader_engines); i++) | ||
624 | disabled_rb_mask &= ~(1 << i); | ||
625 | } | ||
618 | 626 | ||
619 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); | 627 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); |
620 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); | 628 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); |