Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/intel/xe_pm: Add a check for power management capability
@ 2025-03-06 19:06 Jakub Kolakowski
  2025-03-07  5:44 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jakub Kolakowski @ 2025-03-06 19:06 UTC (permalink / raw)
  To: igt-dev; +Cc: Jakub Kolakowski, Adam Miszczak, Lukasz Laguna,
	Marcin Bernatowicz

Add a check for power management capability of device tested. 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@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Signed-off-by: Jakub Kolakowski <jakub1.kolakowski@intel.com>
---
 tests/intel/xe_pm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index c2026474d..049596ebc 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -17,6 +17,7 @@
 
 #include "igt.h"
 #include "lib/igt_device.h"
+#include "lib/igt_pci.h"
 #include "lib/igt_pm.h"
 #include "lib/igt_sysfs.h"
 #include "lib/igt_syncobj.h"
@@ -38,6 +39,8 @@
 #define PREFETCH (0x1 << 1)
 #define UNBIND_ALL (0x1 << 2)
 
+#define PCI_PM_CAP_ID 0x01
+
 enum mem_op {
 	READ,
 	WRITE,
@@ -779,6 +782,7 @@ igt_main
 	device_t device;
 	uint32_t d3cold_allowed;
 	int sysfs_fd;
+	int offset;
 
 	const struct s_state {
 		const char *name;
@@ -812,6 +816,11 @@ igt_main
 		device.fd_xe = drm_open_driver(DRIVER_XE);
 		device.pci_xe = igt_device_get_pci_device(device.fd_xe);
 		device.pci_root = igt_device_get_pci_root_port(device.fd_xe);
+
+		/* Make sure power management capability is present for device being tested */
+		offset = find_pci_cap_offset(device.pci_root, PCI_PM_CAP_ID);
+		igt_require_f(offset > 0, "PCI power management capability not found\n");
+
 		igt_device_get_pci_slot_name(device.fd_xe, device.pci_slot_name);
 
 		/* Always perform initial once-basic exec checking for health */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-10  8:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 19:06 [PATCH i-g-t] tests/intel/xe_pm: Add a check for power management capability Jakub Kolakowski
2025-03-07  5:44 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-03-07  6:03 ` ✓ i915.CI.BAT: " Patchwork
2025-03-07  7:45 ` ✗ i915.CI.Full: failure " Patchwork
2025-03-07 18:23 ` ✗ Xe.CI.Full: " Patchwork
2025-03-10  8:19 ` [PATCH i-g-t] " Bernatowicz, Marcin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox