drm/amd/pp: Export registers for read vddc on VI/Vega10
Subsystems (2)
PATCH 1/5 drm/amd/pp: Export registers for read vddc on VI/Vega10
--- drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h | 1 + drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_sh_mask.h | 6 ++++-- drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_9_0_offset.h | 3 +++ drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_9_0_sh_mask.h | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h +1 -0
@@ -1246,5 +1246,6 @@#define ixGC_CAC_OVRD_CU 0xe7#define ixCURRENT_PG_STATUS 0xc020029c#define ixCURRENT_PG_STATUS_APU 0xd020029c +#define ixPWR_SVI2_STATUS 0xC0200294#endif /* SMU_7_1_3_D_H */
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_sh_mask.h +4 -2
@@ -6078,6 +6078,8 @@#define GC_CAC_OVRD_CU__OVRRD_VALUE__SHIFT 0x10#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004 - - +#define PWR_SVI2_STATUS__PLANE1_VID_MASK 0x000000ff +#define PWR_SVI2_STATUS__PLANE1_VID__SHIFT 0x00000000 +#define PWR_SVI2_STATUS__PLANE2_VID_MASK 0x0000ff00 +#define PWR_SVI2_STATUS__PLANE2_VID__SHIFT 0x00000008#endif /* SMU_7_1_3_SH_MASK_H */
drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_9_0_offset.h +3 -0
@@ -172,4 +172,7 @@#define mmROM_SW_DATA_64 0x006d#define mmROM_SW_DATA_64_BASE_IDX 0 +#define mmSMUSVI0_PLANE0_CURRENTVID_BASE_IDX 0 +#define mmSMUSVI0_PLANE0_CURRENTVID 0x0013 +#endif
drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_9_0_sh_mask.h +3 -0
@@ -254,5 +254,8 @@//ROM_SW_DATA_64 #define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0#define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xFFFFFFFFL +/* SMUSVI0_PLANE0_CURRENTVID */ +#define SMUSVI0_PLANE0_CURRENTVID__CURRENT_SVI0_PLANE0_VID__SHIFT 0x18 +#define SMUSVI0_PLANE0_CURRENTVID__CURRENT_SVI0_PLANE0_VID_MASK 0xFF000000L#endif
Signature · 6 lines
1.9.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): 1516101495-26385-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/5 drm/amd/pp: Add querying current gfx voltage for CI/VI
Store the voltage regulator configuration,
so we can properly query the voltage.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 12 +++++++++++- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h | 1 + drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | 2 +- drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 2 +- drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c | 3 +-- 5 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +11 -1
@@ -3317,7 +3317,7 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { uint32_t sclk, mclk, activity_percent; -uint32_t offset; +uint32_t offset, val_vid;struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);/* size must be at least 4 bytes for all sensors */
@@ -3365,6 +3365,16 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx,return -EINVAL ; *size =sizeof (struct pp_gpu_power );return smu7_get_gpu_power (hwmgr, (struct pp_gpu_power *)value); +case AMDGPU_PP_SENSOR_VDDGFX : +if ((data->vr_config &0xff ) ==0x2 ) + val_vid =PHM_READ_INDIRECT_FIELD (hwmgr->device, +CGS_IND_REG__SMC ,PWR_SVI2_STATUS ,PLANE2_VID ); +else + val_vid =PHM_READ_INDIRECT_FIELD (hwmgr->device, +CGS_IND_REG__SMC ,PWR_SVI2_STATUS ,PLANE1_VID ); + + *((uint32_t *)value) = (uint32_t )convert_to_vddc (val_vid); +return 0 ;default :return -EINVAL ; }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h +1 -0
@@ -305,6 +305,7 @@ struct smu7_hwmgr {uint32_t frame_time_x2;uint16_t mem_latency_high;uint16_t mem_latency_low; +uint32_t vr_config; };/* To convert to Q8.8 format for firmware */
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +1 -1
@@ -2141,7 +2141,7 @@ static int fiji_init_smc_table(struct pp_hwmgr *hwmgr) result =fiji_populate_vr_config (hwmgr, table);PP_ASSERT_WITH_CODE (0 == result, "Failed to populate VRConfig setting!", return result); - + data->vr_config = table->VRConfig; table->ThermGpio =17 ; table->SclkStepSize =0x4000 ;
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -1
@@ -1991,7 +1991,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) result =polaris10_populate_vr_config (hwmgr, table);PP_ASSERT_WITH_CODE (0 == result, "Failed to populate VRConfig setting!", return result); - + hw_data->vr_config = table->VRConfig; table->ThermGpio =17 ; table->SclkStepSize =0x4000 ;
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +1 -2
@@ -2434,7 +2434,7 @@ static int tonga_init_smc_table(struct pp_hwmgr *hwmgr) result =tonga_populate_vr_config (hwmgr, table);PP_ASSERT_WITH_CODE (!result, "Failed to populate VRConfig setting !", return result); - + data->vr_config = table->VRConfig; table->ThermGpio =17 ; table->SclkStepSize =0x4000 ;
@@ -2501,7 +2501,6 @@ static int tonga_init_smc_table(struct pp_hwmgr *hwmgr)for (i =0 ; i <SMU72_MAX_ENTRIES_SMIO ; i++) table->Smio[i] =PP_HOST_TO_SMC_UL (table->Smio[i]); -CONVERT_FROM_HOST_TO_SMC_UL (table->SystemFlags);CONVERT_FROM_HOST_TO_SMC_UL (table->VRConfig);CONVERT_FROM_HOST_TO_SMC_UL (table->SmioMask1);
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 drm/amd/pp: Add querying current gfx voltage for Vega10
In reply to a message not in the archive--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 13 +++++++++++++ drivers/gpu/drm/amd/powerplay/inc/pp_soc15.h | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +13 -0
@@ -51,6 +51,9 @@#include "pp_overdriver.h" #include "pp_thermal.h" +#include "smuio/smuio_9_0_offset.h" +#include "smuio/smuio_9_0_sh_mask.h" +#define VOLTAGE_SCALE 4#define VOLTAGE_VID_OFFSET_SCALE1 625#define VOLTAGE_VID_OFFSET_SCALE2 100
@@ -3900,6 +3903,7 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx,struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);struct vega10_dpm_table *dpm_table = &data->dpm_table;int ret =0 ; +uint32_t reg, val_vid;switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK :
@@ -3946,6 +3950,15 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx, ret =vega10_get_gpu_power (hwmgr, (struct pp_gpu_power *)value); }break ; +case AMDGPU_PP_SENSOR_VDDGFX : + reg =soc15_get_register_offset (SMUIO_HWID ,0 , + mmSMUSVI0_PLANE0_CURRENTVID_BASE_IDX, + mmSMUSVI0_PLANE0_CURRENTVID); + val_vid = (cgs_read_register (hwmgr->device, reg) & +SMUSVI0_PLANE0_CURRENTVID__CURRENT_SVI0_PLANE0_VID_MASK ) >> +SMUSVI0_PLANE0_CURRENTVID__CURRENT_SVI0_PLANE0_VID__SHIFT ; + *((uint32_t *)value) = (uint32_t )convert_to_vddc ((uint8_t )val_vid); +return 0 ;default : ret = -EINVAL ;break ;
drivers/gpu/drm/amd/powerplay/inc/pp_soc15.h +2 -1
@@ -43,7 +43,8 @@ inline static uint32_t soc15_get_register_offset( reg =DF_BASE .instance[inst].segment[segment] + offset; else if (hw_id == GC_HWID) reg =GC_BASE .instance[inst].segment[segment] + offset; - + else if (hw_id == SMUIO_HWID) + reg =SMUIO_BASE .instance[inst].segment[segment] + offset;return reg; }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amd/pp: Implement voltage regulator config on CI
In reply to a message not in the archiveStore the voltage regulator configuration
so we can properly query the voltage
--- drivers/gpu/drm/amd/powerplay/inc/smu7.h | 19 ++++++++++++ drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h | 3 +- drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 37 +++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/smu7.h +19 -0
@@ -82,6 +82,25 @@#define SCRATCH_B_CURR_SAMU_INDEX_MASK (0x7<<SCRATCH_B_CURR_SAMU_INDEX_SHIFT) +/* Voltage Regulator Configuration */ +/* VR Config info is contained in dpmTable */ + +#define VRCONF_VDDC_MASK 0x000000FF +#define VRCONF_VDDC_SHIFT 0 +#define VRCONF_VDDGFX_MASK 0x0000FF00 +#define VRCONF_VDDGFX_SHIFT 8 +#define VRCONF_VDDCI_MASK 0x00FF0000 +#define VRCONF_VDDCI_SHIFT 16 +#define VRCONF_MVDD_MASK 0xFF000000 +#define VRCONF_MVDD_SHIFT 24 + +#define VR_MERGED_WITH_VDDC 0 +#define VR_SVI2_PLANE_1 1 +#define VR_SVI2_PLANE_2 2 +#define VR_SMIO_PATTERN_1 3 +#define VR_SMIO_PATTERN_2 4 +#define VR_STATIC_VOLTAGE 5 +struct SMU7_PIDController {uint32_t Ki;
drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h +2 -1
@@ -316,7 +316,8 @@ struct SMU7_Discrete_DpmTableuint8_t AcpLevelCount;uint8_t SamuLevelCount;uint8_t MasterDeepSleepControl; -uint32_t Reserved[5 ]; +uint32_t VRConfig; +uint32_t Reserved[4 ];// uint32_t SamuDefaultLevel; SMU7_Discrete_GraphicsLevel GraphicsLevel [SMU7_MAX_LEVELS_GRAPHICS ];
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +37 -0
@@ -1941,6 +1941,37 @@ static int ci_start_smc(struct pp_hwmgr *hwmgr)return 0 ; } +static int ci_populate_vr_config (struct pp_hwmgr *hwmgr,SMU7_Discrete_DpmTable *table) +{ +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +uint16_t config; + + config =VR_SVI2_PLANE_1 ; + table->VRConfig |= (config<<VRCONF_VDDGFX_SHIFT ); + +if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) { + config =VR_SVI2_PLANE_2 ; + table->VRConfig |= config; + }else { +pr_info ("VDDCshould be on SVI2 controller!" ); + } + +if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) { + config =VR_SVI2_PLANE_2 ; + table->VRConfig |= (config<<VRCONF_VDDCI_SHIFT ); + }else if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { + config =VR_SMIO_PATTERN_1 ; + table->VRConfig |= (config<<VRCONF_VDDCI_SHIFT ); + } + +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { + config =VR_SMIO_PATTERN_2 ; + table->VRConfig |= (config<<VRCONF_MVDD_SHIFT ); + } + +return 0 ; +} +static int ci_init_smc_table (struct pp_hwmgr *hwmgr) {int result;
@@ -2064,6 +2095,11 @@ static int ci_init_smc_table(struct pp_hwmgr *hwmgr) table->PCIeBootLinkLevel = (uint8_t )data->dpm_table.pcie_speed_table.count; table->PCIeGenInterval =1 ; + result =ci_populate_vr_config (hwmgr, table); +PP_ASSERT_WITH_CODE (0 == result, + "Failed to populate VRConfig setting!", return result); + data->vr_config = table->VRConfig; +ci_populate_smc_svi2_config (hwmgr, table);for (i =0 ; i <SMU7_MAX_ENTRIES_SMIO ; i++)
@@ -2084,6 +2120,7 @@ static int ci_init_smc_table(struct pp_hwmgr *hwmgr) table->AcDcGpio =SMU7_UNUSED_GPIO_PIN ;CONVERT_FROM_HOST_TO_SMC_UL (table->SystemFlags); +CONVERT_FROM_HOST_TO_SMC_UL (table->VRConfig);CONVERT_FROM_HOST_TO_SMC_UL (table->SmioMaskVddcVid);CONVERT_FROM_HOST_TO_SMC_UL (table->SmioMaskVddcPhase);CONVERT_FROM_HOST_TO_SMC_UL (table->SmioMaskVddciVid);
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amd/pp: Fix SMIO implementation on CI
In reply to a message not in the archiveSetup smio table(smio registers's address and voltage ID) for various voltage domain.
--- drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 31 +++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +20 -11
@@ -860,10 +860,13 @@ static int ci_populate_smc_vddc_table(struct pp_hwmgr *hwmgr,PP_ASSERT_WITH_CODE (0 == result,"do not populate SMC VDDC voltage table" , return -EINVAL );/* GPIO voltage control */ -if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) - table->VddcLevel[count].Smio |= data->vddc_voltage_table.entries[count].smio_low; -else +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) { + table->VddcLevel[count].Smio = (uint8_t ) count; + table->Smio[count] |= data->vddc_voltage_table.entries[count].smio_low; + table->SmioMaskVddcVid |= data->vddc_voltage_table.entries[count].smio_low; + }else { table->VddcLevel[count].Smio =0 ; + } }CONVERT_FROM_HOST_TO_SMC_UL (table->VddcLevelCount);
@@ -885,10 +888,13 @@ static int ci_populate_smc_vdd_ci_table(struct pp_hwmgr *hwmgr, &(data->vddci_voltage_table.entries[count]), &(table->VddciLevel[count]));PP_ASSERT_WITH_CODE (result ==0 ,"do not populate SMC VDDCI voltage table" , return -EINVAL ); -if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) - table->VddciLevel[count].Smio |= data->vddci_voltage_table.entries[count].smio_low; -else - table->VddciLevel[count].Smio |=0 ; +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { + table->VddciLevel[count].Smio = (uint8_t ) count; + table->Smio[count] |= data->vddci_voltage_table.entries[count].smio_low; + table->SmioMaskVddciVid |= data->vddci_voltage_table.entries[count].smio_low; + }else { + table->VddciLevel[count].Smio =0 ; + } }CONVERT_FROM_HOST_TO_SMC_UL (table->VddciLevelCount);
@@ -910,10 +916,13 @@ static int ci_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, &(data->mvdd_voltage_table.entries[count]), &table->MvddLevel[count]);PP_ASSERT_WITH_CODE (result ==0 ,"do not populate SMC mvdd voltage table" , return -EINVAL ); -if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) - table->MvddLevel[count].Smio |= data->mvdd_voltage_table.entries[count].smio_low; -else - table->MvddLevel[count].Smio |=0 ; +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { + table->MvddLevel[count].Smio = (uint8_t ) count; + table->Smio[count] |= data->mvdd_voltage_table.entries[count].smio_low; + table->SmioMaskMvddVid |= data->mvdd_voltage_table.entries[count].smio_low; + }else { + table->MvddLevel[count].Smio =0 ; + } }CONVERT_FROM_HOST_TO_SMC_UL (table->MvddLevelCount);
Signature · 6 lines
1.9.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): 1516101495-26385-5-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 5/5] drm/amd/pp: Fix SMIO implementation on CI
Quoted 6 lines · Rex Zhu
Setup smio table(smio registers's address and voltage ID) for various voltage domain.
Change-Id I14be46053ffb2954c1533f4e67d3b0632107af7aReviewed-by Alex Deucher <[email protected]>Signed-off-by Rex Zhu <[email protected]>
Series is:
Quoted 64 lines
--- drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 31 +++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +20
-12@@ -860,10 +860,13 @@ static int ci_populate_smc_vddc_table(struct pp_hwmgr *hwmgr,PP_ASSERT_WITH_CODE (0 == result,"do not populate SMC VDDC voltage table" , return -EINVAL );/* GPIO voltage control */ -if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) - table->VddcLevel[count].Smio |= data->vddc_voltage_table.entries[count].smio_low; -else +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) { + table->VddcLevel[count].Smio = (uint8_t ) count; + table->Smio[count] |= data->vddc_voltage_table.entries[count].smio_low; + table->SmioMaskVddcVid |= data->vddc_voltage_table.entries[count].smio_low; + }else { table->VddcLevel[count].Smio =0 ; + } }CONVERT_FROM_HOST_TO_SMC_UL (table->VddcLevelCount);@@ -885,10 +888,13 @@ static int ci_populate_smc_vdd_ci_table(struct pp_hwmgr *hwmgr, &(data->vddci_voltage_table.entries[count]), &(table->VddciLevel[count]));PP_ASSERT_WITH_CODE (result ==0 ,"do not populate SMC VDDCI voltage table" , return -EINVAL ); -if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) - table->VddciLevel[count].Smio |= data->vddci_voltage_table.entries[count].smio_low; -else - table->VddciLevel[count].Smio |=0 ; +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { + table->VddciLevel[count].Smio = (uint8_t ) count; + table->Smio[count] |= data->vddci_voltage_table.entries[count].smio_low; + table->SmioMaskVddciVid |= data->vddci_voltage_table.entries[count].smio_low; + }else { + table->VddciLevel[count].Smio =0 ; + } }CONVERT_FROM_HOST_TO_SMC_UL (table->VddciLevelCount);@@ -910,10 +916,13 @@ static int ci_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, &(data->mvdd_voltage_table.entries[count]), &table->MvddLevel[count]);PP_ASSERT_WITH_CODE (result ==0 ,"do not populate SMC mvdd voltage table" , return -EINVAL ); -if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) - table->MvddLevel[count].Smio |= data->mvdd_voltage_table.entries[count].smio_low; -else - table->MvddLevel[count].Smio |=0 ; +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { + table->MvddLevel[count].Smio = (uint8_t ) count; + table->Smio[count] |= data->mvdd_voltage_table.entries[count].smio_low; + table->SmioMaskMvddVid |= data->mvdd_voltage_table.entries[count].smio_low; + }else { + table->MvddLevel[count].Smio =0 ; + } }CONVERT_FROM_HOST_TO_SMC_UL (table->MvddLevelCount); --1.9.1
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