intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 13/18] drm/i915/hsw, bdw: Add irq_pipe_mask, has_vga power well attributes
Date: Tue, 11 Jul 2017 20:02:48 +0300	[thread overview]
Message-ID: <20170711170248.GB12629@intel.com> (raw)
In-Reply-To: <1499352040-8819-14-git-send-email-imre.deak@intel.com>

On Thu, Jul 06, 2017 at 05:40:35PM +0300, Imre Deak wrote:
> The pattern of a power well backing a set of pipe IRQ or VGA
> functionality applies to all HSW+ platforms. Using power well attributes
> instead of platform checks to decide whether to init/reset pipe IRQs and
> VGA correspondingly is cleaner and it allows us to unify the HSW/BDW and
> GEN9+ power well code in follow-up patches.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h         |  6 ++++++
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 34 ++++++++++++++++++++-------------
>  2 files changed, 27 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b27f2fc..dc5ca5a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1391,6 +1391,12 @@ struct i915_power_well {
>  		struct {
>  			enum dpio_phy phy;
>  		} bxt;
> +		struct {
> +			/* Mask of pipes whose IRQ logic is backed by the pw */
> +			u32 irq_pipe_mask;

u8 would be plenty. Might help keep the size down by a few bytes.

> +			/* The pw is backing the VGA functionality */
> +			bool has_vga:1;
> +		} hsw;
>  	};
>  	const struct i915_power_well_ops *ops;
>  };
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index e18c38e6..ab2e0ee 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -281,7 +281,8 @@ void intel_display_set_init_power(struct drm_i915_private *dev_priv,
>   * to be enabled, and it will only be disabled if none of the registers is
>   * requesting it to be enabled.
>   */
> -static void hsw_power_well_post_enable(struct drm_i915_private *dev_priv)
> +static void hsw_power_well_post_enable(struct drm_i915_private *dev_priv,
> +				       u32 irq_pipe_mask, bool has_vga)
>  {
>  	struct pci_dev *pdev = dev_priv->drm.pdev;
>  
> @@ -295,20 +296,21 @@ static void hsw_power_well_post_enable(struct drm_i915_private *dev_priv)
>  	 * sure vgacon can keep working normally without triggering interrupts
>  	 * and error messages.
>  	 */
> -	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> -	outb(inb(VGA_MSR_READ), VGA_MSR_WRITE);
> -	vga_put(pdev, VGA_RSRC_LEGACY_IO);
> +	if (has_vga) {
> +		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> +		outb(inb(VGA_MSR_READ), VGA_MSR_WRITE);
> +		vga_put(pdev, VGA_RSRC_LEGACY_IO);
> +	}
>  
> -	if (IS_BROADWELL(dev_priv))
> -		gen8_irq_power_well_post_enable(dev_priv,
> -						1 << PIPE_C | 1 << PIPE_B);
> +	if (irq_pipe_mask)
> +		gen8_irq_power_well_post_enable(dev_priv, irq_pipe_mask);
>  }
>  
> -static void hsw_power_well_pre_disable(struct drm_i915_private *dev_priv)
> +static void hsw_power_well_pre_disable(struct drm_i915_private *dev_priv,
> +				       u32 irq_pipe_mask)
>  {
> -	if (IS_BROADWELL(dev_priv))
> -		gen8_irq_power_well_pre_disable(dev_priv,
> -						1 << PIPE_C | 1 << PIPE_B);
> +	if (irq_pipe_mask)
> +		gen8_irq_power_well_pre_disable(dev_priv, irq_pipe_mask);
>  }
>  
>  static void skl_power_well_post_enable(struct drm_i915_private *dev_priv,
> @@ -413,7 +415,9 @@ static void hsw_power_well_enable(struct drm_i915_private *dev_priv,
>  				    HSW_PWR_WELL_CTL_STATE(id),
>  				    20))
>  		DRM_ERROR("Timeout enabling power well\n");
> -	hsw_power_well_post_enable(dev_priv);
> +
> +	hsw_power_well_post_enable(dev_priv, power_well->hsw.irq_pipe_mask,
> +				   power_well->hsw.has_vga);
>  }
>  
>  static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
> @@ -422,7 +426,8 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
>  	enum i915_power_well_id id = power_well->id;
>  	u32 val;
>  
> -	hsw_power_well_pre_disable(dev_priv);
> +	hsw_power_well_pre_disable(dev_priv, power_well->hsw.irq_pipe_mask);
> +
>  	val = I915_READ(HSW_PWR_WELL_DRIVER);
>  	I915_WRITE(HSW_PWR_WELL_DRIVER, val & ~HSW_PWR_WELL_CTL_REQ(id));
>  	POSTING_READ(HSW_PWR_WELL_DRIVER);
> @@ -2057,6 +2062,7 @@ static struct i915_power_well hsw_power_wells[] = {
>  		.domains = HSW_DISPLAY_POWER_DOMAINS,
>  		.ops = &hsw_power_well_ops,
>  		.id = HSW_DISP_PW_GLOBAL,
> +		.hsw.has_vga = true,
>  	},
>  };
>  
> @@ -2073,6 +2079,8 @@ static struct i915_power_well bdw_power_wells[] = {
>  		.domains = BDW_DISPLAY_POWER_DOMAINS,
>  		.ops = &hsw_power_well_ops,
>  		.id = HSW_DISP_PW_GLOBAL,
> +		.hsw.irq_pipe_mask = BIT(PIPE_B) | BIT(PIPE_C),
> +		.hsw.has_vga = true,
>  	},
>  };
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-07-11 17:03 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 14:40 [PATCH 00/23] drm/i915: Unify the HSW/BDW and GEN9+ power well code Imre Deak
2017-07-06 14:40 ` [PATCH 01/18] drm/i915/chv: Add unique power well ID for the pipe A power well Imre Deak
2017-07-11 16:31   ` Rodrigo Vivi
2017-07-06 14:40 ` [PATCH 02/18] drm/i915: Unify power well ID enums Imre Deak
2017-07-11 16:43   ` Rodrigo Vivi
2017-07-11 17:21     ` Rodrigo Vivi
2017-07-11 17:36       ` Imre Deak
2017-07-11 20:42   ` [PATCH v2 " Imre Deak
2017-07-06 14:40 ` [PATCH 03/18] drm/i915: Assign everywhere the always-on power well ID Imre Deak
2017-07-11 16:45   ` Rodrigo Vivi
2017-07-06 14:40 ` [PATCH 04/18] drm/i915/gen2: Add an ID for the display pipes power well Imre Deak
2017-07-11 16:50   ` Rodrigo Vivi
2017-07-11 17:01   ` Ville Syrjälä
2017-07-11 20:42   ` [PATCH v2 " Imre Deak
2017-07-06 14:40 ` [PATCH 05/18] drm/i915/hsw, bdw: Add an ID for the global display " Imre Deak
2017-07-11 17:08   ` Rodrigo Vivi
2017-07-11 20:42   ` [PATCH v2 " Imre Deak
2017-07-06 14:40 ` [PATCH 06/18] drm/i915: Check for duplicated power well IDs Imre Deak
2017-07-07 14:39   ` [PATCH v2 " Imre Deak
2017-07-11 17:08     ` Ville Syrjälä
2017-07-11 20:42   ` [PATCH v3 " Imre Deak
2017-07-20 13:08     ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 07/18] drm/i915/bxt, glk: Give a proper name to the power well struct phy field Imre Deak
2017-07-20 13:11   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 08/18] drm/i915/gen9+: Remove redundant power well state assert during enabling Imre Deak
2017-07-21 10:53   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 09/18] drm/i915/gen9+: Remove redundant state check during power well toggling Imre Deak
2017-07-21 11:14   ` Arkadiusz Hiler
2017-07-21 11:25     ` Imre Deak
2017-07-21 11:32       ` Arkadiusz Hiler
2017-07-21 13:24         ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 10/18] drm/i915/hsw, bdw: " Imre Deak
2017-07-21 11:39   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 11/18] drm/i915/hsw, bdw: Split power well set to enable/disable helpers Imre Deak
2017-07-21 11:51   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 12/18] drm/i915/hsw+: Unify the hsw/bdw and gen9+ power well req/state macros Imre Deak
2017-07-21 12:39   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 13/18] drm/i915/hsw, bdw: Add irq_pipe_mask, has_vga power well attributes Imre Deak
2017-07-11 17:02   ` Ville Syrjälä [this message]
2017-07-11 20:42   ` [PATCH v2 " Imre Deak
2017-07-12 15:54   ` [PATCH v3 " Imre Deak
2017-07-21 12:50     ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 14/18] drm/i915/hsw, bdw: Wait for the power well disabled state Imre Deak
2017-07-21 13:00   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 15/18] drm/i915/hsw+: Add has_fuses power well attribute Imre Deak
2017-07-11 17:05   ` Ville Syrjälä
2017-07-11 17:22     ` Imre Deak
2017-07-11 17:37       ` Ville Syrjälä
2017-07-11 17:49         ` Imre Deak
2017-07-11 20:42   ` [PATCH v2 " Imre Deak
2017-07-21 13:10     ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 16/18] drm/i915/gen9+: Unify the HSW/BDW and GEN9+ power well helpers Imre Deak
2017-07-11 20:42   ` [PATCH v2 " Imre Deak
2017-07-21 13:22     ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 17/18] drm/i915: Move hsw_power_well_enable() next to the rest of HSW helpers Imre Deak
2017-07-21 13:29   ` Arkadiusz Hiler
2017-07-06 14:40 ` [PATCH 18/18] drm/i915: Gather all the power well->domain mappings to one place Imre Deak
2017-07-21 13:39   ` Arkadiusz Hiler
2017-07-06 15:51 ` ✓ Fi.CI.BAT: success for drm/i915: Unify the HSW/BDW and GEN9+ power well code Patchwork
2017-07-07 14:59 ` ✓ Fi.CI.BAT: success for drm/i915: Unify the HSW/BDW and GEN9+ power well code (rev2) Patchwork
2017-07-11 21:01 ` ✗ Fi.CI.BAT: warning for drm/i915: Unify the HSW/BDW and GEN9+ power well code (rev8) Patchwork
2017-07-12 16:17 ` ✗ Fi.CI.BAT: failure for drm/i915: Unify the HSW/BDW and GEN9+ power well code (rev9) Patchwork
2017-07-12 17:17   ` Imre Deak
2017-07-24 14:32     ` 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=20170711170248.GB12629@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=imre.deak@intel.com \
    --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).