diff options
author | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2014-11-05 19:56:36 -0500 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2014-11-06 11:15:39 -0500 |
commit | d6a8b72edc92471283925ceb4ba12799b67c3ff8 (patch) | |
tree | 4ea9359c507794eee8daa41d7c8774e94ba0ac41 | |
parent | 0df1f2487d2f0d04703f142813d53615d62a1da4 (diff) |
drm/i915: Disable caches for Global GTT.
Global GTT doesn't have pat_sel[2:0] so it always point to pat_sel = 000;
So the only way to avoid screen corruptions is setting PAT 0 to Uncached.
MOCS can still be used though. But if userspace is trusting PTE for
cache selection the safest thing to do is to let caches disabled.
BSpec: "For GGTT, there is NO pat_sel[2:0] from the entry,
so RTL will always use the value corresponding to pat_sel = 000"
- System agent ggtt writes (i.e. cpu gtt mmaps) already work before
this patch, i.e. the same uncached + snooping access like on gen6/7
seems to be in effect.
- So this just fixes blitter/render access. Again it looks like it's
not just uncached access, but uncached + snooping. So we can still
hold onto all our assumptions wrt cpu clflushing on LLC machines.
v2: Cleaner patch as suggested by Chris.
v3: Add Daniel's comment
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=85576
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: James Ausmus <james.ausmus@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Stable@vger.kernel.org
Tested-by: James Ausmus <james.ausmus@intel.com>
Reviewed-by: James Ausmus <james.ausmus@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index b672b843fd5e..728938f02341 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1902,6 +1902,22 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv) | |||
1902 | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | | 1902 | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | |
1903 | GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); | 1903 | GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); |
1904 | 1904 | ||
1905 | if (!USES_PPGTT(dev_priv->dev)) | ||
1906 | /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry, | ||
1907 | * so RTL will always use the value corresponding to | ||
1908 | * pat_sel = 000". | ||
1909 | * So let's disable cache for GGTT to avoid screen corruptions. | ||
1910 | * MOCS still can be used though. | ||
1911 | * - System agent ggtt writes (i.e. cpu gtt mmaps) already work | ||
1912 | * before this patch, i.e. the same uncached + snooping access | ||
1913 | * like on gen6/7 seems to be in effect. | ||
1914 | * - So this just fixes blitter/render access. Again it looks | ||
1915 | * like it's not just uncached access, but uncached + snooping. | ||
1916 | * So we can still hold onto all our assumptions wrt cpu | ||
1917 | * clflushing on LLC machines. | ||
1918 | */ | ||
1919 | pat = GEN8_PPAT(0, GEN8_PPAT_UC); | ||
1920 | |||
1905 | /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b | 1921 | /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b |
1906 | * write would work. */ | 1922 | * write would work. */ |
1907 | I915_WRITE(GEN8_PRIVATE_PAT, pat); | 1923 | I915_WRITE(GEN8_PRIVATE_PAT, pat); |