[igt-dev] [PATCH i-g-t 08/20] tests/i915/perf: Fix sysfs functions for xe

Ashutosh Dixit ashutosh.dixit at intel.com
Tue Aug 8 01:00:05 UTC 2023


Make sure that we can read freq_rp0 and rc6_residency from sysfs for
xe. The sysfs paths and files names are different for xe.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 tests/i915/perf.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/i915/perf.c b/tests/i915/perf.c
index 03af968d9484..292afda9a434 100644
--- a/tests/i915/perf.c
+++ b/tests/i915/perf.c
@@ -643,7 +643,20 @@ sysfs_read(enum i915_attr_id id)
 {
 	unsigned long value;
 
-	igt_assert(igt_sysfs_rps_scanf(sysfs, id, "%lu", &value) == 1);
+	if (is_xe_device(drm_fd)) {
+		switch (id) {
+		case RPS_RP0_FREQ_MHZ:
+			igt_assert(igt_sysfs_scanf(sysfs, "device/tile0/gt0/freq_rp0", "%lu", &value) == 1);
+			break;
+		case RC6_RESIDENCY_MS:
+			igt_assert(igt_sysfs_scanf(sysfs, "device/tile0/gt0/rc6_residency", "%lu", &value) == 1);
+			break;
+		default:
+			igt_assert(0);
+		}
+	} else {
+		igt_assert(igt_sysfs_rps_scanf(sysfs, id, "%lu", &value) == 1);
+	}
 
 	return value;
 }
@@ -5436,6 +5449,9 @@ static int perf_sysfs_open(int i915)
 {
 	int dirfd, gt;
 
+	if (is_xe_device(drm_fd))
+		return igt_sysfs_open(drm_fd);
+
 	/* use the first available sysfs interface */
 	for_each_sysfs_gt_dirfd(i915, dirfd, gt)
 		break;
-- 
2.41.0



More information about the igt-dev mailing list