Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2015 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | */ |
| 24 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 25 | #include <linux/kthread.h> |
| 26 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 27 | #include "i915_drv.h" |
| 28 | |
Chris Wilson | 2246bea | 2017-02-17 15:13:00 +0000 | [diff] [blame] | 29 | static unsigned long wait_timeout(void) |
| 30 | { |
| 31 | return round_jiffies_up(jiffies + DRM_I915_HANGCHECK_JIFFIES); |
| 32 | } |
| 33 | |
Chris Wilson | 83348ba | 2016-08-09 17:47:51 +0100 | [diff] [blame] | 34 | static void intel_breadcrumbs_hangcheck(unsigned long data) |
| 35 | { |
| 36 | struct intel_engine_cs *engine = (struct intel_engine_cs *)data; |
| 37 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 38 | |
| 39 | if (!b->irq_enabled) |
| 40 | return; |
| 41 | |
Chris Wilson | 2246bea | 2017-02-17 15:13:00 +0000 | [diff] [blame] | 42 | if (b->hangcheck_interrupts != atomic_read(&engine->irq_count)) { |
| 43 | b->hangcheck_interrupts = atomic_read(&engine->irq_count); |
| 44 | mod_timer(&b->hangcheck, wait_timeout()); |
Chris Wilson | 83348ba | 2016-08-09 17:47:51 +0100 | [diff] [blame] | 45 | return; |
| 46 | } |
| 47 | |
Chris Wilson | 8998567 | 2017-02-17 15:13:02 +0000 | [diff] [blame] | 48 | /* If the waiter was currently running, assume it hasn't had a chance |
| 49 | * to process the pending interrupt (e.g, low priority task on a loaded |
| 50 | * system) and wait until it sleeps before declaring a missed interrupt. |
| 51 | */ |
| 52 | if (!intel_engine_wakeup(engine)) { |
| 53 | mod_timer(&b->hangcheck, wait_timeout()); |
| 54 | return; |
| 55 | } |
| 56 | |
Chris Wilson | 83348ba | 2016-08-09 17:47:51 +0100 | [diff] [blame] | 57 | DRM_DEBUG("Hangcheck timer elapsed... %s idle\n", engine->name); |
| 58 | set_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings); |
| 59 | mod_timer(&engine->breadcrumbs.fake_irq, jiffies + 1); |
| 60 | |
| 61 | /* Ensure that even if the GPU hangs, we get woken up. |
| 62 | * |
| 63 | * However, note that if no one is waiting, we never notice |
| 64 | * a gpu hang. Eventually, we will have to wait for a resource |
| 65 | * held by the GPU and so trigger a hangcheck. In the most |
| 66 | * pathological case, this will be upon memory starvation! To |
| 67 | * prevent this, we also queue the hangcheck from the retire |
| 68 | * worker. |
| 69 | */ |
| 70 | i915_queue_hangcheck(engine->i915); |
| 71 | } |
| 72 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 73 | static void intel_breadcrumbs_fake_irq(unsigned long data) |
| 74 | { |
| 75 | struct intel_engine_cs *engine = (struct intel_engine_cs *)data; |
| 76 | |
| 77 | /* |
| 78 | * The timer persists in case we cannot enable interrupts, |
| 79 | * or if we have previously seen seqno/interrupt incoherency |
| 80 | * ("missed interrupt" syndrome). Here the worker will wake up |
| 81 | * every jiffie in order to kick the oldest waiter to do the |
| 82 | * coherent seqno check. |
| 83 | */ |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 84 | if (intel_engine_wakeup(engine)) |
| 85 | mod_timer(&engine->breadcrumbs.fake_irq, jiffies + 1); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | static void irq_enable(struct intel_engine_cs *engine) |
| 89 | { |
Chris Wilson | 3d5564e | 2016-07-01 17:23:23 +0100 | [diff] [blame] | 90 | /* Enabling the IRQ may miss the generation of the interrupt, but |
| 91 | * we still need to force the barrier before reading the seqno, |
| 92 | * just in case. |
| 93 | */ |
Chris Wilson | 538b257 | 2017-01-24 15:18:05 +0000 | [diff] [blame] | 94 | set_bit(ENGINE_IRQ_BREADCRUMB, &engine->irq_posted); |
Chris Wilson | 31bb59c | 2016-07-01 17:23:27 +0100 | [diff] [blame] | 95 | |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 96 | /* Caller disables interrupts */ |
| 97 | spin_lock(&engine->i915->irq_lock); |
Chris Wilson | 31bb59c | 2016-07-01 17:23:27 +0100 | [diff] [blame] | 98 | engine->irq_enable(engine); |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 99 | spin_unlock(&engine->i915->irq_lock); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | static void irq_disable(struct intel_engine_cs *engine) |
| 103 | { |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 104 | /* Caller disables interrupts */ |
| 105 | spin_lock(&engine->i915->irq_lock); |
Chris Wilson | 31bb59c | 2016-07-01 17:23:27 +0100 | [diff] [blame] | 106 | engine->irq_disable(engine); |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 107 | spin_unlock(&engine->i915->irq_lock); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 108 | } |
| 109 | |
Chris Wilson | 6ef98ea | 2017-02-17 15:13:03 +0000 | [diff] [blame] | 110 | static bool use_fake_irq(const struct intel_breadcrumbs *b) |
| 111 | { |
| 112 | const struct intel_engine_cs *engine = |
| 113 | container_of(b, struct intel_engine_cs, breadcrumbs); |
| 114 | |
| 115 | if (!test_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings)) |
| 116 | return false; |
| 117 | |
| 118 | /* Only start with the heavy weight fake irq timer if we have not |
| 119 | * seen any interrupts since enabling it the first time. If the |
| 120 | * interrupts are still arriving, it means we made a mistake in our |
| 121 | * engine->seqno_barrier(), a timing error that should be transient |
| 122 | * and unlikely to reoccur. |
| 123 | */ |
| 124 | return atomic_read(&engine->irq_count) == b->hangcheck_interrupts; |
| 125 | } |
| 126 | |
Chris Wilson | 0417131 | 2016-07-06 12:39:00 +0100 | [diff] [blame] | 127 | static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b) |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 128 | { |
| 129 | struct intel_engine_cs *engine = |
| 130 | container_of(b, struct intel_engine_cs, breadcrumbs); |
| 131 | struct drm_i915_private *i915 = engine->i915; |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 132 | |
| 133 | assert_spin_locked(&b->lock); |
| 134 | if (b->rpm_wakelock) |
Chris Wilson | 0417131 | 2016-07-06 12:39:00 +0100 | [diff] [blame] | 135 | return; |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 136 | |
Chris Wilson | f97fbf9 | 2017-02-13 17:15:14 +0000 | [diff] [blame] | 137 | if (I915_SELFTEST_ONLY(b->mock)) { |
| 138 | /* For our mock objects we want to avoid interaction |
| 139 | * with the real hardware (which is not set up). So |
| 140 | * we simply pretend we have enabled the powerwell |
| 141 | * and the irq, and leave it up to the mock |
| 142 | * implementation to call intel_engine_wakeup() |
| 143 | * itself when it wants to simulate a user interrupt, |
| 144 | */ |
| 145 | b->rpm_wakelock = true; |
| 146 | return; |
| 147 | } |
| 148 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 149 | /* Since we are waiting on a request, the GPU should be busy |
| 150 | * and should have its own rpm reference. For completeness, |
| 151 | * record an rpm reference for ourselves to cover the |
| 152 | * interrupt we unmask. |
| 153 | */ |
| 154 | intel_runtime_pm_get_noresume(i915); |
| 155 | b->rpm_wakelock = true; |
| 156 | |
| 157 | /* No interrupts? Kick the waiter every jiffie! */ |
| 158 | if (intel_irqs_enabled(i915)) { |
Chris Wilson | 3d5564e | 2016-07-01 17:23:23 +0100 | [diff] [blame] | 159 | if (!test_bit(engine->id, &i915->gpu_error.test_irq_rings)) |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 160 | irq_enable(engine); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 161 | b->irq_enabled = true; |
| 162 | } |
| 163 | |
Chris Wilson | 6ef98ea | 2017-02-17 15:13:03 +0000 | [diff] [blame] | 164 | if (!b->irq_enabled || use_fake_irq(b)) { |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 165 | mod_timer(&b->fake_irq, jiffies + 1); |
Chris Wilson | 2f1ac9c | 2017-01-23 09:37:24 +0000 | [diff] [blame] | 166 | i915_queue_hangcheck(i915); |
Chris Wilson | 83348ba | 2016-08-09 17:47:51 +0100 | [diff] [blame] | 167 | } else { |
| 168 | /* Ensure we never sleep indefinitely */ |
Chris Wilson | 2246bea | 2017-02-17 15:13:00 +0000 | [diff] [blame] | 169 | mod_timer(&b->hangcheck, wait_timeout()); |
Chris Wilson | 83348ba | 2016-08-09 17:47:51 +0100 | [diff] [blame] | 170 | } |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | static void __intel_breadcrumbs_disable_irq(struct intel_breadcrumbs *b) |
| 174 | { |
| 175 | struct intel_engine_cs *engine = |
| 176 | container_of(b, struct intel_engine_cs, breadcrumbs); |
| 177 | |
| 178 | assert_spin_locked(&b->lock); |
| 179 | if (!b->rpm_wakelock) |
| 180 | return; |
| 181 | |
Chris Wilson | f97fbf9 | 2017-02-13 17:15:14 +0000 | [diff] [blame] | 182 | if (I915_SELFTEST_ONLY(b->mock)) { |
| 183 | b->rpm_wakelock = false; |
| 184 | return; |
| 185 | } |
| 186 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 187 | if (b->irq_enabled) { |
| 188 | irq_disable(engine); |
| 189 | b->irq_enabled = false; |
| 190 | } |
| 191 | |
| 192 | intel_runtime_pm_put(engine->i915); |
| 193 | b->rpm_wakelock = false; |
| 194 | } |
| 195 | |
| 196 | static inline struct intel_wait *to_wait(struct rb_node *node) |
| 197 | { |
Chris Wilson | d856786 | 2016-12-20 10:40:03 +0000 | [diff] [blame] | 198 | return rb_entry(node, struct intel_wait, node); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | static inline void __intel_breadcrumbs_finish(struct intel_breadcrumbs *b, |
| 202 | struct intel_wait *wait) |
| 203 | { |
| 204 | assert_spin_locked(&b->lock); |
| 205 | |
| 206 | /* This request is completed, so remove it from the tree, mark it as |
| 207 | * complete, and *then* wake up the associated task. |
| 208 | */ |
| 209 | rb_erase(&wait->node, &b->waiters); |
| 210 | RB_CLEAR_NODE(&wait->node); |
| 211 | |
| 212 | wake_up_process(wait->tsk); /* implicit smp_wmb() */ |
| 213 | } |
| 214 | |
| 215 | static bool __intel_engine_add_wait(struct intel_engine_cs *engine, |
| 216 | struct intel_wait *wait) |
| 217 | { |
| 218 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 219 | struct rb_node **p, *parent, *completed; |
| 220 | bool first; |
| 221 | u32 seqno; |
| 222 | |
| 223 | /* Insert the request into the retirement ordered list |
| 224 | * of waiters by walking the rbtree. If we are the oldest |
| 225 | * seqno in the tree (the first to be retired), then |
| 226 | * set ourselves as the bottom-half. |
| 227 | * |
| 228 | * As we descend the tree, prune completed branches since we hold the |
| 229 | * spinlock we know that the first_waiter must be delayed and can |
| 230 | * reduce some of the sequential wake up latency if we take action |
| 231 | * ourselves and wake up the completed tasks in parallel. Also, by |
| 232 | * removing stale elements in the tree, we may be able to reduce the |
| 233 | * ping-pong between the old bottom-half and ourselves as first-waiter. |
| 234 | */ |
| 235 | first = true; |
| 236 | parent = NULL; |
| 237 | completed = NULL; |
Chris Wilson | 1b7744e | 2016-07-01 17:23:17 +0100 | [diff] [blame] | 238 | seqno = intel_engine_get_seqno(engine); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 239 | |
| 240 | /* If the request completed before we managed to grab the spinlock, |
| 241 | * return now before adding ourselves to the rbtree. We let the |
| 242 | * current bottom-half handle any pending wakeups and instead |
| 243 | * try and get out of the way quickly. |
| 244 | */ |
| 245 | if (i915_seqno_passed(seqno, wait->seqno)) { |
| 246 | RB_CLEAR_NODE(&wait->node); |
| 247 | return first; |
| 248 | } |
| 249 | |
| 250 | p = &b->waiters.rb_node; |
| 251 | while (*p) { |
| 252 | parent = *p; |
| 253 | if (wait->seqno == to_wait(parent)->seqno) { |
| 254 | /* We have multiple waiters on the same seqno, select |
| 255 | * the highest priority task (that with the smallest |
| 256 | * task->prio) to serve as the bottom-half for this |
| 257 | * group. |
| 258 | */ |
| 259 | if (wait->tsk->prio > to_wait(parent)->tsk->prio) { |
| 260 | p = &parent->rb_right; |
| 261 | first = false; |
| 262 | } else { |
| 263 | p = &parent->rb_left; |
| 264 | } |
| 265 | } else if (i915_seqno_passed(wait->seqno, |
| 266 | to_wait(parent)->seqno)) { |
| 267 | p = &parent->rb_right; |
| 268 | if (i915_seqno_passed(seqno, to_wait(parent)->seqno)) |
| 269 | completed = parent; |
| 270 | else |
| 271 | first = false; |
| 272 | } else { |
| 273 | p = &parent->rb_left; |
| 274 | } |
| 275 | } |
| 276 | rb_link_node(&wait->node, parent, p); |
| 277 | rb_insert_color(&wait->node, &b->waiters); |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 278 | GEM_BUG_ON(!first && !rcu_access_pointer(b->irq_seqno_bh)); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 279 | |
| 280 | if (completed) { |
| 281 | struct rb_node *next = rb_next(completed); |
| 282 | |
| 283 | GEM_BUG_ON(!next && !first); |
| 284 | if (next && next != &wait->node) { |
| 285 | GEM_BUG_ON(first); |
| 286 | b->first_wait = to_wait(next); |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 287 | rcu_assign_pointer(b->irq_seqno_bh, b->first_wait->tsk); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 288 | /* As there is a delay between reading the current |
| 289 | * seqno, processing the completed tasks and selecting |
| 290 | * the next waiter, we may have missed the interrupt |
| 291 | * and so need for the next bottom-half to wakeup. |
| 292 | * |
| 293 | * Also as we enable the IRQ, we may miss the |
| 294 | * interrupt for that seqno, so we have to wake up |
| 295 | * the next bottom-half in order to do a coherent check |
| 296 | * in case the seqno passed. |
| 297 | */ |
| 298 | __intel_breadcrumbs_enable_irq(b); |
Chris Wilson | 538b257 | 2017-01-24 15:18:05 +0000 | [diff] [blame] | 299 | if (test_bit(ENGINE_IRQ_BREADCRUMB, |
| 300 | &engine->irq_posted)) |
Chris Wilson | 3d5564e | 2016-07-01 17:23:23 +0100 | [diff] [blame] | 301 | wake_up_process(to_wait(next)->tsk); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | do { |
| 305 | struct intel_wait *crumb = to_wait(completed); |
| 306 | completed = rb_prev(completed); |
| 307 | __intel_breadcrumbs_finish(b, crumb); |
| 308 | } while (completed); |
| 309 | } |
| 310 | |
| 311 | if (first) { |
| 312 | GEM_BUG_ON(rb_first(&b->waiters) != &wait->node); |
| 313 | b->first_wait = wait; |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 314 | rcu_assign_pointer(b->irq_seqno_bh, wait->tsk); |
Chris Wilson | 0417131 | 2016-07-06 12:39:00 +0100 | [diff] [blame] | 315 | /* After assigning ourselves as the new bottom-half, we must |
| 316 | * perform a cursory check to prevent a missed interrupt. |
| 317 | * Either we miss the interrupt whilst programming the hardware, |
| 318 | * or if there was a previous waiter (for a later seqno) they |
| 319 | * may be woken instead of us (due to the inherent race |
Chris Wilson | aca34b6 | 2016-07-06 12:39:02 +0100 | [diff] [blame] | 320 | * in the unlocked read of b->irq_seqno_bh in the irq handler) |
| 321 | * and so we miss the wake up. |
Chris Wilson | 0417131 | 2016-07-06 12:39:00 +0100 | [diff] [blame] | 322 | */ |
| 323 | __intel_breadcrumbs_enable_irq(b); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 324 | } |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 325 | GEM_BUG_ON(!rcu_access_pointer(b->irq_seqno_bh)); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 326 | GEM_BUG_ON(!b->first_wait); |
| 327 | GEM_BUG_ON(rb_first(&b->waiters) != &b->first_wait->node); |
| 328 | |
| 329 | return first; |
| 330 | } |
| 331 | |
| 332 | bool intel_engine_add_wait(struct intel_engine_cs *engine, |
| 333 | struct intel_wait *wait) |
| 334 | { |
| 335 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 336 | bool first; |
| 337 | |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 338 | spin_lock_irq(&b->lock); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 339 | first = __intel_engine_add_wait(engine, wait); |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 340 | spin_unlock_irq(&b->lock); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 341 | |
| 342 | return first; |
| 343 | } |
| 344 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 345 | static inline bool chain_wakeup(struct rb_node *rb, int priority) |
| 346 | { |
| 347 | return rb && to_wait(rb)->tsk->prio <= priority; |
| 348 | } |
| 349 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 350 | static inline int wakeup_priority(struct intel_breadcrumbs *b, |
| 351 | struct task_struct *tsk) |
| 352 | { |
| 353 | if (tsk == b->signaler) |
| 354 | return INT_MIN; |
| 355 | else |
| 356 | return tsk->prio; |
| 357 | } |
| 358 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 359 | void intel_engine_remove_wait(struct intel_engine_cs *engine, |
| 360 | struct intel_wait *wait) |
| 361 | { |
| 362 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 363 | |
| 364 | /* Quick check to see if this waiter was already decoupled from |
| 365 | * the tree by the bottom-half to avoid contention on the spinlock |
| 366 | * by the herd. |
| 367 | */ |
| 368 | if (RB_EMPTY_NODE(&wait->node)) |
| 369 | return; |
| 370 | |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 371 | spin_lock_irq(&b->lock); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 372 | |
| 373 | if (RB_EMPTY_NODE(&wait->node)) |
| 374 | goto out_unlock; |
| 375 | |
| 376 | if (b->first_wait == wait) { |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 377 | const int priority = wakeup_priority(b, wait->tsk); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 378 | struct rb_node *next; |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 379 | |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 380 | GEM_BUG_ON(rcu_access_pointer(b->irq_seqno_bh) != wait->tsk); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 381 | |
| 382 | /* We are the current bottom-half. Find the next candidate, |
| 383 | * the first waiter in the queue on the remaining oldest |
| 384 | * request. As multiple seqnos may complete in the time it |
| 385 | * takes us to wake up and find the next waiter, we have to |
| 386 | * wake up that waiter for it to perform its own coherent |
| 387 | * completion check. |
| 388 | */ |
| 389 | next = rb_next(&wait->node); |
| 390 | if (chain_wakeup(next, priority)) { |
| 391 | /* If the next waiter is already complete, |
| 392 | * wake it up and continue onto the next waiter. So |
| 393 | * if have a small herd, they will wake up in parallel |
| 394 | * rather than sequentially, which should reduce |
| 395 | * the overall latency in waking all the completed |
| 396 | * clients. |
| 397 | * |
| 398 | * However, waking up a chain adds extra latency to |
| 399 | * the first_waiter. This is undesirable if that |
| 400 | * waiter is a high priority task. |
| 401 | */ |
Chris Wilson | 1b7744e | 2016-07-01 17:23:17 +0100 | [diff] [blame] | 402 | u32 seqno = intel_engine_get_seqno(engine); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 403 | |
| 404 | while (i915_seqno_passed(seqno, to_wait(next)->seqno)) { |
| 405 | struct rb_node *n = rb_next(next); |
| 406 | |
| 407 | __intel_breadcrumbs_finish(b, to_wait(next)); |
| 408 | next = n; |
| 409 | if (!chain_wakeup(next, priority)) |
| 410 | break; |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | if (next) { |
| 415 | /* In our haste, we may have completed the first waiter |
| 416 | * before we enabled the interrupt. Do so now as we |
| 417 | * have a second waiter for a future seqno. Afterwards, |
| 418 | * we have to wake up that waiter in case we missed |
| 419 | * the interrupt, or if we have to handle an |
| 420 | * exception rather than a seqno completion. |
| 421 | */ |
| 422 | b->first_wait = to_wait(next); |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 423 | rcu_assign_pointer(b->irq_seqno_bh, b->first_wait->tsk); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 424 | if (b->first_wait->seqno != wait->seqno) |
| 425 | __intel_breadcrumbs_enable_irq(b); |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 426 | wake_up_process(b->first_wait->tsk); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 427 | } else { |
| 428 | b->first_wait = NULL; |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 429 | rcu_assign_pointer(b->irq_seqno_bh, NULL); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 430 | __intel_breadcrumbs_disable_irq(b); |
| 431 | } |
| 432 | } else { |
| 433 | GEM_BUG_ON(rb_first(&b->waiters) == &wait->node); |
| 434 | } |
| 435 | |
| 436 | GEM_BUG_ON(RB_EMPTY_NODE(&wait->node)); |
| 437 | rb_erase(&wait->node, &b->waiters); |
| 438 | |
| 439 | out_unlock: |
| 440 | GEM_BUG_ON(b->first_wait == wait); |
| 441 | GEM_BUG_ON(rb_first(&b->waiters) != |
| 442 | (b->first_wait ? &b->first_wait->node : NULL)); |
Chris Wilson | dbd6ef2 | 2016-08-09 17:47:52 +0100 | [diff] [blame] | 443 | GEM_BUG_ON(!rcu_access_pointer(b->irq_seqno_bh) ^ RB_EMPTY_ROOT(&b->waiters)); |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 444 | spin_unlock_irq(&b->lock); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 445 | } |
| 446 | |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 447 | static bool signal_complete(struct drm_i915_gem_request *request) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 448 | { |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 449 | if (!request) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 450 | return false; |
| 451 | |
| 452 | /* If another process served as the bottom-half it may have already |
| 453 | * signalled that this wait is already completed. |
| 454 | */ |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 455 | if (intel_wait_complete(&request->signaling.wait)) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 456 | return true; |
| 457 | |
| 458 | /* Carefully check if the request is complete, giving time for the |
| 459 | * seqno to be visible or if the GPU hung. |
| 460 | */ |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 461 | if (__i915_request_irq_complete(request)) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 462 | return true; |
| 463 | |
| 464 | return false; |
| 465 | } |
| 466 | |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 467 | static struct drm_i915_gem_request *to_signaler(struct rb_node *rb) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 468 | { |
Chris Wilson | d856786 | 2016-12-20 10:40:03 +0000 | [diff] [blame] | 469 | return rb_entry(rb, struct drm_i915_gem_request, signaling.node); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | static void signaler_set_rtpriority(void) |
| 473 | { |
| 474 | struct sched_param param = { .sched_priority = 1 }; |
| 475 | |
| 476 | sched_setscheduler_nocheck(current, SCHED_FIFO, ¶m); |
| 477 | } |
| 478 | |
| 479 | static int intel_breadcrumbs_signaler(void *arg) |
| 480 | { |
| 481 | struct intel_engine_cs *engine = arg; |
| 482 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 483 | struct drm_i915_gem_request *request; |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 484 | |
| 485 | /* Install ourselves with high priority to reduce signalling latency */ |
| 486 | signaler_set_rtpriority(); |
| 487 | |
| 488 | do { |
| 489 | set_current_state(TASK_INTERRUPTIBLE); |
| 490 | |
| 491 | /* We are either woken up by the interrupt bottom-half, |
| 492 | * or by a client adding a new signaller. In both cases, |
| 493 | * the GPU seqno may have advanced beyond our oldest signal. |
| 494 | * If it has, propagate the signal, remove the waiter and |
| 495 | * check again with the next oldest signal. Otherwise we |
| 496 | * need to wait for a new interrupt from the GPU or for |
| 497 | * a new client. |
| 498 | */ |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 499 | request = READ_ONCE(b->first_signal); |
| 500 | if (signal_complete(request)) { |
Chris Wilson | 7c9e934 | 2017-01-24 11:00:09 +0000 | [diff] [blame] | 501 | local_bh_disable(); |
| 502 | dma_fence_signal(&request->fence); |
| 503 | local_bh_enable(); /* kick start the tasklets */ |
| 504 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 505 | /* Wake up all other completed waiters and select the |
| 506 | * next bottom-half for the next user interrupt. |
| 507 | */ |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 508 | intel_engine_remove_wait(engine, |
| 509 | &request->signaling.wait); |
Chris Wilson | 5590af3 | 2016-09-09 14:11:54 +0100 | [diff] [blame] | 510 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 511 | /* Find the next oldest signal. Note that as we have |
| 512 | * not been holding the lock, another client may |
| 513 | * have installed an even older signal than the one |
| 514 | * we just completed - so double check we are still |
| 515 | * the oldest before picking the next one. |
| 516 | */ |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 517 | spin_lock_irq(&b->lock); |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 518 | if (request == b->first_signal) { |
| 519 | struct rb_node *rb = |
| 520 | rb_next(&request->signaling.node); |
| 521 | b->first_signal = rb ? to_signaler(rb) : NULL; |
| 522 | } |
| 523 | rb_erase(&request->signaling.node, &b->signals); |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 524 | spin_unlock_irq(&b->lock); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 525 | |
Chris Wilson | e8a261e | 2016-07-20 13:31:49 +0100 | [diff] [blame] | 526 | i915_gem_request_put(request); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 527 | } else { |
| 528 | if (kthread_should_stop()) |
| 529 | break; |
| 530 | |
| 531 | schedule(); |
Chris Wilson | fe3288b | 2017-02-12 17:20:01 +0000 | [diff] [blame] | 532 | |
| 533 | if (kthread_should_park()) |
| 534 | kthread_parkme(); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 535 | } |
| 536 | } while (1); |
| 537 | __set_current_state(TASK_RUNNING); |
| 538 | |
| 539 | return 0; |
| 540 | } |
| 541 | |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 542 | void intel_engine_enable_signaling(struct drm_i915_gem_request *request) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 543 | { |
| 544 | struct intel_engine_cs *engine = request->engine; |
| 545 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 546 | struct rb_node *parent, **p; |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 547 | bool first, wakeup; |
| 548 | |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 549 | /* Note that we may be called from an interrupt handler on another |
| 550 | * device (e.g. nouveau signaling a fence completion causing us |
| 551 | * to submit a request, and so enable signaling). As such, |
| 552 | * we need to make sure that all other users of b->lock protect |
| 553 | * against interrupts, i.e. use spin_lock_irqsave. |
| 554 | */ |
| 555 | |
| 556 | /* locked by dma_fence_enable_sw_signaling() (irqsafe fence->lock) */ |
Chris Wilson | 4a50d20 | 2016-07-26 12:01:50 +0100 | [diff] [blame] | 557 | assert_spin_locked(&request->lock); |
Chris Wilson | 65e4760 | 2016-10-28 13:58:49 +0100 | [diff] [blame] | 558 | if (!request->global_seqno) |
| 559 | return; |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 560 | |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 561 | request->signaling.wait.tsk = b->signaler; |
Chris Wilson | 65e4760 | 2016-10-28 13:58:49 +0100 | [diff] [blame] | 562 | request->signaling.wait.seqno = request->global_seqno; |
Chris Wilson | e8a261e | 2016-07-20 13:31:49 +0100 | [diff] [blame] | 563 | i915_gem_request_get(request); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 564 | |
Chris Wilson | 4a50d20 | 2016-07-26 12:01:50 +0100 | [diff] [blame] | 565 | spin_lock(&b->lock); |
| 566 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 567 | /* First add ourselves into the list of waiters, but register our |
| 568 | * bottom-half as the signaller thread. As per usual, only the oldest |
| 569 | * waiter (not just signaller) is tasked as the bottom-half waking |
| 570 | * up all completed waiters after the user interrupt. |
| 571 | * |
| 572 | * If we are the oldest waiter, enable the irq (after which we |
| 573 | * must double check that the seqno did not complete). |
| 574 | */ |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 575 | wakeup = __intel_engine_add_wait(engine, &request->signaling.wait); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 576 | |
| 577 | /* Now insert ourselves into the retirement ordered list of signals |
| 578 | * on this engine. We track the oldest seqno as that will be the |
| 579 | * first signal to complete. |
| 580 | */ |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 581 | parent = NULL; |
| 582 | first = true; |
| 583 | p = &b->signals.rb_node; |
| 584 | while (*p) { |
| 585 | parent = *p; |
Chris Wilson | 65e4760 | 2016-10-28 13:58:49 +0100 | [diff] [blame] | 586 | if (i915_seqno_passed(request->global_seqno, |
| 587 | to_signaler(parent)->global_seqno)) { |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 588 | p = &parent->rb_right; |
| 589 | first = false; |
| 590 | } else { |
| 591 | p = &parent->rb_left; |
| 592 | } |
| 593 | } |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 594 | rb_link_node(&request->signaling.node, parent, p); |
| 595 | rb_insert_color(&request->signaling.node, &b->signals); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 596 | if (first) |
Chris Wilson | b385085 | 2016-07-01 17:23:26 +0100 | [diff] [blame] | 597 | smp_store_mb(b->first_signal, request); |
| 598 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 599 | spin_unlock(&b->lock); |
| 600 | |
| 601 | if (wakeup) |
| 602 | wake_up_process(b->signaler); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 603 | } |
| 604 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 605 | int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine) |
| 606 | { |
| 607 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 608 | struct task_struct *tsk; |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 609 | |
| 610 | spin_lock_init(&b->lock); |
| 611 | setup_timer(&b->fake_irq, |
| 612 | intel_breadcrumbs_fake_irq, |
| 613 | (unsigned long)engine); |
Chris Wilson | 83348ba | 2016-08-09 17:47:51 +0100 | [diff] [blame] | 614 | setup_timer(&b->hangcheck, |
| 615 | intel_breadcrumbs_hangcheck, |
| 616 | (unsigned long)engine); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 617 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 618 | /* Spawn a thread to provide a common bottom-half for all signals. |
| 619 | * As this is an asynchronous interface we cannot steal the current |
| 620 | * task for handling the bottom-half to the user interrupt, therefore |
| 621 | * we create a thread to do the coherent seqno dance after the |
| 622 | * interrupt and then signal the waitqueue (via the dma-buf/fence). |
| 623 | */ |
| 624 | tsk = kthread_run(intel_breadcrumbs_signaler, engine, |
| 625 | "i915/signal:%d", engine->id); |
| 626 | if (IS_ERR(tsk)) |
| 627 | return PTR_ERR(tsk); |
| 628 | |
| 629 | b->signaler = tsk; |
| 630 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 631 | return 0; |
| 632 | } |
| 633 | |
Chris Wilson | ad07dfc | 2016-10-07 07:53:26 +0100 | [diff] [blame] | 634 | static void cancel_fake_irq(struct intel_engine_cs *engine) |
| 635 | { |
| 636 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 637 | |
| 638 | del_timer_sync(&b->hangcheck); |
| 639 | del_timer_sync(&b->fake_irq); |
| 640 | clear_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings); |
| 641 | } |
| 642 | |
| 643 | void intel_engine_reset_breadcrumbs(struct intel_engine_cs *engine) |
| 644 | { |
| 645 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 646 | |
| 647 | cancel_fake_irq(engine); |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 648 | spin_lock_irq(&b->lock); |
Chris Wilson | ad07dfc | 2016-10-07 07:53:26 +0100 | [diff] [blame] | 649 | |
| 650 | __intel_breadcrumbs_disable_irq(b); |
| 651 | if (intel_engine_has_waiter(engine)) { |
Chris Wilson | ad07dfc | 2016-10-07 07:53:26 +0100 | [diff] [blame] | 652 | __intel_breadcrumbs_enable_irq(b); |
Chris Wilson | 538b257 | 2017-01-24 15:18:05 +0000 | [diff] [blame] | 653 | if (test_bit(ENGINE_IRQ_BREADCRUMB, &engine->irq_posted)) |
Chris Wilson | ad07dfc | 2016-10-07 07:53:26 +0100 | [diff] [blame] | 654 | wake_up_process(b->first_wait->tsk); |
| 655 | } else { |
| 656 | /* sanitize the IMR and unmask any auxiliary interrupts */ |
| 657 | irq_disable(engine); |
| 658 | } |
| 659 | |
Chris Wilson | f6168e3 | 2016-10-28 13:58:55 +0100 | [diff] [blame] | 660 | spin_unlock_irq(&b->lock); |
Chris Wilson | ad07dfc | 2016-10-07 07:53:26 +0100 | [diff] [blame] | 661 | } |
| 662 | |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 663 | void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine) |
| 664 | { |
| 665 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 666 | |
Chris Wilson | 381744f | 2016-11-21 11:07:59 +0000 | [diff] [blame] | 667 | /* The engines should be idle and all requests accounted for! */ |
| 668 | WARN_ON(READ_ONCE(b->first_wait)); |
| 669 | WARN_ON(!RB_EMPTY_ROOT(&b->waiters)); |
| 670 | WARN_ON(READ_ONCE(b->first_signal)); |
| 671 | WARN_ON(!RB_EMPTY_ROOT(&b->signals)); |
| 672 | |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 673 | if (!IS_ERR_OR_NULL(b->signaler)) |
| 674 | kthread_stop(b->signaler); |
| 675 | |
Chris Wilson | ad07dfc | 2016-10-07 07:53:26 +0100 | [diff] [blame] | 676 | cancel_fake_irq(engine); |
Chris Wilson | 688e6c7 | 2016-07-01 17:23:15 +0100 | [diff] [blame] | 677 | } |
| 678 | |
Chris Wilson | 9b6586a | 2017-02-23 07:44:08 +0000 | [diff] [blame^] | 679 | bool intel_breadcrumbs_busy(struct intel_engine_cs *engine) |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 680 | { |
Chris Wilson | 9b6586a | 2017-02-23 07:44:08 +0000 | [diff] [blame^] | 681 | struct intel_breadcrumbs *b = &engine->breadcrumbs; |
| 682 | bool busy = false; |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 683 | |
Chris Wilson | 9b6586a | 2017-02-23 07:44:08 +0000 | [diff] [blame^] | 684 | spin_lock_irq(&b->lock); |
Chris Wilson | 6a5d1db | 2016-11-08 14:37:19 +0000 | [diff] [blame] | 685 | |
Chris Wilson | 9b6586a | 2017-02-23 07:44:08 +0000 | [diff] [blame^] | 686 | if (b->first_wait) { |
| 687 | wake_up_process(b->first_wait->tsk); |
| 688 | busy |= intel_engine_flag(engine); |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 689 | } |
| 690 | |
Chris Wilson | 9b6586a | 2017-02-23 07:44:08 +0000 | [diff] [blame^] | 691 | if (b->first_signal) { |
| 692 | wake_up_process(b->signaler); |
| 693 | busy |= intel_engine_flag(engine); |
| 694 | } |
| 695 | |
| 696 | spin_unlock_irq(&b->lock); |
| 697 | |
| 698 | return busy; |
Chris Wilson | c81d461 | 2016-07-01 17:23:25 +0100 | [diff] [blame] | 699 | } |
Chris Wilson | f97fbf9 | 2017-02-13 17:15:14 +0000 | [diff] [blame] | 700 | |
| 701 | #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) |
| 702 | #include "selftests/intel_breadcrumbs.c" |
| 703 | #endif |