Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] lib/xe/xe_util: introduce helper for enabling ccs mode
@ 2024-12-16 13:11 Dominik Grzegorzek
  2024-12-16 13:11 ` [PATCH i-g-t 2/2] tests/xe_eudebug: Use library helper to enable ccs_mode Dominik Grzegorzek
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Dominik Grzegorzek @ 2024-12-16 13:11 UTC (permalink / raw)
  To: igt-dev; +Cc: Andrzej Hajda

From: Andrzej Hajda <andrzej.hajda@intel.com>

Multiple tests will require enabled ccs mode. Add special helper to
avoid code duplication.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 lib/xe/xe_util.c | 31 +++++++++++++++++++++++++++++++
 lib/xe/xe_util.h |  1 +
 2 files changed, 32 insertions(+)

diff --git a/lib/xe/xe_util.c b/lib/xe/xe_util.c
index 9482819c2..f7ae19f08 100644
--- a/lib/xe/xe_util.c
+++ b/lib/xe/xe_util.c
@@ -302,3 +302,34 @@ int xe_gt_count_engines_by_class(int fd, int gt, int class)
 
 	return n;
 }
+
+/**
+ * xe_sysfs_enable_ccs_mode:
+ * @fd: pointer to xe drm fd, can reopened multiple times
+ *
+ * Enables ccs_mode on all GTs, it must succeed for at least one GT.
+ * Since function requires the driver to be closed during ccs_mode change
+ * @fd will be closed then re-opened.
+ */
+void xe_sysfs_enable_ccs_mode(int *fd)
+{
+	int gt, gt_fd, num_slices, ccs_mode, num_gt, enabled_count = 0;
+
+	num_gt = xe_number_gt(*fd);
+
+	for (gt = 0; gt < num_gt; gt++) {
+		gt_fd = xe_sysfs_gt_open(*fd, gt);
+		drm_close_driver(*fd);
+
+		if (!igt_debug_on(igt_sysfs_scanf(gt_fd, "num_cslices", "%u", &num_slices) <= 0) &&
+		    !igt_debug_on(igt_sysfs_printf(gt_fd, "ccs_mode", "%u", num_slices) <= 0) &&
+		    !igt_debug_on(igt_sysfs_scanf(gt_fd, "ccs_mode", "%u", &ccs_mode) <= 0) &&
+		    !igt_debug_on(num_slices != ccs_mode))
+			enabled_count++;
+		close(gt_fd);
+		*fd = drm_open_driver(DRIVER_XE);
+	}
+
+	if (!enabled_count)
+		igt_require_f(0, "Cannot enable ccs mode for any GT\n");
+}
diff --git a/lib/xe/xe_util.h b/lib/xe/xe_util.h
index b9fbfc5cd..a82c44a2a 100644
--- a/lib/xe/xe_util.h
+++ b/lib/xe/xe_util.h
@@ -53,5 +53,6 @@ int xe_gt_fill_engines_by_class(int fd, int gt, int class,
 				struct drm_xe_engine_class_instance eci[static XE_MAX_ENGINE_INSTANCE]);
 int xe_gt_count_engines_by_class(int fd, int gt, int class);
 
+void xe_sysfs_enable_ccs_mode(int *fd);
 
 #endif /* XE_UTIL_H */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-01-20 12:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 13:11 [PATCH i-g-t 1/2] lib/xe/xe_util: introduce helper for enabling ccs mode Dominik Grzegorzek
2024-12-16 13:11 ` [PATCH i-g-t 2/2] tests/xe_eudebug: Use library helper to enable ccs_mode Dominik Grzegorzek
2024-12-17  9:34   ` Hajda, Andrzej
2024-12-16 20:15 ` ✓ i915.CI.BAT: success for series starting with [i-g-t,1/2] lib/xe/xe_util: introduce helper for enabling ccs mode Patchwork
2024-12-16 20:55 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-16 23:06 ` ✗ Xe.CI.Full: failure " Patchwork
2024-12-17  4:32 ` ✗ i915.CI.Full: " Patchwork
2025-01-17 13:07 ` [PATCH i-g-t 1/2] " Manszewski, Christoph
2025-01-17 13:18   ` Manszewski, Christoph
2025-01-20 12:49     ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox