intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/xe: Inspect all forcewake bits for runtime idleness
@ 2026-09-09  1:37 Vinay Belgaumkar
  2026-09-09  1:37 ` [PATCH 2/2] drm/xe: Poll GT for C6 before D3 Vinay Belgaumkar
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Vinay Belgaumkar @ 2026-09-09  1:37 UTC (permalink / raw)
  To: intel-xe; +Cc: Vinay Belgaumkar, Badal Nilawar, Rodrigo Vivi

Ensure all forcewake bits are clear in the runtime suspend idleness check.
This includes the ones not typically used by Xe KMD as well. Skip suspend
when any of these bits are set, since it could mean someone is trying to
keep the GT awake. Runtime subsystem can retry and succeed when forcewake
bits clear.

Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Assisted-by: Claude:Claude-Sonnet-5
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 drivers/gpu/drm/xe/xe_force_wake.c | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_force_wake.h |  1 +
 drivers/gpu/drm/xe/xe_pci.c        |  6 ++++++
 3 files changed, 34 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/xe/xe_force_wake.c
index 197e2197bd0a..167f39946648 100644
--- a/drivers/gpu/drm/xe/xe_force_wake.c
+++ b/drivers/gpu/drm/xe/xe_force_wake.c
@@ -148,6 +148,33 @@ static int domain_sleep_wait(struct xe_gt *gt,
 	return __domain_wait(gt, domain, false);
 }
 
+/**
+ * xe_force_wake_any_bit_set - Return true if any domain FW bit is set
+ * @fw: struct xe_force_wake
+ *
+ * Check if any FW bit is set across all domains for a given GT.
+
+ * Return: true if any bit in the FW reg is set
+ */
+bool xe_force_wake_any_bit_set(struct xe_force_wake *fw)
+{
+	struct xe_gt *gt = fw->gt;
+	struct xe_force_wake_domain *domain;
+	unsigned int tmp;
+	u32 val;
+
+	for_each_fw_domain(domain, fw, tmp) {
+		val = xe_mmio_read32(&gt->mmio, domain->reg_ctl);
+		if (val & 0xFFFF) {
+			xe_gt_info(gt, "FW bit set in domain: %d, val: 0x%x",
+				   domain->id, val);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 /**
  * xe_force_wake_get() : Increase the domain refcount
  * @fw: struct xe_force_wake
diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
index e2721f205d6c..2f2924a7f146 100644
--- a/drivers/gpu/drm/xe/xe_force_wake.h
+++ b/drivers/gpu/drm/xe/xe_force_wake.h
@@ -18,6 +18,7 @@ void xe_force_wake_init_engines(struct xe_gt *gt,
 unsigned int __must_check xe_force_wake_get(struct xe_force_wake *fw,
 					    enum xe_force_wake_domains domains);
 void xe_force_wake_put(struct xe_force_wake *fw, unsigned int fw_ref);
+bool xe_force_wake_any_bit_set(struct xe_force_wake *fw);
 
 const char *xe_force_wake_domain_to_str(enum xe_force_wake_domain_id id);
 
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index ab4da1d9a9f1..187a39894513 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -21,6 +21,7 @@
 #include "xe_configfs.h"
 #include "xe_device.h"
 #include "xe_drv.h"
+#include "xe_force_wake.h"
 #include "xe_gt.h"
 #include "xe_gt_printk.h"
 #include "xe_gt_sriov_vf.h"
@@ -1438,9 +1439,14 @@ static int xe_pci_runtime_idle(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct xe_device *xe = pdev_to_xe_device(pdev);
+	struct xe_gt *gt;
+	u8 id;
 
 	xe_pm_d3cold_allowed_toggle(xe);
 
+	for_each_gt(gt, xe, id)
+		if (xe_force_wake_any_bit_set(gt_to_fw(gt)))
+			return -EAGAIN;
 	return 0;
 }
 
-- 
2.38.1


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

end of thread, other threads:[~2026-09-10  0:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09  1:37 [PATCH 1/2] drm/xe: Inspect all forcewake bits for runtime idleness Vinay Belgaumkar
2026-09-09  1:37 ` [PATCH 2/2] drm/xe: Poll GT for C6 before D3 Vinay Belgaumkar
2026-09-09  1:53   ` sashiko-bot
2026-09-10  0:48     ` Belgaumkar, Vinay
2026-09-09  1:50 ` ✓ CI.KUnit: success for series starting with [1/2] drm/xe: Inspect all forcewake bits for runtime idleness Patchwork
2026-09-09  1:56 ` [PATCH 1/2] " sashiko-bot
2026-09-10  0:47   ` Belgaumkar, Vinay
2026-09-09  2:26 ` ✓ Xe.CI.BAT: success for series starting with [1/2] " Patchwork
2026-09-09 10:17 ` ✗ Xe.CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).