Skip to contentSkip to conversation

drm/amdgpu: add interface amdgpu_gfx_init_spm_golden for Navi1x

PATCH In review Tianci Yin 3 participants 10 messages Jul 28, 2020 – Jul 29, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Tianci Yin

author
#0 lore raw

PATCH 1/2 drm/amdgpu: add interface amdgpu_gfx_init_spm_golden for Navi1x

From: "Tianci.Yin" <[email protected]>

On Navi1x, the SPM golden settings will be lost after GFXOFF enter/exit, reconfiguration is needed. Make the configuration code as an interface for future use.

Change-Id I172f3dc7f59da69b0364052dcad75a9c9aab019e
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 34 ++++++++++++++++++-------
 2 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index 1e7a2b0997c5..a611e78dd4ba 100644
@@ -216,6 +216,7 @@ struct amdgpu_gfx_funcs {
 	int (*ras_error_inject)(struct amdgpu_device *adev, void *inject_if);
 	int (*query_ras_error_count) (struct amdgpu_device *adev, void *ras_error_status);
 	void (*reset_ras_error_count) (struct amdgpu_device *adev);
+	void (*init_spm_golden)(struct amdgpu_device *adev);
 };
 
 struct sq_work {
@@ -324,6 +325,7 @@ struct amdgpu_gfx {
 #define amdgpu_gfx_get_gpu_clock_counter(adev) (adev)->gfx.funcs->get_gpu_clock_counter((adev))
 #define amdgpu_gfx_select_se_sh(adev, se, sh, instance) (adev)->gfx.funcs->select_se_sh((adev), (se), (sh), (instance))
 #define amdgpu_gfx_select_me_pipe_q(adev, me, pipe, q, vmid) (adev)->gfx.funcs->select_me_pipe_q((adev), (me), (pipe), (q), (vmid))
+#define amdgpu_gfx_init_spm_golden(adev) (adev)->gfx.funcs->init_spm_golden((adev))
 
 /**
  * amdgpu_gfx_create_bitmask - create a bitmask
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +25 -9
index db9f1e89a0f8..da21ad04ac0f 100644
@@ -3307,6 +3307,29 @@ static void gfx_v10_0_set_kiq_pm4_funcs(struct amdgpu_device *adev)
 	adev->gfx.kiq.pmf = &gfx_v10_0_kiq_pm4_funcs;
 }
 
+static void gfx_v10_0_init_spm_golden_registers(struct amdgpu_device *adev)
+{
+	switch (adev->asic_type) {
+	case CHIP_NAVI10:
+		soc15_program_register_sequence(adev,
+						golden_settings_gc_rlc_spm_10_0_nv10,
+						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
+		break;
+	case CHIP_NAVI14:
+		soc15_program_register_sequence(adev,
+						golden_settings_gc_rlc_spm_10_1_nv14,
+						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
+		break;
+	case CHIP_NAVI12:
+		soc15_program_register_sequence(adev,
+						golden_settings_gc_rlc_spm_10_1_2_nv12,
+						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
+		break;
+	default:
+		break;
+	}
+}
+
 static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 {
 	switch (adev->asic_type) {
@@ -3317,9 +3340,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_0_nv10,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_0_nv10));
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_rlc_spm_10_0_nv10,
-						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
 		break;
 	case CHIP_NAVI14:
 		soc15_program_register_sequence(adev,
@@ -3328,9 +3348,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_1_nv14,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_1_nv14));
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_rlc_spm_10_1_nv14,
-						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
 		break;
 	case CHIP_NAVI12:
 		soc15_program_register_sequence(adev,
@@ -3339,9 +3356,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_1_2_nv12,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_1_2_nv12));
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_rlc_spm_10_1_2_nv12,
-						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
 		break;
 	case CHIP_SIENNA_CICHLID:
 		soc15_program_register_sequence(adev,
@@ -3360,6 +3374,7 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 	default:
 		break;
 	}
+	gfx_v10_0_init_spm_golden_registers(adev);
 }
 
 static void gfx_v10_0_scratch_init(struct amdgpu_device *adev)
@@ -4147,6 +4162,7 @@ static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = {
 	.read_wave_sgprs = &gfx_v10_0_read_wave_sgprs,
 	.read_wave_vgprs = &gfx_v10_0_read_wave_vgprs,
 	.select_me_pipe_q = &gfx_v10_0_select_me_pipe_q,
+	.init_spm_golden = &gfx_v10_0_init_spm_golden_registers,
 };
 
 static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

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

From: "Tianci.Yin" <[email protected]>

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

Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +11 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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*/
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1623B0A15166F72FF7032C2AFE730@CY4PR12MB1623.namprd12.prod.outlook.com

#3 lore raw

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

[AMD Official Use Only - Internal Distribution Only]

Thanks Feifei!

Rico

-----Original Message-----
From: Xu, Feifei <[email protected]>
Sent: Tuesday, July 28, 2020 2:21 PM
To: Yin, Tianci (Rico) <[email protected]>; [email protected]
Cc: Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Hesik, Christopher <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Yin, Tianci (Rico) <[email protected]>
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 <Feifei [email protected]>

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

From: "Tianci.Yin" <[email protected]>

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

Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw

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

In reply to Tianci Yin

[AMD Public Use]

One minor comment.

Regards,
Guchun

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

From: "Tianci.Yin" <[email protected]>

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

Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cguchun.chen%40amd.com%7Ce6176c766fe747a6fe1a08d832b6ee3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637315108573876551&amp;sdata=43GHkX%2FCRLsfMmNxurLMIZy4l4ElUB2tnslPyfT7NJg%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

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 <[email protected]>
Sent: Tuesday, July 28, 2020 2:26 PM
To: Yin, Tianci (Rico) <[email protected]>; [email protected]
Cc: Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; Tuikov, Luben <[email protected]>; Hesik, Christopher <[email protected]>; Deucher, Alexander <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Hawking <[email protected]>
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 <[email protected]> On Behalf Of Tianci Yin
Sent: Tuesday, July 28, 2020 1:27 PM
To: [email protected]
Cc: Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; Tuikov, Luben <[email protected]>; Hesik, Christopher <[email protected]>; Deucher, Alexander <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

From: "Tianci.Yin" <[email protected]>

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

Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cguchun.chen%40amd.com%7Ce6176c766fe747a6fe1a08d832b6ee3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637315108573876551&amp;sdata=43GHkX%2FCRLsfMmNxurLMIZy4l4ElUB2tnslPyfT7NJg%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw

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

[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) <[email protected]>
Sent: Tuesday, July 28, 2020 2:48 PM
To: Chen, Guchun <[email protected]>; [email protected]
Cc: Xu, Feifei <[email protected]>; Tuikov, Luben <[email protected]>; Hesik, Christopher <[email protected]>; Deucher, Alexander <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Hawking <[email protected]>
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 <[email protected]>
Sent: Tuesday, July 28, 2020 2:26 PM
To: Yin, Tianci (Rico) <[email protected]>; [email protected]
Cc: Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; Tuikov, Luben <[email protected]>; Hesik, Christopher <[email protected]>; Deucher, Alexander <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Hawking <[email protected]>
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 <[email protected]> On Behalf Of Tianci Yin
Sent: Tuesday, July 28, 2020 1:27 PM
To: [email protected]
Cc: Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; Tuikov, Luben <[email protected]>; Hesik, Christopher <[email protected]>; Deucher, Alexander <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

From: "Tianci.Yin" <[email protected]>

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

Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cguchun.chen%40amd.com%7Ce6176c766fe747a6fe1a08d832b6ee3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637315108573876551&amp;sdata=43GHkX%2FCRLsfMmNxurLMIZy4l4ElUB2tnslPyfT7NJg%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by on v1 2/2
#7 lore raw

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

In reply to Tianci Yin
Quoted 3 lines · Tianci Yin

From: "Tianci.Yin" <[email protected]>

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

" are lost "

Quoted 1 line

reconfigure the golden settings after GFXOFF exit.

" so reconfigure ..."

Quoted 20 lines
Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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;

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_enable_umd_pstate(void *handle, · line 1333

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +6 -0
@@ -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.

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_enable_umd_pstate(void *handle, · line 1336

Quoted 3 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -0
+					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

Regards,
Luben

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_enable_umd_pstate(void *handle, · line 1340

Quoted 5 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
+			}
 		}
 	} else {
 		/* exit umd pstate, restore level, enable gfx cg*/

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author Reviewed-by Luben Tuikov
#8 lore raw

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

[AMD Official Use Only - Internal Distribution Only]

Thanks very much Lunben and Guchun!

Regards,
Rico
________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, July 29, 2020 2:44
To: Yin, Tianci (Rico) <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Xu, Feifei <[email protected]>; Hesik, Christopher <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: reconfigure spm golden settings on Navi1x after GFXOFF exit

Quoted 3 lines · Tianci Yin

From: "Tianci.Yin" <[email protected]>

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

" are lost "

Quoted 1 line

reconfigure the golden settings after GFXOFF exit.

" so reconfigure ..."

Quoted 20 lines
Change-Id I9358ba9c65f241c36f8a35916170b19535148ee9
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
index 55463e7a11e2..5da0436d41e0 100644
@@ -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;

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_enable_umd_pstate(void *handle, · line 1333

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +6 -0
@@ -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.

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_enable_umd_pstate(void *handle, · line 1336

Quoted 3 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -0
+                                     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

Regards,
Luben

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c static int smu_enable_umd_pstate(void *handle, · line 1340

Quoted 5 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
+                     }
               }
       } else {
               /* exit umd pstate, restore level, enable gfx cg*/

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#9 lore raw
In reply to Tianci Yin
Quoted 3 lines · Tianci Yin

From: "Tianci.Yin" <[email protected]>

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

Use present tense:............... " are lost after "

Quoted 1 line

reconfiguration is needed. Make the configuration code as an interface for

Add "so a reconfiguration is needed. "

Quoted 2 lines

future use.

If the lines of your commit message are too long, then "git push" complains about them. Sixty char wide is perfect, since "git log" indents them when displaying them.

With this fixed, then Reviewed-by: Luben Tuikov <[email protected]>

Regards,
Luben

Quoted 101 lines
Change-Id I172f3dc7f59da69b0364052dcad75a9c9aab019e
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 34 ++++++++++++++++++-------
 2 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index 1e7a2b0997c5..a611e78dd4ba 100644
@@ -216,6 +216,7 @@ struct amdgpu_gfx_funcs {
 	int (*ras_error_inject)(struct amdgpu_device *adev, void *inject_if);
 	int (*query_ras_error_count) (struct amdgpu_device *adev, void *ras_error_status);
 	void (*reset_ras_error_count) (struct amdgpu_device *adev);
+	void (*init_spm_golden)(struct amdgpu_device *adev);
 };
 
 struct sq_work {
@@ -324,6 +325,7 @@ struct amdgpu_gfx {
 #define amdgpu_gfx_get_gpu_clock_counter(adev) (adev)->gfx.funcs->get_gpu_clock_counter((adev))
 #define amdgpu_gfx_select_se_sh(adev, se, sh, instance) (adev)->gfx.funcs->select_se_sh((adev), (se), (sh), (instance))
 #define amdgpu_gfx_select_me_pipe_q(adev, me, pipe, q, vmid) (adev)->gfx.funcs->select_me_pipe_q((adev), (me), (pipe), (q), (vmid))
+#define amdgpu_gfx_init_spm_golden(adev) (adev)->gfx.funcs->init_spm_golden((adev))
 
 /**
  * amdgpu_gfx_create_bitmask - create a bitmask
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +24 -9
index db9f1e89a0f8..da21ad04ac0f 100644
@@ -3307,6 +3307,29 @@ static void gfx_v10_0_set_kiq_pm4_funcs(struct amdgpu_device *adev)
 	adev->gfx.kiq.pmf = &gfx_v10_0_kiq_pm4_funcs;
 }
 
+static void gfx_v10_0_init_spm_golden_registers(struct amdgpu_device *adev)
+{
+	switch (adev->asic_type) {
+	case CHIP_NAVI10:
+		soc15_program_register_sequence(adev,
+						golden_settings_gc_rlc_spm_10_0_nv10,
+						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
+		break;
+	case CHIP_NAVI14:
+		soc15_program_register_sequence(adev,
+						golden_settings_gc_rlc_spm_10_1_nv14,
+						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
+		break;
+	case CHIP_NAVI12:
+		soc15_program_register_sequence(adev,
+						golden_settings_gc_rlc_spm_10_1_2_nv12,
+						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
+		break;
+	default:
+		break;
+	}
+}
+
 static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 {
 	switch (adev->asic_type) {
@@ -3317,9 +3340,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_0_nv10,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_0_nv10));
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_rlc_spm_10_0_nv10,
-						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
 		break;
 	case CHIP_NAVI14:
 		soc15_program_register_sequence(adev,
@@ -3328,9 +3348,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_1_nv14,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_1_nv14));
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_rlc_spm_10_1_nv14,
-						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
 		break;
 	case CHIP_NAVI12:
 		soc15_program_register_sequence(adev,
@@ -3339,9 +3356,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_1_2_nv12,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_1_2_nv12));
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_rlc_spm_10_1_2_nv12,
-						(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
 		break;
 	case CHIP_SIENNA_CICHLID:
 		soc15_program_register_sequence(adev,
@@ -3360,6 +3374,7 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 	default:
 		break;
 	}
+	gfx_v10_0_init_spm_golden_registers(adev);
 }
 
 static void gfx_v10_0_scratch_init(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = { · line 4168

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -0
@@ -4147,6 +4162,7 @@ static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = {
 	.read_wave_sgprs = &gfx_v10_0_read_wave_sgprs,
 	.read_wave_vgprs = &gfx_v10_0_read_wave_vgprs,
 	.select_me_pipe_q = &gfx_v10_0_select_me_pipe_q,
+	.init_spm_golden = &gfx_v10_0_init_spm_golden_registers,
 };
 
 static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw

[AMD Official Use Only - Internal Distribution Only]

Thanks very much Luben!

Regards,
Rico
________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, July 29, 2020 2:29
To: Yin, Tianci (Rico) <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Xu, Feifei <[email protected]>; Hesik, Christopher <[email protected]>; Swamy, Manjunatha <[email protected]>; Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: add interface amdgpu_gfx_init_spm_golden for Navi1x

Quoted 3 lines · Tianci Yin

From: "Tianci.Yin" <[email protected]>

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

Use present tense:............... " are lost after "

Quoted 1 line

reconfiguration is needed. Make the configuration code as an interface for

Add "so a reconfiguration is needed. "

Quoted 2 lines

future use.

If the lines of your commit message are too long, then "git push" complains about them. Sixty char wide is perfect, since "git log" indents them when displaying them.

With this fixed, then Reviewed-by: Luben Tuikov <[email protected]>

Regards,
Luben

Quoted 101 lines
Change-Id I172f3dc7f59da69b0364052dcad75a9c9aab019e
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 34 ++++++++++++++++++-------
 2 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index 1e7a2b0997c5..a611e78dd4ba 100644
@@ -216,6 +216,7 @@ struct amdgpu_gfx_funcs {
       int (*ras_error_inject)(struct amdgpu_device *adev, void *inject_if);
       int (*query_ras_error_count) (struct amdgpu_device *adev, void *ras_error_status);
       void (*reset_ras_error_count) (struct amdgpu_device *adev);
+     void (*init_spm_golden)(struct amdgpu_device *adev);
 };
 
 struct sq_work {
@@ -324,6 +325,7 @@ struct amdgpu_gfx {
 #define amdgpu_gfx_get_gpu_clock_counter(adev) (adev)->gfx.funcs->get_gpu_clock_counter((adev))
 #define amdgpu_gfx_select_se_sh(adev, se, sh, instance) (adev)->gfx.funcs->select_se_sh((adev), (se), (sh), (instance))
 #define amdgpu_gfx_select_me_pipe_q(adev, me, pipe, q, vmid) (adev)->gfx.funcs->select_me_pipe_q((adev), (me), (pipe), (q), (vmid))
+#define amdgpu_gfx_init_spm_golden(adev) (adev)->gfx.funcs->init_spm_golden((adev))
 
 /**
  * amdgpu_gfx_create_bitmask - create a bitmask
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +24 -9
index db9f1e89a0f8..da21ad04ac0f 100644
@@ -3307,6 +3307,29 @@ static void gfx_v10_0_set_kiq_pm4_funcs(struct amdgpu_device *adev)
       adev->gfx.kiq.pmf = &gfx_v10_0_kiq_pm4_funcs;
 }
 
+static void gfx_v10_0_init_spm_golden_registers(struct amdgpu_device *adev)
+{
+     switch (adev->asic_type) {
+     case CHIP_NAVI10:
+             soc15_program_register_sequence(adev,
+                                             golden_settings_gc_rlc_spm_10_0_nv10,
+                                             (const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
+             break;
+     case CHIP_NAVI14:
+             soc15_program_register_sequence(adev,
+                                             golden_settings_gc_rlc_spm_10_1_nv14,
+                                             (const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
+             break;
+     case CHIP_NAVI12:
+             soc15_program_register_sequence(adev,
+                                             golden_settings_gc_rlc_spm_10_1_2_nv12,
+                                             (const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
+             break;
+     default:
+             break;
+     }
+}
+
 static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 {
       switch (adev->asic_type) {
@@ -3317,9 +3340,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
               soc15_program_register_sequence(adev,
                                               golden_settings_gc_10_0_nv10,
                                               (const u32)ARRAY_SIZE(golden_settings_gc_10_0_nv10));
-             soc15_program_register_sequence(adev,
-                                             golden_settings_gc_rlc_spm_10_0_nv10,
-                                             (const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
               break;
       case CHIP_NAVI14:
               soc15_program_register_sequence(adev,
@@ -3328,9 +3348,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
               soc15_program_register_sequence(adev,
                                               golden_settings_gc_10_1_nv14,
                                               (const u32)ARRAY_SIZE(golden_settings_gc_10_1_nv14));
-             soc15_program_register_sequence(adev,
-                                             golden_settings_gc_rlc_spm_10_1_nv14,
-                                             (const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
               break;
       case CHIP_NAVI12:
               soc15_program_register_sequence(adev,
@@ -3339,9 +3356,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
               soc15_program_register_sequence(adev,
                                               golden_settings_gc_10_1_2_nv12,
                                               (const u32)ARRAY_SIZE(golden_settings_gc_10_1_2_nv12));
-             soc15_program_register_sequence(adev,
-                                             golden_settings_gc_rlc_spm_10_1_2_nv12,
-                                             (const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
               break;
       case CHIP_SIENNA_CICHLID:
               soc15_program_register_sequence(adev,
@@ -3360,6 +3374,7 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
       default:
               break;
       }
+     gfx_v10_0_init_spm_golden_registers(adev);
 }
 
 static void gfx_v10_0_scratch_init(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = { · line 4168

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -0
@@ -4147,6 +4162,7 @@ static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = {
       .read_wave_sgprs = &gfx_v10_0_read_wave_sgprs,
       .read_wave_vgprs = &gfx_v10_0_read_wave_vgprs,
       .select_me_pipe_q = &gfx_v10_0_select_me_pipe_q,
+     .init_spm_golden = &gfx_v10_0_init_spm_golden_registers,
 };
 
 static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx