RE: [PATCH] drm/amd/powerplay: move maximum sustainable clock retrieving to .hw_init

2020-06-08 Thread Cui, Flora
[AMD Public Use]

Reported-and-tested-by: Flora Cui 

From: Deucher, Alexander 
Sent: Monday, June 8, 2020 11:02 PM
To: Quan, Evan ; amd-gfx@lists.freedesktop.org
Cc: Cui, Flora 
Subject: Re: [PATCH] drm/amd/powerplay: move maximum sustainable clock 
retrieving to .hw_init


[AMD Public Use]

Acked-by: Alex Deucher 
mailto:alexander.deuc...@amd.com>>

From: Quan, Evan mailto:evan.q...@amd.com>>
Sent: Monday, June 8, 2020 6:46 AM
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> 
mailto:amd-gfx@lists.freedesktop.org>>
Cc: Deucher, Alexander 
mailto:alexander.deuc...@amd.com>>; Quan, Evan 
mailto:evan.q...@amd.com>>; Cui, Flora 
mailto:flora@amd.com>>
Subject: [PATCH] drm/amd/powerplay: move maximum sustainable clock retrieving 
to .hw_init

Since DAL settings come between .hw_init and .late_init of SMU. And
DAL needs to know the maximum sustainable clocks.

Change-Id: I0702b7332a0d7c0b29dfdf4999c18efb588b8862
Signed-off-by: Evan Quan mailto:evan.q...@amd.com>>
Reported-by: Flora Cui mailto:flora@amd.com>>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 725ac90c0f36..6beae3b496be 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -819,12 +819,6 @@ static int smu_late_init(void *handle)
 return ret;
 }

-   ret = smu_init_max_sustainable_clocks(smu);
-   if (ret) {
-   dev_err(adev->dev, "Failed to init max sustainable clocks!\n");
-   return ret;
-   }
-
 ret = smu_populate_umd_state_clk(smu);
 if (ret) {
 dev_err(adev->dev, "Failed to populate UMD state clocks!\n");
@@ -1364,6 +1358,19 @@ static int smu_hw_init(void *handle)
 return ret;
 }

+   /*
+* Move maximum sustainable clock retrieving here considering
+* 1. It is not needed on resume(from S3).
+* 2. DAL settings come between .hw_init and .late_init of SMU.
+*And DAL needs to know the maximum sustainable clocks. Thus
+*it cannot be put in .late_init().
+*/
+   ret = smu_init_max_sustainable_clocks(smu);
+   if (ret) {
+   dev_err(adev->dev, "Failed to init max sustainable clocks!\n");
+   return ret;
+   }
+
 adev->pm.dpm_enabled = true;

 dev_info(adev->dev, "SMU is initialized successfully!\n");
--
2.27.0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amd/powerplay: move maximum sustainable clock retrieving to .hw_init

2020-06-08 Thread Deucher, Alexander
[AMD Public Use]

Acked-by: Alex Deucher 

From: Quan, Evan 
Sent: Monday, June 8, 2020 6:46 AM
To: amd-gfx@lists.freedesktop.org 
Cc: Deucher, Alexander ; Quan, Evan 
; Cui, Flora 
Subject: [PATCH] drm/amd/powerplay: move maximum sustainable clock retrieving 
to .hw_init

Since DAL settings come between .hw_init and .late_init of SMU. And
DAL needs to know the maximum sustainable clocks.

Change-Id: I0702b7332a0d7c0b29dfdf4999c18efb588b8862
Signed-off-by: Evan Quan 
Reported-by: Flora Cui 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 725ac90c0f36..6beae3b496be 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -819,12 +819,6 @@ static int smu_late_init(void *handle)
 return ret;
 }

-   ret = smu_init_max_sustainable_clocks(smu);
-   if (ret) {
-   dev_err(adev->dev, "Failed to init max sustainable clocks!\n");
-   return ret;
-   }
-
 ret = smu_populate_umd_state_clk(smu);
 if (ret) {
 dev_err(adev->dev, "Failed to populate UMD state clocks!\n");
@@ -1364,6 +1358,19 @@ static int smu_hw_init(void *handle)
 return ret;
 }

+   /*
+* Move maximum sustainable clock retrieving here considering
+* 1. It is not needed on resume(from S3).
+* 2. DAL settings come between .hw_init and .late_init of SMU.
+*And DAL needs to know the maximum sustainable clocks. Thus
+*it cannot be put in .late_init().
+*/
+   ret = smu_init_max_sustainable_clocks(smu);
+   if (ret) {
+   dev_err(adev->dev, "Failed to init max sustainable clocks!\n");
+   return ret;
+   }
+
 adev->pm.dpm_enabled = true;

 dev_info(adev->dev, "SMU is initialized successfully!\n");
--
2.27.0

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