diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c26d36cc4b31..5b205863b659 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2659,8 +2659,7 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, | |||
2659 | if (submit_req->ctx != ring->default_context) | 2659 | if (submit_req->ctx != ring->default_context) |
2660 | intel_lr_context_unpin(ring, submit_req->ctx); | 2660 | intel_lr_context_unpin(ring, submit_req->ctx); |
2661 | 2661 | ||
2662 | i915_gem_context_unreference(submit_req->ctx); | 2662 | i915_gem_request_unreference(submit_req); |
2663 | kfree(submit_req); | ||
2664 | } | 2663 | } |
2665 | 2664 | ||
2666 | /* | 2665 | /* |
@@ -2937,9 +2936,9 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2937 | req = obj->last_read_req; | 2936 | req = obj->last_read_req; |
2938 | 2937 | ||
2939 | /* Do this after OLR check to make sure we make forward progress polling | 2938 | /* Do this after OLR check to make sure we make forward progress polling |
2940 | * on this IOCTL with a timeout <=0 (like busy ioctl) | 2939 | * on this IOCTL with a timeout == 0 (like busy ioctl) |
2941 | */ | 2940 | */ |
2942 | if (args->timeout_ns <= 0) { | 2941 | if (args->timeout_ns == 0) { |
2943 | ret = -ETIME; | 2942 | ret = -ETIME; |
2944 | goto out; | 2943 | goto out; |
2945 | } | 2944 | } |
@@ -2949,7 +2948,8 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2949 | i915_gem_request_reference(req); | 2948 | i915_gem_request_reference(req); |
2950 | mutex_unlock(&dev->struct_mutex); | 2949 | mutex_unlock(&dev->struct_mutex); |
2951 | 2950 | ||
2952 | ret = __i915_wait_request(req, reset_counter, true, &args->timeout_ns, | 2951 | ret = __i915_wait_request(req, reset_counter, true, |
2952 | args->timeout_ns > 0 ? &args->timeout_ns : NULL, | ||
2953 | file->driver_priv); | 2953 | file->driver_priv); |
2954 | mutex_lock(&dev->struct_mutex); | 2954 | mutex_lock(&dev->struct_mutex); |
2955 | i915_gem_request_unreference(req); | 2955 | i915_gem_request_unreference(req); |
@@ -4793,6 +4793,9 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4793 | if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt()) | 4793 | if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt()) |
4794 | return -EIO; | 4794 | return -EIO; |
4795 | 4795 | ||
4796 | /* Double layer security blanket, see i915_gem_init() */ | ||
4797 | intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); | ||
4798 | |||
4796 | if (dev_priv->ellc_size) | 4799 | if (dev_priv->ellc_size) |
4797 | I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf)); | 4800 | I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf)); |
4798 | 4801 | ||
@@ -4825,7 +4828,7 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4825 | for_each_ring(ring, dev_priv, i) { | 4828 | for_each_ring(ring, dev_priv, i) { |
4826 | ret = ring->init_hw(ring); | 4829 | ret = ring->init_hw(ring); |
4827 | if (ret) | 4830 | if (ret) |
4828 | return ret; | 4831 | goto out; |
4829 | } | 4832 | } |
4830 | 4833 | ||
4831 | for (i = 0; i < NUM_L3_SLICES(dev); i++) | 4834 | for (i = 0; i < NUM_L3_SLICES(dev); i++) |
@@ -4842,9 +4845,11 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4842 | DRM_ERROR("Context enable failed %d\n", ret); | 4845 | DRM_ERROR("Context enable failed %d\n", ret); |
4843 | i915_gem_cleanup_ringbuffer(dev); | 4846 | i915_gem_cleanup_ringbuffer(dev); |
4844 | 4847 | ||
4845 | return ret; | 4848 | goto out; |
4846 | } | 4849 | } |
4847 | 4850 | ||
4851 | out: | ||
4852 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); | ||
4848 | return ret; | 4853 | return ret; |
4849 | } | 4854 | } |
4850 | 4855 | ||
@@ -4878,6 +4883,14 @@ int i915_gem_init(struct drm_device *dev) | |||
4878 | dev_priv->gt.stop_ring = intel_logical_ring_stop; | 4883 | dev_priv->gt.stop_ring = intel_logical_ring_stop; |
4879 | } | 4884 | } |
4880 | 4885 | ||
4886 | /* This is just a security blanket to placate dragons. | ||
4887 | * On some systems, we very sporadically observe that the first TLBs | ||
4888 | * used by the CS may be stale, despite us poking the TLB reset. If | ||
4889 | * we hold the forcewake during initialisation these problems | ||
4890 | * just magically go away. | ||
4891 | */ | ||
4892 | intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); | ||
4893 | |||
4881 | ret = i915_gem_init_userptr(dev); | 4894 | ret = i915_gem_init_userptr(dev); |
4882 | if (ret) | 4895 | if (ret) |
4883 | goto out_unlock; | 4896 | goto out_unlock; |
@@ -4904,6 +4917,7 @@ int i915_gem_init(struct drm_device *dev) | |||
4904 | } | 4917 | } |
4905 | 4918 | ||
4906 | out_unlock: | 4919 | out_unlock: |
4920 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); | ||
4907 | mutex_unlock(&dev->struct_mutex); | 4921 | mutex_unlock(&dev->struct_mutex); |
4908 | 4922 | ||
4909 | return ret; | 4923 | return ret; |