summaryrefslogtreecommitdiff
path: root/tests/ZZ_missed_irq
blob: a99dc80c57ae4baa0da43ef48802237ff8683263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
#
# Testcase: Simulate missed breadcrumb interrupts
#

SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
. $SOURCE_DIR/drm_lib.sh

oldpath=`pwd`

cd $i915_dfs_path

echo $SOURCE_DIR

function check_for_missed_irq {
	if test `cat i915_ring_missed_irq` = 0x00000000; then
		echo "missed interrupts undetected"
		exit 1
	fi
}

function check_for_hang {
	if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
		echo "gpu hang reported"
		exit 2
	fi
}

if [ ! -f i915_ring_missed_irq ] ; then
	echo "kernel doesn't support interrupt masking"
	exit 77
fi

# clear error state first
echo > i915_error_state
check_for_hang

echo 0xf > i915_ring_test_irq
echo "Interrupts masked"
if test `cat i915_ring_test_irq` != 0x0000000f; then
	echo "Failed to set interrupt mask"
	exit 3
fi

(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null

check_for_missed_irq
check_for_hang

(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null

check_for_hang

echo 0 > i915_ring_test_irq
echo "Interrupts unmasked"
if test `cat i915_ring_test_irq` != 0x00000000; then
	echo "Failed to clear interrupt mask"
	exit 3
fi

(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null

check_for_hang

echo 0 > i915_ring_missed_irq
echo "Cleared missed interrupts"
if test `cat i915_ring_missed_irq` != 0x00000000; then
	echo "Failed to clear missed interrupts"
	exit 3
fi

exit 0