Skip to contentSkip to conversation

tests/pm_slpc: Add test for GuC based SLPC

PATCH New Sagar Arun Kamble 1 participant 1 message Nov 14, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/pm_slpc: Add test for GuC based SLPC

This tests whether SLPC in GuC is configured properly through shared data. It checks whether GTPERF is running in default state, post reset and post system suspend/resume.
This test will be extended further based on enablement of other SLPC tasks.

---
 lib/igt_pm.c           | 63 ++++++++++++++++++++++++++++++++++
 lib/igt_pm.h           |  2 ++
 tests/Makefile.sources |  1 +
 tests/pm_slpc.c        | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 159 insertions(+)
 create mode 100644 tests/pm_slpc.c
lib/igt_pm.c +63 -0
index 5bf5b2e..e139d9a 100644
@@ -37,6 +37,7 @@
 #include "drmtest.h"
 #include "igt_pm.h"
 #include "igt_aux.h"
+#include "igt_debugfs.h"
 
 /**
  * SECTION:igt_pm
@@ -338,3 +339,65 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
 {
 	return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
 }
+
+#define DBG_BUF_SIZE 4096
+
+bool igt_slpc_active(void)
+{
+	ssize_t n_read;
+	char buf[DBG_BUF_SIZE];
+	bool guc_load_status = false, slpc_status = false;
+	int guc_load_status_fd;
+	int frequency_info_fd;
+
+	guc_load_status_fd = igt_debugfs_open("i915_guc_load_status", O_RDONLY);
+	igt_skip_on_f(guc_load_status_fd == -1,
+		      "debugfs entry 'i915_guc_load_status' not found\n");
+
+	frequency_info_fd = igt_debugfs_open("i915_frequency_info", O_RDONLY);
+	igt_skip_on_f(frequency_info_fd == -1,
+		      "debugfs entry 'i915_frequency_info' not found\n");
+
+	n_read = read(guc_load_status_fd, buf, ARRAY_SIZE(buf));
+	igt_assert(n_read >= 0);
+	buf[n_read] = '\0';
+
+	if (strstr(buf, "\tload: SUCCESS\n") != NULL)
+		guc_load_status = true;
+	else
+		igt_debug("GuC is not loaded\n");
+
+	n_read = read(frequency_info_fd, buf, ARRAY_SIZE(buf));
+	igt_assert(n_read >= 0);
+	buf[n_read] = '\0';
+
+	if (strstr(buf, "SLPC Active\n") != NULL)
+		slpc_status = true;
+
+	close(frequency_info_fd);
+	close(guc_load_status_fd);
+	return (guc_load_status && slpc_status);
+}
+
+void igt_gtperf_state_check(void)
+{
+	ssize_t n_read;
+	char buf[DBG_BUF_SIZE];
+	int slpc_info_fd;
+
+	igt_assert_f(igt_slpc_active(), "SLPC is not active\n");
+
+	slpc_info_fd = igt_debugfs_open("i915_slpc_info", O_RDONLY);
+	igt_skip_on_f(slpc_info_fd == -1,
+		      "debugfs entry 'i915_slpc_info' not found\n");
+
+	n_read = read(slpc_info_fd, buf, ARRAY_SIZE(buf));
+	igt_assert(n_read >= 0);
+	buf[n_read] = '\0';
+
+	igt_assert(strstr(buf, "global state: 3 (running)\n") != NULL);
+	igt_assert(strstr(buf, "\tgtperf task active: yes\n") != NULL);
+	igt_assert(strstr(buf, "\tfreq switch active: yes\n") != NULL);
+
+	close(slpc_info_fd);
+}
lib/igt_pm.h +2 -0
index eced39f..cc1ae2d 100644
@@ -49,5 +49,7 @@ enum igt_runtime_pm_status {
 bool igt_setup_runtime_pm(void);
 enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
 bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
+bool igt_slpc_active(void);
+void igt_gtperf_state_check(void);
 
 #endif /* IGT_PM_H */
tests/Makefile.sources +1 -0
index 6d081c3..9a2e246 100644
@@ -122,6 +122,7 @@ TESTS_progs_M = \
 	pm_rps \
 	pm_rc6_residency \
 	pm_sseu \
+	pm_slpc \
 	prime_busy \
 	prime_mmap \
 	prime_mmap_coherency \
tests/pm_slpc.c new file +93 -0

93 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx