[igt-dev] [PATCH i-g-t] tests/xe: When GT is in RC6 donot assert if act freq is 0

Badal Nilawar badal.nilawar at intel.com
Thu Jun 22 09:37:18 UTC 2023


When GT is in RC6 state actual frequency reported will be 0.
So during RC6 no need to assert if act freq is not equal to curr freq.

Fixes: acaaca0bf317 ("tests/xe: Add Xe IGT tests")
Signed-off-by: Badal Nilawar <badal.nilawar at intel.com>
---
 tests/xe/xe_guc_pc.c | 51 +++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c
index 60c93288b..a1cf2e039 100644
--- a/tests/xe/xe_guc_pc.c
+++ b/tests/xe/xe_guc_pc.c
@@ -30,6 +30,27 @@
  */
 #define ACT_FREQ_LATENCY_US 100000
 
+/**
+ * SUBTEST: rc6_on_idle
+ * Description: check if GPU is in RC6 on idle
+ * Run type: BAT
+ *
+ * SUBTEST: rc0_on_exec
+ * Description: check if GPU is in RC0 on when doing some work
+ * Run type: BAT
+ */
+
+static bool in_rc6(int sysfs, int gt_id)
+{
+	char path[32];
+	char rc[8];
+
+	sprintf(path, "device/gt%d/rc_status", gt_id);
+	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
+		return false;
+	return strcmp(rc, "rc6") == 0;
+}
+
 static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 		       int n_engines, int n_execs)
 {
@@ -223,13 +244,15 @@ static void test_freq_fixed(int sysfs, int gt_id)
 	igt_assert(set_freq(sysfs, gt_id, "max", rpn) > 0);
 	usleep(ACT_FREQ_LATENCY_US);
 	igt_assert(get_freq(sysfs, gt_id, "cur") == rpn);
-	igt_assert(get_freq(sysfs, gt_id, "act") == rpn);
+	if (!in_rc6(sysfs, gt_id))
+		igt_assert(get_freq(sysfs, gt_id, "act") == rpn);
 
 	igt_assert(set_freq(sysfs, gt_id, "min", rpe) > 0);
 	igt_assert(set_freq(sysfs, gt_id, "max", rpe) > 0);
 	usleep(ACT_FREQ_LATENCY_US);
 	igt_assert(get_freq(sysfs, gt_id, "cur") == rpe);
-	igt_assert(get_freq(sysfs, gt_id, "act") == rpe);
+	if (!in_rc6(sysfs, gt_id))
+		igt_assert(get_freq(sysfs, gt_id, "act") == rpe);
 
 	igt_assert(set_freq(sysfs, gt_id, "min", rp0) > 0);
 	igt_assert(set_freq(sysfs, gt_id, "max", rp0) > 0);
@@ -269,7 +292,8 @@ static void test_freq_range(int sysfs, int gt_id)
 	cur = get_freq(sysfs, gt_id, "cur");
 	igt_assert(rpn <= cur && cur <= rpe);
 	act = get_freq(sysfs, gt_id, "act");
-	igt_assert(rpn <= act && act <= rpe);
+	if (!in_rc6(sysfs, gt_id))
+		igt_assert(rpn <= act && act <= rpe);
 
 	igt_debug("Finished testing range request\n");
 }
@@ -354,27 +378,6 @@ static void test_reset(int fd, int sysfs, int gt_id, int cycles)
 	}
 }
 
-
-/**
- * SUBTEST: rc6_on_idle
- * Description: check if GPU is in RC6 on idle
- * Run type: BAT
- *
- * SUBTEST: rc0_on_exec
- * Description: check if GPU is in RC0 on when doing some work
- * Run type: BAT
- */
-
-static bool in_rc6(int sysfs, int gt_id)
-{
-	char path[32];
-	char rc[8];
-	sprintf(path, "device/gt%d/rc_status", gt_id);
-	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
-		return false;
-	return strcmp(rc, "rc6") == 0;
-}
-
 igt_main
 {
 	struct drm_xe_engine_class_instance *hwe;
-- 
2.25.1



More information about the igt-dev mailing list