From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Subject: Re: [PATCH 2/4] drm/i915: Convert sandybridge_pcode_*() to use intel_wait_for_register()
Date: Thu, 30 Jun 2016 14:04:43 +0100 [thread overview]
Message-ID: <577518EB.1000005@linux.intel.com> (raw)
In-Reply-To: <1467286215-8357-2-git-send-email-chris@chris-wilson.co.uk>
On 30/06/16 12:30, Chris Wilson wrote:
> We want to replace the inline wait_for() with an out-of-line hybrid
> busy/sleep wait_for() in the hopes of speeding up the communication wit
> the PCode unit.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/intel_pm.c | 43 +++++++++++++++++++++++++++--------------
> 1 file changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index d7f8ba89d2a5..f84bf253d04a 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -7623,46 +7623,59 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val
> {
> WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
>
> - if (I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) {
> + /* GEN6_PCODE_* are outside of the forcewake domain, we can
> + * use te fw I915_READ variants to reduce the amount of work
> + * required when reading/writing.
> + */
> +
> + if (I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) {
> DRM_DEBUG_DRIVER("warning: pcode (read) mailbox access failed\n");
> return -EAGAIN;
> }
>
> - I915_WRITE(GEN6_PCODE_DATA, *val);
> - I915_WRITE(GEN6_PCODE_DATA1, 0);
> - I915_WRITE(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox);
> + I915_WRITE_FW(GEN6_PCODE_DATA, *val);
> + I915_WRITE_FW(GEN6_PCODE_DATA1, 0);
> + I915_WRITE_FW(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox);
>
> - if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0,
> - 500)) {
> + if (intel_wait_for_register(dev_priv,
> + GEN6_PCODE_MAILBOX, GEN6_PCODE_READY, 0,
> + 500)) {
Why not the _fw version?
Actually brings me to the point I glanced over in the previous patch -
why would intel_wait_for_register_fw be not suitable for long waits? It
looks like a concern for the calling code grabbing the fw outside it for
a long period and not for the function itself. This call site being a
case in point for that.
> DRM_ERROR("timeout waiting for pcode read (%d) to finish\n", mbox);
> return -ETIMEDOUT;
> }
>
> - *val = I915_READ(GEN6_PCODE_DATA);
> - I915_WRITE(GEN6_PCODE_DATA, 0);
> + *val = I915_READ_FW(GEN6_PCODE_DATA);
> + I915_WRITE_FW(GEN6_PCODE_DATA, 0);
>
> return 0;
> }
>
> -int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u32 mbox, u32 val)
> +int sandybridge_pcode_write(struct drm_i915_private *dev_priv,
> + u32 mbox, u32 val)
> {
> WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
>
> - if (I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) {
> + /* GEN6_PCODE_* are outside of the forcewake domain, we can
> + * use te fw I915_READ variants to reduce the amount of work
> + * required when reading/writing.
> + */
> +
> + if (I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) {
> DRM_DEBUG_DRIVER("warning: pcode (write) mailbox access failed\n");
> return -EAGAIN;
> }
>
> - I915_WRITE(GEN6_PCODE_DATA, val);
> - I915_WRITE(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox);
> + I915_WRITE_FW(GEN6_PCODE_DATA, val);
> + I915_WRITE_FW(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox);
>
> - if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0,
> - 500)) {
> + if (intel_wait_for_register_fw(dev_priv,
> + GEN6_PCODE_MAILBOX, GEN6_PCODE_READY, 0,
> + 500)) {
Here you use the _fw variant.
> DRM_ERROR("timeout waiting for pcode write (%d) to finish\n", mbox);
> return -ETIMEDOUT;
> }
>
> - I915_WRITE(GEN6_PCODE_DATA, 0);
> + I915_WRITE_FW(GEN6_PCODE_DATA, 0);
>
> return 0;
> }
>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-06-30 13:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-30 11:30 [PATCH 1/4] drm/i915: Use a hybrid scheme for fast register waits Chris Wilson
2016-06-30 11:30 ` [PATCH 2/4] drm/i915: Convert sandybridge_pcode_*() to use intel_wait_for_register() Chris Wilson
2016-06-30 13:04 ` Tvrtko Ursulin [this message]
2016-06-30 13:19 ` Chris Wilson
2016-06-30 13:39 ` Tvrtko Ursulin
2016-06-30 19:21 ` Matt Turner
2016-06-30 11:30 ` [PATCH 3/4] drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register() Chris Wilson
2016-06-30 13:27 ` Tvrtko Ursulin
2016-06-30 13:34 ` Chris Wilson
2016-06-30 13:42 ` Tvrtko Ursulin
2016-06-30 11:30 ` [PATCH 4/4] drm/i915: Perform Sandybridge BSD tail write under the forcewake Chris Wilson
2016-06-30 13:32 ` Tvrtko Ursulin
2016-06-30 12:05 ` ✗ Ro.CI.BAT: warning for series starting with [1/4] drm/i915: Use a hybrid scheme for fast register waits Patchwork
2016-06-30 12:58 ` [PATCH 1/4] " 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=577518EB.1000005@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@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