Skip to contentSkip to conversation

drm/i915/tgl: Add memory type decoding for bandwidth checking

PATCH Ville Syrjälä 2 participants 2 messages Sep 20, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ville Syrjälä

author Reviewed-by
#1 lore raw
Quoted 22 lines · James Ausmus

The memory type values have changed in TGL, so we need to translate them differently than ICL.

BSpec: 53998

Cc Ville Syrjälä <[email protected]>
Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_bw.c | 59 ++++++++++++++++++-------
 1 file changed, 43 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_bw.c +0 -2
index 688858ebe4d0..11224d9a6752 100644
@@ -35,22 +35,49 @@ static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv,
 	if (ret)
 		return ret;
 
-	switch (val & 0xf) {
-	case 0:

drivers/gpu/drm/i915/display/intel_bw.c static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv, · line 49

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_bw.c +0 -10
-		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_LPDDR3;

This should be LPDDR4 actually. Doesn't really matter but would be nice to fix as well.

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_bw.c +7 -4
-		break;
-	default:
-		MISSING_CASE(val & 0xf);
-		break;
+	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;

drivers/gpu/drm/i915/display/intel_bw.c static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv, · line 54

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_bw.c +10 -0
+			break;
+		case 4:
+			qi->dram_type = INTEL_DRAM_DDR3;
+			break;
+		case 5:
+			qi->dram_type = INTEL_DRAM_LPDDR3;
+			break;
+		case 1:
+		case 2:
+			/* Unimplemented */

Seems pointless to list these.

The numbers match bspec. Unfortunatley I can't get tgl configdb to cooperate so can't double check against the MC register definition.

Quoted 31 lines
drivers/gpu/drm/i915/display/intel_bw.c +26 -0
+			/* fall through */
+		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_LPDDR3;
+			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;
Signature · 1 line
2.22.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 21 lines · Ville Syrjälä
Quoted 20 lines · James Ausmus

The memory type values have changed in TGL, so we need to translate them differently than ICL.

BSpec: 53998

Cc Ville Syrjälä <[email protected]>
Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_bw.c | 59 ++++++++++++++++++-------
 1 file changed, 43 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_bw.c +0 -0
index 688858ebe4d0..11224d9a6752 100644
@@ -35,22 +35,49 @@ static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv,
 	if (ret)
 		return ret;
 
Quoted 15 lines

drivers/gpu/drm/i915/display/intel_bw.c static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv, · line 49

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_bw.c +0 -12
-	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_LPDDR3;

This should be LPDDR4 actually. Doesn't really matter but would be nice to fix as well.

Either my git send-email config or the ML seems to be eating my original patch mail, and it's not hitting the list, patchwork, or CI, so will have to send a v2 anyway and I will fix this up in that.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/display/intel_bw.c +11 -4
-		break;
-	default:
-		MISSING_CASE(val & 0xf);
-		break;
+	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;
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_bw.c static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv, · line 54

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_bw.c +6 -0
+		case 5:
+			qi->dram_type = INTEL_DRAM_LPDDR3;
+			break;
+		case 1:
+		case 2:
+			/* Unimplemented */

Seems pointless to list these.

Will drop in v2.

Quoted 6 lines

The numbers match bspec. Unfortunatley I can't get tgl configdb to cooperate so can't double check against the MC register definition.

Thanks!

-James

Quoted 29 lines
Quoted 29 lines
drivers/gpu/drm/i915/display/intel_bw.c +26 -0
+			/* fall through */
+		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_LPDDR3;
+			break;
+		default:
+			MISSING_CASE(val & 0xf);
+			break;
+		}
+	} else {
+		MISSING_CASE(INTEL_GEN(dev_priv));
+		qi->dram_type = INTEL_DRAM_LPDDR3; /* Conservative default */
 	}
 
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_bw.c +0 -0
 	qi->num_channels = (val & 0xf0) >> 4;
Signature · 1 line
2.22.1
Signature · 2 lines
Ville Syrjälä
Intel

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