[PATCH i-g-t 2/2] tests/intel/xe_pm: Add a check for power management capability

Jakub Kolakowski jakub1.kolakowski at intel.com
Tue Mar 11 17:01:44 UTC 2025


Add a check for power management capability of device tested in tests
related to D-states. Currently if test is started on configuration
that does not support the PM capability it doesn't skip, instead
depending on test it may fail, abort or timeout.
With this change test will skip with a clear message why it did.

Cc: Adam Miszczak <adam.miszczak at linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna at intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
Signed-off-by: Jakub Kolakowski <jakub1.kolakowski at intel.com>
---
 tests/intel/xe_pm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index c2026474d..25fc7bc9f 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -854,6 +854,8 @@ igt_main
 
 		for (const struct d_state *d = d_states; d->name; d++) {
 			igt_subtest_f("%s-%s-basic-exec", s->name, d->name) {
+				igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 				igt_assert(setup_d3(device, d->state));
 				test_exec(device, 1, 2, s->state, NO_RPM, 0);
 				cleanup_d3(device);
@@ -870,18 +872,24 @@ igt_main
 
 	for (const struct d_state *d = d_states; d->name; d++) {
 		igt_subtest_f("%s-basic", d->name) {
+			igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 			igt_assert(setup_d3(device, d->state));
 			igt_assert(in_d3(device, d->state));
 			cleanup_d3(device);
 		}
 
 		igt_subtest_f("%s-basic-exec", d->name) {
+			igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 			igt_assert(setup_d3(device, d->state));
 			test_exec(device, 1, 1, NO_SUSPEND, d->state, 0);
 			cleanup_d3(device);
 		}
 
 		igt_subtest_f("%s-multiple-execs", d->name) {
+			igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 			igt_assert(setup_d3(device, d->state));
 			test_exec(device, 16, 32, NO_SUSPEND, d->state, 0);
 			cleanup_d3(device);
@@ -890,6 +898,8 @@ igt_main
 		igt_describe_f("Validate mmap memory mappings with system region,"
 			       "when device along with parent bridge in %s", d->name);
 		igt_subtest_f("%s-mmap-system", d->name) {
+			igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 			igt_assert(setup_d3(device, d->state));
 			test_mmap(device, system_memory(device.fd_xe), 0,
 				  READ, d->state);
@@ -903,6 +913,8 @@ igt_main
 		igt_subtest_f("%s-mmap-vram", d->name) {
 			int delay_ms = igt_pm_get_autosuspend_delay(device.pci_xe);
 
+			igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 			/* Give some auto suspend delay to validate rpm active during page fault */
 			igt_pm_set_autosuspend_delay(device.pci_xe, 1000);
 			igt_assert(setup_d3(device, d->state));
@@ -919,6 +931,8 @@ igt_main
 
 		igt_describe_f("Validate the contents of mocs registers over %s state", d->name);
 		igt_subtest_f("%s-mocs", d->name) {
+			igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 			igt_assert(setup_d3(device, d->state));
 			test_mocs_suspend_resume(device, NO_SUSPEND, d->state);
 			cleanup_d3(device);
@@ -928,6 +942,8 @@ igt_main
 	igt_describe("Validate whether card is limited to d3hot,"
 		     "if vram used > vram threshold");
 	igt_subtest("vram-d3cold-threshold") {
+		igt_require_f(igt_is_pm_supported(device.pci_root),
+								"PCI power management capability not found\n");
 		orig_threshold = get_vram_d3cold_threshold(sysfs_fd);
 		igt_install_exit_handler(vram_d3cold_threshold_restore);
 		test_vram_d3cold_threshold(device, sysfs_fd);
-- 
2.34.1



More information about the igt-dev mailing list