[Intel-gfx] [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume
Ewelina Musial
ewelina.musial at intel.com
Tue Jul 25 15:26:09 UTC 2017
In some cases we observed that forcewake isn't kept after
resume and checking RC6 residency is a simple way to verify that.
If forcewake is kept after resume residency should be constant.
Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz at intel.com>
Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg at intel.com>
Cc: Michal Winiarski <michal.winiarski at intel.com>
Signed-off-by: Ewelina Musial <ewelina.musial at intel.com>
---
tests/drv_suspend.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
index 2e39f20a..0c576055 100644
--- a/tests/drv_suspend.c
+++ b/tests/drv_suspend.c
@@ -36,6 +36,9 @@
#include <errno.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include "igt_sysfs.h"
+#include "igt_aux.h"
+#include <time.h>
#include <drm.h>
@@ -160,8 +163,9 @@ test_sysfs_reader(bool hibernate)
igt_stop_helper(&reader);
}
+#define SLEEP_DURATION 3
static void
-test_forcewake(int fd, bool hibernate)
+test_forcewake(int fd, bool hibernate, bool residency)
{
int fw_fd;
@@ -174,8 +178,26 @@ test_forcewake(int fd, bool hibernate)
else
igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
SUSPEND_TEST_NONE);
+ if (residency)
+ {
+ int sysfs;
+ uint32_t residency_pre, residency_post;
- close (fw_fd);
+ sysfs = igt_sysfs_open(fd, NULL);
+ igt_assert_lte(0, sysfs);
+ sleep(1); // time to fully resume
+
+ // forcewake should keep residency constant after resume
+ residency_pre = read_residency(sysfs, "rc6");
+ sleep(SLEEP_DURATION);
+ residency_post = read_residency(sysfs, "rc6");
+
+ igt_assert_eq(residency_pre, residency_post);
+
+ close(sysfs);
+ }
+
+ close (fw_fd);
}
int fd;
@@ -200,7 +222,10 @@ igt_main
test_sysfs_reader(false);
igt_subtest("forcewake")
- test_forcewake(fd, false);
+ test_forcewake(fd, false, false);
+
+ igt_subtest("rc6-forcewake")
+ test_forcewake(fd, false, true);
igt_subtest("fence-restore-tiled2untiled-hibernate")
test_fence_restore(fd, true, true);
@@ -215,7 +240,10 @@ igt_main
test_sysfs_reader(true);
igt_subtest("forcewake-hibernate")
- test_forcewake(fd, true);
+ test_forcewake(fd, true, false);
+
+ igt_subtest("rc6-forcewake-hibernate")
+ test_forcewake(fd, true, true);
igt_fixture
close(fd);
--
2.13.3
More information about the Intel-gfx
mailing list