<div dir="ltr"><br><br>On Fri, Oct 31, 2014 at 5:27 AM, Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>> wrote:<br>><br>> Global GTT doesn't have pat_sel[2:0] so it always point to pat_sel = 000;<br>> So the only way to avoid screen corruptions is setting PAT 0 to Uncached.<br>><br>> MOCS can still be used though. But if userspace is trusting PTE for<br>> cache selection the safest thing to do is to let caches disabled.<br>><br>> BSpec: "For GGTT, there is NO pat_sel[2:0] from the entry,<br>> so RTL will always use the value corresponding to pat_sel = 000"<br>><br>> v2: Cleaner patch as suggested by Chris.<br>><br>> Reference: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=85576">https://bugs.freedesktop.org/show_bug.cgi?id=85576</a><br>> Cc: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>><br>> Cc: James Ausmus <<a href="mailto:james.ausmus@intel.com">james.ausmus@intel.com</a>><br>> Signed-off-by: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>><br>> ---<br>>  drivers/gpu/drm/i915/i915_gem_gtt.c | 9 +++++++++<br>>  1 file changed, 9 insertions(+)<br>><br>> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c<br>> index cb7adab..ae568a2 100644<br>> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c<br>> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c<br>> @@ -1920,6 +1920,15 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv)<br>>               GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) |<br>>               GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3));<br>><br>> +       if (!USES_PPGTT(dev_priv->dev))<br>> +               /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry,<br>> +                * so RTL will always use the value corresponding to<br>> +                * pat_sel = 000".<br>> +                * So let's disable cache for GGTT to avoid screen corruptions.<br>> +                * MOCS still can be used though.<br>> +                */<br>> +               pat = GEN8_PPAT(0, GEN8_PPAT_UC);<br>> +<br>>         /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b<br>>          * write would work. */<br>>         I915_WRITE(GEN8_PRIVATE_PAT, pat);<br>> --<br>> 1.9.3<br>><br><br><span class="" style="font-family:arial,sans-serif;font-size:13px">Tested</span><span style="font-family:arial,sans-serif;font-size:13px">-</span><span class="" style="font-family:arial,sans-serif;font-size:13px">by</span><span style="font-family:arial,sans-serif;font-size:13px">: James Ausmus <<a href="mailto:james.ausmus@intel.com">james.ausmus@intel.com</a>></span><br><br><br>--<br><br><br>James Ausmus<br>Sr. Software Engineer<br>SSG-OTC ChromeOS Integration</div>