Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <andrzej.hajda@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [Intel-gfx] [PATCH v2 3/4] drm/i915: make intel_uncore_rmw() write unconditionally
Date: Thu,  6 Oct 2022 18:31:59 +0200	[thread overview]
Message-ID: <20221006163200.2803722-4-andrzej.hajda@intel.com> (raw)
In-Reply-To: <20221006163200.2803722-1-andrzej.hajda@intel.com>

Two small changes in intel_uncore_rmw will allow to use it more broadly:
- write register unconditionally, for use with latch registers,
- return old value of the register, IRQ cleanup and similar.

If we really want to keep write-only-if-changed feature maybe other
helper will be more suitable for it, intel_uncore_rmw name suggests
unconditional write.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_uncore.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
index 7e1b3b89f68959..5449146a06247c 100644
--- a/drivers/gpu/drm/i915/intel_uncore.h
+++ b/drivers/gpu/drm/i915/intel_uncore.h
@@ -433,15 +433,15 @@ intel_uncore_read64_2x32(struct intel_uncore *uncore,
 #define intel_uncore_write64_fw(...) __raw_uncore_write64(__VA_ARGS__)
 #define intel_uncore_posting_read_fw(...) ((void)intel_uncore_read_fw(__VA_ARGS__))
 
-static inline void intel_uncore_rmw(struct intel_uncore *uncore,
-				    i915_reg_t reg, u32 clear, u32 set)
+static inline u32 intel_uncore_rmw(struct intel_uncore *uncore,
+				   i915_reg_t reg, u32 clear, u32 set)
 {
 	u32 old, val;
 
 	old = intel_uncore_read(uncore, reg);
 	val = (old & ~clear) | set;
-	if (val != old)
-		intel_uncore_write(uncore, reg, val);
+	intel_uncore_write(uncore, reg, val);
+	return old;
 }
 
 static inline void intel_uncore_rmw_fw(struct intel_uncore *uncore,
-- 
2.34.1


  parent reply	other threads:[~2022-10-06 16:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 16:31 [Intel-gfx] [PATCH v2 0/4] Simplify uncore register updates Andrzej Hajda
2022-10-06 16:31 ` [Intel-gfx] [PATCH v2 1/4] drm/i915/display: Use drm_device alias if defined Andrzej Hajda
2022-10-06 16:41   ` Ville Syrjälä
2022-10-06 20:48     ` [Intel-gfx] [PATCH v3 1/4] drm/i915/display: remove drm_device aliases Andrzej Hajda
2022-10-10 14:31       ` Andi Shyti
2022-10-10 15:22         ` Jani Nikula
2022-10-11 10:09         ` Andi Shyti
2022-10-11 10:13           ` Jani Nikula
2022-10-11 10:17             ` Jani Nikula
2022-10-11 10:28               ` Andi Shyti
2022-10-11 11:19             ` Tvrtko Ursulin
2022-10-06 16:31 ` [Intel-gfx] [PATCH v2 2/4] drm/i915/display: Use intel_uncore alias if defined Andrzej Hajda
2022-10-06 16:31 ` Andrzej Hajda [this message]
2022-10-06 16:32 ` [Intel-gfx] [PATCH v2 4/4] drm/i915: use proper helper for register updates Andrzej Hajda
2022-10-14 17:57   ` Matt Roper
2022-10-17  9:28     ` Andrzej Hajda
2022-10-06 16:51 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Simplify uncore register updates (rev2) Patchwork
2022-10-06 17:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-06 21:26 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Simplify uncore register updates (rev3) Patchwork
2022-10-06 21:47 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-10-07  5:00 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for Simplify uncore register updates (rev2) Patchwork
2022-10-11 22:18 ` [Intel-gfx] [PATCH v2 0/4] Simplify uncore register updates Andi Shyti

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=20221006163200.2803722-4-andrzej.hajda@intel.com \
    --to=andrzej.hajda@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@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