Skip to contentSkip to conversation

drm/i915/skl: Update eDRAM calculation

PATCH In review Ben Widawsky 3 participants 6 messages Apr 13, 2016 – Apr 15, 2016

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

PATCH 1/1 drm/i915/skl: Update eDRAM calculation

The two behavioral changes here are the correct detection of the eDRAM size on gen9 (SKL + KBL), and unconditional printing of the eLLC size.

---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +13 -3
index fbc1d21..efef724 100644
@@ -314,8 +314,17 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if ((IS_HASWELL(dev) || IS_BROADWELL(dev) ||
-	     INTEL_INFO(dev)->gen >= 9) &&
+	if (INTEL_INFO(dev)->gen >= 9 && HAS_LLC(dev)) {
+		u32 edramcap = __raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT);
+		if (edramcap & EDRAM_ENABLED) {
+			int sets = (edramcap >> 8) & 0x3;
+			int ways = (edramcap >> 5) & 0x7;
+			int banks = (edramcap >> 1) & 0xf;
+
+			ways = (ways + 1) * 4;
+			dev_priv->ellc_size = sets * ways * banks;
+		}
+	} else if ((IS_HASWELL(dev) || IS_BROADWELL(dev)) &&
 	    (__raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT) & EDRAM_ENABLED)) {
 		/* The docs do not explain exactly how the calculation can be
 		 * made. It is somewhat guessable, but for now, it's always
@@ -323,8 +332,9 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 		 * NB: We can't write IDICR yet because we do not have gt funcs
 		 * set up */
 		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 	}
+
+	DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 }
 
 static bool
Signature · 6 lines
2.8.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#1 lore raw
Quoted 5 lines · Ben Widawsky

The two behavioral changes here are the correct detection of the eDRAM size on gen9 (SKL + KBL), and unconditional printing of the eLLC size.

Please see [1].

BR,
Jani.

[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 39 lines
---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +13 -3
index fbc1d21..efef724 100644
@@ -314,8 +314,17 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if ((IS_HASWELL(dev) || IS_BROADWELL(dev) ||
-	     INTEL_INFO(dev)->gen >= 9) &&
+	if (INTEL_INFO(dev)->gen >= 9 && HAS_LLC(dev)) {
+		u32 edramcap = __raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT);
+		if (edramcap & EDRAM_ENABLED) {
+			int sets = (edramcap >> 8) & 0x3;
+			int ways = (edramcap >> 5) & 0x7;
+			int banks = (edramcap >> 1) & 0xf;
+
+			ways = (ways + 1) * 4;
+			dev_priv->ellc_size = sets * ways * banks;
+		}
+	} else if ((IS_HASWELL(dev) || IS_BROADWELL(dev)) &&
 	    (__raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT) & EDRAM_ENABLED)) {
 		/* The docs do not explain exactly how the calculation can be
 		 * made. It is somewhat guessable, but for now, it's always
@@ -323,8 +332,9 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 		 * NB: We can't write IDICR yet because we do not have gt funcs
 		 * set up */
 		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 	}
+
+	DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 }
 
 static bool
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#2 lore raw
Quoted 7 lines · Jani Nikula
Quoted 5 lines · Ben Widawsky

The two behavioral changes here are the correct detection of the eDRAM size on gen9 (SKL + KBL), and unconditional printing of the eLLC size.

Quoted 7 lines

Please see [1].

BR,
Jani.

[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]

I did mean to refer to the entire series

https://patchwork.freedesktop.org/series/5663/

Quoted 41 lines
Quoted 41 lines

---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +13 -3
index fbc1d21..efef724 100644
@@ -314,8 +314,17 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if ((IS_HASWELL(dev) || IS_BROADWELL(dev) ||
-	     INTEL_INFO(dev)->gen >= 9) &&
+	if (INTEL_INFO(dev)->gen >= 9 && HAS_LLC(dev)) {
+		u32 edramcap = __raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT);
+		if (edramcap & EDRAM_ENABLED) {
+			int sets = (edramcap >> 8) & 0x3;
+			int ways = (edramcap >> 5) & 0x7;
+			int banks = (edramcap >> 1) & 0xf;
+
+			ways = (ways + 1) * 4;
+			dev_priv->ellc_size = sets * ways * banks;
+		}
+	} else if ((IS_HASWELL(dev) || IS_BROADWELL(dev)) &&
 	    (__raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT) & EDRAM_ENABLED)) {
 		/* The docs do not explain exactly how the calculation can be
 		 * made. It is somewhat guessable, but for now, it's always
@@ -323,8 +332,9 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 		 * NB: We can't write IDICR yet because we do not have gt funcs
 		 * set up */
 		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 	}
+
+	DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 }
 
 static bool
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 14 lines · Jani Nikula
Quoted 13 lines · Jani Nikula
Quoted 5 lines · Ben Widawsky

The two behavioral changes here are the correct detection of the eDRAM size on gen9 (SKL + KBL), and unconditional printing of the eLLC size.

Please see [1].

BR,
Jani.

Quoted 7 lines
Quoted 1 line

[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]

I did mean to refer to the entire series

https://patchwork.freedesktop.org/series/5663/

My patch is more correct as it does the proper calculation.

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines

---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +13 -3
index fbc1d21..efef724 100644
@@ -314,8 +314,17 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if ((IS_HASWELL(dev) || IS_BROADWELL(dev) ||
-	     INTEL_INFO(dev)->gen >= 9) &&
+	if (INTEL_INFO(dev)->gen >= 9 && HAS_LLC(dev)) {
+		u32 edramcap = __raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT);
+		if (edramcap & EDRAM_ENABLED) {
+			int sets = (edramcap >> 8) & 0x3;
+			int ways = (edramcap >> 5) & 0x7;
+			int banks = (edramcap >> 1) & 0xf;
+
+			ways = (ways + 1) * 4;
+			dev_priv->ellc_size = sets * ways * banks;
+		}
+	} else if ((IS_HASWELL(dev) || IS_BROADWELL(dev)) &&
 	    (__raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT) & EDRAM_ENABLED)) {
 		/* The docs do not explain exactly how the calculation can be
 		 * made. It is somewhat guessable, but for now, it's always
@@ -323,8 +332,9 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 		 * NB: We can't write IDICR yet because we do not have gt funcs
 		 * set up */
 		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 	}
+
+	DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 }
 
Quoted 4 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 static bool
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

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

author Acked-by
#4 lore raw
Quoted 17 lines · Ben Widawsky
Quoted 16 lines · Jani Nikula
Quoted 14 lines · Jani Nikula
Quoted 5 lines · Ben Widawsky

The two behavioral changes here are the correct detection of the eDRAM size on gen9 (SKL + KBL), and unconditional printing of the eLLC size.

Please see [1].

BR,
Jani.

[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 8 lines
Quoted 5 lines

I did mean to refer to the entire series

https://patchwork.freedesktop.org/series/5663/

My patch is more correct as it does the proper calculation.

Oh. He did it as two patches with the first claiming we can't make the calculation... that was odd.

Anyway, assuming it does the right thing patches 2, and 3 are:

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines

---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +13 -3
index fbc1d21..efef724 100644
@@ -314,8 +314,17 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if ((IS_HASWELL(dev) || IS_BROADWELL(dev) ||
-	     INTEL_INFO(dev)->gen >= 9) &&
+	if (INTEL_INFO(dev)->gen >= 9 && HAS_LLC(dev)) {
+		u32 edramcap = __raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT);
+		if (edramcap & EDRAM_ENABLED) {
+			int sets = (edramcap >> 8) & 0x3;
+			int ways = (edramcap >> 5) & 0x7;
+			int banks = (edramcap >> 1) & 0xf;
+
+			ways = (ways + 1) * 4;
+			dev_priv->ellc_size = sets * ways * banks;
+		}
+	} else if ((IS_HASWELL(dev) || IS_BROADWELL(dev)) &&
 	    (__raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT) & EDRAM_ENABLED)) {
 		/* The docs do not explain exactly how the calculation can be
 		 * made. It is somewhat guessable, but for now, it's always
@@ -323,8 +332,9 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 		 * NB: We can't write IDICR yet because we do not have gt funcs
 		 * set up */
 		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 	}
+
+	DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 static bool
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

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

#5 lore raw
Quoted 25 lines · Ben Widawsky

[ text/plain ]

Quoted 23 lines · Ben Widawsky
Quoted 21 lines · Jani Nikula
Quoted 7 lines · Jani Nikula
Quoted 5 lines · Ben Widawsky

The two behavioral changes here are the correct detection of the eDRAM size on gen9 (SKL + KBL), and unconditional printing of the eLLC size.

Quoted 7 lines

Please see [1].

BR,
Jani.

[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]

I did mean to refer to the entire series

https://patchwork.freedesktop.org/series/5663/

Quoted 6 lines
Quoted 2 lines

My patch is more correct as it does the proper calculation.

Oh. He did it as two patches with the first claiming we can't make the calculation... that was odd.

Yeah that is a mistake. We can't calculate with gen < 9 and thus the comment should have been modified to reflect that. -Mika

Quoted 43 lines

Anyway, assuming it does the right thing patches 2, and 3 are:

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines

---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +13 -3
index fbc1d21..efef724 100644
@@ -314,8 +314,17 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if ((IS_HASWELL(dev) || IS_BROADWELL(dev) ||
-	     INTEL_INFO(dev)->gen >= 9) &&
+	if (INTEL_INFO(dev)->gen >= 9 && HAS_LLC(dev)) {
+		u32 edramcap = __raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT);
+		if (edramcap & EDRAM_ENABLED) {
+			int sets = (edramcap >> 8) & 0x3;
+			int ways = (edramcap >> 5) & 0x7;
+			int banks = (edramcap >> 1) & 0xf;
+
+			ways = (ways + 1) * 4;
+			dev_priv->ellc_size = sets * ways * banks;
+		}
+	} else if ((IS_HASWELL(dev) || IS_BROADWELL(dev)) &&
 	    (__raw_i915_read32(dev_priv, HSW_EDRAM_PRESENT) & EDRAM_ENABLED)) {
 		/* The docs do not explain exactly how the calculation can be
 		 * made. It is somewhat guessable, but for now, it's always
@@ -323,8 +332,9 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 		 * NB: We can't write IDICR yet because we do not have gt funcs
 		 * set up */
 		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 	}
+
+	DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
 }
 
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 static bool
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
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