]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: replace X86_FEATURE_PAT with pat_enabled()
authorLucas De Marchi <lucas.demarchi@intel.com>
Thu, 2 Dec 2021 00:30:48 +0000 (16:30 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 14 Dec 2021 23:29:12 +0000 (15:29 -0800)
PAT can be disabled on boot with "nopat" in the command line. Replace
one x86-ism with another, which is slightly more correct to prepare for
supporting other architectures.

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211202003048.1015511-1-lucas.demarchi@intel.com
drivers/gpu/drm/i915/gem/i915_gem_mman.c
drivers/gpu/drm/i915/gem/i915_gem_pages.c

index 65fc6ff5f59dabd26976f1e159dbb9ff53ce7005..c0c509e5c0aee2d5bb605afa2c995bb41cec6bef 100644 (file)
@@ -72,7 +72,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
        if (args->flags & ~(I915_MMAP_WC))
                return -EINVAL;
 
-       if (args->flags & I915_MMAP_WC && !boot_cpu_has(X86_FEATURE_PAT))
+       if (args->flags & I915_MMAP_WC && !pat_enabled())
                return -ENODEV;
 
        obj = i915_gem_object_lookup(file, args->handle);
@@ -736,7 +736,7 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 
        if (HAS_LMEM(to_i915(dev)))
                mmap_type = I915_MMAP_TYPE_FIXED;
-       else if (boot_cpu_has(X86_FEATURE_PAT))
+       else if (pat_enabled())
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -792,7 +792,7 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                break;
 
        case I915_MMAP_OFFSET_WC:
-               if (!boot_cpu_has(X86_FEATURE_PAT))
+               if (!pat_enabled())
                        return -ENODEV;
                type = I915_MMAP_TYPE_WC;
                break;
@@ -802,7 +802,7 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                break;
 
        case I915_MMAP_OFFSET_UC:
-               if (!boot_cpu_has(X86_FEATURE_PAT))
+               if (!pat_enabled())
                        return -ENODEV;
                type = I915_MMAP_TYPE_UC;
                break;
index 49c6e55c68ce0f2801d0ee57b32a572ec9eebfef..89b70f5cde7ae25a2bdbd269e68ee503373a5344 100644 (file)
@@ -424,8 +424,7 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
                        goto err_unpin;
                }
 
-               if (GEM_WARN_ON(type == I915_MAP_WC &&
-                               !static_cpu_has(X86_FEATURE_PAT)))
+               if (GEM_WARN_ON(type == I915_MAP_WC && !pat_enabled()))
                        ptr = ERR_PTR(-ENODEV);
                else if (i915_gem_object_has_struct_page(obj))
                        ptr = i915_gem_object_map_page(obj, type);