]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drm/i915: store eLLC size
authorBen Widawsky <ben@bwidawsk.net>
Thu, 4 Jul 2013 18:02:05 +0000 (11:02 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 16 Jul 2013 06:08:21 +0000 (08:08 +0200)
The eLLC cannot be determined by PCIID because as far as we know, even
machines supporting eLLC may not have it enabled, or fused off or
whatever. It's possible this isn't actually true, and at that point we
can switch to a DEV_INFO flag instead.

I've defined everything where the docs are clear, and left the rest as
magic.

But we need it before we set the pte_encode function pointers, which
happens really early, in gtt_init.

The problem with just doing the normal sequence earlier is we don't have
the ability to use forcewake until after the pte functions have been set
up.

Since all solutions are somewhat ugly (barring rewriting all the init
ordering), I've opted to do the detection really early, and the enabling
later - since the register to detect doesn't require forcewake.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
[danvet: Move dev_priv->ellc_size away from the dri1 dungeon to a nice
place right next to the l3 parity stuff. Also squash in the follow-up
commit to read out the eLLC size a bit earlier.]
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c

index 6ce9033063206340c52b8b23d22ca68b0376dfa9..a1d04b23e5761357e2aef741f25d1a3bcdc3e677 100644 (file)
@@ -1519,6 +1519,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
        intel_early_sanitize_regs(dev);
 
+       if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+               /* The docs do not explain exactly how the calculation can be
+                * made. It is somewhat guessable, but for now, it's always
+                * 128MB.
+                * 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);
+       }
+
        ret = i915_gem_gtt_init(dev);
        if (ret)
                goto put_bridge;
index 65d54edae17657b60e08b5453f25a8ffd54f212f..5d4491e74871c248a405f4617751ad156ac4e871 100644 (file)
@@ -1151,6 +1151,9 @@ typedef struct drm_i915_private {
 
        struct intel_l3_parity l3_parity;
 
+       /* Cannot be determined by PCIID. You must always read a register. */
+       size_t ellc_size;
+
        /* gen6+ rps state */
        struct intel_gen6_power_mgmt rps;
 
index 1246dfd5ff924084270ad3977d9f1fe0ef8cfe86..53c39bcf8e0e454a1a070daca02a5b83b309c5aa 100644 (file)
@@ -4147,7 +4147,7 @@ i915_gem_init_hw(struct drm_device *dev)
        if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
                return -EIO;
 
-       if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1))
+       if (dev_priv->ellc_size)
                I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
 
        if (HAS_PCH_NOP(dev)) {