Skip to contentSkip to conversation

drm/amdgpu/powerplay: Add special avfs cases for some polaris asics

PATCH In review Alex Deucher 2 participants 6 messages Dec 6, 2018 – Dec 7, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/amdgpu/powerplay: Add special avfs cases for some polaris asics

Add special avfs handling for some polaris variants.

---
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +51 -0
index 94898b2da282..831a182942e6 100644
@@ -1639,6 +1639,7 @@ static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 	struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend);
+	struct amdgpu_device *adev = hwmgr->adev;
 
 	SMU74_Discrete_DpmTable  *table = &(smu_data->smc_state_table);
 	int result = 0;
@@ -1659,6 +1660,56 @@ static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)
 	result = atomctrl_get_avfs_information(hwmgr, &avfs_params);
 
 	if (0 == result) {
+		if (((adev->pdev->device == 0x67ef) &&
+		     ((adev->pdev->revision == 0xe0) ||
+		      (adev->pdev->revision == 0xe5))) ||
+		    ((adev->pdev->device == 0x67ff) &&
+		     ((adev->pdev->revision == 0xcf) ||
+		      (adev->pdev->revision == 0xef) ||
+		      (adev->pdev->revision == 0xff)))) {
+			avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage = 1;
+			if ((adev->pdev->device == 0x67ef && adev->pdev->revision == 0xe5) ||
+			    (adev->pdev->device == 0x67ff && adev->pdev->revision == 0xef)) {
+				if ((avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0 == 0xEA522DD3) &&
+				    (avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1 == 0x5645A) &&
+				    (avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2 == 0x33F9E) &&
+				    (avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 == 0xFFFFC5CC) &&
+				    (avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 == 0x1B1A) &&
+				    (avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b == 0xFFFFFCED)) {
+					avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0   = 0xF718F1D4;
+					avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1   = 0x323FD;
+					avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2   = 0x1E455;
+					avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 = 0;
+					avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 = 0;
+					avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b  = 0x23;
+				}
+			}
+		} else if (hwmgr->chip_id == CHIP_POLARIS12 && !hwmgr->is_kicker) {
+			avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage = 1;
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0   = 0xF6B024DD;
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1   = 0x3005E;
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2   = 0x18A5F;
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 = 0x315;
+			avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 = 0xFED1;
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b  = 0x3B;
+		} else if (((adev->pdev->device == 0x67ef) &&
+			    ((adev->pdev->revision == 0xe0) ||
+			     (adev->pdev->revision == 0xe5))) ||
+			   ((adev->pdev->device == 0x67ff) &&
+			    ((adev->pdev->revision == 0xcf) ||
+			     (adev->pdev->revision == 0xef) ||
+			     (adev->pdev->revision == 0xff)))) {
+			avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage = 1;
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0   = 0xF843B66B;
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1   = 0x59CB5;
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2   = 0xFFFF287F;
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 = 0;
+			avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 = 0xFF23;
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b  = 0x58;
+		}
+	}
+
+	if (0 == result) {
 		table->BTCGB_VDROOP_TABLE[0].a0  = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a0);
 		table->BTCGB_VDROOP_TABLE[0].a1  = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a1);
 		table->BTCGB_VDROOP_TABLE[0].a2  = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a2);
Signature · 6 lines
2.13.6

_______________________________________________
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): 20181206162852.3568-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/3 drm/amdgpu/powerplay: update smu7_ppsmc.h

Add new messages for polaris.

---
 drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h +3 -0
index 62f36ba2435b..d11d6a797ce4 100644
@@ -395,6 +395,9 @@ typedef uint16_t PPSMC_Result;
 
 #define PPSMC_MSG_SetVBITimeout               ((uint16_t) 0x306)
 
+#define PPSMC_MSG_EnableFFC                   ((uint16_t) 0x307)
+#define PPSMC_MSG_DisableFFC                  ((uint16_t) 0x308)
+
 #define PPSMC_MSG_EnableDpmDidt               ((uint16_t) 0x309)
 #define PPSMC_MSG_DisableDpmDidt              ((uint16_t) 0x30A)
 
Signature · 6 lines
2.13.6

_______________________________________________
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): 20181206162852.3568-2-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#4 lore raw

RE: [PATCH 2/3] drm/amdgpu/powerplay: update smu7_ppsmc.h

Quoted 33 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2018年12月7日 0:29
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/3] drm/amdgpu/powerplay: update smu7_ppsmc.h

Add new messages for polaris.

---
 drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h +3 -1
index 62f36ba2435b..d11d6a797ce4 100644
@@ -395,6 +395,9 @@ typedef uint16_t PPSMC_Result;
 
 #define PPSMC_MSG_SetVBITimeout               ((uint16_t) 0x306)
 
+#define PPSMC_MSG_EnableFFC                   ((uint16_t) 0x307)
+#define PPSMC_MSG_DisableFFC                  ((uint16_t) 0x308)
+
 #define PPSMC_MSG_EnableDpmDidt               ((uint16_t) 0x309)
 #define PPSMC_MSG_DisableDpmDidt              ((uint16_t) 0x30A)
 
--

2.13.6

Quoted 4 lines

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

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

#5 lore raw

PATCH 3/3 drm/amdgpu/powerplay: check MC firmware for FFC support

In reply to a message not in the archive

Check if the MC firmware supports FFC and tell the SMC so mclk switching is handled properly.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -0
index 6bfbfd37ed92..d94c7d03bf24 100644
@@ -4222,9 +4222,17 @@ static int smu7_check_mc_firmware(struct pp_hwmgr *hwmgr)
 	if (tmp & (1 << 23)) {
 		data->mem_latency_high = MEM_LATENCY_HIGH;
 		data->mem_latency_low = MEM_LATENCY_LOW;
+		if ((hwmgr->chip_id == CHIP_POLARIS10) ||
+		    (hwmgr->chip_id == CHIP_POLARIS11) ||
+		    (hwmgr->chip_id == CHIP_POLARIS12))
+			smum_send_msg_to_smc(hwmgr, PPSMC_MSG_EnableFFC);
 	} else {
 		data->mem_latency_high = 330;
 		data->mem_latency_low = 330;
+		if ((hwmgr->chip_id == CHIP_POLARIS10) ||
+		    (hwmgr->chip_id == CHIP_POLARIS11) ||
+		    (hwmgr->chip_id == CHIP_POLARIS12))
+			smum_send_msg_to_smc(hwmgr, PPSMC_MSG_DisableFFC);
 	}
 
 	return 0;
Signature · 6 lines
2.13.6

_______________________________________________
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): 20181206162852.3568-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#7 lore raw

RE: [PATCH 3/3] drm/amdgpu/powerplay: check MC firmware for FFC support

Quoted 46 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2018年12月7日 0:29
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu/powerplay: check MC firmware for FFC support

Check if the MC firmware supports FFC and tell the SMC so mclk switching is handled properly.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -0
index 6bfbfd37ed92..d94c7d03bf24 100644
@@ -4222,9 +4222,17 @@ static int smu7_check_mc_firmware(struct
 pp_hwmgr *hwmgr)
 	if (tmp & (1 << 23)) {
 		data->mem_latency_high = MEM_LATENCY_HIGH;
 		data->mem_latency_low = MEM_LATENCY_LOW;
+		if ((hwmgr->chip_id == CHIP_POLARIS10) ||
+		    (hwmgr->chip_id == CHIP_POLARIS11) ||
+		    (hwmgr->chip_id == CHIP_POLARIS12))
+			smum_send_msg_to_smc(hwmgr,
 PPSMC_MSG_EnableFFC);
 	} else {
 		data->mem_latency_high = 330;
 		data->mem_latency_low = 330;
+		if ((hwmgr->chip_id == CHIP_POLARIS10) ||
+		    (hwmgr->chip_id == CHIP_POLARIS11) ||
+		    (hwmgr->chip_id == CHIP_POLARIS12))
+			smum_send_msg_to_smc(hwmgr,
 PPSMC_MSG_DisableFFC);
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
 	}
 
 	return 0;
--

2.13.6

Quoted 4 lines

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

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

#8 lore raw
In reply to a message not in the archive

Comment inline

Quoted 35 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2018年12月7日 0:29
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu/powerplay: Add special avfs cases for some polaris asics

Add special avfs handling for some polaris variants.

---
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    | 51
++++++++++++++++++++++
 1 file changed, 51 insertions(+)
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
index 94898b2da282..831a182942e6 100644
@@ -1639,6 +1639,7 @@ static int
 polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)  {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr-
 >backend);
 	struct polaris10_smumgr *smu_data = (struct polaris10_smumgr
 *)(hwmgr->smu_backend);
+	struct amdgpu_device *adev = hwmgr->adev;
 

SMU74_Discrete_DpmTable *table = &(smu_data-

Quoted 1 line

smc_state_table);

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +0 -0
 	int result = 0;
@@ -1659,6 +1660,56 @@ static int
 polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c static int · line 1670

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +7 -0
 	result = atomctrl_get_avfs_information(hwmgr, &avfs_params);
 
 	if (0 == result) {
+		if (((adev->pdev->device == 0x67ef) &&
+		     ((adev->pdev->revision == 0xe0) ||
+		      (adev->pdev->revision == 0xe5))) ||
+		    ((adev->pdev->device == 0x67ff) &&
+		     ((adev->pdev->revision == 0xcf) ||
+		      (adev->pdev->revision == 0xef) ||
+		      (adev->pdev->revision == 0xff)))) {

[Quan, Evan] 1st "if" statement here.

Quoted 48 lines
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +2 -0
+			avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage
 = 1;
+			if ((adev->pdev->device == 0x67ef && adev->pdev-
Quoted 1 line

revision == 0xe5) ||

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			    (adev->pdev->device == 0x67ff && adev->pdev-
Quoted 1 line

revision == 0xef)) {

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+				if

((avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0 == 0xEA522DD3) && +
(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1 == 0x5645A) && +
(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2 == 0x33F9E) && +
(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 == 0xFFFFC5CC) && +
(avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 == 0x1B1A) && +
(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b == 0xFFFFFCED)) { +

	avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0   = 0xF718F1D4;
+
	avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1   = 0x323FD;
+
	avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2   = 0x1E455;
+
	avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 = 0;
+
	avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 = 0;
+
	avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b  = 0x23;
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +3 -0
+				}
+			}
+		} else if (hwmgr->chip_id == CHIP_POLARIS12 && !hwmgr-
Quoted 1 line

is_kicker) {

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage

= 1;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0   =

0xF6B024DD;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1   =

0x3005E;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2   =

0x18A5F;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 =

0x315;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =

0xFED1;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b  =

0x3B;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr) · line 1701

Quoted 7 lines
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +7 -0
+		} else if (((adev->pdev->device == 0x67ef) &&
+			    ((adev->pdev->revision == 0xe0) ||
+			     (adev->pdev->revision == 0xe5))) ||
+			   ((adev->pdev->device == 0x67ff) &&
+			    ((adev->pdev->revision == 0xcf) ||
+			     (adev->pdev->revision == 0xef) ||
+			     (adev->pdev->revision == 0xff)))) {

[Quan, Evan] This seems the same as the 1st "if" statement. Typo?

Quoted 27 lines
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage

= 1;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0   =

0xF843B66B;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1   =

0x59CB5;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2   =

0xFFFF287F;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 =

0;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =

0xFF23;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -0
+			avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b  =

0x58;

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +4 -0
+		}
+	}
+
+	if (0 == result) {
 		table->BTCGB_VDROOP_TABLE[0].a0  =

PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a0);
table->BTCGB_VDROOP_TABLE[0].a1 =
PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a1);
table->BTCGB_VDROOP_TABLE[0].a2 =
PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a2); --
2.13.6

Quoted 4 lines

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

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