All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Avoid divbyzero in modesetting
Date: Mon, 22 Feb 2016 14:09:52 +0100	[thread overview]
Message-ID: <56CB08A0.30406@linux.intel.com> (raw)
In-Reply-To: <1456141948-7172-1-git-send-email-tvrtko.ursulin@linux.intel.com>

Hey,

Op 22-02-16 om 12:52 schreef Tvrtko Ursulin:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Not sure if intel_wm_config->num_pipes_active is supposed to
> ever be zero when intel_update_watermarks gets called. But
> since it can be triggered in early platform bringup perhaps
> we want to guard against it rather than divide by zero.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index feb57598727a..2b7998889617 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -2831,8 +2831,13 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
>  		nth_active_pipe++;
>  	}
>  
> -	pipe_size = ddb_size / config->num_pipes_active;
> -	alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active;
> +	if (WARN_ON(!config->num_pipes_active)) {
> +		pipe_size = 0;
> +		alloc->start = 0;
> +	} else {
> +		pipe_size = ddb_size / config->num_pipes_active;
> +		alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active;
> +	}
>  	alloc->end = alloc->start + pipe_size;
>  }
>  
How can this happen? It seems in that case cstate->base.active would be false for the current pipe,
and the code should bail early already..
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-02-22 13:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 11:52 [PATCH] drm/i915: Avoid divbyzero in modesetting Tvrtko Ursulin
2016-02-22 12:17 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-02-22 13:09 ` Maarten Lankhorst [this message]
2016-02-22 14:27   ` [PATCH] " Tvrtko Ursulin
2016-02-22 14:56     ` Maarten Lankhorst
2016-02-22 15:22       ` Tvrtko Ursulin
2016-02-23  8:38     ` Maarten Lankhorst
2016-02-23  9:49       ` Tvrtko Ursulin

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=56CB08A0.30406@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.