Skip to contentSkip to conversation

Adjust suspend flow for dGPUs

RFC Superseded Mario Limonciello 3 participants 12 messages Feb 20, 2023 – Feb 22, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Adjust suspend flow for dGPUs

Currently when a dGPU supports BOCO and is runtime suspended when running the prepare() callback, the rest of the suspend and resume will be skipped. This skipping is due to "Smart prepare", "Smart suspend" and "Smart resume" flags.

dGPUs that support BACO are normally suspended via PMFW and lack of video or audio, but this policy doesn't apply to them.

Furthermore even if a dGPU is runtime suspended the system wide suspend callbacks always wake them even if the power rails won't be cut.

This series adjust the flow around runtime suspend handling for dGPUs.

Mario Limonciello (3):
drm/amd: Don't always set s3 for dGPUs in all sleep modes drm/amd: Allow dGPUs that support BACO to use smart suspend drm/amd: Use runtime suspend in lieu regular suspend on supported
dGPUs

 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c |  9 +++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 17 ++++++++++++-----
 2 files changed, 19 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 drm/amd: Allow dGPUs that support BACO to use smart suspend

If a dGPU is already runtime suspended using BACO, there is no point to waking it up to run regular suspend callbacks.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -3
index 1f6d93dc3d72..c3d3a042946d 100644
@@ -2187,8 +2187,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);
@@ -2389,7 +2390,8 @@ static int amdgpu_pmops_prepare(struct device *dev)
 	/* Return a positive number here so
 	 * DPM_FLAG_SMART_SUSPEND works properly
 	 */
-	if (amdgpu_device_supports_boco(drm_dev))
+	if (amdgpu_device_supports_boco(drm_dev) ||
+	    amdgpu_device_supports_baco(drm_dev))
 		return pm_runtime_suspended(dev);
 
 	/* if we will not support s3 or s2i for the device
Signature · 1 line
2.34.1
#2 lore raw

RE: [PATCH 1/3] drm/amd: Allow dGPUs that support BACO to use smart suspend

[AMD Official Use Only - General]

Quoted 10 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello
Sent: Tuesday, February 21, 2023 4:16 AM
To: [email protected]
Cc: Peter Kopec <[email protected]>; Limonciello, Mario <[email protected]>
Subject: [PATCH 1/3] drm/amd: Allow dGPUs that support BACO to use smart suspend

Quoted 2 lines

If a dGPU is already runtime suspended using BACO, there is no point to waking it up to run regular suspend callbacks.

Not quite sure about this.. Since the expectations for runtime suspend(over BACO) and regular suspend seem different:
- For runtime suspending over BACO, part of the chip(SMU, NBIO) is still alive.
- For regular suspend(suspend to ram), the whole chip is expected to be powered down.
That means the resuming sequences for them might be slightly different. Not sure whether that will cause some problems.

BR
Evan

Quoted 41 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -2
index 1f6d93dc3d72..c3d3a042946d 100644
@@ -2187,8 +2187,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);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -2389,7 +2390,8 @@ static int amdgpu_pmops_prepare(struct device
 *dev)
 	/* Return a positive number here so
 	 * DPM_FLAG_SMART_SUSPEND works properly
 	 */
-	if (amdgpu_device_supports_boco(drm_dev))
+	if (amdgpu_device_supports_boco(drm_dev) ||
+	    amdgpu_device_supports_baco(drm_dev))
 		return pm_runtime_suspended(dev);
 

/* if we will not support s3 or s2i for the device
--
2.34.1

#3 lore raw

PATCH 2/3 drm/amd: Use runtime suspend in lieu regular suspend on supported dGPUs

In reply to Mario Limonciello

The PMFW on dGPUs that support BACO will transition them in and out of BACO when video/audio move in out of D3/D0.

On the Linux side users can configure what sleep mode to use in /sys/power/mem_sleep, but if the host hardware doesn't cut the power rails during this state then calling suspend from Linux may cause a mismatch of behavior.

To avoid this, only run the runtime suspend and resume callbacks when the dGPU supports BACO or BOCO and the smart flags didn't return to skip these stages (because already runtime suspended).

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +7 -2
index c3d3a042946d..fdc1cbf8ad10 100644
@@ -2418,8 +2418,11 @@ static int amdgpu_pmops_suspend(struct device *dev)
 		adev->in_s0ix = true;
 	else if (amdgpu_acpi_is_s3_active(adev))
 		adev->in_s3 = true;
-	if (!adev->in_s0ix && !adev->in_s3)
+	if (!adev->in_s0ix && !adev->in_s3) {
+		pm_runtime_mark_last_busy(dev);
+		pm_runtime_autosuspend(dev);
 		return 0;
+	}
 	return amdgpu_device_suspend(drm_dev, true);
 }
 
@@ -2440,8 +2443,10 @@ static int amdgpu_pmops_resume(struct device *dev)
 	struct amdgpu_device *adev = drm_to_adev(drm_dev);
 	int r;
 
-	if (!adev->in_s0ix && !adev->in_s3)
+	if (!adev->in_s0ix && !adev->in_s3) {
+		pm_runtime_resume(dev);
 		return 0;
+	}
 
 	/* Avoids registers access if device is physically gone */
 	if (!pci_device_is_present(adev->pdev))
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/3] drm/amd: Use runtime suspend in lieu regular suspend on supported dGPUs

Quoted 23 lines · Mario Limonciello

The PMFW on dGPUs that support BACO will transition them in and out of BACO when video/audio move in out of D3/D0.

On the Linux side users can configure what sleep mode to use in /sys/power/mem_sleep, but if the host hardware doesn't cut the power rails during this state then calling suspend from Linux may cause a mismatch of behavior.

To avoid this, only run the runtime suspend and resume callbacks when the dGPU supports BACO or BOCO and the smart flags didn't return to skip these stages (because already runtime suspended).

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index c3d3a042946d..fdc1cbf8ad10 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct device *dev) · line 2423

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
@@ -2418,8 +2418,11 @@ static int amdgpu_pmops_suspend(struct device *dev)
  		adev->in_s0ix = true;
  	else if (amdgpu_acpi_is_s3_active(adev))
  		adev->in_s3 = true;
-	if (!adev->in_s0ix && !adev->in_s3)
+	if (!adev->in_s0ix && !adev->in_s3) {
+		pm_runtime_mark_last_busy(dev);
+		pm_runtime_autosuspend(dev);

This is asking the device to be suspended (from a suspend call and that sounds weird). Runtime pm handler will assume D3cold scenario and explicitly request BACO entry. Wondering what would happen if the platform doesn't put it in D3cold under s2Idle for dGPUs (BACO/BOCO).

Thanks,
Lijo

Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -1
  		return 0;
+	}
  	return amdgpu_device_suspend(drm_dev, true);
  }
 
@@ -2440,8 +2443,10 @@ static int amdgpu_pmops_resume(struct device *dev)
  	struct amdgpu_device *adev = drm_to_adev(drm_dev);
  	int r;
 
-	if (!adev->in_s0ix && !adev->in_s3)
+	if (!adev->in_s0ix && !adev->in_s3) {
+		pm_runtime_resume(dev);
  		return 0;
+	}
 
  	/* Avoids registers access if device is physically gone */
  	if (!pci_device_is_present(adev->pdev))
#5 lore raw

RE: [PATCH 2/3] drm/amd: Use runtime suspend in lieu regular suspend on supported dGPUs

[Public]

Quoted 37 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, February 21, 2023 07:20
To: Limonciello, Mario <[email protected]>; amd- [email protected]
Cc: Peter Kopec <[email protected]>
Subject: Re: [PATCH 2/3] drm/amd: Use runtime suspend in lieu regular suspend on supported dGPUs

Quoted 12 lines · Mario Limonciello

The PMFW on dGPUs that support BACO will transition them in and out of BACO when video/audio move in out of D3/D0.

On the Linux side users can configure what sleep mode to use in /sys/power/mem_sleep, but if the host hardware doesn't cut the power rails during this state then calling suspend from Linux may cause a mismatch of behavior.

To avoid this, only run the runtime suspend and resume callbacks when the dGPU supports BACO or BOCO and the smart flags didn't return to skip these stages (because already runtime suspended).

Review

Quoted 7 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct device

Quoted 4 lines

index c3d3a042946d..fdc1cbf8ad10 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -2418,8 +2418,11 @@ static int amdgpu_pmops_suspend(struct device

*dev)

Quoted 10 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct device *dev) · line 2423

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
  		adev->in_s0ix = true;
  	else if (amdgpu_acpi_is_s3_active(adev))
  		adev->in_s3 = true;
-	if (!adev->in_s0ix && !adev->in_s3)
+	if (!adev->in_s0ix && !adev->in_s3) {
+		pm_runtime_mark_last_busy(dev);
+		pm_runtime_autosuspend(dev);

This is asking the device to be suspended (from a suspend call and that sounds weird).

I had convinced myself that it was necessary from reading documentation, but re-reading I believe it should not be necessary if smart suspend is used.

If I drop this patch then the PMFW should still transition it when the video turns off.

Quoted 4 lines

Runtime pm handler will assume D3cold scenario and explicitly request BACO entry. Wondering what would happen if the platform doesn't put it in D3cold under s2Idle for dGPUs (BACO/BOCO).

Higher power consumption I expect.

Quoted 21 lines

Thanks,
Lijo

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_resume(struct device

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
  		return 0;
+	}
  	return amdgpu_device_suspend(drm_dev, true);
  }
 
@@ -2440,8 +2443,10 @@ static int amdgpu_pmops_resume(struct device

*dev)

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
  	struct amdgpu_device *adev = drm_to_adev(drm_dev);
  	int r;
 
-	if (!adev->in_s0ix && !adev->in_s3)
+	if (!adev->in_s0ix && !adev->in_s3) {
+		pm_runtime_resume(dev);
  		return 0;
+	}
 
  	/* Avoids registers access if device is physically gone */
  	if (!pci_device_is_present(adev->pdev))
#6 lore raw

PATCH 3/3 drm/amd: Don't always set s3 for dGPUs in all sleep modes

In reply to Mario Limonciello

dGPUs that will be using BACO or BOCO shouldn't be put into S3 when the system is being put into s2idle.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +7 -2
index 25e902077caf..5c69116bc883 100644
@@ -1038,8 +1038,13 @@ void amdgpu_acpi_detect(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
-	return !(adev->flags & AMD_IS_APU) ||
-		(pm_suspend_target_state == PM_SUSPEND_MEM);
+	if (pm_suspend_target_state == PM_SUSPEND_MEM)
+		return true;
+	if (adev->flags & AMD_IS_APU)
+		return false;
+	return !amdgpu_device_supports_baco(&adev->ddev) &&
+		!amdgpu_device_supports_boco(&adev->ddev);
+
 }
 
 /**
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH 3/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes

Quoted 14 lines · Mario Limonciello

dGPUs that will be using BACO or BOCO shouldn't be put into S3 when the system is being put into s2idle.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
index 25e902077caf..5c69116bc883 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_detect(void) · line 1044

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -2
@@ -1038,8 +1038,13 @@ void amdgpu_acpi_detect(void)
   */
  bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
  {
-	return !(adev->flags & AMD_IS_APU) ||
-		(pm_suspend_target_state == PM_SUSPEND_MEM);
+	if (pm_suspend_target_state == PM_SUSPEND_MEM)
+		return true;
+	if (adev->flags & AMD_IS_APU)
+		return false;

What is the expected path of APUs which don't support S2idle?

Thanks,
Lijo

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+	return !amdgpu_device_supports_baco(&adev->ddev) &&
+		!amdgpu_device_supports_boco(&adev->ddev);
+
  }
 
  /**
#8 lore raw

Re: [PATCH 3/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes

Quoted 12 lines · Lijo
Quoted 9 lines · Mario Limonciello

dGPUs that will be using BACO or BOCO shouldn't be put into S3 when the system is being put into s2idle.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 +++++++--

  1 file changed, 7 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
index 25e902077caf..5c69116bc883 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_detect(void) · line 1044

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -2
@@ -1038,8 +1038,13 @@ void amdgpu_acpi_detect(void)
    */
   bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
   {
-    return !(adev->flags & AMD_IS_APU) ||
-        (pm_suspend_target_state == PM_SUSPEND_MEM);
+    if (pm_suspend_target_state == PM_SUSPEND_MEM)
+        return true;
+    if (adev->flags & AMD_IS_APU)
+        return false;

What is the expected path of APUs which don't support S2idle?

They should staying powered on and not running any suspend code.
Since they don't support BACO or BOCO I expect the call to enter autosuspend to be a no-op for them.

This was shown to improve power consumption for such cases (a reporter actually measured it).

Quoted 9 lines

Thanks,
Lijo

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+    return !amdgpu_device_supports_baco(&adev->ddev) &&
+        !amdgpu_device_supports_boco(&adev->ddev);
+
   }
   /**
#9 lore raw

Re: [PATCH 3/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes

Quoted 30 lines · Mario Limonciello
Quoted 12 lines · Lijo
Quoted 9 lines · Mario Limonciello

dGPUs that will be using BACO or BOCO shouldn't be put into S3 when the system is being put into s2idle.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 +++++++--

  1 file changed, 7 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
index 25e902077caf..5c69116bc883 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_detect(void) · line 1044

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -2
@@ -1038,8 +1038,13 @@ void amdgpu_acpi_detect(void)
    */
   bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
   {
-    return !(adev->flags & AMD_IS_APU) ||
-        (pm_suspend_target_state == PM_SUSPEND_MEM);
+    if (pm_suspend_target_state == PM_SUSPEND_MEM)
+        return true;
+    if (adev->flags & AMD_IS_APU)
+        return false;

What is the expected path of APUs which don't support S2idle?

Quoted 4 lines

They should staying powered on and not running any suspend code.
Since they don't support BACO or BOCO I expect the call to enter autosuspend to be a no-op for them.

This was shown to improve power consumption for such cases (a reporter actually measured it).

To clarify on this - someone tried s2idle on an APU which doesn't support it (no FW S0ix support/PMC driver support) and the power consumption is better for the APU. Is it because the peripherals went idle now, but in earlier path APU prevented S2idle entry altogether?

Thanks,
Lijo

Quoted 10 lines
Quoted 9 lines

Thanks,
Lijo

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+    return !amdgpu_device_supports_baco(&adev->ddev) &&
+        !amdgpu_device_supports_boco(&adev->ddev);
+
   }
   /**
#10 lore raw

Re: [PATCH 3/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes

Quoted 33 lines · Lijo
Quoted 30 lines · Mario Limonciello
Quoted 28 lines · Lijo
Quoted 14 lines · Mario Limonciello

dGPUs that will be using BACO or BOCO shouldn't be put into S3 when the system is being put into s2idle.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 +++++++--

  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
index 25e902077caf..5c69116bc883 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_detect(void) · line 1044

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -2
@@ -1038,8 +1038,13 @@ void amdgpu_acpi_detect(void)
    */
   bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
   {
-    return !(adev->flags & AMD_IS_APU) ||
-        (pm_suspend_target_state == PM_SUSPEND_MEM);
+    if (pm_suspend_target_state == PM_SUSPEND_MEM)
+        return true;
+    if (adev->flags & AMD_IS_APU)
+        return false;

What is the expected path of APUs which don't support S2idle?

Quoted 6 lines
Quoted 4 lines

They should staying powered on and not running any suspend code.
Since they don't support BACO or BOCO I expect the call to enter autosuspend to be a no-op for them.

This was shown to improve power consumption for such cases (a reporter actually measured it).

To clarify on this - someone tried s2idle on an APU which doesn't support it (no FW S0ix support/PMC driver support) and the power consumption is better for the APU. Is it because the peripherals went idle now, but in earlier path APU prevented S2idle entry altogether?

I double checked and realize I misspoke - it's not that they don't run any suspend code, but they handle the s0ix flow even even without underlying hardware support.

https://gitlab.freedesktop.org/agd5f/linux/-/commit/9cdb69924f545fdc3086bc8b085dad8146057141

So the path for them doesn't change in this series.

Quoted 13 lines

Thanks,
Lijo

Quoted 10 lines
Quoted 9 lines

Thanks,
Lijo

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+    return !amdgpu_device_supports_baco(&adev->ddev) &&
+        !amdgpu_device_supports_boco(&adev->ddev);
+
   }
   /**
#11 lore raw

RE: [PATCH 3/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes

In reply to Mario Limonciello

[AMD Official Use Only - General]

Quoted 10 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello
Sent: Tuesday, February 21, 2023 4:16 AM
To: [email protected]
Cc: Peter Kopec <[email protected]>; Limonciello, Mario <[email protected]>
Subject: [PATCH 3/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes

Quoted 2 lines

dGPUs that will be using BACO or BOCO shouldn't be put into S3 when the system is being put into s2idle.

Will this break regular suspend to ram scenario? I mean
- For s2idle scenario, amdgpu_pmops_prepare will be called. And for this scenario, it is expected dgpu using BACO or BOCO to be not put into S3. Right?
- For regular s2ram scenario, amdgpu_pmops_prepare will also get called. Then dgpu using BACO or BOCO will be not put into S3 either?

BR
Evan

Quoted 30 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +7 -3
index 25e902077caf..5c69116bc883 100644
@@ -1038,8 +1038,13 @@ void amdgpu_acpi_detect(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
-	return !(adev->flags & AMD_IS_APU) ||
-		(pm_suspend_target_state == PM_SUSPEND_MEM);
+	if (pm_suspend_target_state == PM_SUSPEND_MEM)
+		return true;
+	if (adev->flags & AMD_IS_APU)
+		return false;
+	return !amdgpu_device_supports_baco(&adev->ddev) &&
+		!amdgpu_device_supports_boco(&adev->ddev);
+
 }
 
 /**
--

2.34.1