Commit a0de80a0 authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: Fix context sizes on HSW

With updates to the spec, we can actually see the context layout, and
how many dwords are allocated. That table suggests we need 70720 bytes
per HW context. Rounded up, this is 18 pages. Looking at what lives
after the current 4 pages we use, I can't see too much important (mostly
it's d3d related), but there are a couple of things which look scary. I
am hopeful this can explain some of our odd HSW failures.

v2: Make the context only 17 pages. The power context space isn't used
ever, and execlists aren't used in our driver, making the actual total
66944 bytes.

v3: Add a comment to the code. (Jesse & Paulo)
Reported-by: default avatar"Azad, Vinit" <vinit.azad@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 921c3b67
...@@ -113,7 +113,7 @@ static int get_context_size(struct drm_device *dev) ...@@ -113,7 +113,7 @@ static int get_context_size(struct drm_device *dev)
case 7: case 7:
reg = I915_READ(GEN7_CXT_SIZE); reg = I915_READ(GEN7_CXT_SIZE);
if (IS_HASWELL(dev)) if (IS_HASWELL(dev))
ret = HSW_CXT_TOTAL_SIZE(reg) * 64; ret = HSW_CXT_TOTAL_SIZE;
else else
ret = GEN7_CXT_TOTAL_SIZE(reg) * 64; ret = GEN7_CXT_TOTAL_SIZE(reg) * 64;
break; break;
......
...@@ -1718,14 +1718,13 @@ ...@@ -1718,14 +1718,13 @@
GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \ GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \
GEN7_CXT_GT1_SIZE(ctx_reg) + \ GEN7_CXT_GT1_SIZE(ctx_reg) + \
GEN7_CXT_VFSTATE_SIZE(ctx_reg)) GEN7_CXT_VFSTATE_SIZE(ctx_reg))
#define HSW_CXT_POWER_SIZE(ctx_reg) ((ctx_reg >> 26) & 0x3f) /* Haswell does have the CXT_SIZE register however it does not appear to be
#define HSW_CXT_RING_SIZE(ctx_reg) ((ctx_reg >> 23) & 0x7) * valid. Now, docs explain in dwords what is in the context object. The full
#define HSW_CXT_RENDER_SIZE(ctx_reg) ((ctx_reg >> 15) & 0xff) * size is 70720 bytes, however, the power context and execlist context will
#define HSW_CXT_TOTAL_SIZE(ctx_reg) (HSW_CXT_POWER_SIZE(ctx_reg) + \ * never be saved (power context is stored elsewhere, and execlists don't work
HSW_CXT_RING_SIZE(ctx_reg) + \ * on HSW) - so the final size is 66944 bytes, which rounds to 17 pages.
HSW_CXT_RENDER_SIZE(ctx_reg) + \ */
GEN7_CXT_VFSTATE_SIZE(ctx_reg)) #define HSW_CXT_TOTAL_SIZE (17 * PAGE_SIZE)
/* /*
* Overlay regs * Overlay regs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment