public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>, ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Avoid div-by-zero when pixel_multiplier is zero
Date: Tue, 10 Jun 2014 19:41:29 +0300	[thread overview]
Message-ID: <87zjhksona.fsf@intel.com> (raw)
In-Reply-To: <20140610071203.GG5821@phenom.ffwll.local>

On Tue, 10 Jun 2014, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Jun 09, 2014 at 04:20:46PM +0300, ville.syrjala@linux.intel.com wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> 
>> On certain platforms pixel_multiplier is read out in
>> .get_pipe_config(), but it also gets used to calculate the
>> pixel clock in intel_sdvo_get_config(). If the pipe is disable
>> but some SDVO outputs are active, we may end up dividing by zero
>> in intel_sdvo_get_config().
>> 
>> To avoid the problem simply check for zero pixel_multiplier and skip
>> the division. Another attempt at fixing this involved populating
>> pixel_multiplier to 1 even for disabled pipes, but that triggered a
>> WARN because SDVO_CMD_GET_CLOCK_RATE_MULT command failed and thus
>> encoder_pixel_multiplier was left at zero and didn't match
>> pipe_config->pixel_multiplier.
>> 
>> The "divide by pixel_multiplier" operation got introduced here:
>>  commit 18442d08786472c63a0a80c27f92b033dffc26de
>>  Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>  Date:   Fri Sep 13 16:00:08 2013 +0300
>> 
>>     drm/i915: Fix port_clock and adjusted_mode.clock readout all over
>> 
>> and it has caused a regression on certain machines since they would
>> hit the div-by-zero during resume.
>> 
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76520
>> Cc: <stable@vger.kernel.org> # 3.13+
>> Tested-by: Tim Richardson <tim@tim-richardson.net>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Pushed to -fixes, thanks for the patch and review.

BR,
Jani.

>
>> ---
>>  drivers/gpu/drm/i915/intel_sdvo.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
>> index 6a4d5bc..20375cc 100644
>> --- a/drivers/gpu/drm/i915/intel_sdvo.c
>> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
>> @@ -1385,7 +1385,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
>>  			 >> SDVO_PORT_MULTIPLY_SHIFT) + 1;
>>  	}
>>  
>> -	dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
>> +	dotclock = pipe_config->port_clock;
>> +	if (pipe_config->pixel_multiplier)
>> +		dotclock /= pipe_config->pixel_multiplier;
>>  
>>  	if (HAS_PCH_SPLIT(dev))
>>  		ironlake_check_encoder_dotclock(pipe_config, dotclock);
>> -- 
>> 1.8.5.5
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center

      reply	other threads:[~2014-06-10 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 13:20 [PATCH] drm/i915: Avoid div-by-zero when pixel_multiplier is zero ville.syrjala
2014-06-10  7:12 ` Daniel Vetter
2014-06-10 16:41   ` Jani Nikula [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjhksona.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox