Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Riana Tauro <riana.tauro@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: badal.nilawar@intel.com
Subject: [igt-dev] [PATCH i-g-t] tests/xe: Add a test that validates GT C0 on exec
Date: Thu, 20 Jul 2023 10:00:15 +0530	[thread overview]
Message-ID: <20230720043015.1677140-1-riana.tauro@intel.com> (raw)

Add a test that validates if GT is in C0 while
running a spinner on an engine of the gt

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 tests/xe/xe_pm_residency.c | 39 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/xe/xe_pm_residency.c b/tests/xe/xe_pm_residency.c
index a20c4449c..7614af761 100644
--- a/tests/xe/xe_pm_residency.c
+++ b/tests/xe/xe_pm_residency.c
@@ -14,6 +14,7 @@
 #include "igt.h"
 #include "igt_sysfs.h"
 
+#include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 
 #define SLEEP_DURATION 3000 /* in milliseconds */
@@ -76,6 +77,38 @@ static unsigned long read_idle_residency(int fd, int gt)
 	return residency;
 }
 
+/**
+ * SUBTEST: gt-c0-on-exec
+ * Description: Validate if GT is in C0 while running a spinner
+ *		on an engine of that GT
+ * Run type: FULL
+ */
+static void test_c0_exec(int fd, struct drm_xe_engine_class_instance *hwe)
+{
+	uint64_t ahnd;
+	unsigned int engine;
+	uint32_t vm;
+	igt_spin_t *spin;
+
+	/* Start with GT in C6 */
+	igt_assert_f(igt_wait(is_gt_in_c6(fd, hwe->gt_id), 1000, 1), "GT is not in C6\n");
+
+	igt_debug("Run on engine: %s:%d\n",
+		  xe_engine_class_string(hwe->engine_class), hwe->engine_instance);
+	vm = xe_vm_create(fd, 0, 0);
+	engine = xe_engine_create(fd, vm, hwe, 0);
+	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
+	spin = igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .vm = vm);
+
+	/* GT should be in C0 when busy */
+	igt_assert_f(!is_gt_in_c6(fd, hwe->gt_id), "GT in C6\n");
+
+	igt_spin_free(fd, spin);
+	put_ahnd(ahnd);
+	xe_engine_destroy(fd, engine);
+	xe_vm_destroy(fd, vm);
+}
+
 /**
  * SUBTEST: idle-residency
  * Description: basic residency test to validate idle residency
@@ -101,12 +134,18 @@ static void test_idle_residency(int fd, int gt)
 igt_main
 {
 	int fd, gt;
+	struct drm_xe_engine_class_instance *hwe;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
 		igt_require(!IS_PONTEVECCHIO(xe_dev_id(fd)));
 	}
 
+	igt_describe("Validate GT C0 on exec");
+	igt_subtest("gt-c0-on-exec")
+		xe_for_each_hw_engine(fd, hwe)
+			test_c0_exec(fd, hwe);
+
 	igt_describe("Validate GT C6 on idle");
 	igt_subtest("gt-c6-on-idle")
 		xe_for_each_gt(fd, gt)
-- 
2.40.0

             reply	other threads:[~2023-07-20  4:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  4:30 Riana Tauro [this message]
2023-07-20  5:45 ` [igt-dev] ○ CI.xeBAT: info for tests/xe: Add a test that validates GT C0 on exec Patchwork
2023-07-20  5:49 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-07-20  9:32 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-07-21  9:22 ` [igt-dev] [PATCH i-g-t] " Gupta, Anshuman
2023-07-24  5:12   ` Riana Tauro
2023-07-24  6:55     ` Gupta, Anshuman
2023-07-26 11:34       ` Riana Tauro

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=20230720043015.1677140-1-riana.tauro@intel.com \
    --to=riana.tauro@intel.com \
    --cc=badal.nilawar@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