diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index e5daad5f75fb..5b205863b659 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2936,9 +2936,9 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2936 | req = obj->last_read_req; | 2936 | req = obj->last_read_req; |
2937 | 2937 | ||
2938 | /* 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 |
2939 | * on this IOCTL with a timeout <=0 (like busy ioctl) | 2939 | * on this IOCTL with a timeout == 0 (like busy ioctl) |
2940 | */ | 2940 | */ |
2941 | if (args->timeout_ns <= 0) { | 2941 | if (args->timeout_ns == 0) { |
2942 | ret = -ETIME; | 2942 | ret = -ETIME; |
2943 | goto out; | 2943 | goto out; |
2944 | } | 2944 | } |
@@ -2948,7 +2948,8 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2948 | i915_gem_request_reference(req); | 2948 | i915_gem_request_reference(req); |
2949 | mutex_unlock(&dev->struct_mutex); | 2949 | mutex_unlock(&dev->struct_mutex); |
2950 | 2950 | ||
2951 | 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, | ||
2952 | file->driver_priv); | 2953 | file->driver_priv); |
2953 | mutex_lock(&dev->struct_mutex); | 2954 | mutex_lock(&dev->struct_mutex); |
2954 | i915_gem_request_unreference(req); | 2955 | i915_gem_request_unreference(req); |
@@ -4792,6 +4793,9 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4792 | if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt()) | 4793 | if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt()) |
4793 | return -EIO; | 4794 | return -EIO; |
4794 | 4795 | ||
4796 | /* Double layer security blanket, see i915_gem_init() */ | ||
4797 | intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); | ||
4798 | |||
4795 | if (dev_priv->ellc_size) | 4799 | if (dev_priv->ellc_size) |
4796 | I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf)); | 4800 | I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf)); |
4797 | 4801 | ||
@@ -4824,7 +4828,7 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4824 | for_each_ring(ring, dev_priv, i) { | 4828 | for_each_ring(ring, dev_priv, i) { |
4825 | ret = ring->init_hw(ring); | 4829 | ret = ring->init_hw(ring); |
4826 | if (ret) | 4830 | if (ret) |
4827 | return ret; | 4831 | goto out; |
4828 | } | 4832 | } |
4829 | 4833 | ||
4830 | for (i = 0; i < NUM_L3_SLICES(dev); i++) | 4834 | for (i = 0; i < NUM_L3_SLICES(dev); i++) |
@@ -4841,9 +4845,11 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4841 | DRM_ERROR("Context enable failed %d\n", ret); | 4845 | DRM_ERROR("Context enable failed %d\n", ret); |
4842 | i915_gem_cleanup_ringbuffer(dev); | 4846 | i915_gem_cleanup_ringbuffer(dev); |
4843 | 4847 | ||
4844 | return ret; | 4848 | goto out; |
4845 | } | 4849 | } |
4846 | 4850 | ||
4851 | out: | ||
4852 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); | ||
4847 | return ret; | 4853 | return ret; |
4848 | } | 4854 | } |
4849 | 4855 | ||
@@ -4877,6 +4883,14 @@ int i915_gem_init(struct drm_device *dev) | |||
4877 | dev_priv->gt.stop_ring = intel_logical_ring_stop; | 4883 | dev_priv->gt.stop_ring = intel_logical_ring_stop; |
4878 | } | 4884 | } |
4879 | 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 | |||
4880 | ret = i915_gem_init_userptr(dev); | 4894 | ret = i915_gem_init_userptr(dev); |
4881 | if (ret) | 4895 | if (ret) |
4882 | goto out_unlock; | 4896 | goto out_unlock; |
@@ -4903,6 +4917,7 @@ int i915_gem_init(struct drm_device *dev) | |||
4903 | } | 4917 | } |
4904 | 4918 | ||
4905 | out_unlock: | 4919 | out_unlock: |
4920 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); | ||
4906 | mutex_unlock(&dev->struct_mutex); | 4921 | mutex_unlock(&dev->struct_mutex); |
4907 | 4922 | ||
4908 | return ret; | 4923 | return ret; |