diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-09 10:35:54 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-13 09:00:19 +0000 |
commit | 7a02d3056fe93fd2ddd2986f7d3db5f384ee22a0 (patch) | |
tree | 84f3116b26e48447e8bda918fdd5c2ce096904df /lib/ioctl_wrappers.c | |
parent | f8d6fa4fa04103b027430f960f2c55d24c4a9600 (diff) |
lib: force a reset on an uncooperative i915 device
Try to reset the GPU from within igt_require_gem() if we notice we are
starting with a wedged device. If it remains wedged, the test definitely
cannot run. We leave a warning in place to highlight the potentially
suspect result, which will keep the flip-flops alive in CI!
v2: Split out device reset to avoid reusing a local variable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r-- | lib/ioctl_wrappers.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 10d95872..7b656cce 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1405,6 +1405,22 @@ void gem_require_caching(int fd) errno = 0; } +static void reset_device(int fd) +{ + int dir; + + dir = igt_debugfs_dir(fd); + igt_require(dir >= 0); + + if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) { + igt_info("Found wedged device, trying to reset and continue\n"); + igt_sysfs_set(dir, "i915_wedged", "-1"); + } + igt_sysfs_set(dir, "i915_next_seqno", "1"); + + close(dir); +} + void igt_require_gem(int fd) { char path[256]; @@ -1427,15 +1443,12 @@ void igt_require_gem(int fd) * itself, which avoids accidentally hanging when setting up long * sequences of batches. */ - err = igt_debugfs_dir(fd); - if (err != -1) { - igt_sysfs_printf(err, "i915_next_seqno", "1"); - close(err); - } + reset_device(fd); err = 0; if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) err = -errno; + close(fd); igt_require_f(err == 0, "Unresponsive i915/GEM device\n"); |