[PATCH] drm/amd/amdgpu: Skip GFX CG/PG state change during S0i3 resume
Pratik Vishwakarma
Pratik.Vishwakarma at amd.com
Tue Mar 16 08:42:28 UTC 2021
[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 at amd.com>
---
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
More information about the amd-gfx
mailing list