All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
	Eero Tamminen <eero.t.tamminen@intel.com>
Subject: [PATCH] drm/i915/skl: Update eDRAM calculation
Date: Wed, 13 Apr 2016 08:52:24 -0700	[thread overview]
Message-ID: <1460562744-26811-1-git-send-email-ben@bwidawsk.net> (raw)

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

Cc: Eero Tamminen <eero.t.tamminen@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/intel_uncore.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index fbc1d21..efef724 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -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
-- 
2.8.0

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

             reply	other threads:[~2016-04-13 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 15:52 Ben Widawsky [this message]
2016-04-14  8:13 ` [PATCH] drm/i915/skl: Update eDRAM calculation Jani Nikula
2016-04-14  8:14   ` Jani Nikula
2016-04-14 14:48     ` Ben Widawsky
2016-04-14 14:50       ` Ben Widawsky
2016-04-15  7:23         ` Mika Kuoppala

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=1460562744-26811-1-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=eero.t.tamminen@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.