Re: [PATCH] drm/amd/amdgpu: Skip GFX CG/PG state change during S0i3 resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - Internal Distribution Only]


The problem is we are not properly suspending some of these blocks in the first place.  Please take a look at my WIP patches here:

Alex


From: Vishwakarma, Pratik <Pratik.Vishwakarma@xxxxxxx>
Sent: Tuesday, March 16, 2021 4:42 AM
To: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Liang, Prike <Prike.Liang@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
Cc: Vishwakarma, Pratik <Pratik.Vishwakarma@xxxxxxx>
Subject: [PATCH] drm/amd/amdgpu: Skip GFX CG/PG state change during S0i3 resume
 
[Why]
amdgpu resume time is over 1 sec.

[How]
GFX CG/PG state change is skipped for S0ix suspend.
Skip CG/PG state chage for GFX during S0ix resume too.
This reduces resume time to under 150msec.

Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  7 ++++++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 5da112b3feb0..036ca9f0c739 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1040,6 +1040,9 @@ struct amdgpu_device {
          */
         bool                             in_poweroff_reboot_com;
 
+       /* Flag used to identify system is in resume sequence */
+       bool                            in_resume;
+
         atomic_t                         in_gpu_reset;
         enum pp_mp1_state               mp1_state;
         struct rw_semaphore reset_sem;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 3dbee9671d59..4089135b6493 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2349,6 +2349,11 @@ static int amdgpu_device_set_cg_state(struct amdgpu_device *adev,
                     adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCN &&
                     adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_JPEG &&
                     adev->ip_blocks[i].version->funcs->set_clockgating_state) {
+                       /* Skip GFX gating for S0ix during resume */
+                       if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX) {
+                               if (amdgpu_acpi_is_s0ix_supported(adev) && adev->in_resume)
+                                       continue;
+                       }
                         /* enable clockgating to save power */
                         r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
                                                                                      state);
@@ -2380,6 +2385,12 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                     adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCN &&
                     adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_JPEG &&
                     adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       /* Skip GFX gating for S0ix during resume */
+                       if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX) {
+                               if (amdgpu_acpi_is_s0ix_supported(adev) && adev->in_resume)
+                                       continue;
+                       }
+
                         /* enable powergating to save power */
                         r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
                                                                                         state);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index f98843eeb084..693ad3b3e6a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1400,8 +1400,13 @@ static int amdgpu_pmops_suspend(struct device *dev)
 static int amdgpu_pmops_resume(struct device *dev)
 {
         struct drm_device *drm_dev = dev_get_drvdata(dev);
+       struct amdgpu_device *adev = drm_to_adev(drm_dev);
+       int r;
 
-       return amdgpu_device_resume(drm_dev, true);
+       adev->in_resume = true;
+       r = amdgpu_device_resume(drm_dev, true);
+       adev->in_resume = false;
+       return r;
 }
 
 static int amdgpu_pmops_freeze(struct device *dev)
--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux