drm/i915: add runtime put/get calls at the basic places
If I add code to enable runtime PM on my Haswell machine, start a desktop environment, then enable runtime PM, these functions will complain that they're trying to read/write registers while the graphics card is suspended. v2: - Simplify i915_gem_fault changes. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> [danvet: Drop the hunk in i915_hangcheck_elapsed, it's the wrong thing to do.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
cd2e9e908a
commit
f65c916898
|
@ -1380,6 +1380,8 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
bool write = !!(vmf->flags & FAULT_FLAG_WRITE);
|
bool write = !!(vmf->flags & FAULT_FLAG_WRITE);
|
||||||
|
|
||||||
|
intel_runtime_pm_get(dev_priv);
|
||||||
|
|
||||||
/* We don't use vmf->pgoff since that has the fake offset */
|
/* We don't use vmf->pgoff since that has the fake offset */
|
||||||
page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >>
|
page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >>
|
||||||
PAGE_SHIFT;
|
PAGE_SHIFT;
|
||||||
|
@ -1427,8 +1429,10 @@ out:
|
||||||
/* If this -EIO is due to a gpu hang, give the reset code a
|
/* If this -EIO is due to a gpu hang, give the reset code a
|
||||||
* chance to clean up the mess. Otherwise return the proper
|
* chance to clean up the mess. Otherwise return the proper
|
||||||
* SIGBUS. */
|
* SIGBUS. */
|
||||||
if (i915_terminally_wedged(&dev_priv->gpu_error))
|
if (i915_terminally_wedged(&dev_priv->gpu_error)) {
|
||||||
return VM_FAULT_SIGBUS;
|
ret = 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
|
||||||
|
@ -1443,15 +1447,22 @@ out:
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
return VM_FAULT_NOPAGE;
|
ret = VM_FAULT_NOPAGE;
|
||||||
|
break;
|
||||||
case -ENOMEM:
|
case -ENOMEM:
|
||||||
return VM_FAULT_OOM;
|
ret = VM_FAULT_OOM;
|
||||||
|
break;
|
||||||
case -ENOSPC:
|
case -ENOSPC:
|
||||||
return VM_FAULT_SIGBUS;
|
ret = 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);
|
||||||
return VM_FAULT_SIGBUS;
|
ret = VM_FAULT_SIGBUS;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intel_runtime_pm_put(dev_priv);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4169,6 +4180,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
|
||||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||||
struct i915_vma *vma, *next;
|
struct i915_vma *vma, *next;
|
||||||
|
|
||||||
|
intel_runtime_pm_get(dev_priv);
|
||||||
|
|
||||||
trace_i915_gem_object_destroy(obj);
|
trace_i915_gem_object_destroy(obj);
|
||||||
|
|
||||||
if (obj->phys_obj)
|
if (obj->phys_obj)
|
||||||
|
@ -4213,6 +4226,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
|
||||||
|
|
||||||
kfree(obj->bit_17);
|
kfree(obj->bit_17);
|
||||||
i915_gem_object_free(obj);
|
i915_gem_object_free(obj);
|
||||||
|
|
||||||
|
intel_runtime_pm_put(dev_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
|
struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
|
||||||
|
|
|
@ -1108,6 +1108,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intel_runtime_pm_get(dev_priv);
|
||||||
|
|
||||||
ret = i915_mutex_lock_interruptible(dev);
|
ret = i915_mutex_lock_interruptible(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto pre_mutex_err;
|
goto pre_mutex_err;
|
||||||
|
@ -1237,6 +1239,10 @@ err:
|
||||||
|
|
||||||
pre_mutex_err:
|
pre_mutex_err:
|
||||||
kfree(cliprects);
|
kfree(cliprects);
|
||||||
|
|
||||||
|
/* intel_gpu_busy should also get a ref, so it will free when the device
|
||||||
|
* is really idle. */
|
||||||
|
intel_runtime_pm_put(dev_priv);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue