[Intel-gfx] [PATCH i-g-t] tests/pm_rc6_residency: Add subtest to check RC6 suspend handling

Ewelina Musial ewelina.musial at intel.com
Mon Apr 24 12:55:23 UTC 2017


In some cases we observed that forcewake isn't kept after
resume and then RC6 residency is not constant.

References: HSD#1804921797
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Cc: Michal Winiarski <michal.winiarski at intel.com>
Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz at intel.com>
Signed-off-by: Ewelina Musial <ewelina.musial at intel.com>
---
 tests/pm_rc6_residency.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index bdb9747..4e61326 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -165,6 +165,44 @@ static void measure_residencies(int devid, unsigned int rc6_mask,
 	res->rc6 += res->rc6p;
 }
 
+enum sleep_state { NOSLEEP, SUSPEND, HIBERNATE };
+static void test_rc6_forcewake(enum sleep_state sleep_state)
+{
+	int fd, fw_fd;
+	unsigned long residency_pre, residency_post;
+
+	fd = drm_open_driver(DRIVER_INTEL);
+	igt_assert_lte(0, fd);
+
+	fw_fd = igt_open_forcewake_handle(fd);
+	igt_assert_lte(0, fw_fd);
+
+	switch (sleep_state) {
+		case NOSLEEP:
+			break;
+		case SUSPEND:
+			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+						      SUSPEND_TEST_NONE);
+			break;
+		case HIBERNATE:
+			igt_system_suspend_autoresume(SUSPEND_STATE_DISK,
+						      SUSPEND_TEST_NONE);
+			break;
+	}
+
+	sleep(1); // time to fully resume
+
+	// forcewake should keep residency constant after resume
+	residency_pre = read_rc6_residency("rc6");
+	sleep(SLEEP_DURATION);
+	residency_post = read_rc6_residency("rc6");
+
+	igt_assert_eq(residency_pre, residency_post);
+
+	close(fw_fd);
+	close(fd);
+}
+
 igt_main
 {
 	unsigned int rc6_mask;
@@ -209,4 +247,19 @@ igt_main
 
 		residency_accuracy(res.rc6pp, res.duration, "rc6pp");
 	}
+	igt_subtest("rc6-forcewake") {
+		igt_skip_on(!(rc6_mask & RC6_ENABLED));
+
+		test_rc6_forcewake(NOSLEEP);
+	}
+	igt_subtest("rc6-forcewake-suspend") {
+		igt_skip_on(!(rc6_mask & RC6_ENABLED));
+
+		test_rc6_forcewake(SUSPEND);
+	}
+	igt_subtest("rc6-forcewake-hibernate") {
+		igt_skip_on(!(rc6_mask & RC6_ENABLED));
+
+		test_rc6_forcewake(HIBERNATE);
+	}
 }
-- 
2.9.3



More information about the Intel-gfx mailing list