* [PATCH] drm/i915: Hold forcewake for whole of punit communication
@ 2017-02-15 10:41 Chris Wilson
2017-02-15 11:33 ` Ville Syrjälä
2017-02-15 12:52 ` ✓ Fi.CI.BAT: success for " Patchwork
0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2017-02-15 10:41 UTC (permalink / raw)
To: intel-gfx; +Cc: Mika Kuoppala
Take the forcewake for punit access and hold it across our waits to
ensure that the powerwell is not dropped by a spurious sleep.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
---
drivers/gpu/drm/i915/intel_sideband.c | 55 ++++++++++++++++++++++-------------
1 file changed, 34 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_sideband.c b/drivers/gpu/drm/i915/intel_sideband.c
index 9f782b5eb6e6..ce6d166d67ea 100644
--- a/drivers/gpu/drm/i915/intel_sideband.c
+++ b/drivers/gpu/drm/i915/intel_sideband.c
@@ -39,42 +39,55 @@
/* Private register write, double-word addressing, non-posted */
#define SB_CRWRDA_NP 0x07
-static int vlv_sideband_rw(struct drm_i915_private *dev_priv, u32 devfn,
- u32 port, u32 opcode, u32 addr, u32 *val)
+static int vlv_sideband_rw(struct drm_i915_private *dev_priv,
+ u32 devfn, u32 port, u32 opcode, u32 addr,
+ u32 *val)
{
- u32 cmd, be = 0xf, bar = 0;
- bool is_read = (opcode == SB_MRD_NP || opcode == SB_CRRDDA_NP);
+ const bool is_read = (opcode == SB_MRD_NP || opcode == SB_CRRDDA_NP);
+ enum forcewake_domains fw_domains;
+ int err = 0;
- cmd = (devfn << IOSF_DEVFN_SHIFT) | (opcode << IOSF_OPCODE_SHIFT) |
- (port << IOSF_PORT_SHIFT) | (be << IOSF_BYTE_ENABLES_SHIFT) |
- (bar << IOSF_BAR_SHIFT);
+ lockdep_assert_held(&dev_priv->sb_lock);
- WARN_ON(!mutex_is_locked(&dev_priv->sb_lock));
+ fw_domains = intel_uncore_forcewake_for_reg(dev_priv,
+ VLV_IOSF_DOORBELL_REQ,
+ FW_REG_READ | FW_REG_WRITE);
+ intel_uncore_forcewake_get(dev_priv, fw_domains);
- if (intel_wait_for_register(dev_priv,
- VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
- 5)) {
+ if (intel_wait_for_register_fw(dev_priv,
+ VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
+ 5)) {
DRM_DEBUG_DRIVER("IOSF sideband idle wait (%s) timed out\n",
is_read ? "read" : "write");
- return -EAGAIN;
+ err = -EAGAIN;
+ goto out;
}
- I915_WRITE(VLV_IOSF_ADDR, addr);
- I915_WRITE(VLV_IOSF_DATA, is_read ? 0 : *val);
- I915_WRITE(VLV_IOSF_DOORBELL_REQ, cmd);
+ I915_WRITE_FW(VLV_IOSF_ADDR, addr);
+ I915_WRITE_FW(VLV_IOSF_DATA, is_read ? 0 : *val);
+ I915_WRITE_FW(VLV_IOSF_DOORBELL_REQ,
+ (devfn << IOSF_DEVFN_SHIFT) |
+ (opcode << IOSF_OPCODE_SHIFT) |
+ (port << IOSF_PORT_SHIFT) |
+ (0xf << IOSF_BYTE_ENABLES_SHIFT) |
+ (0 << IOSF_BAR_SHIFT));
- if (intel_wait_for_register(dev_priv,
- VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
- 5)) {
+
+ if (intel_wait_for_register_fw(dev_priv,
+ VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
+ 5)) {
DRM_DEBUG_DRIVER("IOSF sideband finish wait (%s) timed out\n",
is_read ? "read" : "write");
- return -ETIMEDOUT;
+ err = -ETIMEDOUT;
+ goto out;
}
if (is_read)
- *val = I915_READ(VLV_IOSF_DATA);
+ *val = I915_READ_FW(VLV_IOSF_DATA);
- return 0;
+out:
+ intel_uncore_forcewake_put(dev_priv, fw_domains);
+ return err;
}
u32 vlv_punit_read(struct drm_i915_private *dev_priv, u32 addr)
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: Hold forcewake for whole of punit communication
2017-02-15 10:41 [PATCH] drm/i915: Hold forcewake for whole of punit communication Chris Wilson
@ 2017-02-15 11:33 ` Ville Syrjälä
2017-02-15 12:06 ` Chris Wilson
2017-02-15 12:52 ` ✓ Fi.CI.BAT: success for " Patchwork
1 sibling, 1 reply; 4+ messages in thread
From: Ville Syrjälä @ 2017-02-15 11:33 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, Mika Kuoppala
On Wed, Feb 15, 2017 at 10:41:29AM +0000, Chris Wilson wrote:
> Take the forcewake for punit access and hold it across our waits to
> ensure that the powerwell is not dropped by a spurious sleep.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/intel_sideband.c | 55 ++++++++++++++++++++++-------------
> 1 file changed, 34 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sideband.c b/drivers/gpu/drm/i915/intel_sideband.c
> index 9f782b5eb6e6..ce6d166d67ea 100644
> --- a/drivers/gpu/drm/i915/intel_sideband.c
> +++ b/drivers/gpu/drm/i915/intel_sideband.c
> @@ -39,42 +39,55 @@
> /* Private register write, double-word addressing, non-posted */
> #define SB_CRWRDA_NP 0x07
>
> -static int vlv_sideband_rw(struct drm_i915_private *dev_priv, u32 devfn,
> - u32 port, u32 opcode, u32 addr, u32 *val)
> +static int vlv_sideband_rw(struct drm_i915_private *dev_priv,
> + u32 devfn, u32 port, u32 opcode, u32 addr,
> + u32 *val)
> {
> - u32 cmd, be = 0xf, bar = 0;
> - bool is_read = (opcode == SB_MRD_NP || opcode == SB_CRRDDA_NP);
> + const bool is_read = (opcode == SB_MRD_NP || opcode == SB_CRRDDA_NP);
> + enum forcewake_domains fw_domains;
> + int err = 0;
>
> - cmd = (devfn << IOSF_DEVFN_SHIFT) | (opcode << IOSF_OPCODE_SHIFT) |
> - (port << IOSF_PORT_SHIFT) | (be << IOSF_BYTE_ENABLES_SHIFT) |
> - (bar << IOSF_BAR_SHIFT);
> + lockdep_assert_held(&dev_priv->sb_lock);
>
> - WARN_ON(!mutex_is_locked(&dev_priv->sb_lock));
> + fw_domains = intel_uncore_forcewake_for_reg(dev_priv,
> + VLV_IOSF_DOORBELL_REQ,
The mailbox lives in the display register range, and so doesn't need
forcewake.
> + FW_REG_READ | FW_REG_WRITE);
> + intel_uncore_forcewake_get(dev_priv, fw_domains);
>
> - if (intel_wait_for_register(dev_priv,
> - VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
> - 5)) {
> + if (intel_wait_for_register_fw(dev_priv,
> + VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
> + 5)) {
> DRM_DEBUG_DRIVER("IOSF sideband idle wait (%s) timed out\n",
> is_read ? "read" : "write");
> - return -EAGAIN;
> + err = -EAGAIN;
> + goto out;
> }
>
> - I915_WRITE(VLV_IOSF_ADDR, addr);
> - I915_WRITE(VLV_IOSF_DATA, is_read ? 0 : *val);
> - I915_WRITE(VLV_IOSF_DOORBELL_REQ, cmd);
> + I915_WRITE_FW(VLV_IOSF_ADDR, addr);
> + I915_WRITE_FW(VLV_IOSF_DATA, is_read ? 0 : *val);
> + I915_WRITE_FW(VLV_IOSF_DOORBELL_REQ,
> + (devfn << IOSF_DEVFN_SHIFT) |
> + (opcode << IOSF_OPCODE_SHIFT) |
> + (port << IOSF_PORT_SHIFT) |
> + (0xf << IOSF_BYTE_ENABLES_SHIFT) |
> + (0 << IOSF_BAR_SHIFT));
>
> - if (intel_wait_for_register(dev_priv,
> - VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
> - 5)) {
> +
> + if (intel_wait_for_register_fw(dev_priv,
> + VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
> + 5)) {
> DRM_DEBUG_DRIVER("IOSF sideband finish wait (%s) timed out\n",
> is_read ? "read" : "write");
> - return -ETIMEDOUT;
> + err = -ETIMEDOUT;
> + goto out;
> }
>
> if (is_read)
> - *val = I915_READ(VLV_IOSF_DATA);
> + *val = I915_READ_FW(VLV_IOSF_DATA);
>
> - return 0;
> +out:
> + intel_uncore_forcewake_put(dev_priv, fw_domains);
> + return err;
> }
>
> u32 vlv_punit_read(struct drm_i915_private *dev_priv, u32 addr)
> --
> 2.11.0
>
> _______________________________________________
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: Hold forcewake for whole of punit communication
2017-02-15 11:33 ` Ville Syrjälä
@ 2017-02-15 12:06 ` Chris Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2017-02-15 12:06 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx, Mika Kuoppala
On Wed, Feb 15, 2017 at 01:33:01PM +0200, Ville Syrjälä wrote:
> On Wed, Feb 15, 2017 at 10:41:29AM +0000, Chris Wilson wrote:
> > Take the forcewake for punit access and hold it across our waits to
> > ensure that the powerwell is not dropped by a spurious sleep.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_sideband.c | 55 ++++++++++++++++++++++-------------
> > 1 file changed, 34 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_sideband.c b/drivers/gpu/drm/i915/intel_sideband.c
> > index 9f782b5eb6e6..ce6d166d67ea 100644
> > --- a/drivers/gpu/drm/i915/intel_sideband.c
> > +++ b/drivers/gpu/drm/i915/intel_sideband.c
> > @@ -39,42 +39,55 @@
> > /* Private register write, double-word addressing, non-posted */
> > #define SB_CRWRDA_NP 0x07
> >
> > -static int vlv_sideband_rw(struct drm_i915_private *dev_priv, u32 devfn,
> > - u32 port, u32 opcode, u32 addr, u32 *val)
> > +static int vlv_sideband_rw(struct drm_i915_private *dev_priv,
> > + u32 devfn, u32 port, u32 opcode, u32 addr,
> > + u32 *val)
> > {
> > - u32 cmd, be = 0xf, bar = 0;
> > - bool is_read = (opcode == SB_MRD_NP || opcode == SB_CRRDDA_NP);
> > + const bool is_read = (opcode == SB_MRD_NP || opcode == SB_CRRDDA_NP);
> > + enum forcewake_domains fw_domains;
> > + int err = 0;
> >
> > - cmd = (devfn << IOSF_DEVFN_SHIFT) | (opcode << IOSF_OPCODE_SHIFT) |
> > - (port << IOSF_PORT_SHIFT) | (be << IOSF_BYTE_ENABLES_SHIFT) |
> > - (bar << IOSF_BAR_SHIFT);
> > + lockdep_assert_held(&dev_priv->sb_lock);
> >
> > - WARN_ON(!mutex_is_locked(&dev_priv->sb_lock));
> > + fw_domains = intel_uncore_forcewake_for_reg(dev_priv,
> > + VLV_IOSF_DOORBELL_REQ,
>
> The mailbox lives in the display register range, and so doesn't need
> forcewake.
That's what I actually thought... So we could even bypass the fw
mmio interface. Probably not worth it.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* ✓ Fi.CI.BAT: success for drm/i915: Hold forcewake for whole of punit communication
2017-02-15 10:41 [PATCH] drm/i915: Hold forcewake for whole of punit communication Chris Wilson
2017-02-15 11:33 ` Ville Syrjälä
@ 2017-02-15 12:52 ` Patchwork
1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2017-02-15 12:52 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Hold forcewake for whole of punit communication
URL : https://patchwork.freedesktop.org/series/19691/
State : success
== Summary ==
Series 19691v1 drm/i915: Hold forcewake for whole of punit communication
https://patchwork.freedesktop.org/api/1.0/series/19691/revisions/1/mbox/
fi-bdw-5557u total:252 pass:241 dwarn:0 dfail:0 fail:0 skip:11
fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39
fi-bxt-j4205 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19
fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12
fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27
fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31
fi-hsw-4770 total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16
fi-hsw-4770r total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16
fi-ilk-650 total:252 pass:202 dwarn:0 dfail:0 fail:0 skip:50
fi-ivb-3520m total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18
fi-ivb-3770 total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18
fi-kbl-7500u total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18
fi-skl-6260u total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10
fi-skl-6700hq total:252 pass:235 dwarn:0 dfail:0 fail:0 skip:17
fi-skl-6700k total:252 pass:230 dwarn:4 dfail:0 fail:0 skip:18
fi-skl-6770hq total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10
fi-snb-2520m total:252 pass:224 dwarn:0 dfail:0 fail:0 skip:28
fi-snb-2600 total:252 pass:223 dwarn:0 dfail:0 fail:0 skip:29
78640dff39ba539190c519d5b210c9e28fb886bb drm-tip: 2017y-02m-15d-10h-08m-38s UTC integration manifest
1286601 drm/i915: Hold forcewake for whole of punit communication
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3820/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-15 12:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-15 10:41 [PATCH] drm/i915: Hold forcewake for whole of punit communication Chris Wilson
2017-02-15 11:33 ` Ville Syrjälä
2017-02-15 12:06 ` Chris Wilson
2017-02-15 12:52 ` ✓ Fi.CI.BAT: success for " Patchwork
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.