diff options
| author | Mikko Tiihonen <mikko.tiihonen@iki.fi> | 2013-01-30 14:10:04 -0500 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2013-01-30 14:10:04 -0500 |
| commit | f689e3acbd2e48cc4101e0af454193f81af4baaf (patch) | |
| tree | 39cd14fa86616b7dca061d3211079f235386e02e /drivers | |
| parent | f7eb97300832f4fe5fe916c5d84cd2e25169330e (diff) | |
drm/radeon: protect against div by 0 in backend setup
Make sure at least one RB is enabled in
r6xx_remap_render_backend() to avoid an division by
zero in some corner cases.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=892233
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index bc2540b17c5e..becb03e8b32f 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -1462,12 +1462,15 @@ u32 r6xx_remap_render_backend(struct radeon_device *rdev, | |||
| 1462 | u32 disabled_rb_mask) | 1462 | u32 disabled_rb_mask) |
| 1463 | { | 1463 | { |
| 1464 | u32 rendering_pipe_num, rb_num_width, req_rb_num; | 1464 | u32 rendering_pipe_num, rb_num_width, req_rb_num; |
| 1465 | u32 pipe_rb_ratio, pipe_rb_remain; | 1465 | u32 pipe_rb_ratio, pipe_rb_remain, tmp; |
| 1466 | u32 data = 0, mask = 1 << (max_rb_num - 1); | 1466 | u32 data = 0, mask = 1 << (max_rb_num - 1); |
| 1467 | unsigned i, j; | 1467 | unsigned i, j; |
| 1468 | 1468 | ||
| 1469 | /* mask out the RBs that don't exist on that asic */ | 1469 | /* mask out the RBs that don't exist on that asic */ |
| 1470 | disabled_rb_mask |= (0xff << max_rb_num) & 0xff; | 1470 | tmp = disabled_rb_mask | ((0xff << max_rb_num) & 0xff); |
| 1471 | /* make sure at least one RB is available */ | ||
| 1472 | if ((tmp & 0xff) != 0xff) | ||
| 1473 | disabled_rb_mask = tmp; | ||
| 1471 | 1474 | ||
| 1472 | rendering_pipe_num = 1 << tiling_pipe_num; | 1475 | rendering_pipe_num = 1 << tiling_pipe_num; |
| 1473 | req_rb_num = total_max_rb_num - r600_count_pipe_bits(disabled_rb_mask); | 1476 | req_rb_num = total_max_rb_num - r600_count_pipe_bits(disabled_rb_mask); |
