Commit ba2ebf60 authored by Chris Wilson's avatar Chris Wilson Committed by Rodrigo Vivi

drm/i915/gem: Prevent using pgprot_writecombine() if PAT is not supported

Let's not try and use PAT attributes for I915_MAP_WC if the CPU doesn't
support PAT.

Fixes: 6056e500 ("drm/i915/gem: Support discontiguous lmem object maps")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: <stable@vger.kernel.org> # v5.6+
Link: https://patchwork.freedesktop.org/patch/msgid/20200915091417.4086-2-chris@chris-wilson.co.uk
(cherry picked from commit 121ba69f)
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 4caf017e
...@@ -254,6 +254,10 @@ static void *i915_gem_object_map(struct drm_i915_gem_object *obj, ...@@ -254,6 +254,10 @@ static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
if (!i915_gem_object_has_struct_page(obj) && type != I915_MAP_WC) if (!i915_gem_object_has_struct_page(obj) && type != I915_MAP_WC)
return NULL; return NULL;
if (GEM_WARN_ON(type == I915_MAP_WC &&
!static_cpu_has(X86_FEATURE_PAT)))
return NULL;
/* A single page can always be kmapped */ /* A single page can always be kmapped */
if (n_pte == 1 && type == I915_MAP_WB) { if (n_pte == 1 && type == I915_MAP_WB) {
struct page *page = sg_page(sgt->sgl); struct page *page = sg_page(sgt->sgl);
......
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