public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/3] tests/gem_reset_stats: add support for BDW+
@ 2013-11-20 14:58 Mika Kuoppala
  2013-11-20 14:58 ` [PATCH 2/3] tests/gem_reset_stats: stop rings after injecting hang Mika Kuoppala
  2013-11-20 14:58 ` [PATCH 3/3] tests/gem_reset_stats: check non root access to reset_stats Mika Kuoppala
  0 siblings, 2 replies; 4+ messages in thread
From: Mika Kuoppala @ 2013-11-20 14:58 UTC (permalink / raw)
  To: intel-gfx

For BDW+, there BATCH_BUFFER_START is 3 * 32bits in length and
length needs to be encoded into the opcode.

Suggested-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 tests/gem_reset_stats.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 07dfac4..a7497f3 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -202,9 +202,13 @@ static int inject_hang(int fd, int ctx)
 	uint64_t gtt_off;
 	uint32_t *buf;
 	int roff, i;
+	unsigned cmd_len = 2;
 
 	srandom(time(NULL));
 
+	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+		cmd_len = 3;
+
 	buf = malloc(BUFSIZE);
 	igt_assert(buf != NULL);
 
@@ -240,9 +244,11 @@ static int inject_hang(int fd, int ctx)
 	for (i = 0; i < ITEMS; i++)
 		buf[i] = MI_NOOP;
 
-	roff = random() % (ITEMS - 2);
-	buf[roff] = MI_BATCH_BUFFER_START;
-	buf[roff + 1] = gtt_off + (roff << 2);
+	roff = random() % (ITEMS - cmd_len);
+	buf[roff] = MI_BATCH_BUFFER_START | (cmd_len - 2);
+	buf[roff + 1] = (gtt_off & 0xfffffffc) + (roff << 2);
+	if (cmd_len == 3)
+		buf[roff + 2] = gtt_off & 0xffffffff00000000ull;
 
 #ifdef VERBOSE
 	printf("loop injected at 0x%lx (off 0x%x, bo_start 0x%lx, bo_end 0x%lx)\n",
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-20 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 14:58 [PATCH 1/3] tests/gem_reset_stats: add support for BDW+ Mika Kuoppala
2013-11-20 14:58 ` [PATCH 2/3] tests/gem_reset_stats: stop rings after injecting hang Mika Kuoppala
2013-11-20 14:58 ` [PATCH 3/3] tests/gem_reset_stats: check non root access to reset_stats Mika Kuoppala
2013-11-20 20:32   ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox