RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit(v3)

2020-08-06 Thread Chen, Guchun
[AMD Public Use]

Please check one comment inline.

Regards,
Guchun

-Original Message-
From: Tianci Yin  
Sent: Friday, August 7, 2020 10:37 AM
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Xu, Feifei 
; Hesik, Christopher ; Swamy, 
Manjunatha ; Quan, Evan ; Chen, 
Guchun ; Feng, Kenneth ; Yin, Tianci 
(Rico) 
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit(v3)

From: "Tianci.Yin" 

On Navi1x, the SPM golden settings are lost after GFXOFF enter/exit, so 
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 8eff0173360d..9e133fd0372d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -571,8 +571,14 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool 
enable)
if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) 
{
schedule_delayed_work(>gfx.gfx_off_delay_work, 
GFX_OFF_DELAY_ENABLE);
} else if (!enable && adev->gfx.gfx_off_state) {
-   if (!amdgpu_dpm_set_powergating_by_smu(adev, 
AMD_IP_BLOCK_TYPE_GFX, false))
+   if (!amdgpu_dpm_set_powergating_by_smu(adev, 
AMD_IP_BLOCK_TYPE_GFX, 
+false)) {
adev->gfx.gfx_off_state = false;
+
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev, "GFXOFF is disabled, re-init 
SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
[Guchun] Since we have the function pointer check, why here we use another 
function for execution? init_spm_golden is one guard to indicate spm 
availability on navi1x ASICs?

+   }
+   }
}
 
mutex_unlock(>gfx.gfx_off_mutex);
--
2.17.1
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit(v3)

2020-08-06 Thread Zhang, Hawking
[AMD Public Use]

Series is

Reviewed-by: Hawking Zhang 

Regards,
Hawking
-Original Message-
From: Tianci Yin  
Sent: Friday, August 7, 2020 10:37
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Xu, Feifei 
; Hesik, Christopher ; Swamy, 
Manjunatha ; Quan, Evan ; Chen, 
Guchun ; Feng, Kenneth ; Yin, Tianci 
(Rico) 
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit(v3)

From: "Tianci.Yin" 

On Navi1x, the SPM golden settings are lost after GFXOFF enter/exit, so 
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 8eff0173360d..9e133fd0372d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -571,8 +571,14 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool 
enable)
if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) 
{
schedule_delayed_work(>gfx.gfx_off_delay_work, 
GFX_OFF_DELAY_ENABLE);
} else if (!enable && adev->gfx.gfx_off_state) {
-   if (!amdgpu_dpm_set_powergating_by_smu(adev, 
AMD_IP_BLOCK_TYPE_GFX, false))
+   if (!amdgpu_dpm_set_powergating_by_smu(adev, 
AMD_IP_BLOCK_TYPE_GFX, 
+false)) {
adev->gfx.gfx_off_state = false;
+
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev, "GFXOFF is disabled, re-init 
SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
+   }
+   }
}
 
mutex_unlock(>gfx.gfx_off_mutex);
--
2.17.1
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit(v3)

2020-08-06 Thread Tianci Yin
From: "Tianci.Yin" 

On Navi1x, the SPM golden settings are lost after GFXOFF
enter/exit, so reconfigure the golden settings after GFXOFF
exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 8eff0173360d..9e133fd0372d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -571,8 +571,14 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool 
enable)
if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) 
{
schedule_delayed_work(>gfx.gfx_off_delay_work, 
GFX_OFF_DELAY_ENABLE);
} else if (!enable && adev->gfx.gfx_off_state) {
-   if (!amdgpu_dpm_set_powergating_by_smu(adev, 
AMD_IP_BLOCK_TYPE_GFX, false))
+   if (!amdgpu_dpm_set_powergating_by_smu(adev, 
AMD_IP_BLOCK_TYPE_GFX, false)) {
adev->gfx.gfx_off_state = false;
+
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev, "GFXOFF is disabled, re-init 
SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
+   }
+   }
}
 
mutex_unlock(>gfx.gfx_off_mutex);
-- 
2.17.1

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


Re: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-28 Thread Yin, Tianci (Rico)
[AMD Official Use Only - Internal Distribution Only]

Thanks very much Lunben and Guchun!

Regards,
Rico

From: Tuikov, Luben 
Sent: Wednesday, July 29, 2020 2:44
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org 

Cc: Deucher, Alexander ; Zhang, Hawking 
; Xu, Feifei ; Hesik, Christopher 
; Swamy, Manjunatha ; 
Quan, Evan ; Feng, Kenneth 
Subject: Re: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

On 2020-07-28 1:27 a.m., Tianci Yin wrote:
> From: "Tianci.Yin" 
>
> On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit,

" are lost "

> reconfigure the golden settings after GFXOFF exit.

" so reconfigure ..."

>
> Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
> Signed-off-by: Tianci.Yin 
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 55463e7a11e2..5da0436d41e0 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,
>
>struct smu_context *smu = (struct smu_context*)(handle);
>struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
> + struct amdgpu_device *adev = smu->adev;
>
>if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
>return -EINVAL;
> @@ -1324,6 +1325,16 @@ static int smu_enable_umd_pstate(void *handle,
>amdgpu_device_ip_set_clockgating_state(smu->adev,
>   
> AMD_IP_BLOCK_TYPE_GFX,
>   
> AMD_CG_STATE_UNGATE);
> +
> + if (adev->asic_type >= CHIP_NAVI10 &&
> + adev->asic_type <= CHIP_NAVI12 &&
> + (adev->pm.pp_feature & PP_GFXOFF_MASK)) {
> + if (adev->gfx.funcs->init_spm_golden) {
> + dev_dbg(adev->dev,"GFXOFF exited, 
> re-init SPM golden settings\n");

Space after comma is required.

> + amdgpu_gfx_init_spm_golden(adev);
> + } else
> + dev_warn(adev->dev,"Callback 
> init_spm_golden is NULL\n");

Space after comma is required.

Please add braces to the single statement of the "else". The reason for this
is that it complements the braces of the "if ( ) {" of the multi-line statement
and closes the block. "checkpatch" calls it "unbalanced braces".

With these three fixed, this patch is
Reviewed-by: Luben Tuikov 

Regards,
Luben

> + }
>}
>} else {
>/* exit umd pstate, restore level, enable gfx cg*/
>

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


Re: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-28 Thread Luben Tuikov
On 2020-07-28 1:27 a.m., Tianci Yin wrote:
> From: "Tianci.Yin" 
> 
> On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit,

" are lost "

> reconfigure the golden settings after GFXOFF exit.

" so reconfigure ..."

> 
> Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
> Signed-off-by: Tianci.Yin 
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 55463e7a11e2..5da0436d41e0 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,
>  
>   struct smu_context *smu = (struct smu_context*)(handle);
>   struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
> + struct amdgpu_device *adev = smu->adev;
>  
>   if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
>   return -EINVAL;
> @@ -1324,6 +1325,16 @@ static int smu_enable_umd_pstate(void *handle,
>   amdgpu_device_ip_set_clockgating_state(smu->adev,
>  
> AMD_IP_BLOCK_TYPE_GFX,
>  
> AMD_CG_STATE_UNGATE);
> +
> + if (adev->asic_type >= CHIP_NAVI10 &&
> + adev->asic_type <= CHIP_NAVI12 &&
> + (adev->pm.pp_feature & PP_GFXOFF_MASK)) {
> + if (adev->gfx.funcs->init_spm_golden) {
> + dev_dbg(adev->dev,"GFXOFF exited, 
> re-init SPM golden settings\n");

Space after comma is required.

> + amdgpu_gfx_init_spm_golden(adev);
> + } else
> + dev_warn(adev->dev,"Callback 
> init_spm_golden is NULL\n");

Space after comma is required.

Please add braces to the single statement of the "else". The reason for this
is that it complements the braces of the "if ( ) {" of the multi-line statement
and closes the block. "checkpatch" calls it "unbalanced braces".

With these three fixed, this patch is
Reviewed-by: Luben Tuikov 

Regards,
Luben

> + }
>   }
>   } else {
>   /* exit umd pstate, restore level, enable gfx cg*/
> 

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


RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-28 Thread Chen, Guchun
[AMD Public Use]

Hi Tianci,

My point is, as in the new patch, one new local adev variable is introduced, 
then in the same function, for others where smu->adev is used should be replace 
by the new local adev as well.
Otherwise, it looks not perfect from coding style's perspective.

Regards,
Guchun

-Original Message-
From: Yin, Tianci (Rico)  
Sent: Tuesday, July 28, 2020 2:48 PM
To: Chen, Guchun ; amd-gfx@lists.freedesktop.org
Cc: Xu, Feifei ; Tuikov, Luben ; 
Hesik, Christopher ; Deucher, Alexander 
; Swamy, Manjunatha ; 
Quan, Evan ; Feng, Kenneth ; Zhang, 
Hawking 
Subject: RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

Hi Guchun,

Since the adev variable invoked a few times, local adev make the code more 
concise.

Thanks!
Rico

-Original Message-
From: Chen, Guchun  
Sent: Tuesday, July 28, 2020 2:26 PM
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org
Cc: Xu, Feifei ; Yin, Tianci (Rico) ; 
Tuikov, Luben ; Hesik, Christopher 
; Deucher, Alexander ; 
Swamy, Manjunatha ; Quan, Evan ; 
Feng, Kenneth ; Zhang, Hawking 
Subject: RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

[AMD Public Use]

One minor comment.

Regards,
Guchun

-Original Message-
From: amd-gfx  On Behalf Of Tianci Yin
Sent: Tuesday, July 28, 2020 1:27 PM
To: amd-gfx@lists.freedesktop.org
Cc: Xu, Feifei ; Yin, Tianci (Rico) ; 
Tuikov, Luben ; Hesik, Christopher 
; Deucher, Alexander ; 
Swamy, Manjunatha ; Quan, Evan ; 
Feng, Kenneth ; Zhang, Hawking 
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

From: "Tianci.Yin" 

On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit, 
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 55463e7a11e2..5da0436d41e0 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,
 
struct smu_context *smu = (struct smu_context*)(handle);
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
+   struct amdgpu_device *adev = smu->adev;

if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
return -EINVAL;
@@ -1324,6 +1325,16 @@ static int smu_enable_umd_pstate(void *handle,
amdgpu_device_ip_set_clockgating_state(smu->adev,
[Guchun]Use the local adev instead of smu->adev?

   
AMD_IP_BLOCK_TYPE_GFX,
   
AMD_CG_STATE_UNGATE);

+
+   if (adev->asic_type >= CHIP_NAVI10 &&
+   adev->asic_type <= CHIP_NAVI12 &&
+   (adev->pm.pp_feature & PP_GFXOFF_MASK)) {
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev,"GFXOFF exited, 
re-init SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
+   } else
+   dev_warn(adev->dev,"Callback 
init_spm_golden is NULL\n");
+   }
}
} else {
/* exit umd pstate, restore level, enable gfx cg*/
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cguchun.chen%40amd.com%7Ce6176c766fe747a6fe1a08d832b6ee3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637315108573876551sdata=43GHkX%2FCRLsfMmNxurLMIZy4l4ElUB2tnslPyfT7NJg%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-28 Thread Yin, Tianci (Rico)
Hi Guchun,

Since the adev variable invoked a few times, local adev make the code more 
concise.

Thanks!
Rico

-Original Message-
From: Chen, Guchun  
Sent: Tuesday, July 28, 2020 2:26 PM
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org
Cc: Xu, Feifei ; Yin, Tianci (Rico) ; 
Tuikov, Luben ; Hesik, Christopher 
; Deucher, Alexander ; 
Swamy, Manjunatha ; Quan, Evan ; 
Feng, Kenneth ; Zhang, Hawking 
Subject: RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

[AMD Public Use]

One minor comment.

Regards,
Guchun

-Original Message-
From: amd-gfx  On Behalf Of Tianci Yin
Sent: Tuesday, July 28, 2020 1:27 PM
To: amd-gfx@lists.freedesktop.org
Cc: Xu, Feifei ; Yin, Tianci (Rico) ; 
Tuikov, Luben ; Hesik, Christopher 
; Deucher, Alexander ; 
Swamy, Manjunatha ; Quan, Evan ; 
Feng, Kenneth ; Zhang, Hawking 
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

From: "Tianci.Yin" 

On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit, 
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 55463e7a11e2..5da0436d41e0 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,
 
struct smu_context *smu = (struct smu_context*)(handle);
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
+   struct amdgpu_device *adev = smu->adev;

if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
return -EINVAL;
@@ -1324,6 +1325,16 @@ static int smu_enable_umd_pstate(void *handle,
amdgpu_device_ip_set_clockgating_state(smu->adev,
[Guchun]Use the local adev instead of smu->adev?

   
AMD_IP_BLOCK_TYPE_GFX,
   
AMD_CG_STATE_UNGATE);

+
+   if (adev->asic_type >= CHIP_NAVI10 &&
+   adev->asic_type <= CHIP_NAVI12 &&
+   (adev->pm.pp_feature & PP_GFXOFF_MASK)) {
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev,"GFXOFF exited, 
re-init SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
+   } else
+   dev_warn(adev->dev,"Callback 
init_spm_golden is NULL\n");
+   }
}
} else {
/* exit umd pstate, restore level, enable gfx cg*/
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cguchun.chen%40amd.com%7Ce6176c766fe747a6fe1a08d832b6ee3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637315108573876551sdata=43GHkX%2FCRLsfMmNxurLMIZy4l4ElUB2tnslPyfT7NJg%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-28 Thread Chen, Guchun
[AMD Public Use]

One minor comment.

Regards,
Guchun

-Original Message-
From: amd-gfx  On Behalf Of Tianci Yin
Sent: Tuesday, July 28, 2020 1:27 PM
To: amd-gfx@lists.freedesktop.org
Cc: Xu, Feifei ; Yin, Tianci (Rico) ; 
Tuikov, Luben ; Hesik, Christopher 
; Deucher, Alexander ; 
Swamy, Manjunatha ; Quan, Evan ; 
Feng, Kenneth ; Zhang, Hawking 
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

From: "Tianci.Yin" 

On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit, 
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 55463e7a11e2..5da0436d41e0 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,
 
struct smu_context *smu = (struct smu_context*)(handle);
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
+   struct amdgpu_device *adev = smu->adev;

if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
return -EINVAL;
@@ -1324,6 +1325,16 @@ static int smu_enable_umd_pstate(void *handle,
amdgpu_device_ip_set_clockgating_state(smu->adev,
[Guchun]Use the local adev instead of smu->adev?

   
AMD_IP_BLOCK_TYPE_GFX,
   
AMD_CG_STATE_UNGATE);

+
+   if (adev->asic_type >= CHIP_NAVI10 &&
+   adev->asic_type <= CHIP_NAVI12 &&
+   (adev->pm.pp_feature & PP_GFXOFF_MASK)) {
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev,"GFXOFF exited, 
re-init SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
+   } else
+   dev_warn(adev->dev,"Callback 
init_spm_golden is NULL\n");
+   }
}
} else {
/* exit umd pstate, restore level, enable gfx cg*/
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cguchun.chen%40amd.com%7Ce6176c766fe747a6fe1a08d832b6ee3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637315108573876551sdata=43GHkX%2FCRLsfMmNxurLMIZy4l4ElUB2tnslPyfT7NJg%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-28 Thread Yin, Tianci (Rico)
[AMD Official Use Only - Internal Distribution Only]

Thanks Feifei!

Rico

-Original Message-
From: Xu, Feifei 
Sent: Tuesday, July 28, 2020 2:21 PM
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Hesik, 
Christopher ; Swamy, Manjunatha 
; Quan, Evan ; Feng, Kenneth 
; Yin, Tianci (Rico) 
Subject: RE: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

[AMD Official Use Only - Internal Distribution Only]

Series is Reviewed-by: Feifei Xu 

-Original Message-
From: Tianci Yin 
Sent: Tuesday, July 28, 2020 1:27 PM
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Xu, Feifei 
; Hesik, Christopher ; Swamy, 
Manjunatha ; Quan, Evan ; Feng, 
Kenneth ; Yin, Tianci (Rico) 
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x 
after GFXOFF exit

From: "Tianci.Yin" 

On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit, 
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 55463e7a11e2..5da0436d41e0 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,

 struct smu_context *smu = (struct smu_context*)(handle);  struct 
smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
+struct amdgpu_device *adev = smu->adev;

 if (!smu->is_apu && !smu_dpm_ctx->dpm_context)  return -EINVAL; @@ -1324,6 
+1325,16 @@ static int smu_enable_umd_pstate(void *handle,  
amdgpu_device_ip_set_clockgating_state(smu->adev,
AMD_IP_BLOCK_TYPE_GFX,
AMD_CG_STATE_UNGATE);
+
+if (adev->asic_type >= CHIP_NAVI10 &&
+adev->asic_type <= CHIP_NAVI12 &&
+(adev->pm.pp_feature & PP_GFXOFF_MASK)) { if
+(adev->gfx.funcs->init_spm_golden) { dev_dbg(adev->dev,"GFXOFF exited,
+re-init SPM golden settings\n"); amdgpu_gfx_init_spm_golden(adev); }
+else dev_warn(adev->dev,"Callback init_spm_golden is NULL\n"); }
 }
 } else {
 /* exit umd pstate, restore level, enable gfx cg*/
--
2.17.1


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


[PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

2020-07-27 Thread Tianci Yin
From: "Tianci.Yin" 

On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit,
reconfigure the golden settings after GFXOFF exit.

Change-Id: I9358ba9c65f241c36f8a35916170b19535148ee9
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 55463e7a11e2..5da0436d41e0 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1309,6 +1309,7 @@ static int smu_enable_umd_pstate(void *handle,
 
struct smu_context *smu = (struct smu_context*)(handle);
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
+   struct amdgpu_device *adev = smu->adev;
 
if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
return -EINVAL;
@@ -1324,6 +1325,16 @@ static int smu_enable_umd_pstate(void *handle,
amdgpu_device_ip_set_clockgating_state(smu->adev,
   
AMD_IP_BLOCK_TYPE_GFX,
   
AMD_CG_STATE_UNGATE);
+
+   if (adev->asic_type >= CHIP_NAVI10 &&
+   adev->asic_type <= CHIP_NAVI12 &&
+   (adev->pm.pp_feature & PP_GFXOFF_MASK)) {
+   if (adev->gfx.funcs->init_spm_golden) {
+   dev_dbg(adev->dev,"GFXOFF exited, 
re-init SPM golden settings\n");
+   amdgpu_gfx_init_spm_golden(adev);
+   } else
+   dev_warn(adev->dev,"Callback 
init_spm_golden is NULL\n");
+   }
}
} else {
/* exit umd pstate, restore level, enable gfx cg*/
-- 
2.17.1

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