@@ -925,7 +925,7 @@ static int xe_pci_suspend(struct device *dev)
/*
* Enabling D3Cold is needed for S2Idle/S0ix.
- * It is save to allow here since xe_pm_suspend has evicted
+ * It is safe to allow here since xe_pm_suspend has evicted
* the local memory and the direct complete optimization is disabled.
*/
d3cold_toggle(pdev, D3COLD_ENABLE);
@@ -942,7 +942,7 @@ static int xe_pci_resume(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev);
int err;
- /* Give back the D3Cold decision to the runtime P M*/
+ /* Give back the D3Cold decision to the runtime PM */
d3cold_toggle(pdev, D3COLD_DISABLE);
err = pci_set_power_state(pdev, PCI_D0);
@@ -151,7 +151,7 @@ static void xe_rpm_lockmap_release(const struct xe_device *xe)
static void xe_pm_suspend_prepare(struct xe_device *xe)
{
if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE)
- xe_pm_d3cold_allowed_toggle(xe);
+ xe_pm_d3cold_target_state_toggle(xe);
else
xe->d3cold.target_state = XE_D3COLD_OFF;
}
@@ -182,10 +182,12 @@ int xe_pm_suspend(struct xe_device *xe)
xe_display_pm_suspend(xe);
- /* FIXME: Super racey... */
- err = xe_bo_evict_all(xe);
- if (err)
- goto err_pxp;
+ if (xe->d3cold.target_state == XE_D3COLD_OFF) {
+ /* FIXME: Super racey... */
+ err = xe_bo_evict_all(xe);
+ if (err)
+ goto err_pxp;
+ }
for_each_gt(gt, xe, id) {
err = xe_gt_suspend(gt);
@@ -197,6 +199,12 @@ int xe_pm_suspend(struct xe_device *xe)
xe_display_pm_suspend_late(xe);
+ if (xe->d3cold.target_state == XE_D3COLD_VRSR) {
+ err = xe_pm_vrsr_enable(xe, true);
+ if (err)
+ goto err_display;
+ }
+
drm_dbg(&xe->drm, "Device suspended\n");
return 0;
@@ -238,9 +246,11 @@ int xe_pm_resume(struct xe_device *xe)
* This only restores pinned memory which is the memory required for the
* GT(s) to resume.
*/
- err = xe_bo_restore_kernel(xe);
- if (err)
- goto err;
+ if (xe->d3cold.target_state == XE_D3COLD_OFF) {
+ err = xe_bo_restore_kernel(xe);
+ if (err)
+ goto err;
+ }
xe_irq_resume(xe);
@@ -249,9 +259,11 @@ int xe_pm_resume(struct xe_device *xe)
xe_display_pm_resume(xe);
- err = xe_bo_restore_user(xe);
- if (err)
- goto err;
+ if (xe->d3cold.target_state == XE_D3COLD_OFF) {
+ err = xe_bo_restore_user(xe);
+ if (err)
+ goto err;
+ }
xe_pxp_pm_resume(xe->pxp);
@@ -595,7 +607,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
xe_display_pm_runtime_suspend(xe);
- if (xe->d3cold.target_state) {
+ if (xe->d3cold.target_state == XE_D3COLD_OFF) {
err = xe_bo_evict_all(xe);
if (err)
goto out_resume;
@@ -611,6 +623,14 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
xe_display_pm_runtime_suspend_late(xe);
+ if (xe->d3cold.target_state == XE_D3COLD_VRSR) {
+ err = xe_pm_vrsr_enable(xe, true);
+ if (err) {
+ drm_err(&xe->drm, "Failed to enable VRSR: %d\n", err);
+ goto out_resume;
+ }
+ }
+
xe_rpm_lockmap_release(xe);
xe_pm_write_callback_task(xe, NULL);
return 0;
@@ -642,7 +662,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)
xe_rpm_lockmap_acquire(xe);
- if (xe->d3cold.target_state) {
+ if (xe->d3cold.target_state == XE_D3COLD_OFF) {
err = xe_pcode_ready(xe, true);
if (err)
goto out;
@@ -658,6 +678,9 @@ int xe_pm_runtime_resume(struct xe_device *xe)
goto out;
}
+ if (xe->d3cold.target_state == XE_D3COLD_VRSR)
+ xe_display_pm_resume_early(xe);
+
xe_irq_resume(xe);
for_each_gt(gt, xe, id)
@@ -665,7 +688,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)
xe_display_pm_runtime_resume(xe);
- if (xe->d3cold.target_state) {
+ if (xe->d3cold.target_state == XE_D3COLD_OFF) {
err = xe_bo_restore_user(xe);
if (err)
goto out;