public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH 4/4] drm/i915: Rewrite CL/CTG L-shaped memory detection
Date: Wed, 21 Apr 2021 18:34:01 +0300	[thread overview]
Message-ID: <20210421153401.13847-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20210421153401.13847-1-ville.syrjala@linux.intel.com>

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

Currently we try to detect a symmetric memory configurations
using a magic DCC2_MODIFIED_ENHANCED_DISABLE bit. That bit is
either only set on a very specific subset of machines or it
just does not exist (it's not mentioned in any public chipset
datasheets I've found). As it happens my CL/CTG machines never
set said bit, even if I populate the channels with identical
sticks.

So let's do the L-shaped memory detection the same way as the
desktop variants, ie. just look at the DRAM rank boundary
registers to see if both channels have an identical size.

With this my CL/CTG no longer claim L-shaped memory when I use
identical sticks. Also tested with non-matching sticks just to
make sure the L-shaped memory is still properly detected.

And for completeness let's update the debugfs code to dump
the correct set of registers on each platform.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c | 15 ++++++++-------
 drivers/gpu/drm/i915/i915_debugfs.c          | 16 ++++++++++++----
 drivers/gpu/drm/i915/i915_reg.h              |  4 ++++
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
index 0fa6c38893f7..754f20768de5 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
@@ -693,14 +693,15 @@ static void detect_bit_6_swizzle(struct i915_ggtt *ggtt)
 				swizzle_x = I915_BIT_6_SWIZZLE_9_10_17;
 				swizzle_y = I915_BIT_6_SWIZZLE_9_17;
 			}
-			break;
-		}
 
-		/* check for L-shaped memory aka modified enhanced addressing */
-		if (IS_GEN(i915, 4) &&
-		    !(intel_uncore_read(uncore, DCC2) & DCC2_MODIFIED_ENHANCED_DISABLE)) {
-			swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
-			swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
+			/* check for L-shaped memory aka modified enhanced addressing */
+			if (IS_GEN(i915, 4) &&
+			    intel_uncore_read16(uncore, C0DRB3_CL) !=
+			    intel_uncore_read16(uncore, C1DRB3_CL)) {
+				swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
+				swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
+			}
+			break;
 		}
 
 		if (dcc == 0xffffffff) {
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 8dd374691102..6de11ffcde38 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -621,10 +621,18 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
 			   intel_uncore_read(uncore, DCC));
 		seq_printf(m, "DDC2 = 0x%08x\n",
 			   intel_uncore_read(uncore, DCC2));
-		seq_printf(m, "C0DRB3 = 0x%04x\n",
-			   intel_uncore_read16(uncore, C0DRB3_BW));
-		seq_printf(m, "C1DRB3 = 0x%04x\n",
-			   intel_uncore_read16(uncore, C1DRB3_BW));
+
+		if (IS_G45(dev_priv) || IS_I965G(dev_priv) || IS_G33(dev_priv)) {
+			seq_printf(m, "C0DRB3 = 0x%04x\n",
+				   intel_uncore_read16(uncore, C0DRB3_BW));
+			seq_printf(m, "C1DRB3 = 0x%04x\n",
+				   intel_uncore_read16(uncore, C1DRB3_BW));
+		} else if (IS_GEN(dev_priv, 4)) {
+			seq_printf(m, "C0DRB3 = 0x%04x\n",
+				   intel_uncore_read16(uncore, C0DRB3_CL));
+			seq_printf(m, "C1DRB3 = 0x%04x\n",
+				   intel_uncore_read16(uncore, C1DRB3_CL));
+		}
 	} else if (INTEL_GEN(dev_priv) >= 6) {
 		seq_printf(m, "MAD_DIMM_C0 = 0x%08x\n",
 			   intel_uncore_read(uncore, MAD_DIMM_C0));
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 0587b2455ea1..055c258179a1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3790,6 +3790,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define C0DRB3_BW		_MMIO(MCHBAR_MIRROR_BASE + 0x206)
 #define C1DRB3_BW		_MMIO(MCHBAR_MIRROR_BASE + 0x606)
 
+/* 965gm,ctg DRAM channel configuration */
+#define C0DRB3_CL		_MMIO(MCHBAR_MIRROR_BASE + 0x1206)
+#define C1DRB3_CL		_MMIO(MCHBAR_MIRROR_BASE + 0x1306)
+
 /* snb MCH registers for reading the DRAM channel configuration */
 #define MAD_DIMM_C0			_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5004)
 #define MAD_DIMM_C1			_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5008)
-- 
2.26.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-04-21 15:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 15:33 [Intel-gfx] [PATCH 0/4] drm/i915: Fix older platforms Ville Syrjala
2021-04-21 15:33 ` [Intel-gfx] [PATCH 1/4] drm/i915: Avoid div-by-zero on gen2 Ville Syrjala
2021-04-21 15:33 ` [Intel-gfx] [PATCH 2/4] drm/i915: Read C0DRB3/C1DRB3 as 16 bits again Ville Syrjala
2021-04-21 15:34 ` [Intel-gfx] [PATCH 3/4] drm/i915: Give C0DRB3/C1DRB3 a _BW suffix Ville Syrjala
2021-04-21 15:34 ` Ville Syrjala [this message]
2021-04-22  9:49   ` [Intel-gfx] [PATCH 4/4] drm/i915: Rewrite CL/CTG L-shaped memory detection Daniel Vetter
2021-04-22 13:11     ` Ville Syrjälä
2021-04-26 16:08       ` Daniel Vetter
2021-04-26 17:18         ` Ville Syrjälä
2021-04-27  8:58           ` Daniel Vetter
2021-10-04 10:36             ` Ville Syrjälä
2021-04-22 18:51     ` Ville Syrjälä
2021-04-21 16:48 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915: Fix older platforms Patchwork
2021-04-21 17:12 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-04-22  0:14 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20210421153401.13847-5-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --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