blob: 6e8cfc279c306ffd84c4efdaf607d7f6330a691e [file] [log] [blame]
Chris Wilsonb53f22c2013-08-23 12:32:43 +01001#!/bin/bash
2#
3# Testcase: Simulate missed breadcrumb interrupts
4#
5
6SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
Chris Wilsonb53f22c2013-08-23 12:32:43 +01007. $SOURCE_DIR/drm_lib.sh
Daniel Vetter1cefd192013-10-17 10:48:29 +02008
9oldpath=`pwd`
10
Chris Wilsonb53f22c2013-08-23 12:32:43 +010011cd $i915_dfs_path
12
Chris Wilson5eeb1f32014-09-06 17:25:01 +010013function 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 Wilsonb53f22c2013-08-23 12:32:43 +010019function 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
26function 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
33if [ ! -f i915_ring_missed_irq ] ; then
34 echo "kernel doesn't support interrupt masking"
35 exit 77
36fi
37
38# clear error state first
39echo > i915_error_state
40check_for_hang
41
42echo 0xf > i915_ring_test_irq
43echo "Interrupts masked"
44if test `cat i915_ring_test_irq` != 0x0000000f; then
45 echo "Failed to set interrupt mask"
46 exit 3
47fi
48
Chris Wilson5eeb1f32014-09-06 17:25:01 +010049blt_wait
Chris Wilsonb53f22c2013-08-23 12:32:43 +010050check_for_missed_irq
51check_for_hang
52
Chris Wilson5eeb1f32014-09-06 17:25:01 +010053blt_wait
Chris Wilsonb53f22c2013-08-23 12:32:43 +010054check_for_hang
55
56echo 0 > i915_ring_test_irq
57echo "Interrupts unmasked"
58if test `cat i915_ring_test_irq` != 0x00000000; then
59 echo "Failed to clear interrupt mask"
60 exit 3
61fi
62
Chris Wilson5eeb1f32014-09-06 17:25:01 +010063blt_wait
Chris Wilsonb53f22c2013-08-23 12:32:43 +010064check_for_hang
65
66echo 0 > i915_ring_missed_irq
67echo "Cleared missed interrupts"
68if test `cat i915_ring_missed_irq` != 0x00000000; then
69 echo "Failed to clear missed interrupts"
70 exit 3
71fi
72
73exit 0