Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] Polish DRAM information readout code
@ 2019-03-06 20:35 Ville Syrjala
  2019-03-06 20:35 ` [PATCH v2 01/12] drm/i915: Store DIMM rank information as a number Ville Syrjala
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: Ville Syrjala @ 2019-03-06 20:35 UTC (permalink / raw)
  To: intel-gfx

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

Addressed Jani's review comments (thanks!). Should be good to land once
CI gives the green light.

Ville Syrjälä (12):
  drm/i915: Store DIMM rank information as a number
  drm/i915: Extract functions to derive SKL+ DIMM info
  drm/i915: Polish skl_is_16gb_dimm()
  drm/i915: Extract BXT DIMM helpers
  drm/i915: Fix DRAM size reporting for BXT
  drm/i915: Extract DIMM info on GLK too
  drm/i915: Use dram_dimm_info more
  drm/i915: Generalize intel_is_dram_symmetric()
  drm/i914: s/l_info/dimm_l/ etc.
  drm/i915: Clean up intel_get_dram_info() a bit
  drm/i915: Extract DIMM info on cnl+
  drm/i915: Read out memory type

 drivers/gpu/drm/i915/i915_drv.c | 422 +++++++++++++++++++++-----------
 drivers/gpu/drm/i915/i915_drv.h |  24 +-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++-
 3 files changed, 331 insertions(+), 155 deletions(-)

-- 
2.19.2

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

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH 03/12] drm/i915: Polish skl_is_16gb_dimm()
@ 2019-02-25 20:28 Ville Syrjala
  2019-02-26 15:26 ` [PATCH v2 " Ville Syrjala
  0 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2019-02-25 20:28 UTC (permalink / raw)
  To: intel-gfx

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

Pass the dimm struct to skl_is_16gb_dimm() rather than passing each
value separately. And let's replace the hardcoded set of values with
some simple arithmetic.

Also fix the byte vs. bit inconsistency in the debug message,
and polish the wording otherwise as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 22 ++++++----------------
 drivers/gpu/drm/i915/i915_drv.h |  8 +++++---
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index b94bf475b04c..9d7fc2bc6593 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1107,18 +1107,9 @@ static int skl_get_dimm_ranks(u16 val)
 }
 
 static bool
-skl_is_16gb_dimm(u8 ranks, u8 size, u8 width)
+skl_is_16gb_dimm(const struct dram_dimm_info *dimm)
 {
-	if (ranks == 1 && width == 8 && size == 16)
-		return true;
-	else if (ranks == 2 && width == 8 && size == 32)
-		return true;
-	else if (ranks == 1 && width == 16 && size == 8)
-		return true;
-	else if (ranks == 2 && width == 16 && size == 16)
-		return true;
-
-	return false;
+	return dimm->size * dimm->width / (8 * dimm->ranks ?: 1) == 16;
 }
 
 static int
@@ -1148,10 +1139,9 @@ skl_dram_get_channel_info(struct dram_channel_info *ch, u32 val)
 	else
 		ch->ranks = 1;
 
-	ch->is_16gb_dimm = skl_is_16gb_dimm(ch->l_info.ranks, ch->l_info.size,
-					    ch->l_info.width) ||
-			   skl_is_16gb_dimm(ch->s_info.ranks, ch->s_info.size,
-					    ch->s_info.width);
+	ch->is_16gb_dimm =
+		skl_is_16gb_dimm(&ch->l_info) ||
+		skl_is_16gb_dimm(&ch->s_info);
 
 	DRM_DEBUG_KMS("(size:width:ranks) L(%dGB:X%d:%d) S(%dGB:X%d:%d)\n",
 		      ch->l_info.size, ch->l_info.width, ch->l_info.ranks,
@@ -1369,7 +1359,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 		sprintf(bandwidth_str, "unknown");
 	DRM_DEBUG_KMS("DRAM bandwidth:%s, total-channels: %u\n",
 		      bandwidth_str, dram_info->num_channels);
-	DRM_DEBUG_KMS("DRAM ranks: %d, 16GB-dimm:%s\n",
+	DRM_DEBUG_KMS("DRAM ranks: %d, 16Gb DIMMs: %s\n",
 		      dram_info->ranks, yesno(dram_info->is_16gb_dimm));
 }
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c9cb13a6edaf..fcde09934bb5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2065,10 +2065,12 @@ struct drm_i915_private {
 	 */
 };
 
+struct dram_dimm_info {
+	u8 size, width, ranks;
+};
+
 struct dram_channel_info {
-	struct info {
-		u8 size, width, ranks;
-	} l_info, s_info;
+	struct dram_dimm_info l_info, s_info;
 	u8 ranks;
 	bool is_16gb_dimm;
 };
-- 
2.19.2

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

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-03-06 23:51 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-06 20:35 [PATCH v2 00/12] Polish DRAM information readout code Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 01/12] drm/i915: Store DIMM rank information as a number Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 02/12] drm/i915: Extract functions to derive SKL+ DIMM info Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 03/12] drm/i915: Polish skl_is_16gb_dimm() Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 04/12] drm/i915: Extract BXT DIMM helpers Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 05/12] drm/i915: Fix DRAM size reporting for BXT Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 06/12] drm/i915: Extract DIMM info on GLK too Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 07/12] drm/i915: Use dram_dimm_info more Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 08/12] drm/i915: Generalize intel_is_dram_symmetric() Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 09/12] drm/i914: s/l_info/dimm_l/ etc Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 10/12] drm/i915: Clean up intel_get_dram_info() a bit Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 11/12] drm/i915: Extract DIMM info on cnl+ Ville Syrjala
2019-03-06 20:35 ` [PATCH v2 12/12] drm/i915: Read out memory type Ville Syrjala
2019-03-06 20:57 ` ✗ Fi.CI.CHECKPATCH: warning for Polish DRAM information readout code (rev6) Patchwork
2019-03-06 21:02 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-06 21:21 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-06 23:51 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-02-25 20:28 [PATCH 03/12] drm/i915: Polish skl_is_16gb_dimm() Ville Syrjala
2019-02-26 15:26 ` [PATCH v2 " Ville Syrjala
2019-03-04 18:19   ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox