RE: [PATCH v6 4/4] drm/amd: Only run s3 or s0ix if system is configured properly

2022-01-27 Thread Limonciello, Mario
[Public]

Thanks for the review.  I'm only going to merge 2-4 initially though.
The reporter on 1 has some questionable results, and I have a follow up patch 
for them to try.
If that combined with 1 looks good I'll bring that patch for review.

From: Deucher, Alexander 
Sent: Thursday, January 27, 2022 08:50
To: Limonciello, Mario ; 
amd-gfx@lists.freedesktop.org
Cc: Liang, Prike 
Subject: Re: [PATCH v6 4/4] drm/amd: Only run s3 or s0ix if system is 
configured properly


[Public]

Series is:
Reviewed-by: Alex Deucher 
mailto:alexander.deuc...@amd.com>>

From: amd-gfx 
mailto:amd-gfx-boun...@lists.freedesktop.org>>
 on behalf of Mario Limonciello 
mailto:mario.limoncie...@amd.com>>
Sent: Wednesday, January 26, 2022 5:58 PM
To: amd-gfx@lists.freedesktop.org 
mailto:amd-gfx@lists.freedesktop.org>>
Cc: Liang, Prike mailto:prike.li...@amd.com>>; 
Limonciello, Mario mailto:mario.limoncie...@amd.com>>
Subject: [PATCH v6 4/4] drm/amd: Only run s3 or s0ix if system is configured 
properly

This will cause misconfigured systems to not run the GPU suspend
routines.

* In APUs that are properly configured system will go into s2idle.
* In APUs that are intended to be S3 but user selects
  s2idle the GPU will stay fully powered for the suspend.
* In APUs that are intended to be s2idle and system misconfigured
  the GPU will stay fully powered for the suspend.
* In systems that are intended to be s2idle, but AMD dGPU is also
  present, the dGPU will go through S3

Signed-off-by: Mario Limonciello 
mailto:mario.limoncie...@amd.com>>
---
v5->v6:
 * Move code into prepare vfunc and use DPM_FLAG_SMART_SUSPEND to skip
   suspend code in incorrectly configured systems.
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 922accdd4246..3e581f35f19d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2289,6 +2289,7 @@ static void amdgpu_drv_delayed_reset_work_handler(struct 
work_struct *work)
 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
@@ -2296,6 +2297,13 @@ static int amdgpu_pmops_prepare(struct device *dev)
 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;
+
 return 0;
 }

--
2.25.1


Re: [PATCH v6 4/4] drm/amd: Only run s3 or s0ix if system is configured properly

2022-01-27 Thread Deucher, Alexander
[Public]

Series is:
Reviewed-by: Alex Deucher 

From: amd-gfx  on behalf of Mario 
Limonciello 
Sent: Wednesday, January 26, 2022 5:58 PM
To: amd-gfx@lists.freedesktop.org 
Cc: Liang, Prike ; Limonciello, Mario 

Subject: [PATCH v6 4/4] drm/amd: Only run s3 or s0ix if system is configured 
properly

This will cause misconfigured systems to not run the GPU suspend
routines.

* In APUs that are properly configured system will go into s2idle.
* In APUs that are intended to be S3 but user selects
  s2idle the GPU will stay fully powered for the suspend.
* In APUs that are intended to be s2idle and system misconfigured
  the GPU will stay fully powered for the suspend.
* In systems that are intended to be s2idle, but AMD dGPU is also
  present, the dGPU will go through S3

Signed-off-by: Mario Limonciello 
---
v5->v6:
 * Move code into prepare vfunc and use DPM_FLAG_SMART_SUSPEND to skip
   suspend code in incorrectly configured systems.
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 922accdd4246..3e581f35f19d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2289,6 +2289,7 @@ static void amdgpu_drv_delayed_reset_work_handler(struct 
work_struct *work)
 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
@@ -2296,6 +2297,13 @@ static int amdgpu_pmops_prepare(struct device *dev)
 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;
+
 return 0;
 }

--
2.25.1