Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Testcase: Simulate missed breadcrumb interrupts |
| 4 | # |
| 5 | |
| 6 | SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" |
Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 7 | . $SOURCE_DIR/drm_lib.sh |
Daniel Vetter | 1cefd19 | 2013-10-17 10:48:29 +0200 | [diff] [blame] | 8 | |
| 9 | oldpath=`pwd` |
| 10 | |
Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 11 | cd $i915_dfs_path |
| 12 | |
Chris Wilson | 5eeb1f3 | 2014-09-06 17:25:01 +0100 | [diff] [blame] | 13 | function blt_wait { |
| 14 | (cd $oldpath; $SOURCE_DIR/gem_exec_blt 16384) > /dev/null |
| 15 | (cd $oldpath; $SOURCE_DIR/gem_exec_blt 65536) > /dev/null |
| 16 | (cd $oldpath; $SOURCE_DIR/gem_exec_blt 262144) > /dev/null |
| 17 | } |
| 18 | |
Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 19 | function check_for_missed_irq { |
| 20 | if test `cat i915_ring_missed_irq` = 0x00000000; then |
| 21 | echo "missed interrupts undetected" |
| 22 | exit 1 |
| 23 | fi |
| 24 | } |
| 25 | |
| 26 | function check_for_hang { |
| 27 | if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then |
| 28 | echo "gpu hang reported" |
| 29 | exit 2 |
| 30 | fi |
| 31 | } |
| 32 | |
| 33 | if [ ! -f i915_ring_missed_irq ] ; then |
| 34 | echo "kernel doesn't support interrupt masking" |
| 35 | exit 77 |
| 36 | fi |
| 37 | |
| 38 | # clear error state first |
| 39 | echo > i915_error_state |
| 40 | check_for_hang |
| 41 | |
| 42 | echo 0xf > i915_ring_test_irq |
| 43 | echo "Interrupts masked" |
| 44 | if test `cat i915_ring_test_irq` != 0x0000000f; then |
| 45 | echo "Failed to set interrupt mask" |
| 46 | exit 3 |
| 47 | fi |
| 48 | |
Chris Wilson | 5eeb1f3 | 2014-09-06 17:25:01 +0100 | [diff] [blame] | 49 | blt_wait |
Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 50 | check_for_missed_irq |
| 51 | check_for_hang |
| 52 | |
Chris Wilson | 5eeb1f3 | 2014-09-06 17:25:01 +0100 | [diff] [blame] | 53 | blt_wait |
Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 54 | check_for_hang |
| 55 | |
| 56 | echo 0 > i915_ring_test_irq |
| 57 | echo "Interrupts unmasked" |
| 58 | if test `cat i915_ring_test_irq` != 0x00000000; then |
| 59 | echo "Failed to clear interrupt mask" |
| 60 | exit 3 |
| 61 | fi |
| 62 | |
Chris Wilson | 5eeb1f3 | 2014-09-06 17:25:01 +0100 | [diff] [blame] | 63 | blt_wait |
Chris Wilson | b53f22c | 2013-08-23 12:32:43 +0100 | [diff] [blame] | 64 | check_for_hang |
| 65 | |
| 66 | echo 0 > i915_ring_missed_irq |
| 67 | echo "Cleared missed interrupts" |
| 68 | if test `cat i915_ring_missed_irq` != 0x00000000; then |
| 69 | echo "Failed to clear missed interrupts" |
| 70 | exit 3 |
| 71 | fi |
| 72 | |
| 73 | exit 0 |