public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/3] tests/gem_reset_stats: add support for BDW+
Date: Wed, 20 Nov 2013 16:58:15 +0200	[thread overview]
Message-ID: <1384959497-25533-1-git-send-email-mika.kuoppala@intel.com> (raw)

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

             reply	other threads:[~2013-11-20 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 14:58 Mika Kuoppala [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384959497-25533-1-git-send-email-mika.kuoppala@intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox