public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org, Kuoppala@rosetta.fi.intel.com
Subject: [igt-dev] [PATCH i-g-t 4/7] tests/i915: Skip if secure batches is not available
Date: Wed, 13 Nov 2019 17:49:10 +0200	[thread overview]
Message-ID: <20191113154913.8787-4-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20191113154913.8787-1-mika.kuoppala@linux.intel.com>

From: "Kuoppala, Mika" <mika.kuoppala@intel.com>

If we can't do secure execbuf, there is no point in trying.

Signed-off-by: Kuoppala, Mika <mika.kuoppala@intel.com>
---
 tests/i915/gem_exec_params.c   | 16 ++++++++++++++++
 tests/i915/gem_mocs_settings.c | 14 ++++++++++++++
 tests/perf_pmu.c               | 11 +++++++++++
 3 files changed, 41 insertions(+)

diff --git a/tests/i915/gem_exec_params.c b/tests/i915/gem_exec_params.c
index 8f15e645..c5517b07 100644
--- a/tests/i915/gem_exec_params.c
+++ b/tests/i915/gem_exec_params.c
@@ -193,6 +193,19 @@ static void test_batch_first(int fd)
 	gem_close(fd, obj[0].handle);
 }
 
+static int has_secure_batches(const int fd)
+{
+	int v = -1;
+	drm_i915_getparam_t gp;
+
+	gp.param = I915_PARAM_HAS_SECURE_BATCHES;
+	gp.value = &v;
+
+	igt_assert_eq(drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp), 0);
+
+	return v;
+}
+
 struct drm_i915_gem_execbuffer2 execbuf;
 struct drm_i915_gem_exec_object2 gem_exec[1];
 uint32_t batch[2] = {MI_BATCH_BUFFER_END};
@@ -340,6 +353,8 @@ igt_main
 	}
 
 	igt_subtest("secure-non-root") {
+		igt_require(has_secure_batches(fd));
+
 		igt_fork(child, 1) {
 			igt_drop_root();
 
@@ -352,6 +367,7 @@ igt_main
 
 	igt_subtest("secure-non-master") {
 		igt_require(__igt_device_set_master(fd) == 0); /* Requires root privilege */
+		igt_require(has_secure_batches(fd));
 
 		igt_device_drop_master(fd);
 		execbuf.flags = I915_EXEC_RENDER | I915_EXEC_SECURE;
diff --git a/tests/i915/gem_mocs_settings.c b/tests/i915/gem_mocs_settings.c
index fc2ccb21..82eb8a3f 100644
--- a/tests/i915/gem_mocs_settings.c
+++ b/tests/i915/gem_mocs_settings.c
@@ -225,6 +225,19 @@ static uint32_t get_engine_base(int fd, uint32_t engine)
 	}
 }
 
+static int has_secure_batches(const int fd)
+{
+	int v = -1;
+	drm_i915_getparam_t gp;
+
+	gp.param = I915_PARAM_HAS_SECURE_BATCHES;
+	gp.value = &v;
+
+	igt_assert_eq(drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp), 0);
+
+	return v;
+}
+
 #define MI_STORE_REGISTER_MEM_64_BIT_ADDR	((0x24 << 23) | 2)
 
 static int create_read_batch(struct drm_i915_gem_relocation_entry *reloc,
@@ -566,6 +579,7 @@ igt_main
 		igt_require_gem(fd);
 		gem_require_mocs_registers(fd);
 		igt_require(get_mocs_settings(fd, &table, false));
+		igt_require(has_secure_batches(fd));
 	}
 
 	for (e = intel_execution_engines; e->name; e++) {
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index e2bd2cc5..296d04c6 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -893,6 +893,16 @@ static int wait_vblank(int fd, union drm_wait_vblank *vbl)
 	return err;
 }
 
+static int has_secure_batches(const int fd)
+{
+	int v = -1;
+	drm_i915_getparam_t gp;
+	gp.param = I915_PARAM_HAS_SECURE_BATCHES;
+	gp.value = &v;
+	igt_assert_eq(drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp), 0);
+	return v;
+}
+
 static void
 event_wait(int gem_fd, const struct intel_execution_engine2 *e)
 {
@@ -910,6 +920,7 @@ event_wait(int gem_fd, const struct intel_execution_engine2 *e)
 
 	devid = intel_get_drm_devid(gem_fd);
 	igt_require(intel_gen(devid) >= 7);
+	igt_require(has_secure_batches(fd));
 	igt_skip_on(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid));
 
 	kmstest_set_vt_graphics_mode();
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-11-13 15:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 15:49 [Intel-gfx] [PATCH i-g-t 1/7] lib/igt_dummyload: Send batch as first Mika Kuoppala
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 2/7] igt: Use COND_BBEND for busy spinning on gen9 Mika Kuoppala
2019-11-13 16:02   ` [Intel-gfx] " Chris Wilson
2019-11-13 17:19     ` Mika Kuoppala
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 3/7] lib/i915: Add query to detect if engine accepts only ro batches Mika Kuoppala
2019-11-13 23:44   ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-11-13 23:55   ` Chris Wilson
2019-11-13 15:49 ` Mika Kuoppala [this message]
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 5/7] Add tests/gem_blt_parse Mika Kuoppala
2019-11-13 16:14   ` Chris Wilson
2019-11-13 16:37     ` Mika Kuoppala
2019-11-14  8:41   ` Daniel Vetter
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 6/7] lib/igt_aux: Add helper to query suspend-to-mem modes Mika Kuoppala
2019-11-13 15:49 ` [Intel-gfx] [PATCH i-g-t 7/7] test/i915: Add i915_rc6_ctx_corruption Mika Kuoppala
2019-11-13 16:18   ` [igt-dev] " Chris Wilson
2019-11-13 15:57 ` [Intel-gfx] [PATCH i-g-t 1/7] lib/igt_dummyload: Send batch as first Chris Wilson

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=20191113154913.8787-4-mika.kuoppala@linux.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=Kuoppala@rosetta.fi.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --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