drm/amd/powerplay: add SMC message filter for SMU11
Subsystems (2)
PATCH 1/4 drm/amd/powerplay: add SMC message filter for SMU11
1. add smu_11_0_msg_mapping definition
2. add valid info for each SMC message in SRIOV
--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 124 +++++++-------- drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 6 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 146 +++++++++--------- 3 files changed, 141 insertions(+), 135 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +62 -62
@@ -48,8 +48,8 @@#define CTF_OFFSET_HOTSPOT 5#define CTF_OFFSET_HBM 5 -#define MSG_MAP (msg, index) \ - [SMU_MSG_##msg] = {1, (index)} +#define MSG_MAP (msg, index, valid_in_vf) \ + [SMU_MSG_##msg] = {1, (index), (valid_in_vf)}#define ARCTURUS_FEA_MAP (smu_feature, arcturus_feature) \ [smu_feature] = {1, (arcturus_feature)}
@@ -70,65 +70,65 @@/* possible frequency drift (1Mhz) */ #define EPSILON 1 -static struct smu_11_0_cmn2aisc_mapping arcturus_message_map[SMU_MSG_MAX_COUNT ] = { -MSG_MAP (TestMessage, PPSMC_MSG_TestMessage), -MSG_MAP (GetSmuVersion, PPSMC_MSG_GetSmuVersion), -MSG_MAP (GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion), -MSG_MAP (SetAllowedFeaturesMaskLow, PPSMC_MSG_SetAllowedFeaturesMaskLow), -MSG_MAP (SetAllowedFeaturesMaskHigh, PPSMC_MSG_SetAllowedFeaturesMaskHigh), -MSG_MAP (EnableAllSmuFeatures, PPSMC_MSG_EnableAllSmuFeatures), -MSG_MAP (DisableAllSmuFeatures, PPSMC_MSG_DisableAllSmuFeatures), -MSG_MAP (EnableSmuFeaturesLow, PPSMC_MSG_EnableSmuFeaturesLow), -MSG_MAP (EnableSmuFeaturesHigh, PPSMC_MSG_EnableSmuFeaturesHigh), -MSG_MAP (DisableSmuFeaturesLow, PPSMC_MSG_DisableSmuFeaturesLow), -MSG_MAP (DisableSmuFeaturesHigh, PPSMC_MSG_DisableSmuFeaturesHigh), -MSG_MAP (GetEnabledSmuFeaturesLow, PPSMC_MSG_GetEnabledSmuFeaturesLow), -MSG_MAP (GetEnabledSmuFeaturesHigh, PPSMC_MSG_GetEnabledSmuFeaturesHigh), -MSG_MAP (SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh), -MSG_MAP (SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow), -MSG_MAP (SetToolsDramAddrHigh, PPSMC_MSG_SetToolsDramAddrHigh), -MSG_MAP (SetToolsDramAddrLow, PPSMC_MSG_SetToolsDramAddrLow), -MSG_MAP (TransferTableSmu2Dram, PPSMC_MSG_TransferTableSmu2Dram), -MSG_MAP (TransferTableDram2Smu, PPSMC_MSG_TransferTableDram2Smu), -MSG_MAP (UseDefaultPPTable, PPSMC_MSG_UseDefaultPPTable), -MSG_MAP (UseBackupPPTable, PPSMC_MSG_UseBackupPPTable), -MSG_MAP (SetSystemVirtualDramAddrHigh, PPSMC_MSG_SetSystemVirtualDramAddrHigh), -MSG_MAP (SetSystemVirtualDramAddrLow, PPSMC_MSG_SetSystemVirtualDramAddrLow), -MSG_MAP (EnterBaco, PPSMC_MSG_EnterBaco), -MSG_MAP (ExitBaco, PPSMC_MSG_ExitBaco), -MSG_MAP (ArmD3, PPSMC_MSG_ArmD3), -MSG_MAP (SetSoftMinByFreq, PPSMC_MSG_SetSoftMinByFreq), -MSG_MAP (SetSoftMaxByFreq, PPSMC_MSG_SetSoftMaxByFreq), -MSG_MAP (SetHardMinByFreq, PPSMC_MSG_SetHardMinByFreq), -MSG_MAP (SetHardMaxByFreq, PPSMC_MSG_SetHardMaxByFreq), -MSG_MAP (GetMinDpmFreq, PPSMC_MSG_GetMinDpmFreq), -MSG_MAP (GetMaxDpmFreq, PPSMC_MSG_GetMaxDpmFreq), -MSG_MAP (GetDpmFreqByIndex, PPSMC_MSG_GetDpmFreqByIndex), -MSG_MAP (SetWorkloadMask, PPSMC_MSG_SetWorkloadMask), -MSG_MAP (SetDfSwitchType, PPSMC_MSG_SetDfSwitchType), -MSG_MAP (GetVoltageByDpm, PPSMC_MSG_GetVoltageByDpm), -MSG_MAP (GetVoltageByDpmOverdrive, PPSMC_MSG_GetVoltageByDpmOverdrive), -MSG_MAP (SetPptLimit, PPSMC_MSG_SetPptLimit), -MSG_MAP (GetPptLimit, PPSMC_MSG_GetPptLimit), -MSG_MAP (PowerUpVcn0, PPSMC_MSG_PowerUpVcn0), -MSG_MAP (PowerDownVcn0, PPSMC_MSG_PowerDownVcn0), -MSG_MAP (PowerUpVcn1, PPSMC_MSG_PowerUpVcn1), -MSG_MAP (PowerDownVcn1, PPSMC_MSG_PowerDownVcn1), -MSG_MAP (PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload), -MSG_MAP (PrepareMp1ForReset, PPSMC_MSG_PrepareMp1ForReset), -MSG_MAP (PrepareMp1ForShutdown, PPSMC_MSG_PrepareMp1ForShutdown), -MSG_MAP (SoftReset, PPSMC_MSG_SoftReset), -MSG_MAP (RunAfllBtc, PPSMC_MSG_RunAfllBtc), -MSG_MAP (RunDcBtc, PPSMC_MSG_RunDcBtc), -MSG_MAP (DramLogSetDramAddrHigh, PPSMC_MSG_DramLogSetDramAddrHigh), -MSG_MAP (DramLogSetDramAddrLow, PPSMC_MSG_DramLogSetDramAddrLow), -MSG_MAP (DramLogSetDramSize, PPSMC_MSG_DramLogSetDramSize), -MSG_MAP (GetDebugData, PPSMC_MSG_GetDebugData), -MSG_MAP (WaflTest, PPSMC_MSG_WaflTest), -MSG_MAP (SetXgmiMode, PPSMC_MSG_SetXgmiMode), -MSG_MAP (SetMemoryChannelEnable, PPSMC_MSG_SetMemoryChannelEnable), -MSG_MAP (DFCstateControl, PPSMC_MSG_DFCstateControl), -MSG_MAP (GmiPwrDnControl, PPSMC_MSG_GmiPwrDnControl), +static struct smu_11_0_msg_mapping arcturus_message_map[SMU_MSG_MAX_COUNT ] = { +MSG_MAP (TestMessage, PPSMC_MSG_TestMessage,0 ), +MSG_MAP (GetSmuVersion, PPSMC_MSG_GetSmuVersion,1 ), +MSG_MAP (GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion,1 ), +MSG_MAP (SetAllowedFeaturesMaskLow, PPSMC_MSG_SetAllowedFeaturesMaskLow,0 ), +MSG_MAP (SetAllowedFeaturesMaskHigh, PPSMC_MSG_SetAllowedFeaturesMaskHigh,0 ), +MSG_MAP (EnableAllSmuFeatures, PPSMC_MSG_EnableAllSmuFeatures,0 ), +MSG_MAP (DisableAllSmuFeatures, PPSMC_MSG_DisableAllSmuFeatures,0 ), +MSG_MAP (EnableSmuFeaturesLow, PPSMC_MSG_EnableSmuFeaturesLow,1 ), +MSG_MAP (EnableSmuFeaturesHigh, PPSMC_MSG_EnableSmuFeaturesHigh,1 ), +MSG_MAP (DisableSmuFeaturesLow, PPSMC_MSG_DisableSmuFeaturesLow,0 ), +MSG_MAP (DisableSmuFeaturesHigh, PPSMC_MSG_DisableSmuFeaturesHigh,0 ), +MSG_MAP (GetEnabledSmuFeaturesLow, PPSMC_MSG_GetEnabledSmuFeaturesLow,0 ), +MSG_MAP (GetEnabledSmuFeaturesHigh, PPSMC_MSG_GetEnabledSmuFeaturesHigh,0 ), +MSG_MAP (SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh,1 ), +MSG_MAP (SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow,1 ), +MSG_MAP (SetToolsDramAddrHigh, PPSMC_MSG_SetToolsDramAddrHigh,0 ), +MSG_MAP (SetToolsDramAddrLow, PPSMC_MSG_SetToolsDramAddrLow,0 ), +MSG_MAP (TransferTableSmu2Dram, PPSMC_MSG_TransferTableSmu2Dram,1 ), +MSG_MAP (TransferTableDram2Smu, PPSMC_MSG_TransferTableDram2Smu,0 ), +MSG_MAP (UseDefaultPPTable, PPSMC_MSG_UseDefaultPPTable,0 ), +MSG_MAP (UseBackupPPTable, PPSMC_MSG_UseBackupPPTable,0 ), +MSG_MAP (SetSystemVirtualDramAddrHigh, PPSMC_MSG_SetSystemVirtualDramAddrHigh,0 ), +MSG_MAP (SetSystemVirtualDramAddrLow, PPSMC_MSG_SetSystemVirtualDramAddrLow,0 ), +MSG_MAP (EnterBaco, PPSMC_MSG_EnterBaco,0 ), +MSG_MAP (ExitBaco, PPSMC_MSG_ExitBaco,0 ), +MSG_MAP (ArmD3, PPSMC_MSG_ArmD3,0 ), +MSG_MAP (SetSoftMinByFreq, PPSMC_MSG_SetSoftMinByFreq,0 ), +MSG_MAP (SetSoftMaxByFreq, PPSMC_MSG_SetSoftMaxByFreq,0 ), +MSG_MAP (SetHardMinByFreq, PPSMC_MSG_SetHardMinByFreq,0 ), +MSG_MAP (SetHardMaxByFreq, PPSMC_MSG_SetHardMaxByFreq,0 ), +MSG_MAP (GetMinDpmFreq, PPSMC_MSG_GetMinDpmFreq,0 ), +MSG_MAP (GetMaxDpmFreq, PPSMC_MSG_GetMaxDpmFreq,0 ), +MSG_MAP (GetDpmFreqByIndex, PPSMC_MSG_GetDpmFreqByIndex,1 ), +MSG_MAP (SetWorkloadMask, PPSMC_MSG_SetWorkloadMask,1 ), +MSG_MAP (SetDfSwitchType, PPSMC_MSG_SetDfSwitchType,0 ), +MSG_MAP (GetVoltageByDpm, PPSMC_MSG_GetVoltageByDpm,0 ), +MSG_MAP (GetVoltageByDpmOverdrive, PPSMC_MSG_GetVoltageByDpmOverdrive,0 ), +MSG_MAP (SetPptLimit, PPSMC_MSG_SetPptLimit,0 ), +MSG_MAP (GetPptLimit, PPSMC_MSG_GetPptLimit,1 ), +MSG_MAP (PowerUpVcn0, PPSMC_MSG_PowerUpVcn0,0 ), +MSG_MAP (PowerDownVcn0, PPSMC_MSG_PowerDownVcn0,0 ), +MSG_MAP (PowerUpVcn1, PPSMC_MSG_PowerUpVcn1,0 ), +MSG_MAP (PowerDownVcn1, PPSMC_MSG_PowerDownVcn1,0 ), +MSG_MAP (PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload,0 ), +MSG_MAP (PrepareMp1ForReset, PPSMC_MSG_PrepareMp1ForReset,0 ), +MSG_MAP (PrepareMp1ForShutdown, PPSMC_MSG_PrepareMp1ForShutdown,0 ), +MSG_MAP (SoftReset, PPSMC_MSG_SoftReset,0 ), +MSG_MAP (RunAfllBtc, PPSMC_MSG_RunAfllBtc,0 ), +MSG_MAP (RunDcBtc, PPSMC_MSG_RunDcBtc,0 ), +MSG_MAP (DramLogSetDramAddrHigh, PPSMC_MSG_DramLogSetDramAddrHigh,0 ), +MSG_MAP (DramLogSetDramAddrLow, PPSMC_MSG_DramLogSetDramAddrLow,0 ), +MSG_MAP (DramLogSetDramSize, PPSMC_MSG_DramLogSetDramSize,0 ), +MSG_MAP (GetDebugData, PPSMC_MSG_GetDebugData,0 ), +MSG_MAP (WaflTest, PPSMC_MSG_WaflTest,0 ), +MSG_MAP (SetXgmiMode, PPSMC_MSG_SetXgmiMode,0 ), +MSG_MAP (SetMemoryChannelEnable, PPSMC_MSG_SetMemoryChannelEnable,0 ), +MSG_MAP (DFCstateControl, PPSMC_MSG_DFCstateControl,0 ), +MSG_MAP (GmiPwrDnControl, PPSMC_MSG_GmiPwrDnControl,0 ), };static struct smu_11_0_cmn2aisc_mapping arcturus_clk_map[SMU_CLK_COUNT ] = {
@@ -199,7 +199,7 @@ static struct smu_11_0_cmn2aisc_mapping arcturus_workload_map[PP_SMC_POWER_PROFIstatic int arcturus_get_smu_msg_index (struct smu_context *smc,uint32_t index) { -struct smu_11_0_cmn2aisc_mapping mapping; +struct smu_11_0_msg_mapping mapping;if (index >=SMU_MSG_MAX_COUNT )return -EINVAL ;
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
@@ -70,6 +70,12 @@ static const struct smu_temperature_range smu11_thermal_policy[] = { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000}, }; +struct smu_11_0_msg_mapping { +int valid_mapping; +int map_to; +int valid_in_vf; +}; + struct smu_11_0_cmn2aisc_mapping { int valid_mapping; int map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +73 -73
158 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/amd/powerplay: enable SMC message filter
1. enable SMC message filter in SRIOV situation
2. return -EACCESS if msg is blocked from smu_msg_get_index
3. if msg is block, always return 0 from smu_v11_0_send_msg_with_param
--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 12 +++--------- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 3 +++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +3 -9
@@ -208,6 +208,9 @@ static int arcturus_get_smu_msg_index(struct smu_context *smc, uint32_t index)if (!(mapping.valid_mapping))return -EINVAL ; +if (amdgpu_sriov_vf (smc->adev) && !mapping.valid_in_vf) +return -EACCES ; +return mapping.map_to; }
@@ -382,11 +385,6 @@ arcturus_set_single_dpm_table(struct smu_context *smu,return ret; } -if (!num_of_levels) { -pr_err ("[%s] number of clk levels is invalid!\n" , __func__); -return -EINVAL ; - } - single_dpm_table->count = num_of_levels;for (i =0 ; i < num_of_levels; i++) { ret = smu_send_smc_msg_with_param(smu,
@@ -397,10 +395,6 @@ arcturus_set_single_dpm_table(struct smu_context *smu,pr_err ("[%s] failed to get dpm freq by index!\n" , __func__);return ret; } -if (!clk) { -pr_err ("[%s] clk value is invalid!\n" , __func__); -return -EINVAL ; - } single_dpm_table->dpm_levels[i].value = clk; single_dpm_table->dpm_levels[i].enabled = true; }
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +3 -0
@@ -228,6 +228,9 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index)return -EINVAL ; } +if (amdgpu_sriov_vf (smc->adev) && !mapping.valid_in_vf) +return -EACCES ; +return mapping.map_to; }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -1
@@ -100,7 +100,7 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, index =smu_msg_get_index (smu, msg);if (index <0 ) -return index; +return index == -EACCES ?0 : index;mutex_lock (&smu->message_lock); ret =smu_v11_0_wait_for_response (smu);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amd/powerplay: remove SRIOV check in SMU11
In reply to Wenhui ShengWe don't need SRIOV check after we enable SMC msg filter in SMU11
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 159 +++++++++---------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 24 --- 4 files changed, 80 insertions(+), 115 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +76 -83
@@ -563,10 +563,8 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, intbool is_support_sw_smu (struct amdgpu_device *adev) { -if (adev->asic_type >=CHIP_ARCTURUS ) { -if (amdgpu_sriov_is_pp_one_vf (adev) || !amdgpu_sriov_vf (adev)) -return true; - } +if (adev->asic_type >=CHIP_ARCTURUS ) +return true;return false; }
@@ -1109,59 +1107,58 @@ static int smu_smc_table_hw_init(struct smu_context *smu,return ret;/* smu_dump_pptable(smu); */ -if (!amdgpu_sriov_vf (adev)) { -/* -* Copy pptable bo in the vram to smc with SMU MSGs such as -* SetDriverDramAddr and TransferTableDram2Smu. -*/ - ret =smu_write_pptable (smu); -if (ret) -return ret; - -/* issue Run*Btc msg */ - ret =smu_run_btc (smu); -if (ret) -return ret; - ret =smu_feature_set_allowed_mask (smu); -if (ret) -return ret; +/* +* Copy pptable bo in the vram to smc with SMU MSGs such as +* SetDriverDramAddr and TransferTableDram2Smu. +*/ + ret =smu_write_pptable (smu); +if (ret) +return ret; - ret =smu_system_features_control (smu, true); -if (ret) -return ret; +/* issue Run*Btc msg */ + ret =smu_run_btc (smu); +if (ret) +return ret; + ret =smu_feature_set_allowed_mask (smu); +if (ret) +return ret; -if (adev->asic_type ==CHIP_NAVI10 ) { -if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || - adev->pdev->revision ==0xc3 || - adev->pdev->revision ==0xca || - adev->pdev->revision ==0xcb )) || - (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || - adev->pdev->revision ==0xf4 || - adev->pdev->revision ==0xf5 || - adev->pdev->revision ==0xf6 ))) { - ret =smu_disable_umc_cdr_12gbps_workaround (smu); -if (ret) { -pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n" ); -return ret; - } - } - } + ret =smu_system_features_control (smu, true); +if (ret) +return ret; -if (smu->ppt_funcs->set_power_source) { -/* -* For Navi1X, manually switch it to AC mode as PMFW -* may boot it with DC mode. -*/ -if (adev->pm.ac_power) - ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC ); -else - ret =smu_set_power_source (smu,SMU_POWER_SOURCE_DC ); +if (adev->asic_type ==CHIP_NAVI10 ) { +if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || + adev->pdev->revision ==0xc3 || + adev->pdev->revision ==0xca || + adev->pdev->revision ==0xcb )) || + (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || + adev->pdev->revision ==0xf4 || + adev->pdev->revision ==0xf5 || + adev->pdev->revision ==0xf6 ))) { + ret =smu_disable_umc_cdr_12gbps_workaround (smu);if (ret) { -pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n" );return ret; } } } + +if (smu->ppt_funcs->set_power_source) { +/* +* For Navi1X, manually switch it to AC mode as PMFW +* may boot it with DC mode. +*/ +if (adev->pm.ac_power) + ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC ); +else + ret =smu_set_power_source (smu,SMU_POWER_SOURCE_DC ); +if (ret) { +pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +return ret; + } + } +if (adev->asic_type !=CHIP_ARCTURUS ) { ret =smu_notify_display_change (smu);if (ret)
@@ -1214,9 +1211,8 @@ static int smu_smc_table_hw_init(struct smu_context *smu,/* * Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools. */ -if (!amdgpu_sriov_vf (adev)) { - ret =smu_set_tool_table_location (smu); - } + ret =smu_set_tool_table_location (smu); +if (!smu_is_dpm_running (smu))pr_info ("dpm has been disabled\n" );
@@ -1376,9 +1372,6 @@ static int smu_hw_init(void *handle)static int smu_stop_dpms (struct smu_context *smu) { -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -return smu_system_features_control (smu, false); }
@@ -1403,35 +1396,35 @@ static int smu_hw_fini(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)){ +if (!amdgpu_sriov_vf (adev)) {smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); + } + + ret =smu_stop_thermal_control (smu); +if (ret) { +pr_warn ("Fail to stop thermal control!\n" ); +return ret; + } - ret =smu_stop_thermal_control (smu); +/* +* For custom pptable uploading, skip the DPM features +* disable process on Navi1x ASICs. +* - As the gfx related features are under control of +* RLC on those ASICs. RLC reinitialization will be +* needed to reenable them. That will cost much more +* efforts. +* +* - SMU firmware can handle the DPM reenablement +* properly. +*/ +if (!smu->uploading_custom_pp_table || + !((adev->asic_type >=CHIP_NAVI10 ) && + (adev->asic_type <=CHIP_NAVI12 ))) { + ret =smu_stop_dpms (smu);if (ret) { -pr_warn ("Fail to stop thermal control!\n" ); +pr_warn ("Fail to stop Dpms!\n" );return ret; } - -/* -* For custom pptable uploading, skip the DPM features -* disable process on Navi1x ASICs. -* - As the gfx related features are under control of -* RLC on those ASICs. RLC reinitialization will be -* needed to reenable them. That will cost much more -* efforts. -* -* - SMU firmware can handle the DPM reenablement -* properly. -*/ -if (!smu->uploading_custom_pp_table || - !((adev->asic_type >=CHIP_NAVI10 ) && - (adev->asic_type <=CHIP_NAVI12 ))) { - ret =smu_stop_dpms (smu); -if (ret) { -pr_warn ("Fail to stop Dpms!\n" ); -return ret; - } - } }kfree (table_context->driver_pptable);
@@ -1548,12 +1541,12 @@ static int smu_suspend(void *handle)if (!amdgpu_sriov_vf (adev)) {smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - - ret =smu_disable_dpm (smu); -if (ret) -return ret; } + ret =smu_disable_dpm (smu); +if (ret) +return ret; + smu->watermarks_bitmap &= ~(WATERMARKS_LOADED ); if (adev->asic_type >= CHIP_NAVI10 &&
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +3 -3
@@ -1369,7 +1369,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,if (result)return result; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) +if (smu_version >=0x360d00 ) size +=sprintf (buf + size,"%16s %s %s %s %s %s %s %s %s %s %s\n" , title[0 ], title[1 ], title[2 ], title[3 ], title[4 ], title[5 ], title[6 ], title[7 ], title[8 ], title[9 ], title[10 ]);
@@ -1386,7 +1386,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,if (workload_type <0 )continue ; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) { +if (smu_version >=0x360d00 ) { result = smu_update_table(smu, SMU_TABLE_ACTIVITY_MONITOR_COEFF, workload_type,
@@ -1401,7 +1401,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, size +=sprintf (buf + size,"%2d %14s%s\n" , i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) { +if (smu_version >=0x360d00 ) { size += sprintf(buf + size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ", 0,
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -5
@@ -1818,8 +1818,7 @@ static int navi10_get_power_limit(struct smu_context *smu,int power_src;if (!smu->power_limit) { -if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT ) && - !amdgpu_sriov_vf (smu->adev)) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT )) { power_src =smu_power_get_index (smu,SMU_POWER_SOURCE_AC );if (power_src <0 )return -EINVAL ;
@@ -1962,9 +1961,6 @@ static int navi10_set_default_od_settings(struct smu_context *smu, bool initialiOverDriveTable_t *od_table, *boot_od_table;int ret =0 ; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - ret =smu_v11_0_set_default_od_settings (smu, initialize,sizeof (OverDriveTable_t));if (ret)return ret;
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -24
@@ -768,9 +768,6 @@ int smu_v11_0_set_deep_sleep_dcefclk(struct smu_context *smu, uint32_t clk) {int ret; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetMinDeepSleepDcefclk, clk,NULL );if (ret)
@@ -814,9 +811,6 @@ int smu_v11_0_set_tool_table_location(struct smu_context *smu)int ret =0 ;struct smu_table *tool_table = &smu->smu_table.tables[SMU_TABLE_PMSTATUSLOG ]; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (tool_table->mc_address) { ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetToolsDramAddrHigh,
@@ -836,9 +830,6 @@ int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count) {int ret =0 ; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (!smu->pm_enabled)return ret;
@@ -853,9 +844,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)int ret =0 ;uint32_t feature_mask[2 ]; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -mutex_lock (&feature->mutex);if (bitmap_empty (feature->allowed,SMU_FEATURE_MAX ) || feature->feature_num <64 ) goto failed;
@@ -884,9 +872,6 @@ int smu_v11_0_get_enabled_mask(struct smu_context *smu,struct smu_feature *feature = &smu->smu_feature;int ret =0 ; -if (amdgpu_sriov_vf (smu->adev) && !amdgpu_sriov_is_pp_one_vf (smu->adev)) -return 0 ; -if (!feature_mask || num <2 )return -EINVAL ;
@@ -942,9 +927,6 @@ int smu_v11_0_notify_display_change(struct smu_context *smu) {int ret =0 ; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (!smu->pm_enabled)return ret;
@@ -1107,9 +1089,6 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n)int ret =0 ;uint32_t max_power_limit; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - max_power_limit =smu_v11_0_get_max_power_limit (smu);if (n > max_power_limit) {
@@ -1860,9 +1839,6 @@ int smu_v11_0_override_pcie_parameters(struct smu_context *smu)uint32_t pcie_gen =0 , pcie_width =0 ;int ret; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4 ) pcie_gen =3 ;else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 )
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
[AMD Official Use Only - Internal Distribution Only]
Please confirm the changes of arcturus_get_power_profile_mode() do not break SRIOV. Since this seems skipped before but enabled now.
Other than that, the series is acked-by: Evan Quan <[email protected]>
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenhui Sheng
Sent: Tuesday, May 26, 2020 6:06 PM
To: [email protected]
Cc: Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
We don't need SRIOV check after we enable SMC msg filter in SMU11
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 159 +++++++++---------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 24 --- 4 files changed, 80 insertions(+), 115 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +47 -49
@@ -563,10 +563,8 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, intbool is_support_sw_smu (struct amdgpu_device *adev) { -if (adev->asic_type >=CHIP_ARCTURUS ) { -if (amdgpu_sriov_is_pp_one_vf (adev) || !amdgpu_sriov_vf (adev)) -return true; -} +if (adev->asic_type >=CHIP_ARCTURUS ) +return true;return false; }
@@ -1109,59 +1107,58 @@ static int smu_smc_table_hw_init(struct smu_context *smu,return ret;/* smu_dump_pptable(smu); */ -if (!amdgpu_sriov_vf (adev)) { -/* -* Copy pptable bo in the vram to smc with SMU MSGs such as -* SetDriverDramAddr and TransferTableDram2Smu. -*/ -ret =smu_write_pptable (smu); -if (ret) -return ret; - -/* issue Run*Btc msg */ -ret =smu_run_btc (smu); -if (ret) -return ret; -ret =smu_feature_set_allowed_mask (smu); -if (ret) -return ret; +/* +* Copy pptable bo in the vram to smc with SMU MSGs such as +* SetDriverDramAddr and TransferTableDram2Smu. +*/ +ret =smu_write_pptable (smu); +if (ret) +return ret; -ret =smu_system_features_control (smu, true); -if (ret) -return ret; +/* issue Run*Btc msg */ +ret =smu_run_btc (smu); +if (ret) +return ret; +ret =smu_feature_set_allowed_mask (smu); +if (ret) +return ret; -if (adev->asic_type ==CHIP_NAVI10 ) { -if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || - adev->pdev->revision ==0xc3 || - adev->pdev->revision ==0xca || - adev->pdev->revision ==0xcb )) || - (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || - adev->pdev->revision ==0xf4 || - adev->pdev->revision ==0xf5 || - adev->pdev->revision ==0xf6 ))) { -ret =smu_disable_umc_cdr_12gbps_workaround (smu); -if (ret) { -pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n" ); -return ret; -} -} -} +ret =smu_system_features_control (smu, true); +if (ret) +return ret; -if (smu->ppt_funcs->set_power_source) { -/* -* For Navi1X, manually switch it to AC mode as PMFW -* may boot it with DC mode. -*/ -if (adev->pm.ac_power) -ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC ); -else -ret =smu_set_power_source (smu,SMU_POWER_SOURCE_DC ); +if (adev->asic_type ==CHIP_NAVI10 ) { +if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || + adev->pdev->revision ==0xc3 || + adev->pdev->revision ==0xca || + adev->pdev->revision ==0xcb )) || + (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || + adev->pdev->revision ==0xf4 || + adev->pdev->revision ==0xf5 || + adev->pdev->revision ==0xf6 ))) { +ret =smu_disable_umc_cdr_12gbps_workaround (smu);if (ret) { -pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps +SKU!\n");return ret; } } } + +if (smu->ppt_funcs->set_power_source) { +/* +* For Navi1X, manually switch it to AC mode as PMFW +* may boot it with DC mode. +*/ +if (adev->pm.ac_power) +ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC ); +else +ret =smu_set_power_source (smu,SMU_POWER_SOURCE_DC ); +if (ret) { +pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +return ret; +} +} +if (adev->asic_type !=CHIP_ARCTURUS ) { ret =smu_notify_display_change (smu);
if (ret)
@@ -1214,9 +1211,8 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
/*
* Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools. */
-if (!amdgpu_sriov_vf(adev)) {
-ret = smu_set_tool_table_location(smu);
-}
+ret = smu_set_tool_table_location(smu);
+
if (!smu_is_dpm_running(smu))
pr_info("dpm has been disabled\n");
@@ -1376,9 +1372,6 @@ static int smu_hw_init(void *handle)
static int smu_stop_dpms(struct smu_context *smu) {
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
return smu_system_features_control(smu, false); }
@@ -1403,35 +1396,35 @@ static int smu_hw_fini(void *handle)
adev->pm.dpm_enabled = false;
-if (!amdgpu_sriov_vf(adev)){
+if (!amdgpu_sriov_vf(adev)) {
smu_i2c_eeprom_fini(smu, &adev->pm.smu_i2c);
+}
+
+ret = smu_stop_thermal_control(smu);
+if (ret) {
+pr_warn("Fail to stop thermal control!\n");
+return ret;
+}
-ret = smu_stop_thermal_control(smu);
+/*
+ * For custom pptable uploading, skip the DPM features
+ * disable process on Navi1x ASICs.
+ * - As the gfx related features are under control of
+ * RLC on those ASICs. RLC reinitialization will be + * needed to reenable them. That will cost much more + * efforts.
+ *
+ * - SMU firmware can handle the DPM reenablement
+ * properly.
+ */
+if (!smu->uploading_custom_pp_table || +!((adev->asic_type >= CHIP_NAVI10) && +(adev->asic_type <= CHIP_NAVI12))) {
+ret = smu_stop_dpms(smu);
if (ret) {
-pr_warn("Fail to stop thermal control!\n"); +pr_warn("Fail to stop Dpms!\n");
return ret;
}
-
-/*
- * For custom pptable uploading, skip the DPM features
- * disable process on Navi1x ASICs.
- * - As the gfx related features are under control of
- * RLC on those ASICs. RLC reinitialization will be - * needed to reenable them. That will cost much more - * efforts.
- *
- * - SMU firmware can handle the DPM reenablement
- * properly.
- */
-if (!smu->uploading_custom_pp_table ||
-!((adev->asic_type >= CHIP_NAVI10) &&
-(adev->asic_type <= CHIP_NAVI12))) {
-ret = smu_stop_dpms(smu);
-if (ret) {
-pr_warn("Fail to stop Dpms!\n");
-return ret;
-}
-}
}
kfree(table_context->driver_pptable);
@@ -1548,12 +1541,12 @@ static int smu_suspend(void *handle)
if (!amdgpu_sriov_vf(adev)) {
smu_i2c_eeprom_fini(smu, &adev->pm.smu_i2c);
-
-ret = smu_disable_dpm(smu);
-if (ret)
-return ret;
}
+ret = smu_disable_dpm(smu);
+if (ret)
+return ret;
+
smu->watermarks_bitmap &= ~(WATERMARKS_LOADED);
if (adev->asic_type >= CHIP_NAVI10 &&
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -1
@@ -1369,7 +1369,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,if (result)return result; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) +if (smu_version >=0x360d00 ) size +=sprintf (buf + size,"%16s %s %s %s %s %s %s %s %s %s %s\n" , title[0 ], title[1 ], title[2 ], title[3 ], title[4 ], title[5 ], title[6], title[7], title[8], title[9], title[10]); @@ -1386,7 +1386,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,
if (workload_type < 0)
continue;
-if (smu_version >= 0x360d00 && !amdgpu_sriov_vf(adev)) {
+if (smu_version >= 0x360d00) {
result = smu_update_table(smu,
SMU_TABLE_ACTIVITY_MONITOR_COEFF,
workload_type,
@@ -1401,7 +1401,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,
size += sprintf(buf + size, "%2d %14s%s\n",
i, profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
-if (smu_version >= 0x360d00 && !amdgpu_sriov_vf(adev)) {
+if (smu_version >= 0x360d00) {
size += sprintf(buf + size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ",
0,
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -5
@@ -1818,8 +1818,7 @@ static int navi10_get_power_limit(struct smu_context *smu,int power_src;if (!smu->power_limit) { -if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT ) && -!amdgpu_sriov_vf (smu->adev)) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT )) { power_src =smu_power_get_index (smu,SMU_POWER_SOURCE_AC );if (power_src <0 )return -EINVAL ;
@@ -1962,9 +1961,6 @@ static int navi10_set_default_od_settings(struct smu_context *smu, bool initialiOverDriveTable_t *od_table, *boot_od_table;int ret =0 ; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - ret =smu_v11_0_set_default_od_settings (smu, initialize,sizeof (OverDriveTable_t));if (ret)return ret;
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -24
@@ -768,9 +768,6 @@ int smu_v11_0_set_deep_sleep_dcefclk(struct smu_context *smu, uint32_t clk) {int ret; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetMinDeepSleepDcefclk, clk,NULL );if (ret)
@@ -814,9 +811,6 @@ int smu_v11_0_set_tool_table_location(struct smu_context *smu)int ret =0 ;struct smu_table *tool_table = &smu->smu_table.tables[SMU_TABLE_PMSTATUSLOG ]; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (tool_table->mc_address) { ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetToolsDramAddrHigh,
@@ -836,9 +830,6 @@ int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count) {int ret =0 ; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (!smu->pm_enabled)return ret;
@@ -853,9 +844,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)int ret =0 ;uint32_t feature_mask[2 ]; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -mutex_lock (&feature->mutex);if (bitmap_empty (feature->allowed,SMU_FEATURE_MAX ) || feature->feature_num <64 ) goto failed;
@@ -884,9 +872,6 @@ int smu_v11_0_get_enabled_mask(struct smu_context *smu,struct smu_feature *feature = &smu->smu_feature;int ret =0 ; -if (amdgpu_sriov_vf (smu->adev) && !amdgpu_sriov_is_pp_one_vf (smu->adev)) -return 0 ; -if (!feature_mask || num <2 )return -EINVAL ;
@@ -942,9 +927,6 @@ int smu_v11_0_notify_display_change(struct smu_context *smu) {int ret =0 ; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (!smu->pm_enabled)return ret;
@@ -1107,9 +1089,6 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n)int ret =0 ;uint32_t max_power_limit; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - max_power_limit =smu_v11_0_get_max_power_limit (smu);if (n > max_power_limit) {
@@ -1860,9 +1839,6 @@ int smu_v11_0_override_pcie_parameters(struct smu_context *smu)uint32_t pcie_gen =0 , pcie_width =0 ;int ret; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; -if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4 ) pcie_gen =3 ;else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 )
--
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&data=02%7C01%7Cevan.quan%40amd.com%7C1cec0ad4526347481e9708d8015c67be%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637260843725484475&sdata=EXruuZmiUCQdu824UO8eLcg1WEbJVwghYChj2lAK%2FqI%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sheng, Wenhui
Reviewed-by Hawking ZhangRE: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
[AMD Official Use Only - Internal Distribution Only]
[AMD Official Use Only - Internal Distribution Only]
Hi Evan,
With Kevin's previous patch, we will not create sysfs node pp_power_profile_mode under VF mode.
Brs
Wenhui
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, May 26, 2020 7:25 PM
To: Sheng, Wenhui <[email protected]>; [email protected]
Cc: Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
[AMD Official Use Only - Internal Distribution Only]
Please confirm the changes of arcturus_get_power_profile_mode() do not break SRIOV. Since this seems skipped before but enabled now.
Other than that, the series is acked-by: Evan Quan <[email protected]>
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenhui Sheng
Sent: Tuesday, May 26, 2020 6:06 PM
To: [email protected]
Cc: Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
We don't need SRIOV check after we enable SMC msg filter in SMU11
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 159 +++++++++---------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 24 --- 4 files changed, 80 insertions(+), 115 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +69 -71
@@ -563,10 +563,8 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, int bool is_support_sw_smu(struct amdgpu_device *adev) { -if (adev->asic_type >= CHIP_ARCTURUS) { -if (amdgpu_sriov_is_pp_one_vf (adev) || !amdgpu_sriov_vf (adev)) -return true; -} +if (adev->asic_type >=CHIP_ARCTURUS ) +return true;return false; }
@@ -1109,59 +1107,58 @@ static int smu_smc_table_hw_init(struct smu_context *smu, return ret;/* smu_dump_pptable(smu); */ -if (!amdgpu_sriov_vf (adev)) { -/* -* Copy pptable bo in the vram to smc with SMU MSGs such as -* SetDriverDramAddr and TransferTableDram2Smu. -*/ -ret =smu_write_pptable (smu); -if (ret) -return ret; - -/* issue Run*Btc msg */ -ret =smu_run_btc (smu); -if (ret) -return ret; -ret =smu_feature_set_allowed_mask (smu); -if (ret) -return ret; +/* +* Copy pptable bo in the vram to smc with SMU MSGs such as +* SetDriverDramAddr and TransferTableDram2Smu. +*/ +ret =smu_write_pptable (smu); +if (ret) +return ret; -ret = smu_system_features_control(smu, true); -if (ret) -return ret; +/* issue Run*Btc msg */ +ret =smu_run_btc (smu); +if (ret) +return ret; +ret =smu_feature_set_allowed_mask (smu); +if (ret) +return ret; -if (adev->asic_type ==CHIP_NAVI10 ) { -if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || - adev->pdev->revision ==0xc3 || - adev->pdev->revision ==0xca || - adev->pdev->revision ==0xcb )) || - (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || - adev->pdev->revision ==0xf4 || - adev->pdev->revision ==0xf5 || - adev->pdev->revision ==0xf6 ))) { -ret =smu_disable_umc_cdr_12gbps_workaround (smu); -if (ret) { -pr_err("Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n"); -return ret; -} -} -} +ret =smu_system_features_control (smu, true);if (ret)return ret; -if (smu->ppt_funcs->set_power_source) { -/* -* For Navi1X, manually switch it to AC mode as PMFW -* may boot it with DC mode. -*/ -if (adev->pm.ac_power) -ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC ); -else -ret =smu_set_power_source (smu,SMU_POWER_SOURCE_DC ); +if (adev->asic_type ==CHIP_NAVI10 ) { +if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || + adev->pdev->revision ==0xc3 || + adev->pdev->revision ==0xca || + adev->pdev->revision ==0xcb )) || + (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || + adev->pdev->revision ==0xf4 || + adev->pdev->revision ==0xf5 || + adev->pdev->revision ==0xf6 ))) { ret = +smu_disable_umc_cdr_12gbps_workaround (smu);if (ret) { -pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps +SKU!\n");return ret; } } } + +if (smu->ppt_funcs->set_power_source) { +/* +* For Navi1X, manually switch it to AC mode as PMFW +* may boot it with DC mode. +*/ +if (adev->pm.ac_power) +ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC );else ret = +smu_set_power_source (smu,SMU_POWER_SOURCE_DC );if (ret) { +pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" : +"DC" );return ret; } } + if (adev->asic_type != CHIP_ARCTURUS) { ret = smu_notify_display_change(smu); if (ret) @@ -1214,9 +1211,8 @@ static int smu_smc_table_hw_init(struct smu_context *smu,/* * Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools. */ -if (!amdgpu_sriov_vf(adev)) { -ret = smu_set_tool_table_location(smu); -} +ret = smu_set_tool_table_location(smu); +if (!smu_is_dpm_running (smu))pr_info ("dpm has been disabled\n" );
@@ -1376,9 +1372,6 @@ static int smu_hw_init(void *handle) static int smu_stop_dpms(struct smu_context *smu) { -if (amdgpu_sriov_vf(smu->adev)) -return 0; -return smu_system_features_control (smu, false); }
@@ -1403,35 +1396,35 @@ static int smu_hw_fini(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)){ +if (!amdgpu_sriov_vf (adev)) {smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); +} + +ret =smu_stop_thermal_control (smu); +if (ret) { +pr_warn ("Fail to stop thermal control!\n" );return ret; } -ret =smu_stop_thermal_control (smu); +/* +* For custom pptable uploading, skip the DPM features +* disable process on Navi1x ASICs. +* - As the gfx related features are under control of +* RLC on those ASICs. RLC reinitialization will be +* needed to reenable them. That will cost much more +* efforts. +* +* - SMU firmware can handle the DPM reenablement +* properly. +*/ +if (!smu->uploading_custom_pp_table || +!((adev->asic_type >=CHIP_NAVI10 ) && +(adev->asic_type <=CHIP_NAVI12 ))) { +ret =smu_stop_dpms (smu);if (ret) { -pr_warn ("Fail to stop thermal control!\n" ); +pr_warn ("Fail to stop Dpms!\n" );return ret; } - -/* -* For custom pptable uploading, skip the DPM features -* disable process on Navi1x ASICs. -* - As the gfx related features are under control of -* RLC on those ASICs. RLC reinitialization will be -* needed to reenable them. That will cost much more -* efforts. -* -* - SMU firmware can handle the DPM reenablement -* properly. -*/ -if (!smu->uploading_custom_pp_table || -!((adev->asic_type >=CHIP_NAVI10 ) && -(adev->asic_type <=CHIP_NAVI12 ))) { -ret =smu_stop_dpms (smu); -if (ret) { -pr_warn ("Fail to stop Dpms!\n" ); -return ret; -} -} }kfree (table_context->driver_pptable);
@@ -1548,12 +1541,12 @@ static int smu_suspend(void *handle)if (!amdgpu_sriov_vf (adev)) {smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - -ret =smu_disable_dpm (smu); -if (ret) -return ret; } +ret =smu_disable_dpm (smu); +if (ret) +return ret; + smu->watermarks_bitmap &= ~(WATERMARKS_LOADED ); if (adev->asic_type >= CHIP_NAVI10 &&
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +2 -2
@@ -1369,7 +1369,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, if (result) return result; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) +if (smu_version >=0x360d00 ) size += sprintf(buf + size, "%16s %s %s %s %s %s %s %s %s %s %s\n", title[0], title[1], title[2], title[3], title[4], title[5], title[6], title[7], title[8], title[9], title[10]); @@ -1386,7 +1386,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, if (workload_type < 0) continue; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) { +if (smu_version >=0x360d00 ) { result = smu_update_table(smu, SMU_TABLE_ACTIVITY_MONITOR_COEFF,
workload_type,
@@ -1401,7 +1401,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, size += sprintf(buf + size, "%2d %14s%s\n", i, profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
-if (smu_version >= 0x360d00 && !amdgpu_sriov_vf(adev)) {
+if (smu_version >= 0x360d00) {
size += sprintf(buf + size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ", 0, diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 5f7373e86d90..ef4952afb365 100644
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -4
@@ -1818,8 +1818,7 @@ static int navi10_get_power_limit(struct smu_context *smu, int power_src;if (!smu->power_limit) { -if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT ) && -!amdgpu_sriov_vf (smu->adev)) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT )) { power_src = smu_power_get_index(smu, SMU_POWER_SOURCE_AC); if (power_src < 0) return -EINVAL; @@ -1962,9 +1961,6 @@ static int navi10_set_default_od_settings(struct smu_context *smu, bool initiali OverDriveTable_t *od_table, *boot_od_table; int ret = 0; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ;
-
ret = smu_v11_0_set_default_od_settings(smu, initialize, sizeof(OverDriveTable_t)); if (ret) return ret; diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 906bc7f2e686..3af439a77876 100644
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -5
@@ -768,9 +768,6 @@ int smu_v11_0_set_deep_sleep_dcefclk(struct smu_context *smu, uint32_t clk) { int ret; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetMinDeepSleepDcefclk, clk, NULL); if (ret) @@ -814,9 +811,6 @@ int smu_v11_0_set_tool_table_location(struct smu_context *smu) int ret = 0; struct smu_table *tool_table = &smu->smu_table.tables[SMU_TABLE_PMSTATUSLOG]; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ;
-
if (tool_table->mc_address) {
ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetToolsDramAddrHigh,
@@ -836,9 +830,6 @@ int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count) { int ret = 0;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
if (!smu->pm_enabled)
return ret;
@@ -853,9 +844,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu) int ret = 0; uint32_t feature_mask[2];
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
mutex_lock(&feature->mutex);
if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) goto failed; @@ -884,9 +872,6 @@ int smu_v11_0_get_enabled_mask(struct smu_context *smu, struct smu_feature *feature = &smu->smu_feature; int ret = 0;
-if (amdgpu_sriov_vf(smu->adev) && !amdgpu_sriov_is_pp_one_vf(smu->adev)) -return 0;
-
if (!feature_mask || num < 2)
return -EINVAL;
@@ -942,9 +927,6 @@ int smu_v11_0_notify_display_change(struct smu_context *smu) { int ret = 0;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
if (!smu->pm_enabled)
return ret;
@@ -1107,9 +1089,6 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n) int ret = 0; uint32_t max_power_limit;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
max_power_limit = smu_v11_0_get_max_power_limit(smu);
if (n > max_power_limit) {
@@ -1860,9 +1839,6 @@ int smu_v11_0_override_pcie_parameters(struct smu_context *smu) uint32_t pcie_gen = 0, pcie_width = 0; int ret;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4) pcie_gen = 3;
else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
--
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&data=02%7C01%7Cevan.quan%40amd.com%7C1cec0ad4526347481e9708d8015c67be%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637260843725484475&sdata=EXruuZmiUCQdu824UO8eLcg1WEbJVwghYChj2lAK%2FqI%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quan, Evan
Reviewed-by Hawking ZhangRE: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
[AMD Official Use Only - Internal Distribution Only]
OK, I see.
BR
Evan
-----Original Message-----
From: Sheng, Wenhui <[email protected]>
Sent: Wednesday, May 27, 2020 10:19 AM
To: Quan, Evan <[email protected]>
Cc: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
[AMD Official Use Only - Internal Distribution Only]
[AMD Official Use Only - Internal Distribution Only]
Hi Evan,
With Kevin's previous patch, we will not create sysfs node pp_power_profile_mode under VF mode.
Brs
Wenhui
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, May 26, 2020 7:25 PM
To: Sheng, Wenhui <[email protected]>; [email protected]
Cc: Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
[AMD Official Use Only - Internal Distribution Only]
Please confirm the changes of arcturus_get_power_profile_mode() do not break SRIOV. Since this seems skipped before but enabled now.
Other than that, the series is acked-by: Evan Quan <[email protected]>
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenhui Sheng
Sent: Tuesday, May 26, 2020 6:06 PM
To: [email protected]
Cc: Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 3/4] drm/amd/powerplay: remove SRIOV check in SMU11
We don't need SRIOV check after we enable SMC msg filter in SMU11
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 159 +++++++++---------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 6 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 24 --- 4 files changed, 80 insertions(+), 115 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +69 -71
@@ -563,10 +563,8 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, int bool is_support_sw_smu(struct amdgpu_device *adev) { -if (adev->asic_type >= CHIP_ARCTURUS) { -if (amdgpu_sriov_is_pp_one_vf (adev) || !amdgpu_sriov_vf (adev)) -return true; -} +if (adev->asic_type >=CHIP_ARCTURUS ) +return true;return false; }
@@ -1109,59 +1107,58 @@ static int smu_smc_table_hw_init(struct smu_context *smu, return ret;/* smu_dump_pptable(smu); */ -if (!amdgpu_sriov_vf (adev)) { -/* -* Copy pptable bo in the vram to smc with SMU MSGs such as -* SetDriverDramAddr and TransferTableDram2Smu. -*/ -ret =smu_write_pptable (smu); -if (ret) -return ret; - -/* issue Run*Btc msg */ -ret =smu_run_btc (smu); -if (ret) -return ret; -ret =smu_feature_set_allowed_mask (smu); -if (ret) -return ret; +/* +* Copy pptable bo in the vram to smc with SMU MSGs such as +* SetDriverDramAddr and TransferTableDram2Smu. +*/ +ret =smu_write_pptable (smu); +if (ret) +return ret; -ret = smu_system_features_control(smu, true); -if (ret) -return ret; +/* issue Run*Btc msg */ +ret =smu_run_btc (smu); +if (ret) +return ret; +ret =smu_feature_set_allowed_mask (smu); +if (ret) +return ret; -if (adev->asic_type ==CHIP_NAVI10 ) { -if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || - adev->pdev->revision ==0xc3 || - adev->pdev->revision ==0xca || - adev->pdev->revision ==0xcb )) || - (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || - adev->pdev->revision ==0xf4 || - adev->pdev->revision ==0xf5 || - adev->pdev->revision ==0xf6 ))) { -ret =smu_disable_umc_cdr_12gbps_workaround (smu); -if (ret) { -pr_err("Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n"); -return ret; -} -} -} +ret =smu_system_features_control (smu, true);if (ret)return ret; -if (smu->ppt_funcs->set_power_source) { -/* -* For Navi1X, manually switch it to AC mode as PMFW -* may boot it with DC mode. -*/ -if (adev->pm.ac_power) -ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC ); -else -ret =smu_set_power_source (smu,SMU_POWER_SOURCE_DC ); +if (adev->asic_type ==CHIP_NAVI10 ) { +if ((adev->pdev->device ==0x731f && (adev->pdev->revision ==0xc2 || + adev->pdev->revision ==0xc3 || + adev->pdev->revision ==0xca || + adev->pdev->revision ==0xcb )) || + (adev->pdev->device ==0x66af && (adev->pdev->revision ==0xf3 || + adev->pdev->revision ==0xf4 || + adev->pdev->revision ==0xf5 || + adev->pdev->revision ==0xf6 ))) { ret = +smu_disable_umc_cdr_12gbps_workaround (smu);if (ret) { -pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps +SKU!\n");return ret; } } } + +if (smu->ppt_funcs->set_power_source) { +/* +* For Navi1X, manually switch it to AC mode as PMFW +* may boot it with DC mode. +*/ +if (adev->pm.ac_power) +ret =smu_set_power_source (smu,SMU_POWER_SOURCE_AC );else ret = +smu_set_power_source (smu,SMU_POWER_SOURCE_DC );if (ret) { +pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" : +"DC" );return ret; } } + if (adev->asic_type != CHIP_ARCTURUS) { ret = smu_notify_display_change(smu); if (ret) @@ -1214,9 +1211,8 @@ static int smu_smc_table_hw_init(struct smu_context *smu,/* * Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools. */ -if (!amdgpu_sriov_vf(adev)) { -ret = smu_set_tool_table_location(smu); -} +ret = smu_set_tool_table_location(smu); +if (!smu_is_dpm_running (smu))pr_info ("dpm has been disabled\n" );
@@ -1376,9 +1372,6 @@ static int smu_hw_init(void *handle) static int smu_stop_dpms(struct smu_context *smu) { -if (amdgpu_sriov_vf(smu->adev)) -return 0; -return smu_system_features_control (smu, false); }
@@ -1403,35 +1396,35 @@ static int smu_hw_fini(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)){ +if (!amdgpu_sriov_vf (adev)) {smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); +} + +ret =smu_stop_thermal_control (smu); +if (ret) { +pr_warn ("Fail to stop thermal control!\n" );return ret; } -ret =smu_stop_thermal_control (smu); +/* +* For custom pptable uploading, skip the DPM features +* disable process on Navi1x ASICs. +* - As the gfx related features are under control of +* RLC on those ASICs. RLC reinitialization will be +* needed to reenable them. That will cost much more +* efforts. +* +* - SMU firmware can handle the DPM reenablement +* properly. +*/ +if (!smu->uploading_custom_pp_table || +!((adev->asic_type >=CHIP_NAVI10 ) && +(adev->asic_type <=CHIP_NAVI12 ))) { +ret =smu_stop_dpms (smu);if (ret) { -pr_warn ("Fail to stop thermal control!\n" ); +pr_warn ("Fail to stop Dpms!\n" );return ret; } - -/* -* For custom pptable uploading, skip the DPM features -* disable process on Navi1x ASICs. -* - As the gfx related features are under control of -* RLC on those ASICs. RLC reinitialization will be -* needed to reenable them. That will cost much more -* efforts. -* -* - SMU firmware can handle the DPM reenablement -* properly. -*/ -if (!smu->uploading_custom_pp_table || -!((adev->asic_type >=CHIP_NAVI10 ) && -(adev->asic_type <=CHIP_NAVI12 ))) { -ret =smu_stop_dpms (smu); -if (ret) { -pr_warn ("Fail to stop Dpms!\n" ); -return ret; -} -} }kfree (table_context->driver_pptable);
@@ -1548,12 +1541,12 @@ static int smu_suspend(void *handle)if (!amdgpu_sriov_vf (adev)) {smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - -ret =smu_disable_dpm (smu); -if (ret) -return ret; } +ret =smu_disable_dpm (smu); +if (ret) +return ret; + smu->watermarks_bitmap &= ~(WATERMARKS_LOADED ); if (adev->asic_type >= CHIP_NAVI10 &&
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +2 -2
@@ -1369,7 +1369,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, if (result) return result; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) +if (smu_version >=0x360d00 ) size += sprintf(buf + size, "%16s %s %s %s %s %s %s %s %s %s %s\n", title[0], title[1], title[2], title[3], title[4], title[5], title[6], title[7], title[8], title[9], title[10]); @@ -1386,7 +1386,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, if (workload_type < 0) continue; -if (smu_version >=0x360d00 && !amdgpu_sriov_vf (adev)) { +if (smu_version >=0x360d00 ) { result = smu_update_table(smu, SMU_TABLE_ACTIVITY_MONITOR_COEFF,
workload_type,
@@ -1401,7 +1401,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, size += sprintf(buf + size, "%2d %14s%s\n", i, profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
-if (smu_version >= 0x360d00 && !amdgpu_sriov_vf(adev)) {
+if (smu_version >= 0x360d00) {
size += sprintf(buf + size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ", 0, diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 5f7373e86d90..ef4952afb365 100644
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -4
@@ -1818,8 +1818,7 @@ static int navi10_get_power_limit(struct smu_context *smu, int power_src;if (!smu->power_limit) { -if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT ) && -!amdgpu_sriov_vf (smu->adev)) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT )) { power_src = smu_power_get_index(smu, SMU_POWER_SOURCE_AC); if (power_src < 0) return -EINVAL; @@ -1962,9 +1961,6 @@ static int navi10_set_default_od_settings(struct smu_context *smu, bool initiali OverDriveTable_t *od_table, *boot_od_table; int ret = 0; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ;
-
ret = smu_v11_0_set_default_od_settings(smu, initialize, sizeof(OverDriveTable_t)); if (ret) return ret; diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 906bc7f2e686..3af439a77876 100644
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -5
@@ -768,9 +768,6 @@ int smu_v11_0_set_deep_sleep_dcefclk(struct smu_context *smu, uint32_t clk) { int ret; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ; - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetMinDeepSleepDcefclk, clk, NULL); if (ret) @@ -814,9 +811,6 @@ int smu_v11_0_set_tool_table_location(struct smu_context *smu) int ret = 0; struct smu_table *tool_table = &smu->smu_table.tables[SMU_TABLE_PMSTATUSLOG]; -if (amdgpu_sriov_vf (smu->adev)) -return 0 ;
-
if (tool_table->mc_address) {
ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetToolsDramAddrHigh,
@@ -836,9 +830,6 @@ int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count) { int ret = 0;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
if (!smu->pm_enabled)
return ret;
@@ -853,9 +844,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu) int ret = 0; uint32_t feature_mask[2];
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
mutex_lock(&feature->mutex);
if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) goto failed; @@ -884,9 +872,6 @@ int smu_v11_0_get_enabled_mask(struct smu_context *smu, struct smu_feature *feature = &smu->smu_feature; int ret = 0;
-if (amdgpu_sriov_vf(smu->adev) && !amdgpu_sriov_is_pp_one_vf(smu->adev)) -return 0;
-
if (!feature_mask || num < 2)
return -EINVAL;
@@ -942,9 +927,6 @@ int smu_v11_0_notify_display_change(struct smu_context *smu) { int ret = 0;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
if (!smu->pm_enabled)
return ret;
@@ -1107,9 +1089,6 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n) int ret = 0; uint32_t max_power_limit;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
max_power_limit = smu_v11_0_get_max_power_limit(smu);
if (n > max_power_limit) {
@@ -1860,9 +1839,6 @@ int smu_v11_0_override_pcie_parameters(struct smu_context *smu) uint32_t pcie_gen = 0, pcie_width = 0; int ret;
-if (amdgpu_sriov_vf(smu->adev))
-return 0;
-
if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4) pcie_gen = 3;
else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
--
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&data=02%7C01%7Cevan.quan%40amd.com%7C1cec0ad4526347481e9708d8015c67be%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637260843725484475&sdata=EXruuZmiUCQdu824UO8eLcg1WEbJVwghYChj2lAK%2FqI%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amd/powerplay: add check before i2c_add_adapter
In reply to Wenhui Shengsmu_i2c_eeprom_init may be invoked twice or more under sroiv mode, while we don't want to add check
if (!amdgpu_sriov_vf) before we invoke smu_i2c_eeprom_init/fini each time, so we check if i2c adapter is already added before we invoke i2c_add_adapter
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 24 +++++++------------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 14 ++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +8 -16
@@ -1354,11 +1354,9 @@ static int smu_hw_init(void *handle)if (ret) goto failed; -if (!amdgpu_sriov_vf (adev)) { - ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); -if (ret) - goto failed; - } + ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); +if (ret) + goto failed; adev->pm.dpm_enabled = true;
@@ -1396,9 +1394,7 @@ static int smu_hw_fini(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)) { -smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - } +smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); ret =smu_stop_thermal_control (smu);if (ret) {
@@ -1539,9 +1535,7 @@ static int smu_suspend(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)) { -smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - } +smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); ret =smu_disable_dpm (smu);if (ret)
@@ -1586,11 +1580,9 @@ static int smu_resume(void *handle)if (ret) goto failed; -if (!amdgpu_sriov_vf (adev)) { - ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); -if (ret) - goto failed; - } + ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); +if (ret) + goto failed;if (smu->is_apu)smu_set_gfx_cgpg (&adev->smu, true);
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +14 -0
@@ -2224,11 +2224,22 @@ static const struct i2c_algorithm arcturus_i2c_eeprom_i2c_algo = { .functionality = arcturus_i2c_eeprom_i2c_func, }; +static bool arcturus_i2c_adapter_is_added (struct i2c_adapter *control) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); + +return control->dev.parent == &adev->pdev->dev ? true : false; +} +static int arcturus_i2c_eeprom_control_init (struct i2c_adapter *control) {struct amdgpu_device *adev =to_amdgpu_device (control);int res; +/* smu_i2c_eeprom_init may be called twice in sriov */ +if (arcturus_i2c_adapter_is_added (control)) +return 0 ; + control->owner =THIS_MODULE ; control->class =I2C_CLASS_SPD ; control->dev.parent = &adev->pdev->dev;
@@ -2244,6 +2255,9 @@ static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)static void arcturus_i2c_eeprom_control_fini (struct i2c_adapter *control) { +if (!arcturus_i2c_adapter_is_added (control)) +return ; +i2c_del_adapter (control); }
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 4/4] drm/amd/powerplay: add check before i2c_add_adapter
[AMD Official Use Only - Internal Distribution Only]
________________________________
From: amd-gfx <[email protected]> on behalf of Wenhui Sheng <[email protected]>
Sent: Tuesday, May 26, 2020 6:05 PM
To: [email protected] <[email protected]>
Cc: Sheng, Wenhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 4/4] drm/amd/powerplay: add check before i2c_add_adapter
smu_i2c_eeprom_init may be invoked twice or more under sroiv mode, while we don't want to add check
if (!amdgpu_sriov_vf) before we invoke smu_i2c_eeprom_init/fini each time, so we check if i2c adapter is already added before we invoke i2c_add_adapter
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 24 +++++++------------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 14 ++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +8 -16
@@ -1354,11 +1354,9 @@ static int smu_hw_init(void *handle)if (ret) goto failed; -if (!amdgpu_sriov_vf (adev)) { - ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); -if (ret) - goto failed; - } + ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); +if (ret) + goto failed; adev->pm.dpm_enabled = true;
@@ -1396,9 +1394,7 @@ static int smu_hw_fini(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)) { -smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - } +smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); ret =smu_stop_thermal_control (smu);if (ret) {
@@ -1539,9 +1535,7 @@ static int smu_suspend(void *handle) adev->pm.dpm_enabled = false; -if (!amdgpu_sriov_vf (adev)) { -smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); - } +smu_i2c_eeprom_fini (smu, &adev->pm.smu_i2c); ret =smu_disable_dpm (smu);if (ret)
@@ -1586,11 +1580,9 @@ static int smu_resume(void *handle)if (ret) goto failed; -if (!amdgpu_sriov_vf (adev)) { - ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); -if (ret) - goto failed; - } + ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c); +if (ret) + goto failed;if (smu->is_apu)smu_set_gfx_cgpg (&adev->smu, true);
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +5 -0
@@ -2224,11 +2224,22 @@ static const struct i2c_algorithm arcturus_i2c_eeprom_i2c_algo = { .functionality = arcturus_i2c_eeprom_i2c_func, }; +static bool arcturus_i2c_adapter_is_added (struct i2c_adapter *control) +{ +struct amdgpu_device *adev =to_amdgpu_device (control); + +return control->dev.parent == &adev->pdev->dev ? true : false;
[kevin]:
please change code from
"return control->dev.parent == &adev->pdev->dev ? true : false;" to
"return control->dev.parent == &adev->pdev->dev".
after fixed, Series is
+}
+
static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)
{
struct amdgpu_device *adev = to_amdgpu_device(control);
int res;+ /* smu_i2c_eeprom_init may be called twice in sriov */
+ if (arcturus_i2c_adapter_is_added(control))
+ return 0;
+
control->owner = THIS_MODULE;
control->class = I2C_CLASS_SPD;
control->dev.parent = &adev->pdev->dev;@@ -2244,6 +2255,9 @@ static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)
static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control) {
+ if (!arcturus_i2c_adapter_is_added(control))
+ return;
+
i2c_del_adapter(control);
}
--
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&data=02%7C01%7CKevin1.Wang%40amd.com%7C598c8cf6946745005df908d8015c692b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637260843721510576&sdata=lQSeaMsfm7pHjDP%2FLo94JqVzSZEIF1NLTNz3fSvkJ3k%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx