Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@linux.intel.com>
To: IGT dev <igt-dev@lists.freedesktop.org>
Cc: Fei Yang <fei.yang@intel.com>
Subject: [igt-dev] [PATCH] test/i915/gem_create: Skip the test if the PAT index is set on a non MTL device
Date: Wed, 12 Jul 2023 10:37:27 +0200	[thread overview]
Message-ID: <20230712083727.282741-1-andi.shyti@linux.intel.com> (raw)

If we try to set the PAT index on a device that is not a Meteor
Lake, we expect an -ENODEV return value. But then, we forget to
skip and soon after we assert on the return value being '0',
forcing the error path.

Skip, as expected, in case the return value is either EINVAL or
ENODEV, the latter for meteor lake devices.

Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Fei Yang <fei.yang@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/i915/gem_create.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index b7961d9ef2..4b00fe6aab 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -668,14 +668,25 @@ static void create_ext_set_pat(int fd)
 	ret = __gem_create_ext(fd, &size, 0, &handle, &setparam_pat.base);
 
 	/*
-	 * With a valid PAT index specified, returning -EINVAL here
-	 * indicates set_pat extension is not supported
+	 * Currently the PAT index is supported only for Meteor Lake, so that
+	 * we expect:
+	 *
+	 *  * -EINVAL if i915 does not support the PAT index, e.g. the kernel is
+	 *    too old to have the PAT index supported.
+	 *  * -ENODEV if we are trying to set the PAT index on a non Meteor Lake
+	 *    platform.
+	 *
+	 * In both cases, though, the I915_GEM_CREATE_EXT_SET_PAT flag is not
+	 * supported.
 	 */
-	if (ret == -EINVAL)
-		igt_skip("I915_GEM_CREATE_EXT_SET_PAT is not supported\n");
-	else if (!IS_METEORLAKE(devid))
-		igt_assert_eq(ret, -ENODEV);
+	igt_skip_on_f(ret == -EINVAL ||
+		      (ret == -ENODEV && IS_METEORLAKE(devid)),
+		      "I915_GEM_CREATE_EXT_SET_PAT is not supported\n");
 
+	/*
+	 * This means that we are on a Meteor Lake and the PAT
+	 * index is already supported by the running i915
+	 */
 	igt_assert(ret == 0);
 
 	/*
-- 
2.40.1

             reply	other threads:[~2023-07-12  8:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  8:37 Andi Shyti [this message]
2023-07-12  8:57 ` [igt-dev] [PATCH] test/i915/gem_create: Skip the test if the PAT index is set on a non MTL device Tvrtko Ursulin
2023-07-12 12:21 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-07-12 12:27 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2023-07-12 14:59 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2023-07-12 16:20 ` [igt-dev] [PATCH] " Yang, Fei
2023-07-26 16:32   ` Tvrtko Ursulin
2023-07-27  0:16     ` Yang, Fei

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=20230712083727.282741-1-andi.shyti@linux.intel.com \
    --to=andi.shyti@linux.intel.com \
    --cc=fei.yang@intel.com \
    --cc=igt-dev@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