[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230828122614.3815122-5-Arvind.Yadav@amd.com>
Date: Mon, 28 Aug 2023 17:56:11 +0530
From: Arvind Yadav <Arvind.Yadav@....com>
To: <Christian.Koenig@....com>, <alexander.deucher@....com>,
<shashank.sharma@....com>, <Xinhui.Pan@....com>,
<airlied@...il.com>, <daniel@...ll.ch>, <Felix.Kuehling@....com>,
<amd-gfx@...ts.freedesktop.org>
CC: <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
"Arvind Yadav" <Arvind.Yadav@....com>,
Christian Koenig <christian.koenig@....com>
Subject: [PATCH v3 4/7] drm/amdgpu: Add suspend function to clear the GPU power profile.
This patch adds a suspend function that will clear the GPU
power profile before going into suspend state.
v2:
- Add the new suspend function based on review comment.
v3:
- Adressed the review comment.
- Now clearing all the profile in work handler.
Cc: Shashank Sharma <shashank.sharma@....com>
Cc: Christian Koenig <christian.koenig@....com>
Cc: Alex Deucher <alexander.deucher@....com>
Signed-off-by: Arvind Yadav <Arvind.Yadav@....com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
drivers/gpu/drm/amd/amdgpu/amdgpu_workload.c | 7 +++++++
drivers/gpu/drm/amd/include/amdgpu_workload.h | 2 ++
3 files changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index cd3bf641b630..3b70e657b439 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4212,6 +4212,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
amdgpu_ras_suspend(adev);
+ amdgpu_workload_profile_suspend(adev);
+
amdgpu_device_ip_suspend_phase1(adev);
if (!adev->in_s0ix)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_workload.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_workload.c
index fbe86ee5b8bf..0ba0000b274a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_workload.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_workload.c
@@ -197,6 +197,13 @@ void amdgpu_workload_profile_get(struct amdgpu_device *adev,
mutex_unlock(&workload->workload_lock);
}
+void amdgpu_workload_profile_suspend(struct amdgpu_device *adev)
+{
+ struct amdgpu_smu_workload *workload = &adev->smu_workload;
+
+ amdgpu_power_profile_clear_all(adev, workload);
+}
+
void amdgpu_workload_profile_init(struct amdgpu_device *adev)
{
adev->smu_workload.adev = adev;
diff --git a/drivers/gpu/drm/amd/include/amdgpu_workload.h b/drivers/gpu/drm/amd/include/amdgpu_workload.h
index 596a962800e9..34b96a5e7b50 100644
--- a/drivers/gpu/drm/amd/include/amdgpu_workload.h
+++ b/drivers/gpu/drm/amd/include/amdgpu_workload.h
@@ -52,6 +52,8 @@ void amdgpu_workload_profile_put(struct amdgpu_device *adev,
void amdgpu_workload_profile_get(struct amdgpu_device *adev,
uint32_t ring_type);
+void amdgpu_workload_profile_suspend(struct amdgpu_device *adev);
+
void amdgpu_workload_profile_init(struct amdgpu_device *adev);
void amdgpu_workload_profile_fini(struct amdgpu_device *adev);
--
2.34.1
Powered by blists - more mailing lists