Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Soham Purkait <soham.purkait@intel.com>
To: igt-dev@lists.freedesktop.org, riana.tauro@intel.com,
	vinay.belgaumkar@intel.com, kamil.konieczny@intel.com
Cc: anshuman.gupta@intel.com, lucas.demarchi@intel.com,
	rodrigo.vivi@intel.com, soham.purkait@intel.com
Subject: [PATCH i-g-t v4 2/2] tools/intel_pm_rpm: Add support for xe in runtime pm
Date: Fri, 28 Mar 2025 19:40:00 +0530	[thread overview]
Message-ID: <20250328141000.1847594-3-soham.purkait@intel.com> (raw)
In-Reply-To: <20250328141000.1847594-1-soham.purkait@intel.com>

Add support for runtime power management
for Xe driver along with existing i915
support

v1 :  Updated references from "i915" to
      "generic GPU driver" to include support
      for the xe driver, ensuring clarity and
      consistency

v2 : Add prefix in commit message (Kamil)

v3 : Add a error or warn statement (Riana)

v4 : Fix for timedout log message (Riana)

Signed-off-by: Soham Purkait <soham.purkait@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>

---
 tools/intel_pm_rpm.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/intel_pm_rpm.c b/tools/intel_pm_rpm.c
index 08c25ca8a..9622f0552 100644
--- a/tools/intel_pm_rpm.c
+++ b/tools/intel_pm_rpm.c
@@ -35,7 +35,7 @@
 #include "igt_pm.h"
 
 #define DONT_SET_AUTOSUSPEND_DELAY (1 << 0)
-#define SET_I915_AUTOSUSPEND_DELAY (1 << 1)
+#define SET_AUTOSUSPEND_DELAY (1 << 1)
 
 typedef struct {
 	int drm_fd;
@@ -47,8 +47,8 @@ typedef struct {
 const char *help_str =
 	"  --disable-display-wait\t\tDisable all screens and try to go into runtime pm.\n"
 	"  --force-d3cold-wait\t\tForce dgfx gfx card to enter runtime D3Cold.\n"
-	"  --setup-d3cold\t\tEnable gfx card runtime pm and optionally set autosupend delay to"
-	"  i915 autosuspend delay. Use --setup-d3cold=i915-auto-delay as optional argument.\n"
+	"  --setup-d3cold\t\tEnable gfx card runtime pm and optionally set GPU driver's"
+	"  autosuspend delay. Use --setup-d3cold=auto-delay as optional argument.\n"
 	"  --help\t\tProvide help. Provide card name with IGT_DEVICE=drm:/dev/dri/card*.";
 static struct option long_options[] = {
 	{"disable-display-wait", 0, 0, 'd'},
@@ -80,14 +80,14 @@ static void disable_all_displays(data_t *data)
 static void
 setup_gfx_card_d3cold(data_t *data, unsigned char setup_d3cold)
 {
-	struct pci_device *root, *i915;
+	struct pci_device *root, *gpu_device;
 
 	root = igt_device_get_pci_root_port(data->drm_fd);
 	if (setup_d3cold == DONT_SET_AUTOSUSPEND_DELAY) {
 		igt_pm_enable_pci_card_runtime_pm(root, NULL);
-	} else if (setup_d3cold == SET_I915_AUTOSUSPEND_DELAY) {
-		i915 = igt_device_get_pci_device(data->drm_fd);
-		igt_pm_enable_pci_card_runtime_pm(root, i915);
+	} else if (setup_d3cold == SET_AUTOSUSPEND_DELAY) {
+		gpu_device = igt_device_get_pci_device(data->drm_fd);
+		igt_pm_enable_pci_card_runtime_pm(root, gpu_device);
 	}
 
 	igt_info("Enabled pci devs runtime pm under Root port %04x:%02x:%02x.%01x\n",
@@ -151,7 +151,8 @@ int main(int argc, char *argv[])
 			goto exit;
 		}
 	} else {
-		if (!igt_device_find_first_i915_discrete_card(&card)) {
+		if (!igt_device_find_first_i915_discrete_card(&card) &&
+		    !igt_device_find_first_xe_discrete_card(&card)) {
 			igt_warn("No discrete gpu found\n");
 			ret = EXIT_FAILURE;
 			goto exit;
@@ -169,8 +170,8 @@ int main(int argc, char *argv[])
 			break;
 		case 's':
 			if (optarg) {
-				if (!strcmp(optarg, "i915-auto-delay")) {
-					setup_d3cold = SET_I915_AUTOSUSPEND_DELAY;
+				if (!strcmp(optarg, "auto-delay")) {
+					setup_d3cold = SET_AUTOSUSPEND_DELAY;
 				} else	{
 					usage(argv[0]);
 					ret = EXIT_SUCCESS;
@@ -203,7 +204,7 @@ int main(int argc, char *argv[])
 		kmstest_set_vt_graphics_mode();
 		igt_display_require(&data.display, data.drm_fd);
 
-		/* i915 disables RPM in case DMC is not loaded on kms supported cards */
+		/* GPU driver disables RPM in case DMC is not loaded on kms supported cards */
 		if (!igt_pm_dmc_loaded(data.debugfs_fd)) {
 			igt_warn("dmc fw is not loaded, no runtime pm\n");
 			ret = EXIT_FAILURE;
@@ -215,7 +216,13 @@ int main(int argc, char *argv[])
 		igt_setup_runtime_pm(data.drm_fd);
 		disable_all_displays(&data);
 		if (!igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)) {
-			__igt_debugfs_dump(data.drm_fd, "i915_runtime_pm_status", IGT_LOG_INFO);
+			if (!strcmp("i915", card.driver))
+				__igt_debugfs_dump(data.drm_fd,
+						   "i915_runtime_pm_status",
+						   IGT_LOG_INFO);
+			else
+				igt_log(IGT_LOG_DOMAIN, IGT_LOG_INFO,
+					"Device not runtime suspended\n");
 			ret = EXIT_FAILURE;
 			goto exit;
 		}
-- 
2.34.1


  parent reply	other threads:[~2025-03-28 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 14:09 [PATCH i-g-t v4 0/2] Add support for Xe in runtime-pm Soham Purkait
2025-03-28 14:09 ` [PATCH i-g-t v4 1/2] lib/igt_device_scan: Add driver field to igt_device_card struct Soham Purkait
2025-03-28 14:10 ` Soham Purkait [this message]
2025-03-29  1:21 ` ✓ Xe.CI.BAT: success for Add support for Xe in runtime-pm (rev5) Patchwork
2025-03-29  1:42 ` ✓ i915.CI.BAT: " Patchwork
2025-03-29  7:14 ` ✓ i915.CI.Full: " Patchwork
2025-03-29 19:52 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-06 19:44 ` Patchwork

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=20250328141000.1847594-3-soham.purkait@intel.com \
    --to=soham.purkait@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=vinay.belgaumkar@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