[PATCH i-g-t 1/2] tests/intel/xe_mmap: Acquire rpm reference for pci-membarrier tests

Kolanupaka Naveena kolanupaka.naveena at intel.com
Fri May 16 13:58:18 UTC 2025


During the test, the device is entering into runtime suspend, which is
leading the device to d3hot or d3cold mode. Hence the read is giving
a special value 0xffffffff.

To avoid this issue acquired an rpm ref to keep the device awake
during the access.

Suggested-by: Matthew Auld <matthew.auld at intel.com>
Signed-off-by: Kolanupaka Naveena <kolanupaka.naveena at intel.com>
---
 tests/intel/xe_mmap.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/intel/xe_mmap.c b/tests/intel/xe_mmap.c
index 5fd641075..061b3de0a 100644
--- a/tests/intel/xe_mmap.c
+++ b/tests/intel/xe_mmap.c
@@ -11,6 +11,8 @@
  * Functionality: mmap
  */
 
+#include <fcntl.h>
+
 #include "igt.h"
 
 #include "xe_drm.h"
@@ -404,6 +406,7 @@ static bool is_pci_membarrier_supported(int fd)
 igt_main
 {
 	int fd;
+	int fw_handle = -1;
 
 	igt_fixture
 		fd = drm_open_driver(DRIVER_XE);
@@ -421,7 +424,10 @@ igt_main
 
 	igt_subtest("pci-membarrier") {
 		igt_require(is_pci_membarrier_supported(fd));
+		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
+		igt_assert_lte(0, fw_handle);
 		test_pci_membarrier(fd);
+		close(fw_handle);
 	}
 
 	igt_subtest("pci-membarrier-parallel") {
@@ -433,17 +439,23 @@ igt_main
 		xe = drm_open_driver(DRIVER_XE);
 		srand(time(0));
 		i = rand() % (PAGE_SIZE / sizeof(*ptr));
+		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
+		igt_assert_lte(0, fw_handle);
 		igt_fork(child, 1)
 			test_pci_membarrier_parallel(xe, child, i);
 		test_pci_membarrier_parallel(fd, -1, i);
 		igt_waitchildren();
 
+		close(fw_handle);
 		close(xe);
 	}
 
 	igt_subtest("pci-membarrier-bad-pagesize") {
 		igt_require(is_pci_membarrier_supported(fd));
+		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
+		igt_assert_lte(0, fw_handle);
 		test_bad_pagesize_for_pcimem(fd);
+		close(fw_handle);
 	}
 
 	igt_subtest("bad-flags")
@@ -457,7 +469,10 @@ igt_main
 
 	igt_subtest("pci-membarrier-bad-object") {
 		igt_require(is_pci_membarrier_supported(fd));
+		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
+		igt_assert_lte(0, fw_handle);
 		test_bad_object_for_pcimem(fd);
+		close(fw_handle);
 	}
 
 	igt_subtest("small-bar") {
-- 
2.34.1



More information about the igt-dev mailing list