[PATCH v2 1/3] drm/amd: Allow dGPUs that support BACO to use smart suspend
Mario Limonciello
mario.limonciello at amd.com
Tue Feb 28 04:43:02 UTC 2023
If a dGPU is already runtime suspended using BACO, there is no point
to waking it up to run regular suspend callbacks.
Cc: Peter Kopec <pekopec at redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
---
v1->v2:
* Simplify prepare call
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 32 ++++++++++++-------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index e11f83bd1653..750984517192 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2190,8 +2190,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
/* only need to skip on ATPX */
if (amdgpu_device_supports_px(ddev))
dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
- /* we want direct complete for BOCO */
- if (amdgpu_device_supports_boco(ddev))
+ /* we want direct complete for BOCO and for BACO */
+ if (amdgpu_device_supports_boco(ddev) ||
+ amdgpu_device_supports_baco(ddev))
dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_SMART_PREPARE |
DPM_FLAG_SMART_SUSPEND |
DPM_FLAG_MAY_SKIP_RESUME);
@@ -2384,25 +2385,24 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)
return;
}
+/**
+ * amdgpu_pmops_prepare
+ *
+ * @dev: device pointer
+ *
+ * Run the "prepare" PM operation. For devices supporting
+ * BOCO or BACO use DPM_FLAG_SMART_PREPARE to skip rest of
+ * suspend process.
+ *
+ */
static int amdgpu_pmops_prepare(struct device *dev)
{
struct drm_device *drm_dev = dev_get_drvdata(dev);
- struct amdgpu_device *adev = drm_to_adev(drm_dev);
- /* Return a positive number here so
- * DPM_FLAG_SMART_SUSPEND works properly
- */
- if (amdgpu_device_supports_boco(drm_dev))
- return pm_runtime_suspended(dev);
-
- /* if we will not support s3 or s2i for the device
- * then skip suspend
- */
- if (!amdgpu_acpi_is_s0ix_active(adev) &&
- !amdgpu_acpi_is_s3_active(adev))
- return 1;
+ if (!dev_pm_test_driver_flags(drm_dev->dev, DPM_FLAG_SMART_PREPARE))
+ return 0;
- return 0;
+ return pm_runtime_suspended(dev);
}
static void amdgpu_pmops_complete(struct device *dev)
--
2.34.1
More information about the amd-gfx
mailing list