Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kolakowski <jakub1.kolakowski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>,
	Adam Miszczak <adam.miszczak@linux.intel.com>,
	Lukasz Laguna <lukasz.laguna@intel.com>,
	Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH i-g-t] tests/intel/xe_pm: Add a check for power management capability
Date: Thu,  6 Mar 2025 19:06:21 +0000	[thread overview]
Message-ID: <20250306190621.260153-1-jakub1.kolakowski@intel.com> (raw)

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


             reply	other threads:[~2025-03-06 19:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 19:06 Jakub Kolakowski [this message]
2025-03-07  5:44 ` ✓ Xe.CI.BAT: success for tests/intel/xe_pm: Add a check for power management capability 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250306190621.260153-1-jakub1.kolakowski@intel.com \
    --to=jakub1.kolakowski@intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lukasz.laguna@intel.com \
    --cc=marcin.bernatowicz@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox