Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 06/13] drm/i915: Extract multiply_wm_latency() from skl_read_wm_latency()
Date: Fri,  5 Sep 2025 17:58:25 +0300	[thread overview]
Message-ID: <20250905145832.12097-7-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20250905145832.12097-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I want skl_read_wm_latency() to just do what it says on
the tin, ie. read the latency values from the pcode mailbox.
Move the DG2 "multiply by two" trick elsewhere.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/skl_watermark.c | 29 ++++++++++++++------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
index 02b64e97ecfe..8a98c3e52dc5 100644
--- a/drivers/gpu/drm/i915/display/skl_watermark.c
+++ b/drivers/gpu/drm/i915/display/skl_watermark.c
@@ -3174,6 +3174,15 @@ void skl_watermark_ipc_init(struct intel_display *display)
 	skl_watermark_ipc_update(display);
 }
 
+static void multiply_wm_latency(struct intel_display *display, int mult)
+{
+	u16 *wm = display->wm.skl_latency;
+	int level, num_levels = display->wm.num_levels;
+
+	for (level = 0; level < num_levels; level++)
+		wm[level] *= mult;
+}
+
 static bool need_16gb_dimm_wa(struct intel_display *display)
 {
 	const struct dram_info *dram_info = intel_dram_info(display->drm);
@@ -3200,6 +3209,9 @@ adjust_wm_latency(struct intel_display *display)
 	int i, level, num_levels = display->wm.num_levels;
 	int read_latency = wm_read_latency(display);
 
+	if (display->platform.dg2)
+		multiply_wm_latency(display, 2);
+
 	/*
 	 * If a level n (n > 1) has a 0us latency, all levels m (m >= n)
 	 * need to be disabled. We make sure to sanitize the values out
@@ -3262,7 +3274,6 @@ static void mtl_read_wm_latency(struct intel_display *display)
 static void skl_read_wm_latency(struct intel_display *display)
 {
 	u16 *wm = display->wm.skl_latency;
-	int mult = display->platform.dg2 ? 2 : 1;
 	u32 val;
 	int ret;
 
@@ -3274,10 +3285,10 @@ static void skl_read_wm_latency(struct intel_display *display)
 		return;
 	}
 
-	wm[0] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_0_4_MASK, val) * mult;
-	wm[1] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_1_5_MASK, val) * mult;
-	wm[2] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_2_6_MASK, val) * mult;
-	wm[3] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_3_7_MASK, val) * mult;
+	wm[0] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_0_4_MASK, val);
+	wm[1] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_1_5_MASK, val);
+	wm[2] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_2_6_MASK, val);
+	wm[3] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_3_7_MASK, val);
 
 	/* read the second set of memory latencies[4:7] */
 	val = 1; /* data0 to be programmed to 1 for second set */
@@ -3287,10 +3298,10 @@ static void skl_read_wm_latency(struct intel_display *display)
 		return;
 	}
 
-	wm[4] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_0_4_MASK, val) * mult;
-	wm[5] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_1_5_MASK, val) * mult;
-	wm[6] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_2_6_MASK, val) * mult;
-	wm[7] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_3_7_MASK, val) * mult;
+	wm[4] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_0_4_MASK, val);
+	wm[5] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_1_5_MASK, val);
+	wm[6] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_2_6_MASK, val);
+	wm[7] = REG_FIELD_GET(GEN9_MEM_LATENCY_LEVEL_3_7_MASK, val);
 }
 
 static void skl_setup_wm_latency(struct intel_display *display)
-- 
2.49.1


  parent reply	other threads:[~2025-09-05 14:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 14:58 [PATCH 00/13] drm/1915: skl+ watermark/latency stuff Ville Syrjala
2025-09-05 14:58 ` [PATCH 01/13] drm/i915/dram: Also apply the 16Gb DIMM w/a for larger DRAM chips Ville Syrjala
2025-09-16  8:15   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 02/13] drm/i915: Apply the 16Gb DIMM w/a only for the platforms that need it Ville Syrjala
2025-09-16  8:25   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 03/13] drm/i915: Tweak the read latency fixup code Ville Syrjala
2025-09-16  8:28   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 04/13] drm/i915: Don't pass the latency array to {skl, mtl}_read_wm_latency() Ville Syrjala
2025-09-16  8:35   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 05/13] drm/i915: Move adjust_wm_latency() out from {mtl, skl}_read_wm_latency() Ville Syrjala
2025-09-16  8:36   ` Luca Coelho
2025-09-05 14:58 ` Ville Syrjala [this message]
2025-09-16  8:41   ` [PATCH 06/13] drm/i915: Extract multiply_wm_latency() from skl_read_wm_latency() Luca Coelho
2025-09-05 14:58 ` [PATCH 07/13] drm/i915: Extract increase_wm_latency() Ville Syrjala
2025-09-16  8:44   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 08/13] drm/i915: Use increase_wm_latency() for the 16Gb DIMM w/a Ville Syrjala
2025-09-16  8:46   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 09/13] drm/i915: Extract sanitize_wm_latency() Ville Syrjala
2025-09-16  8:49   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 10/13] drm/i915: Flatten sanitize_wm_latency() a bit Ville Syrjala
2025-09-16  8:58   ` Luca Coelho
2025-09-18 13:31   ` [PATCH v2 " Ville Syrjala
2025-09-05 14:58 ` [PATCH 11/13] drm/i915: Make wm latencies monotonic Ville Syrjala
2025-09-16 10:29   ` Luca Coelho
2025-09-18 13:29     ` Ville Syrjälä
2025-09-05 14:58 ` [PATCH 12/13] drm/i915: Print both the original and adjusted wm latencies Ville Syrjala
2025-09-16  9:25   ` Luca Coelho
2025-09-05 14:58 ` [PATCH 13/13] drm/i915: Make sure wm block/lines are non-decreasing Ville Syrjala
2025-09-16 11:15   ` Luca Coelho
2025-09-05 15:25 ` ✗ CI.checkpatch: warning for drm/1915: skl+ watermark/latency stuff (rev2) Patchwork
2025-09-05 15:26 ` ✓ CI.KUnit: success " Patchwork
2025-09-05 16:02 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-06  1:26 ` ✓ Xe.CI.Full: " Patchwork

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=20250905145832.12097-7-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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