intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 12/12] drm/i915/lvds: ensure the HW is powered during HW state readout
Date: Tue, 16 Feb 2016 18:47:13 +0200	[thread overview]
Message-ID: <1455641233.19310.21.camel@intel.com> (raw)
In-Reply-To: <20160216160536.GS32705@phenom.ffwll.local>

On ti, 2016-02-16 at 17:05 +0100, Daniel Vetter wrote:
> On Fri, Feb 12, 2016 at 06:55:21PM +0200, Imre Deak wrote:
> > The assumption when adding the intel_display_power_is_enabled()
> > checks
> > was that if it returns success the power can't be turned off
> > afterwards
> > during the HW access, which is guaranteed by modeset locks. This
> > isn't
> > always true, so make sure we hold a dedicated reference for the
> > time of
> > the access.
> > 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> 
> For patches 9-12:
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> I'm assuming you're working on more patches to get rid of all the
> powe_is_enabled() checks, so that we can remove this fundamentally
> unsafe
> function evenutally?

Mika noticed that I missed to convert the one in
skl_ddb_get_hw_state(), I'll send a patch for it.

For the other two remaining callers I gave an explanation in the cover
letter as to why I haven't converted them.

--Imre


> -Daniel
> > ---
> >  drivers/gpu/drm/i915/intel_lvds.c | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_lvds.c
> > b/drivers/gpu/drm/i915/intel_lvds.c
> > index 811ddf7..30a8403 100644
> > --- a/drivers/gpu/drm/i915/intel_lvds.c
> > +++ b/drivers/gpu/drm/i915/intel_lvds.c
> > @@ -76,22 +76,30 @@ static bool intel_lvds_get_hw_state(struct
> > intel_encoder *encoder,
> >  	struct intel_lvds_encoder *lvds_encoder =
> > to_lvds_encoder(&encoder->base);
> >  	enum intel_display_power_domain power_domain;
> >  	u32 tmp;
> > +	bool ret;
> >  
> >  	power_domain = intel_display_port_power_domain(encoder);
> > -	if (!intel_display_power_is_enabled(dev_priv,
> > power_domain))
> > +	if (!intel_display_power_get_if_enabled(dev_priv,
> > power_domain))
> >  		return false;
> >  
> > +	ret = false;
> > +
> >  	tmp = I915_READ(lvds_encoder->reg);
> >  
> >  	if (!(tmp & LVDS_PORT_EN))
> > -		return false;
> > +		goto out;
> >  
> >  	if (HAS_PCH_CPT(dev))
> >  		*pipe = PORT_TO_PIPE_CPT(tmp);
> >  	else
> >  		*pipe = PORT_TO_PIPE(tmp);
> >  
> > -	return true;
> > +	ret = true;
> > +
> > +out:
> > +	intel_display_power_put(dev_priv, power_domain);
> > +
> > +	return ret;
> >  }
> >  
> >  static void intel_lvds_get_config(struct intel_encoder *encoder,
> > -- 
> > 2.5.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-02-16 16:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 16:55 [PATCH 00/12] drm/i915: add missing display power refs Imre Deak
2016-02-12 16:55 ` [PATCH 01/12] drm/i915: add helper to get a display power ref if it was already enabled Imre Deak
2016-02-15  8:09   ` Joonas Lahtinen
2016-02-15 14:18   ` [PATCH v2 " Imre Deak
2016-02-17 12:17     ` [PATCH v3 " Imre Deak
2016-02-12 16:55 ` [PATCH 02/12] drm/i915: ensure the HW is powered during display pipe HW readout Imre Deak
2016-02-15 13:23   ` Mika Kuoppala
2016-02-12 16:55 ` [PATCH 03/12] drm/i915/ibx: ensure the HW is powered during PLL " Imre Deak
2016-02-15 13:59   ` Mika Kuoppala
2016-02-12 16:55 ` [PATCH 04/12] drm/i915: ensure the HW is powered when disabling VGA Imre Deak
2016-02-12 16:55 ` [PATCH 05/12] drm/i915: ensure the HW is powered during HW access in assert_pipe Imre Deak
2016-02-12 16:55 ` [PATCH 06/12] drm/i915/crt: ensure the HW is powered during HW state readout Imre Deak
2016-02-12 16:55 ` [PATCH 07/12] drm/i915/ddi: " Imre Deak
2016-02-12 16:55 ` [PATCH 08/12] drm/i915: ensure the HW is powered when accessing the CRC HW block Imre Deak
2016-02-16 16:02   ` Daniel Vetter
2016-02-17 12:20     ` Imre Deak
2016-02-17 16:09       ` Daniel Vetter
2016-02-12 16:55 ` [PATCH 09/12] drm/i915/dp: ensure the HW is powered during HW state readout Imre Deak
2016-02-12 16:55 ` [PATCH 10/12] drm/i915/dsi: " Imre Deak
2016-02-12 16:55 ` [PATCH 11/12] drm/i915/hdmi: " Imre Deak
2016-02-12 16:55 ` [PATCH 12/12] drm/i915/lvds: " Imre Deak
2016-02-16 16:05   ` Daniel Vetter
2016-02-16 16:47     ` Imre Deak [this message]
2016-02-16 11:15 ` ✗ Fi.CI.BAT: failure for drm/i915: add missing display power refs (rev2) Patchwork
2016-02-16 14:04 ` [PATCH 00/12] drm/i915: add missing display power refs Mika Kuoppala
2016-02-16 17:35   ` Imre Deak
2016-02-17 12:44 ` ✓ Fi.CI.BAT: success for drm/i915: add missing display power refs (rev3) Patchwork
2016-02-17 14:21   ` Imre Deak

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=1455641233.19310.21.camel@intel.com \
    --to=imre.deak@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).