[Intel-xe] [PATCH 2/2] drm/xe/pm: Fix PM runtime_idle callback

Anshuman Gupta anshuman.gupta at intel.com
Fri Jun 16 14:11:15 UTC 2023


xe driver is using runtime_idle RPM callback but
xe_pm_runtime_put() is using pm_runtime_put_autosuspend(), which
eventually make PM Core to trigger autosuspend directly
without even calling runtime_idle callback.

Fixing it accordingly in both xe_pm_runtime_put()
and xe_pci_runtime_idle().

Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
---
 drivers/gpu/drm/xe/xe_pci.c | 5 ++++-
 drivers/gpu/drm/xe/xe_pm.c  | 3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 2991cf5365d5..7d2f93728585 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -796,6 +796,7 @@ 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);
+	int ret = 1; /* Trigger autosuspend */
 
 	/*
 	 * TODO: d3cold should be allowed (true) if
@@ -810,7 +811,9 @@ static int xe_pci_runtime_idle(struct device *dev)
 	 */
 	 xe->d3cold_allowed = false;
 
-	return 0;
+	pm_runtime_mark_last_busy(dev);
+	pm_runtime_autosuspend(dev);
+	return ret;
 }
 #endif
 
diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index 04c5353ba870..ad48312c4e1d 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -206,8 +206,7 @@ int xe_pm_runtime_get(struct xe_device *xe)
 
 int xe_pm_runtime_put(struct xe_device *xe)
 {
-	pm_runtime_mark_last_busy(xe->drm.dev);
-	return pm_runtime_put_autosuspend(xe->drm.dev);
+	return pm_runtime_put(xe->drm.dev);
 }
 
 static bool xe_pm_runtime_suspended(struct xe_device *xe)
-- 
2.38.0



More information about the Intel-xe mailing list