To make driver report a simulated hang in dmesg.

Suggested-by: Daniel Vetter <daniel.vet...@ffwll.ch>
Signed-off-by: Mika Kuoppala <mika.kuopp...@intel.com>
---
 tests/gem_reset_stats.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index a7497f3..9e52b60 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -42,6 +42,7 @@
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 #include "rendercopy.h"
+#include "igt_debugfs.h"
 
 #define RS_NO_ERROR      0
 #define RS_BATCH_ACTIVE  (1 << 0)
@@ -73,6 +74,8 @@ struct local_drm_i915_gem_context_destroy {
 #define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2e, struct 
local_drm_i915_gem_context_destroy)
 #define GET_RESET_STATS_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x32, struct 
local_drm_i915_reset_stats)
 
+static igt_debugfs_t dfs;
+
 static uint32_t context_create(int fd)
 {
        struct local_drm_i915_gem_context_create create;
@@ -192,6 +195,17 @@ static int exec_valid(int fd, int ctx)
        return exec.handle;
 }
 
+static void stop_rings(void)
+{
+       int fd;
+
+       fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_WRONLY);
+       igt_assert(fd >= 0);
+
+       igt_assert(write(fd, "0xff", 4) == 4);
+       close(fd);
+}
+
 #define BUFSIZE (4 * 1024)
 #define ITEMS   (BUFSIZE >> 2)
 
@@ -284,6 +298,8 @@ static int inject_hang(int fd, int ctx)
 
        free(buf);
 
+       stop_rings();
+
        return exec.handle;
 }
 
@@ -743,6 +759,8 @@ igt_main
                        igt_skip("Kernel is too old, or contexts not supported: 
%s\n",
                                 strerror(errno));
 
+               assert(igt_debugfs_init(&dfs) == 0);
+
                close(fd);
        }
 
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to