Skip to contentSkip to conversation

drm/i915: Nuke not needed members of dram_info

PATCH In review José Roberto de Souza 3 participants 8 messages Jan 27, 2021 – Jan 28, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 drm/i915: Nuke not needed members of dram_info

Valid, ranks and bandwidth_kbps are set into dram_info but are not used anywhere else so nuking it.

---
 drivers/gpu/drm/i915/i915_drv.c   |  4 +--
 drivers/gpu/drm/i915/i915_drv.h   |  3 --
 drivers/gpu/drm/i915/intel_dram.c | 47 +++++++------------------------
 3 files changed, 12 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -2
index 0037b81d991e..36e073c4bc06 100644
@@ -616,8 +616,8 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 
 	intel_opregion_setup(dev_priv);
 	/*
-	 * Fill the dram structure to get the system raw bandwidth and
-	 * dram info. This will be used for memory latency calculation.
+	 * Fill the dram structure to get the system dram info. This will be
+	 * used for memory latency calculation.
 	 */
 	intel_dram_detect(dev_priv);
 
drivers/gpu/drm/i915/i915_drv.h +0 -3
index 3edc9c4f2d21..4e8e151c7ade 100644
@@ -1128,11 +1128,8 @@ struct drm_i915_private {
 	} wm;
 
 	struct dram_info {
-		bool valid;
 		bool is_16gb_dimm;
 		u8 num_channels;
-		u8 ranks;
-		u32 bandwidth_kbps;
 		bool symmetric_memory;
 		enum intel_dram_type {
 			INTEL_DRAM_UNKNOWN,
drivers/gpu/drm/i915/intel_dram.c +10 -37

98 lines not on this page · raw message

Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 2/4 drm/i915/gen11+: Only load DRAM information from pcode

Up to now we were reading some DRAM information from MCHBAR register and from pcode what is already not good but some GEN12(TGL-H and ADL-S) platforms have MCHBAR DRAM information in different offsets.

This was notified to HW team that decided that the best alternative is always apply the 16gb_dimm watermark adjustment for GEN12+ platforms and read the remaning DRAM information needed to other display programming from pcode.

So here moving the DRAM pcode function to intel_dram.c, removing the duplicated fields from intel_qgv_info, setting and using information from dram_info.

v2:
- bring back num_points to intel_qgv_info as num_qgv_point can be overwritten in icl_get_qgv_points()
- add gen12_get_dram_info() and simplify gen11_get_dram_info()

---
 drivers/gpu/drm/i915/display/intel_bw.c | 80 +++---------------------
 drivers/gpu/drm/i915/i915_drv.c         |  5 +-
 drivers/gpu/drm/i915/i915_drv.h         |  1 +
 drivers/gpu/drm/i915/intel_dram.c       | 82 ++++++++++++++++++++++++-
 4 files changed, 93 insertions(+), 75 deletions(-)
drivers/gpu/drm/i915/display/intel_bw.c +8 -72
index bd060404d249..4b5a30ac84bc 100644
@@ -20,76 +20,9 @@ struct intel_qgv_point {
 struct intel_qgv_info {
 	struct intel_qgv_point points[I915_NUM_QGV_POINTS];
 	u8 num_points;
-	u8 num_channels;
 	u8 t_bl;
-	enum intel_dram_type dram_type;
 };
 
-static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv,
-					  struct intel_qgv_info *qi)
-{
-	u32 val = 0;
-	int ret;
-
-	ret = sandybridge_pcode_read(dev_priv,
-				     ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
-				     ICL_PCODE_MEM_SS_READ_GLOBAL_INFO,
-				     &val, NULL);
-	if (ret)
-		return ret;
-
-	if (IS_GEN(dev_priv, 12)) {
-		switch (val & 0xf) {
-		case 0:
-			qi->dram_type = INTEL_DRAM_DDR4;
-			break;
-		case 3:
-			qi->dram_type = INTEL_DRAM_LPDDR4;
-			break;
-		case 4:
-			qi->dram_type = INTEL_DRAM_DDR3;
-			break;
-		case 5:
-			qi->dram_type = INTEL_DRAM_LPDDR3;
-			break;
-		default:
-			MISSING_CASE(val & 0xf);
-			break;
-		}
-	} else if (IS_GEN(dev_priv, 11)) {
-		switch (val & 0xf) {
-		case 0:
-			qi->dram_type = INTEL_DRAM_DDR4;
-			break;
-		case 1:
-			qi->dram_type = INTEL_DRAM_DDR3;
-			break;
-		case 2:
-			qi->dram_type = INTEL_DRAM_LPDDR3;
-			break;
-		case 3:
-			qi->dram_type = INTEL_DRAM_LPDDR4;
-			break;
-		default:
-			MISSING_CASE(val & 0xf);
-			break;
-		}
-	} else {
-		MISSING_CASE(INTEL_GEN(dev_priv));
-		qi->dram_type = INTEL_DRAM_LPDDR3; /* Conservative default */
-	}
-
-	qi->num_channels = (val & 0xf0) >> 4;
-	qi->num_points = (val & 0xf00) >> 8;
-
-	if (IS_GEN(dev_priv, 12))
-		qi->t_bl = qi->dram_type == INTEL_DRAM_DDR4 ? 4 : 16;
-	else if (IS_GEN(dev_priv, 11))
-		qi->t_bl = qi->dram_type == INTEL_DRAM_DDR4 ? 4 : 8;
-
-	return 0;
-}
-
 static int icl_pcode_read_qgv_point_info(struct drm_i915_private *dev_priv,
 					 struct intel_qgv_point *sp,
 					 int point)
@@ -139,11 +72,15 @@ int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv,
 static int icl_get_qgv_points(struct drm_i915_private *dev_priv,
 			      struct intel_qgv_info *qi)
 {
+	const struct dram_info *dram_info = &dev_priv->dram_info;
 	int i, ret;
 
-	ret = icl_pcode_read_mem_global_info(dev_priv, qi);
-	if (ret)
-		return ret;
+	qi->num_points = dram_info->num_qgv_points;
+
+	if (IS_GEN(dev_priv, 12))
+		qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 16;
+	else if (IS_GEN(dev_priv, 11))
+		qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 8;
 
 	if (drm_WARN_ON(&dev_priv->drm,
 			qi->num_points > ARRAY_SIZE(qi->points)))
@@ -209,7 +146,7 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel
 {
 	struct intel_qgv_info qi = {};
 	bool is_y_tile = true; /* assume y tile may be used */
-	int num_channels;
+	int num_channels = dev_priv->dram_info.num_channels;
 	int deinterleave;
 	int ipqdepth, ipqdepthpch;
 	int dclk_max;
@@ -222,7 +159,6 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel
 			    "Failed to get memory subsystem information, ignoring bandwidth limits");
 		return ret;
 	}
-	num_channels = qi.num_channels;
 
 	deinterleave = DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2);
 	dclk_max = icl_sagv_max_dclk(&qi);
drivers/gpu/drm/i915/i915_drv.c +3 -2
index 36e073c4bc06..aec0e870dc25 100644
@@ -615,14 +615,15 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 		goto err_msi;
 
 	intel_opregion_setup(dev_priv);
+
+	intel_pcode_init(dev_priv);
+
 	/*
 	 * Fill the dram structure to get the system dram info. This will be
 	 * used for memory latency calculation.
 	 */
 	intel_dram_detect(dev_priv);
 
-	intel_pcode_init(dev_priv);
-
 	intel_bw_init_hw(dev_priv);
 
 	return 0;
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 4e8e151c7ade..80227d47b5cb 100644
@@ -1138,6 +1138,7 @@ struct drm_i915_private {
 			INTEL_DRAM_LPDDR3,
 			INTEL_DRAM_LPDDR4
 		} type;
+		u8 num_qgv_points;
 	} dram_info;
 
 	struct intel_bw_info {
drivers/gpu/drm/i915/intel_dram.c +81 -1

100 lines not on this page · raw message

Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 2/4
#2 lore raw

Re: [Intel-gfx] [PATCH v2 2/4] drm/i915/gen11+: Only load DRAM information from pcode

Quoted 13 lines · Jose Souza

Up to now we were reading some DRAM information from MCHBAR register and from pcode what is already not good but some GEN12(TGL-H and ADL-S) platforms have MCHBAR DRAM information in different offsets.

This was notified to HW team that decided that the best alternative is always apply the 16gb_dimm watermark adjustment for GEN12+ platforms and read the remaning DRAM information needed to other display programming from pcode.

So here moving the DRAM pcode function to intel_dram.c, removing the duplicated fields from intel_qgv_info, setting and using information from dram_info.

Quoted 6 lines

v2:
- bring back num_points to intel_qgv_info as num_qgv_point can be overwritten in icl_get_qgv_points()
- add gen12_get_dram_info() and simplify gen11_get_dram_info()

Lucas De Marchi

Quoted 272 lines

---

drivers/gpu/drm/i915/display/intel_bw.c | 80 +++---------------------
drivers/gpu/drm/i915/i915_drv.c         |  5 +-
drivers/gpu/drm/i915/i915_drv.h         |  1 +
drivers/gpu/drm/i915/intel_dram.c       | 82 ++++++++++++++++++++++++-
4 files changed, 93 insertions(+), 75 deletions(-)
drivers/gpu/drm/i915/display/intel_bw.c +8 -72
index bd060404d249..4b5a30ac84bc 100644
@@ -20,76 +20,9 @@ struct intel_qgv_point {
 struct intel_qgv_info {
 	struct intel_qgv_point points[I915_NUM_QGV_POINTS];
 	u8 num_points;
-	u8 num_channels;
 	u8 t_bl;
-	enum intel_dram_type dram_type;
 };
 
-static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv,
-					  struct intel_qgv_info *qi)
-{
-	u32 val = 0;
-	int ret;
-
-	ret = sandybridge_pcode_read(dev_priv,
-				     ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
-				     ICL_PCODE_MEM_SS_READ_GLOBAL_INFO,
-				     &val, NULL);
-	if (ret)
-		return ret;
-
-	if (IS_GEN(dev_priv, 12)) {
-		switch (val & 0xf) {
-		case 0:
-			qi->dram_type = INTEL_DRAM_DDR4;
-			break;
-		case 3:
-			qi->dram_type = INTEL_DRAM_LPDDR4;
-			break;
-		case 4:
-			qi->dram_type = INTEL_DRAM_DDR3;
-			break;
-		case 5:
-			qi->dram_type = INTEL_DRAM_LPDDR3;
-			break;
-		default:
-			MISSING_CASE(val & 0xf);
-			break;
-		}
-	} else if (IS_GEN(dev_priv, 11)) {
-		switch (val & 0xf) {
-		case 0:
-			qi->dram_type = INTEL_DRAM_DDR4;
-			break;
-		case 1:
-			qi->dram_type = INTEL_DRAM_DDR3;
-			break;
-		case 2:
-			qi->dram_type = INTEL_DRAM_LPDDR3;
-			break;
-		case 3:
-			qi->dram_type = INTEL_DRAM_LPDDR4;
-			break;
-		default:
-			MISSING_CASE(val & 0xf);
-			break;
-		}
-	} else {
-		MISSING_CASE(INTEL_GEN(dev_priv));
-		qi->dram_type = INTEL_DRAM_LPDDR3; /* Conservative default */
-	}
-
-	qi->num_channels = (val & 0xf0) >> 4;
-	qi->num_points = (val & 0xf00) >> 8;
-
-	if (IS_GEN(dev_priv, 12))
-		qi->t_bl = qi->dram_type == INTEL_DRAM_DDR4 ? 4 : 16;
-	else if (IS_GEN(dev_priv, 11))
-		qi->t_bl = qi->dram_type == INTEL_DRAM_DDR4 ? 4 : 8;
-
-	return 0;
-}
-
 static int icl_pcode_read_qgv_point_info(struct drm_i915_private *dev_priv,
 					 struct intel_qgv_point *sp,
 					 int point)
@@ -139,11 +72,15 @@ int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv,
 static int icl_get_qgv_points(struct drm_i915_private *dev_priv,
 			      struct intel_qgv_info *qi)
 {
+	const struct dram_info *dram_info = &dev_priv->dram_info;
 	int i, ret;
 
-	ret = icl_pcode_read_mem_global_info(dev_priv, qi);
-	if (ret)
-		return ret;
+	qi->num_points = dram_info->num_qgv_points;
+
+	if (IS_GEN(dev_priv, 12))
+		qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 16;
+	else if (IS_GEN(dev_priv, 11))
+		qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 8;
 
 	if (drm_WARN_ON(&dev_priv->drm,
 			qi->num_points > ARRAY_SIZE(qi->points)))
@@ -209,7 +146,7 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel
 {
 	struct intel_qgv_info qi = {};
 	bool is_y_tile = true; /* assume y tile may be used */
-	int num_channels;
+	int num_channels = dev_priv->dram_info.num_channels;
 	int deinterleave;
 	int ipqdepth, ipqdepthpch;
 	int dclk_max;
@@ -222,7 +159,6 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel
 			    "Failed to get memory subsystem information, ignoring bandwidth limits");
 		return ret;
 	}
-	num_channels = qi.num_channels;
 
 	deinterleave = DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2);
 	dclk_max = icl_sagv_max_dclk(&qi);
drivers/gpu/drm/i915/i915_drv.c +3 -2
index 36e073c4bc06..aec0e870dc25 100644
@@ -615,14 +615,15 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 		goto err_msi;
 
 	intel_opregion_setup(dev_priv);
+
+	intel_pcode_init(dev_priv);
+
 	/*
 	 * Fill the dram structure to get the system dram info. This will be
 	 * used for memory latency calculation.
 	 */
 	intel_dram_detect(dev_priv);
 
-	intel_pcode_init(dev_priv);
-
 	intel_bw_init_hw(dev_priv);
 
 	return 0;
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 4e8e151c7ade..80227d47b5cb 100644
@@ -1138,6 +1138,7 @@ struct drm_i915_private {
 			INTEL_DRAM_LPDDR3,
 			INTEL_DRAM_LPDDR4
 		} type;
+		u8 num_qgv_points;
 	} dram_info;
 
 	struct intel_bw_info {
drivers/gpu/drm/i915/intel_dram.c +81 -1
index 694fbd8c9cd4..4d5ab206eacb 100644
@@ -5,6 +5,7 @@
 
 #include "i915_drv.h"
 #include "intel_dram.h"
+#include "intel_sideband.h"
 
 struct dram_dimm_info {
 	u16 size;
@@ -408,6 +409,81 @@ static int bxt_get_dram_info(struct drm_i915_private *i915)
 	return 0;
 }
 
+static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv)
+{
+	struct dram_info *dram_info = &dev_priv->dram_info;
+	u32 val = 0;
+	int ret;
+
+	ret = sandybridge_pcode_read(dev_priv,
+				     ICL_PCODE_MEM_SUBSYSYSTEM_INFO |
+				     ICL_PCODE_MEM_SS_READ_GLOBAL_INFO,
+				     &val, NULL);
+	if (ret)
+		return ret;
+
+	if (IS_GEN(dev_priv, 12)) {
+		switch (val & 0xf) {
+		case 0:
+			dram_info->type = INTEL_DRAM_DDR4;
+			break;
+		case 3:
+			dram_info->type = INTEL_DRAM_LPDDR4;
+			break;
+		case 4:
+			dram_info->type = INTEL_DRAM_DDR3;
+			break;
+		case 5:
+			dram_info->type = INTEL_DRAM_LPDDR3;
+			break;
+		default:
+			MISSING_CASE(val & 0xf);
+			return -1;
+		}
+	} else {
+		switch (val & 0xf) {
+		case 0:
+			dram_info->type = INTEL_DRAM_DDR4;
+			break;
+		case 1:
+			dram_info->type = INTEL_DRAM_DDR3;
+			break;
+		case 2:
+			dram_info->type = INTEL_DRAM_LPDDR3;
+			break;
+		case 3:
+			dram_info->type = INTEL_DRAM_LPDDR4;
+			break;
+		default:
+			MISSING_CASE(val & 0xf);
+			return -1;
+		}
+	}
+
+	dram_info->num_channels = (val & 0xf0) >> 4;
+	dram_info->num_qgv_points = (val & 0xf00) >> 8;
+
+	return 0;
+}
+
+static int gen11_get_dram_info(struct drm_i915_private *i915)
+{
+	int ret = skl_get_dram_info(i915);
+
+	if (ret)
+		return ret;
+
+	return icl_pcode_read_mem_global_info(i915);
+}
+
+static int gen12_get_dram_info(struct drm_i915_private *i915)
+{
+	/* Always needed for GEN12+ */
+	i915->dram_info.is_16gb_dimm = true;
+
+	return icl_pcode_read_mem_global_info(i915);
+}
+
 void intel_dram_detect(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
@@ -423,7 +499,11 @@ void intel_dram_detect(struct drm_i915_private *i915)
 	if (INTEL_GEN(i915) < 9 || !HAS_DISPLAY(i915))
 		return;
 
-	if (IS_GEN9_LP(i915))
+	if (INTEL_GEN(i915) >= 12)
+		ret = gen12_get_dram_info(i915);
+	else if (INTEL_GEN(i915) >= 11)
+		ret = gen11_get_dram_info(i915);
+	else if (IS_GEN9_LP(i915))
 		ret = bxt_get_dram_info(i915);
 	else
 		ret = skl_get_dram_info(i915);
Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH v2 3/4 drm/i915: Fail driver probe when unable to load DRAM information

In reply to José Roberto de Souza

DRAM information is required to properly program display. Before "drm/i915/gen11+: Only load DRAM information from pcode" we were failing driver load if unable to fetch DRAM information from pcode form GEN11+ but we should also extend it to GEN9 plaforms.

---
 drivers/gpu/drm/i915/i915_drv.c   |  6 +++++-
 drivers/gpu/drm/i915/intel_dram.c | 13 +++++++++----
 drivers/gpu/drm/i915/intel_dram.h |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -1
index aec0e870dc25..7ff58ea30c7c 100644
@@ -622,12 +622,16 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 	 * Fill the dram structure to get the system dram info. This will be
 	 * used for memory latency calculation.
 	 */
-	intel_dram_detect(dev_priv);
+	ret = intel_dram_detect(dev_priv);
+	if (ret)
+		goto err_dram;
 
 	intel_bw_init_hw(dev_priv);
 
 	return 0;
 
+err_dram:
+	intel_gvt_driver_remove(dev_priv);
 err_msi:
 	if (pdev->msi_enabled)
 		pci_disable_msi(pdev);
drivers/gpu/drm/i915/intel_dram.c +9 -4
index 4d5ab206eacb..6ce56eedaf12 100644
@@ -484,7 +484,7 @@ static int gen12_get_dram_info(struct drm_i915_private *i915)
 	return icl_pcode_read_mem_global_info(i915);
 }
 
-void intel_dram_detect(struct drm_i915_private *i915)
+int intel_dram_detect(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
 	int ret;
@@ -497,7 +497,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
 	dram_info->is_16gb_dimm = !IS_GEN9_LP(i915);
 
 	if (INTEL_GEN(i915) < 9 || !HAS_DISPLAY(i915))
-		return;
+		return 0;
 
 	if (INTEL_GEN(i915) >= 12)
 		ret = gen12_get_dram_info(i915);
@@ -507,13 +507,18 @@ void intel_dram_detect(struct drm_i915_private *i915)
 		ret = bxt_get_dram_info(i915);
 	else
 		ret = skl_get_dram_info(i915);
-	if (ret)
-		return;
+
+	if (ret) {
+		drm_warn(&i915->drm, "Unable to load dram information\n");
+		return ret;
+	}
 
 	drm_dbg_kms(&i915->drm, "DRAM channels: %u\n", dram_info->num_channels);
 
 	drm_dbg_kms(&i915->drm, "DRAM 16Gb DIMMs: %s\n",
 		    yesno(dram_info->is_16gb_dimm));
+
+	return 0;
 }
 
 static u32 gen9_edram_size_mb(struct drm_i915_private *i915, u32 cap)
drivers/gpu/drm/i915/intel_dram.h +1 -1
index 4ba13c13162c..2a0f283b1a1d 100644
@@ -9,6 +9,6 @@
 struct drm_i915_private;
 
 void intel_dram_edram_detect(struct drm_i915_private *i915);
-void intel_dram_detect(struct drm_i915_private *i915);
+int intel_dram_detect(struct drm_i915_private *i915);
 
 #endif /* __INTEL_DRAM_H__ */
Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 3/4
#4 lore raw

Re: [Intel-gfx] [PATCH v2 3/4] drm/i915: Fail driver probe when unable to load DRAM information

Quoted 6 lines · Jose Souza

DRAM information is required to properly program display. Before "drm/i915/gen11+: Only load DRAM information from pcode" we were failing driver load if unable to fetch DRAM information from pcode form GEN11+ but we should also extend it to GEN9 plaforms.

makes sense and seems correct. But this needs to be tested on DG1 that is not on CI and AFAIR misbehaved when trying to get this info from pcode. If that is passing now,

Lucas De Marchi

Quoted 90 lines

---

drivers/gpu/drm/i915/i915_drv.c   |  6 +++++-
drivers/gpu/drm/i915/intel_dram.c | 13 +++++++++----
drivers/gpu/drm/i915/intel_dram.h |  2 +-
3 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -1
index aec0e870dc25..7ff58ea30c7c 100644
@@ -622,12 +622,16 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 	 * Fill the dram structure to get the system dram info. This will be
 	 * used for memory latency calculation.
 	 */
-	intel_dram_detect(dev_priv);
+	ret = intel_dram_detect(dev_priv);
+	if (ret)
+		goto err_dram;
 
 	intel_bw_init_hw(dev_priv);
 
 	return 0;
 
+err_dram:
+	intel_gvt_driver_remove(dev_priv);

err_msi:

	if (pdev->msi_enabled)
		pci_disable_msi(pdev);
drivers/gpu/drm/i915/intel_dram.c +9 -4
index 4d5ab206eacb..6ce56eedaf12 100644
@@ -484,7 +484,7 @@ static int gen12_get_dram_info(struct drm_i915_private *i915)
 	return icl_pcode_read_mem_global_info(i915);
 }
 
-void intel_dram_detect(struct drm_i915_private *i915)
+int intel_dram_detect(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
 	int ret;
@@ -497,7 +497,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
 	dram_info->is_16gb_dimm = !IS_GEN9_LP(i915);
 
 	if (INTEL_GEN(i915) < 9 || !HAS_DISPLAY(i915))
-		return;
+		return 0;
 
 	if (INTEL_GEN(i915) >= 12)
 		ret = gen12_get_dram_info(i915);
@@ -507,13 +507,18 @@ void intel_dram_detect(struct drm_i915_private *i915)
 		ret = bxt_get_dram_info(i915);
 	else
 		ret = skl_get_dram_info(i915);
-	if (ret)
-		return;
+
+	if (ret) {
+		drm_warn(&i915->drm, "Unable to load dram information\n");
+		return ret;
+	}
 
 	drm_dbg_kms(&i915->drm, "DRAM channels: %u\n", dram_info->num_channels);
 
 	drm_dbg_kms(&i915->drm, "DRAM 16Gb DIMMs: %s\n",
 		    yesno(dram_info->is_16gb_dimm));
+
+	return 0;
 }
 
 static u32 gen9_edram_size_mb(struct drm_i915_private *i915, u32 cap)
drivers/gpu/drm/i915/intel_dram.h +1 -1
index 4ba13c13162c..2a0f283b1a1d 100644
@@ -9,6 +9,6 @@
 struct drm_i915_private;
 
 void intel_dram_edram_detect(struct drm_i915_private *i915);
-void intel_dram_detect(struct drm_i915_private *i915);
+int intel_dram_detect(struct drm_i915_private *i915);
 
 #endif /* __INTEL_DRAM_H__ */
Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [Intel-gfx] [PATCH v2 3/4] drm/i915: Fail driver probe when unable to load DRAM information

Quoted 11 lines · Lucas De Marchi
Quoted 6 lines · Jose Souza

DRAM information is required to properly program display. Before "drm/i915/gen11+: Only load DRAM information from pcode" we were failing driver load if unable to fetch DRAM information from pcode form GEN11+ but we should also extend it to GEN9 plaforms.

makes sense and seems correct. But this needs to be tested on DG1 that is not on CI and AFAIR misbehaved when trying to get this info from pcode. If that is passing now,

Okay, will send the 3 other and merge as soon as I get CI results.
Will do some more testing with this one before merging it, it might be causing some regression in fi-glk-dsi.

thanks for the reviews.

Quoted 88 lines

Lucas De Marchi

Quoted 82 lines

---

drivers/gpu/drm/i915/i915_drv.c   |  6 +++++-
drivers/gpu/drm/i915/intel_dram.c | 13 +++++++++----
drivers/gpu/drm/i915/intel_dram.h |  2 +-
3 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -1
index aec0e870dc25..7ff58ea30c7c 100644
@@ -622,12 +622,16 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 	 * Fill the dram structure to get the system dram info. This will be
 	 * used for memory latency calculation.
 	 */
-	intel_dram_detect(dev_priv);
+	ret = intel_dram_detect(dev_priv);
+	if (ret)
+		goto err_dram;
 
 	intel_bw_init_hw(dev_priv);
 
 	return 0;
 
+err_dram:
+	intel_gvt_driver_remove(dev_priv);

err_msi:

	if (pdev->msi_enabled)
		pci_disable_msi(pdev);
drivers/gpu/drm/i915/intel_dram.c +9 -4
index 4d5ab206eacb..6ce56eedaf12 100644
@@ -484,7 +484,7 @@ static int gen12_get_dram_info(struct drm_i915_private *i915)
 	return icl_pcode_read_mem_global_info(i915);
 }
 
-void intel_dram_detect(struct drm_i915_private *i915)
+int intel_dram_detect(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
 	int ret;
@@ -497,7 +497,7 @@ void intel_dram_detect(struct drm_i915_private *i915)
 	dram_info->is_16gb_dimm = !IS_GEN9_LP(i915);
 
 	if (INTEL_GEN(i915) < 9 || !HAS_DISPLAY(i915))
-		return;
+		return 0;
 
 	if (INTEL_GEN(i915) >= 12)
 		ret = gen12_get_dram_info(i915);
@@ -507,13 +507,18 @@ void intel_dram_detect(struct drm_i915_private *i915)
 		ret = bxt_get_dram_info(i915);
 	else
 		ret = skl_get_dram_info(i915);
-	if (ret)
-		return;
+
+	if (ret) {
+		drm_warn(&i915->drm, "Unable to load dram information\n");
+		return ret;
+	}
 
 	drm_dbg_kms(&i915->drm, "DRAM channels: %u\n", dram_info->num_channels);
 
 	drm_dbg_kms(&i915->drm, "DRAM 16Gb DIMMs: %s\n",
 		    yesno(dram_info->is_16gb_dimm));
+
+	return 0;
 }
 
 static u32 gen9_edram_size_mb(struct drm_i915_private *i915, u32 cap)
drivers/gpu/drm/i915/intel_dram.h +1 -1
index 4ba13c13162c..2a0f283b1a1d 100644
@@ -9,6 +9,6 @@
 struct drm_i915_private;
 
 void intel_dram_edram_detect(struct drm_i915_private *i915);
-void intel_dram_detect(struct drm_i915_private *i915);
+int intel_dram_detect(struct drm_i915_private *i915);
 
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dram.h +0 -0
 #endif /* __INTEL_DRAM_H__ */
Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

PATCH v2 4/4 drm/i915: Rename is_16gb_dimm to wm_lv_0_adjust_needed

In reply to José Roberto de Souza

As it now it is always required for GEN12+ the is_16gb_dimm name do not make sense for GEN12+.

v2:
- Updated comment on top of "dram_info->wm_lv_0_adjust_needed = !IS_GEN9_LP(i915);"

---
 drivers/gpu/drm/i915/i915_drv.h   |  2 +-
 drivers/gpu/drm/i915/intel_dram.c | 15 +++++++--------
 drivers/gpu/drm/i915/intel_pm.c   |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 80227d47b5cb..f684147290cb 100644
@@ -1128,7 +1128,7 @@ struct drm_i915_private {
 	} wm;
 
 	struct dram_info {
-		bool is_16gb_dimm;
+		bool wm_lv_0_adjust_needed;
 		u8 num_channels;
 		bool symmetric_memory;
 		enum intel_dram_type {
drivers/gpu/drm/i915/intel_dram.c +7 -8
index 6ce56eedaf12..6a13cf39da99 100644
@@ -207,7 +207,7 @@ skl_dram_get_channels_info(struct drm_i915_private *i915)
 		return -EINVAL;
 	}
 
-	dram_info->is_16gb_dimm = ch0.is_16gb_dimm || ch1.is_16gb_dimm;
+	dram_info->wm_lv_0_adjust_needed = ch0.is_16gb_dimm || ch1.is_16gb_dimm;
 
 	dram_info->symmetric_memory = intel_is_dram_symmetric(&ch0, &ch1);
 
@@ -479,7 +479,7 @@ static int gen11_get_dram_info(struct drm_i915_private *i915)
 static int gen12_get_dram_info(struct drm_i915_private *i915)
 {
 	/* Always needed for GEN12+ */
-	i915->dram_info.is_16gb_dimm = true;
+	i915->dram_info.wm_lv_0_adjust_needed = true;
 
 	return icl_pcode_read_mem_global_info(i915);
 }
@@ -490,11 +490,10 @@ int intel_dram_detect(struct drm_i915_private *i915)
 	int ret;
 
 	/*
-	 * Assume 16Gb DIMMs are present until proven otherwise.
-	 * This is only used for the level 0 watermark latency
-	 * w/a which does not apply to bxt/glk.
+	 * Assume level 0 watermark latency adjustment is needed until proven
+	 * otherwise, this w/a is not needed by bxt/glk.
 	 */
-	dram_info->is_16gb_dimm = !IS_GEN9_LP(i915);
+	dram_info->wm_lv_0_adjust_needed = !IS_GEN9_LP(i915);
 
 	if (INTEL_GEN(i915) < 9 || !HAS_DISPLAY(i915))
 		return 0;
@@ -515,8 +514,8 @@ int intel_dram_detect(struct drm_i915_private *i915)
 
 	drm_dbg_kms(&i915->drm, "DRAM channels: %u\n", dram_info->num_channels);
 
-	drm_dbg_kms(&i915->drm, "DRAM 16Gb DIMMs: %s\n",
-		    yesno(dram_info->is_16gb_dimm));
+	drm_dbg_kms(&i915->drm, "Watermark level 0 adjustment needed: %s\n",
+		    yesno(dram_info->wm_lv_0_adjust_needed));
 
 	return 0;
 }
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 6e9678bd0597..c58e5077590d 100644
@@ -2930,7 +2930,7 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
 		 * any underrun. If not able to get Dimm info assume 16GB dimm
 		 * to avoid any underrun.
 		 */
-		if (dev_priv->dram_info.is_16gb_dimm)
+		if (dev_priv->dram_info.wm_lv_0_adjust_needed)
 			wm[0] += 1;
 
 	} else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
Signature · 6 lines
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v2,1/4] drm/i915: Nuke not needed members of dram_info

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/4] drm/i915: Nuke not needed members of dram_info
URL : https://patchwork.freedesktop.org/series/86360/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9688 -> Patchwork_19522
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_19522 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_19522, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_19522:

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@reload:
- fi-glk-dsi: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-glk-dsi/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_19522 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_fence@basic-busy:
- fi-glk-dsi: NOTRUN -> [SKIP][3] ([fdo#109271]) +13 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-byt-j1900: NOTRUN -> [SKIP][4] ([fdo#109271]) +27 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-byt-j1900/igt@[email protected]

* igt@gem_mmap_gtt@basic:
- fi-tgl-y: [PASS][5] -> [DMESG-WARN][6] ([i915#402]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-tgl-y/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-tgl-y/igt@[email protected]

* igt@i915_selftest@live@late_gt_pm:
- fi-bsw-nick: [PASS][7] -> [DMESG-FAIL][8] ([i915#2927])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-bsw-nick/igt@i915_selftest@live@late_gt_pm.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-bsw-nick/igt@i915_selftest@live@late_gt_pm.html

* igt@i915_selftest@live@sanitycheck:
- fi-kbl-7500u: [PASS][9] -> [DMESG-WARN][10] ([i915#2605])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-kbl-7500u/igt@i915_selftest@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-kbl-7500u/igt@i915_selftest@[email protected]

* igt@kms_addfb_basic@invalid-set-prop-any:
- fi-glk-dsi: [PASS][11] -> [SKIP][12] ([fdo#109271]) +116 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-glk-dsi/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]

* igt@kms_chamelium@hdmi-crc-fast:
- fi-byt-j1900: NOTRUN -> [SKIP][13] ([fdo#109271] / [fdo#111827]) +8 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-byt-j1900/igt@[email protected]

* igt@runner@aborted:
- fi-glk-dsi: NOTRUN -> [FAIL][14] ([i915#2292] / [i915#2295] / [k.org#202321] / [k.org#204565])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]
- fi-bsw-nick: NOTRUN -> [FAIL][15] ([i915#1436])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-bsw-nick/igt@[email protected]
- fi-bdw-5557u: NOTRUN -> [FAIL][16] ([i915#1602] / [i915#2029] / [i915#2369])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-bdw-5557u/igt@[email protected]

#### Possible fixes ####

* igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y: [DMESG-WARN][17] ([i915#402]) -> [PASS][18] +2 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html

#### Warnings ####

* igt@gem_huc_copy@huc-copy:
- fi-glk-dsi: [SKIP][19] ([fdo#109271] / [i915#2190]) -> [SKIP][20] ([fdo#109271])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-glk-dsi/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- fi-hsw-4770: [SKIP][21] ([fdo#109271]) -> [SKIP][22] ([fdo#109271] / [i915#3012])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-hsw-4770/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-hsw-4770/igt@[email protected]

* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-hsw-4770: [SKIP][23] ([fdo#109271]) -> [SKIP][24] ([fdo#109271] / [fdo#109289])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-hsw-4770/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-hsw-4770/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-glk-dsi: [SKIP][25] ([fdo#109271] / [fdo#111827]) -> [SKIP][26] ([fdo#109271]) +8 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-glk-dsi/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-hsw-4770: [SKIP][27] ([fdo#109271]) -> [SKIP][28] ([fdo#109271] / [i915#533])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-hsw-4770/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-hsw-4770/igt@[email protected]
- fi-glk-dsi: [SKIP][29] ([fdo#109271] / [i915#533]) -> [SKIP][30] ([fdo#109271])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9688/fi-glk-dsi/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/fi-glk-dsi/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2292]: https://gitlab.freedesktop.org/drm/intel/issues/2292
[i915#2295]: https://gitlab.freedesktop.org/drm/intel/issues/2295
[i915#2369]: https://gitlab.freedesktop.org/drm/intel/issues/2369
[i915#2605]: https://gitlab.freedesktop.org/drm/intel/issues/2605
[i915#2927]: https://gitlab.freedesktop.org/drm/intel/issues/2927
[i915#3011]: https://gitlab.freedesktop.org/drm/intel/issues/3011
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
[k.org#204565]: https://bugzilla.kernel.org/show_bug.cgi?id=204565

Participating hosts (45 -> 39)
------------------------------

Additional (1): fi-byt-j1900
Missing (7): fi-jsl-1 fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-cml-drallion fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_9688 -> Patchwork_19522

CI-20190529: 20190529
CI_DRM_9688: 43295c2b7bc37446a480bb5d42b03675baed171a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5974: a85398dcae50930c0e27548cf8c9575ad0bf69d1 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19522: 5b9e486ea2a0ff860ecca424f9aabee0248115a1 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

5b9e486ea2a0 drm/i915: Rename is_16gb_dimm to wm_lv_0_adjust_needed b5fe6803e4b9 drm/i915: Fail driver probe when unable to load DRAM information 3b48cc1d0270 drm/i915/gen11+: Only load DRAM information from pcode e64cb7c9d8cb drm/i915: Nuke not needed members of dram_info

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19522/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx