<div dir="ltr"><div>I had time to test the patches during weekend. The first div-by-zero patch allows the machine to boot with modeset enabled. The second patch you created actually makes X stable (with only my patch it used to halt for 5 seconds every 1 second). So both patches look excellent.<br>
<br>Thank you for making my machine usable and hope to see the patches reach official kernel soon.<br><br></div>-Mikko<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 9:14 PM, Alex Deucher <span dir="ltr"><<a href="mailto:alexdeucher@gmail.com" target="_blank">alexdeucher@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Jan 29, 2013 at 1:09 PM, Mikko Tiihonen <<a href="mailto:mikko.tiihonen@iki.fi">mikko.tiihonen@iki.fi</a>> wrote:<br>

> Hi,<br>
><br>
> I have a A4-3400 CPU that I bought half a year ago. I've tried once month,<br>
> but  Fedora has never succeeded in booting in graphical mode.<br>
><br>
> Some time ago a finally built some custom kernels to figure out why. I<br>
> created a bug to Fedora bug, but it has not progressed.<br>
><br>
> Analysis:<br>
> The radeon module startup fails with division by zero in<br>
> r6xx_remap_render_backend because the first RB is not enabled and the code<br>
> assuming that enabled RBs must be all the first ones of the valid range.<br>
><br>
><br>
> Longer version:<br>
><br>
> In r600.c:r6xx_remap_render_backend<br>
><br>
> The function contains only one divide:<br>
><br>
> u32 r6xx_remap_render_backend(struct radeon_device *rdev,<br>
>                               u32 tiling_pipe_num,<br>
>                               u32 max_rb_num,<br>
>                               u32 total_max_rb_num,<br>
>                               u32 disabled_rb_mask)<br>
> {<br>
>         u32 rendering_pipe_num, rb_num_width, req_rb_num;<br>
> ...<br>
>         /* mask out the RBs that don't exist on that asic */<br>
>         disabled_rb_mask |= (0xff << max_rb_num) & 0xff;<br>
><br>
>         rendering_pipe_num = 1 << tiling_pipe_num;<br>
>         req_rb_num = total_max_rb_num -<br>
> r600_count_pipe_bits(disabled_rb_mask);<br>
>         BUG_ON(rendering_pipe_num < req_rb_num);<br>
><br>
>         pipe_rb_ratio = rendering_pipe_num / req_rb_num;<br>
><br>
> I added a printk to see what actual parameters are passed in:<br>
><br>
> tiling_pipe_num=2, max_rb_num=1, total_max_rb_num=8, disabled_rb_mask=253<br>
><br>
> Using those to calculate the divide by zero comes from:<br>
><br>
> disabled_rb_mask |= 254; -> 255<br>
> req_rb_num = 8 - 8;<br>
><br>
><br>
> Quick fix for stable kernel series:<br>
><br>
> The attached fix activates only in the division by zero case and instead of<br>
> failing uses the given disabled_rb_mask. This is guaranteed to be regression<br>
> free and actually allows me to load the radeon driver successfully. It does<br>
> help with cards that currently work, but for which some usable RBs are<br>
> disabled due to the eager masking.<br>
><br>
><br>
> Proper fix would propably be to find out think why the disabled_rb_mask is<br>
> masked the way it is, were there bugs in other places for which it is a<br>
> workaround. I can see two possible modifictions:<br>
> 1) only mask bits exceeding total_max_rb_num instead of the max_rb_num since<br>
> the one enabled RB on A4-3400 can propably be any one of the 8 possible<br>
> values.<br>
> 2) or activate the current code only if there are more than max_rb_num zero<br>
> bits in the given disabled_rb_mask<br>
<br>
</div></div>Looks good.  I've gone ahead and applied your patch for safety sake<br>
and I also added a patch to set up the RBs correctly on your board.<br>
Please test the attached patches.<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888"><br>
Alex<br>
</font></span></blockquote></div><br></div>