From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Only apply a rmw mmio update if the value changes
Date: Tue, 17 Sep 2019 16:49:51 +0300 [thread overview]
Message-ID: <87ftkvqbgg.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20190917080029.27632-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> If we try to clear, or even set, a bit in the register that doesn't
> change the register state; skip the write. There's a slight danger in
> that the register acts as a latch-on-write, but I do not think we use a
> rmw cycle with any such latch registers.
>
> Suggested-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
My stance was that with clear ~0, user should be notified.
But I guess on this level of tooling, you should be free
to do the useless read.
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_uncore.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
> index 414fc2cb0459..dcfa243892c6 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.h
> +++ b/drivers/gpu/drm/i915/intel_uncore.h
> @@ -378,23 +378,23 @@ intel_uncore_read64_2x32(struct intel_uncore *uncore,
> static inline void intel_uncore_rmw(struct intel_uncore *uncore,
> i915_reg_t reg, u32 clear, u32 set)
> {
> - u32 val;
> + u32 old, val;
>
> - val = intel_uncore_read(uncore, reg);
> - val &= ~clear;
> - val |= set;
> - intel_uncore_write(uncore, reg, val);
> + old = intel_uncore_read(uncore, reg);
> + val = (old & ~clear) | set;
> + if (val != old)
> + intel_uncore_write(uncore, reg, val);
> }
>
> static inline void intel_uncore_rmw_fw(struct intel_uncore *uncore,
> i915_reg_t reg, u32 clear, u32 set)
> {
> - u32 val;
> + u32 old, val;
>
> - val = intel_uncore_read_fw(uncore, reg);
> - val &= ~clear;
> - val |= set;
> - intel_uncore_write_fw(uncore, reg, val);
> + old = intel_uncore_read_fw(uncore, reg);
> + val = (old & ~clear) | set;
> + if (val != old)
> + intel_uncore_write_fw(uncore, reg, val);
> }
>
> static inline int intel_uncore_write_and_verify(struct intel_uncore *uncore,
> --
> 2.23.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
prev parent reply other threads:[~2019-09-17 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 8:00 [PATCH] drm/i915: Only apply a rmw mmio update if the value changes Chris Wilson
2019-09-17 8:37 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-09-17 12:29 ` ✓ Fi.CI.IGT: " Patchwork
2019-09-17 13:49 ` Mika Kuoppala [this message]
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=87ftkvqbgg.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--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