Commit 52137010 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Change i915_gem_fault() to return vm_fault_t

In preparation for vm_fault_t becoming a distinct type, convert the
fault handler (i915_gem_fault()) over to the new interface.

Based on a patch by Souptick Joarder

References: 1c8f4220 ("mm: change return type to vm_fault_t")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: default avatarMatthew Auld <matthew.william.auld@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180606214520.20220-1-chris@chris-wilson.co.uk
parent 8571a05a
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/hash.h> #include <linux/hash.h>
#include <linux/intel-iommu.h> #include <linux/intel-iommu.h>
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/mm_types.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/pm_qos.h> #include <linux/pm_qos.h>
#include <linux/reservation.h> #include <linux/reservation.h>
...@@ -3174,7 +3175,7 @@ int i915_gem_wait_for_idle(struct drm_i915_private *dev_priv, ...@@ -3174,7 +3175,7 @@ int i915_gem_wait_for_idle(struct drm_i915_private *dev_priv,
int __must_check i915_gem_suspend(struct drm_i915_private *dev_priv); int __must_check i915_gem_suspend(struct drm_i915_private *dev_priv);
void i915_gem_suspend_late(struct drm_i915_private *dev_priv); void i915_gem_suspend_late(struct drm_i915_private *dev_priv);
void i915_gem_resume(struct drm_i915_private *dev_priv); void i915_gem_resume(struct drm_i915_private *dev_priv);
int i915_gem_fault(struct vm_fault *vmf); vm_fault_t i915_gem_fault(struct vm_fault *vmf);
int i915_gem_object_wait(struct drm_i915_gem_object *obj, int i915_gem_object_wait(struct drm_i915_gem_object *obj,
unsigned int flags, unsigned int flags,
long timeout, long timeout,
......
...@@ -1995,7 +1995,7 @@ compute_partial_view(struct drm_i915_gem_object *obj, ...@@ -1995,7 +1995,7 @@ compute_partial_view(struct drm_i915_gem_object *obj,
* The current feature set supported by i915_gem_fault() and thus GTT mmaps * The current feature set supported by i915_gem_fault() and thus GTT mmaps
* is exposed via I915_PARAM_MMAP_GTT_VERSION (see i915_gem_mmap_gtt_version). * is exposed via I915_PARAM_MMAP_GTT_VERSION (see i915_gem_mmap_gtt_version).
*/ */
int i915_gem_fault(struct vm_fault *vmf) vm_fault_t i915_gem_fault(struct vm_fault *vmf)
{ {
#define MIN_CHUNK_PAGES (SZ_1M >> PAGE_SHIFT) #define MIN_CHUNK_PAGES (SZ_1M >> PAGE_SHIFT)
struct vm_area_struct *area = vmf->vma; struct vm_area_struct *area = vmf->vma;
...@@ -2112,10 +2112,8 @@ int i915_gem_fault(struct vm_fault *vmf) ...@@ -2112,10 +2112,8 @@ int i915_gem_fault(struct vm_fault *vmf)
* fail). But any other -EIO isn't ours (e.g. swap in failure) * fail). But any other -EIO isn't ours (e.g. swap in failure)
* and so needs to be reported. * and so needs to be reported.
*/ */
if (!i915_terminally_wedged(&dev_priv->gpu_error)) { if (!i915_terminally_wedged(&dev_priv->gpu_error))
ret = VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
break;
}
case -EAGAIN: case -EAGAIN:
/* /*
* EAGAIN means the gpu is hung and we'll wait for the error * EAGAIN means the gpu is hung and we'll wait for the error
...@@ -2130,21 +2128,16 @@ int i915_gem_fault(struct vm_fault *vmf) ...@@ -2130,21 +2128,16 @@ int i915_gem_fault(struct vm_fault *vmf)
* EBUSY is ok: this just means that another thread * EBUSY is ok: this just means that another thread
* already did the job. * already did the job.
*/ */
ret = VM_FAULT_NOPAGE; return VM_FAULT_NOPAGE;
break;
case -ENOMEM: case -ENOMEM:
ret = VM_FAULT_OOM; return VM_FAULT_OOM;
break;
case -ENOSPC: case -ENOSPC:
case -EFAULT: case -EFAULT:
ret = VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
break;
default: default:
WARN_ONCE(ret, "unhandled error in i915_gem_fault: %i\n", ret); WARN_ONCE(ret, "unhandled error in i915_gem_fault: %i\n", ret);
ret = VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
break;
} }
return ret;
} }
static void __i915_gem_object_release_mmap(struct drm_i915_gem_object *obj) static void __i915_gem_object_release_mmap(struct drm_i915_gem_object *obj)
......
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