diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2013-07-31 20:00:05 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-05 13:04:13 -0400 |
commit | d1ccbb5d711ba4994eb36c4aac84e0269b5365fe (patch) | |
tree | dc857bef41378d61408320d2b3023fee9a59f8b8 /drivers/gpu | |
parent | 3e12302705a961cfe86d52155b4a8cbb34214748 (diff) |
drm/i915: make reset&hangcheck code VM aware
Hangcheck, and some of the recent reset code for guilty batches need to
know which address space the object was in at the time of a hangcheck.
This is because we use offsets in the (PP|G)GTT to determine this
information, and those offsets can differ depending on which VM they are
bound into.
Since we still only have 1 VM ever, this code shouldn't yet have any
impact.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f02d9234bd91..b7386df82030 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2119,10 +2119,11 @@ i915_gem_request_remove_from_client(struct drm_i915_gem_request *request) | |||
2119 | spin_unlock(&file_priv->mm.lock); | 2119 | spin_unlock(&file_priv->mm.lock); |
2120 | } | 2120 | } |
2121 | 2121 | ||
2122 | static bool i915_head_inside_object(u32 acthd, struct drm_i915_gem_object *obj) | 2122 | static bool i915_head_inside_object(u32 acthd, struct drm_i915_gem_object *obj, |
2123 | struct i915_address_space *vm) | ||
2123 | { | 2124 | { |
2124 | if (acthd >= i915_gem_obj_ggtt_offset(obj) && | 2125 | if (acthd >= i915_gem_obj_offset(obj, vm) && |
2125 | acthd < i915_gem_obj_ggtt_offset(obj) + obj->base.size) | 2126 | acthd < i915_gem_obj_offset(obj, vm) + obj->base.size) |
2126 | return true; | 2127 | return true; |
2127 | 2128 | ||
2128 | return false; | 2129 | return false; |
@@ -2145,6 +2146,17 @@ static bool i915_head_inside_request(const u32 acthd_unmasked, | |||
2145 | return false; | 2146 | return false; |
2146 | } | 2147 | } |
2147 | 2148 | ||
2149 | static struct i915_address_space * | ||
2150 | request_to_vm(struct drm_i915_gem_request *request) | ||
2151 | { | ||
2152 | struct drm_i915_private *dev_priv = request->ring->dev->dev_private; | ||
2153 | struct i915_address_space *vm; | ||
2154 | |||
2155 | vm = &dev_priv->gtt.base; | ||
2156 | |||
2157 | return vm; | ||
2158 | } | ||
2159 | |||
2148 | static bool i915_request_guilty(struct drm_i915_gem_request *request, | 2160 | static bool i915_request_guilty(struct drm_i915_gem_request *request, |
2149 | const u32 acthd, bool *inside) | 2161 | const u32 acthd, bool *inside) |
2150 | { | 2162 | { |
@@ -2152,9 +2164,9 @@ static bool i915_request_guilty(struct drm_i915_gem_request *request, | |||
2152 | * pointing inside the ring, matches the batch_obj address range. | 2164 | * pointing inside the ring, matches the batch_obj address range. |
2153 | * However this is extremely unlikely. | 2165 | * However this is extremely unlikely. |
2154 | */ | 2166 | */ |
2155 | |||
2156 | if (request->batch_obj) { | 2167 | if (request->batch_obj) { |
2157 | if (i915_head_inside_object(acthd, request->batch_obj)) { | 2168 | if (i915_head_inside_object(acthd, request->batch_obj, |
2169 | request_to_vm(request))) { | ||
2158 | *inside = true; | 2170 | *inside = true; |
2159 | return true; | 2171 | return true; |
2160 | } | 2172 | } |
@@ -2174,17 +2186,21 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring, | |||
2174 | { | 2186 | { |
2175 | struct i915_ctx_hang_stats *hs = NULL; | 2187 | struct i915_ctx_hang_stats *hs = NULL; |
2176 | bool inside, guilty; | 2188 | bool inside, guilty; |
2189 | unsigned long offset = 0; | ||
2177 | 2190 | ||
2178 | /* Innocent until proven guilty */ | 2191 | /* Innocent until proven guilty */ |
2179 | guilty = false; | 2192 | guilty = false; |
2180 | 2193 | ||
2194 | if (request->batch_obj) | ||
2195 | offset = i915_gem_obj_offset(request->batch_obj, | ||
2196 | request_to_vm(request)); | ||
2197 | |||
2181 | if (ring->hangcheck.action != wait && | 2198 | if (ring->hangcheck.action != wait && |
2182 | i915_request_guilty(request, acthd, &inside)) { | 2199 | i915_request_guilty(request, acthd, &inside)) { |
2183 | DRM_ERROR("%s hung %s bo (0x%lx ctx %d) at 0x%x\n", | 2200 | DRM_ERROR("%s hung %s bo (0x%lx ctx %d) at 0x%x\n", |
2184 | ring->name, | 2201 | ring->name, |
2185 | inside ? "inside" : "flushing", | 2202 | inside ? "inside" : "flushing", |
2186 | request->batch_obj ? | 2203 | offset, |
2187 | i915_gem_obj_ggtt_offset(request->batch_obj) : 0, | ||
2188 | request->ctx ? request->ctx->id : 0, | 2204 | request->ctx ? request->ctx->id : 0, |
2189 | acthd); | 2205 | acthd); |
2190 | 2206 | ||