Commit 5964f3fe authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: avoid calling Vega20 specific SMU message implemention

Prepare for coming lock protection for SMU message issuing.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarKenneth Feng <kenneth.feng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 81bf835e
...@@ -175,17 +175,17 @@ static int vega20_copy_table_from_smc(struct pp_hwmgr *hwmgr, ...@@ -175,17 +175,17 @@ static int vega20_copy_table_from_smc(struct pp_hwmgr *hwmgr,
PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].size != 0, PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].size != 0,
"Invalid SMU Table Length!", return -EINVAL); "Invalid SMU Table Length!", return -EINVAL);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh,
upper_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0, upper_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0,
"[CopyTableFromSMC] Attempt to Set Dram Addr High Failed!", "[CopyTableFromSMC] Attempt to Set Dram Addr High Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow,
lower_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0, lower_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0,
"[CopyTableFromSMC] Attempt to Set Dram Addr Low Failed!", "[CopyTableFromSMC] Attempt to Set Dram Addr Low Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_TransferTableSmu2Dram, table_id)) == 0, PPSMC_MSG_TransferTableSmu2Dram, table_id)) == 0,
"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!", "[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
return ret); return ret);
...@@ -224,17 +224,17 @@ static int vega20_copy_table_to_smc(struct pp_hwmgr *hwmgr, ...@@ -224,17 +224,17 @@ static int vega20_copy_table_to_smc(struct pp_hwmgr *hwmgr,
amdgpu_asic_flush_hdp(adev, NULL); amdgpu_asic_flush_hdp(adev, NULL);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh,
upper_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0, upper_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0,
"[CopyTableToSMC] Attempt to Set Dram Addr High Failed!", "[CopyTableToSMC] Attempt to Set Dram Addr High Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow,
lower_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0, lower_32_bits(priv->smu_tables.entry[table_id].mc_addr))) == 0,
"[CopyTableToSMC] Attempt to Set Dram Addr Low Failed!", "[CopyTableToSMC] Attempt to Set Dram Addr Low Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_TransferTableDram2Smu, table_id)) == 0, PPSMC_MSG_TransferTableDram2Smu, table_id)) == 0,
"[CopyTableToSMC] Attempt to Transfer Table To SMU Failed!", "[CopyTableToSMC] Attempt to Transfer Table To SMU Failed!",
return ret); return ret);
...@@ -255,17 +255,17 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr, ...@@ -255,17 +255,17 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
amdgpu_asic_flush_hdp(adev, NULL); amdgpu_asic_flush_hdp(adev, NULL);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh,
upper_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0, upper_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0,
"[SetActivityMonitor] Attempt to Set Dram Addr High Failed!", "[SetActivityMonitor] Attempt to Set Dram Addr High Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow,
lower_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0, lower_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0,
"[SetActivityMonitor] Attempt to Set Dram Addr Low Failed!", "[SetActivityMonitor] Attempt to Set Dram Addr Low Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_TransferTableDram2Smu, TABLE_ACTIVITY_MONITOR_COEFF | (workload_type << 16))) == 0, PPSMC_MSG_TransferTableDram2Smu, TABLE_ACTIVITY_MONITOR_COEFF | (workload_type << 16))) == 0,
"[SetActivityMonitor] Attempt to Transfer Table To SMU Failed!", "[SetActivityMonitor] Attempt to Transfer Table To SMU Failed!",
return ret); return ret);
...@@ -281,17 +281,17 @@ int vega20_get_activity_monitor_coeff(struct pp_hwmgr *hwmgr, ...@@ -281,17 +281,17 @@ int vega20_get_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
struct amdgpu_device *adev = hwmgr->adev; struct amdgpu_device *adev = hwmgr->adev;
int ret = 0; int ret = 0;
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh,
upper_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0, upper_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0,
"[GetActivityMonitor] Attempt to Set Dram Addr High Failed!", "[GetActivityMonitor] Attempt to Set Dram Addr High Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow,
lower_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0, lower_32_bits(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].mc_addr))) == 0,
"[GetActivityMonitor] Attempt to Set Dram Addr Low Failed!", "[GetActivityMonitor] Attempt to Set Dram Addr Low Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_TransferTableSmu2Dram, PPSMC_MSG_TransferTableSmu2Dram,
TABLE_ACTIVITY_MONITOR_COEFF | (workload_type << 16))) == 0, TABLE_ACTIVITY_MONITOR_COEFF | (workload_type << 16))) == 0,
"[GetActivityMonitor] Attempt to Transfer Table From SMU Failed!", "[GetActivityMonitor] Attempt to Transfer Table From SMU Failed!",
...@@ -316,20 +316,20 @@ int vega20_enable_smc_features(struct pp_hwmgr *hwmgr, ...@@ -316,20 +316,20 @@ int vega20_enable_smc_features(struct pp_hwmgr *hwmgr,
smu_features_high = (uint32_t)((feature_mask & SMU_FEATURES_HIGH_MASK) >> SMU_FEATURES_HIGH_SHIFT); smu_features_high = (uint32_t)((feature_mask & SMU_FEATURES_HIGH_MASK) >> SMU_FEATURES_HIGH_SHIFT);
if (enable) { if (enable) {
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_EnableSmuFeaturesLow, smu_features_low)) == 0, PPSMC_MSG_EnableSmuFeaturesLow, smu_features_low)) == 0,
"[EnableDisableSMCFeatures] Attempt to enable SMU features Low failed!", "[EnableDisableSMCFeatures] Attempt to enable SMU features Low failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_EnableSmuFeaturesHigh, smu_features_high)) == 0, PPSMC_MSG_EnableSmuFeaturesHigh, smu_features_high)) == 0,
"[EnableDisableSMCFeatures] Attempt to enable SMU features High failed!", "[EnableDisableSMCFeatures] Attempt to enable SMU features High failed!",
return ret); return ret);
} else { } else {
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_DisableSmuFeaturesLow, smu_features_low)) == 0, PPSMC_MSG_DisableSmuFeaturesLow, smu_features_low)) == 0,
"[EnableDisableSMCFeatures] Attempt to disable SMU features Low failed!", "[EnableDisableSMCFeatures] Attempt to disable SMU features Low failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_DisableSmuFeaturesHigh, smu_features_high)) == 0, PPSMC_MSG_DisableSmuFeaturesHigh, smu_features_high)) == 0,
"[EnableDisableSMCFeatures] Attempt to disable SMU features High failed!", "[EnableDisableSMCFeatures] Attempt to disable SMU features High failed!",
return ret); return ret);
...@@ -347,16 +347,16 @@ int vega20_get_enabled_smc_features(struct pp_hwmgr *hwmgr, ...@@ -347,16 +347,16 @@ int vega20_get_enabled_smc_features(struct pp_hwmgr *hwmgr,
if (features_enabled == NULL) if (features_enabled == NULL)
return -EINVAL; return -EINVAL;
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr,
PPSMC_MSG_GetEnabledSmuFeaturesLow)) == 0, PPSMC_MSG_GetEnabledSmuFeaturesLow)) == 0,
"[GetEnabledSMCFeatures] Attempt to get SMU features Low failed!", "[GetEnabledSMCFeatures] Attempt to get SMU features Low failed!",
return ret); return ret);
smc_features_low = vega20_get_argument(hwmgr); smc_features_low = smum_get_argument(hwmgr);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr,
PPSMC_MSG_GetEnabledSmuFeaturesHigh)) == 0, PPSMC_MSG_GetEnabledSmuFeaturesHigh)) == 0,
"[GetEnabledSMCFeatures] Attempt to get SMU features High failed!", "[GetEnabledSMCFeatures] Attempt to get SMU features High failed!",
return ret); return ret);
smc_features_high = vega20_get_argument(hwmgr); smc_features_high = smum_get_argument(hwmgr);
*features_enabled = ((((uint64_t)smc_features_low << SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) | *features_enabled = ((((uint64_t)smc_features_low << SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) |
(((uint64_t)smc_features_high << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK)); (((uint64_t)smc_features_high << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK));
...@@ -371,11 +371,11 @@ static int vega20_set_tools_address(struct pp_hwmgr *hwmgr) ...@@ -371,11 +371,11 @@ static int vega20_set_tools_address(struct pp_hwmgr *hwmgr)
int ret = 0; int ret = 0;
if (priv->smu_tables.entry[TABLE_PMSTATUSLOG].mc_addr) { if (priv->smu_tables.entry[TABLE_PMSTATUSLOG].mc_addr) {
ret = vega20_send_msg_to_smc_with_parameter(hwmgr, ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetToolsDramAddrHigh, PPSMC_MSG_SetToolsDramAddrHigh,
upper_32_bits(priv->smu_tables.entry[TABLE_PMSTATUSLOG].mc_addr)); upper_32_bits(priv->smu_tables.entry[TABLE_PMSTATUSLOG].mc_addr));
if (!ret) if (!ret)
ret = vega20_send_msg_to_smc_with_parameter(hwmgr, ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetToolsDramAddrLow, PPSMC_MSG_SetToolsDramAddrLow,
lower_32_bits(priv->smu_tables.entry[TABLE_PMSTATUSLOG].mc_addr)); lower_32_bits(priv->smu_tables.entry[TABLE_PMSTATUSLOG].mc_addr));
} }
...@@ -389,12 +389,12 @@ int vega20_set_pptable_driver_address(struct pp_hwmgr *hwmgr) ...@@ -389,12 +389,12 @@ int vega20_set_pptable_driver_address(struct pp_hwmgr *hwmgr)
(struct vega20_smumgr *)(hwmgr->smu_backend); (struct vega20_smumgr *)(hwmgr->smu_backend);
int ret = 0; int ret = 0;
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrHigh, PPSMC_MSG_SetDriverDramAddrHigh,
upper_32_bits(priv->smu_tables.entry[TABLE_PPTABLE].mc_addr))) == 0, upper_32_bits(priv->smu_tables.entry[TABLE_PPTABLE].mc_addr))) == 0,
"[SetPPtabeDriverAddress] Attempt to Set Dram Addr High Failed!", "[SetPPtabeDriverAddress] Attempt to Set Dram Addr High Failed!",
return ret); return ret);
PP_ASSERT_WITH_CODE((ret = vega20_send_msg_to_smc_with_parameter(hwmgr, PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetDriverDramAddrLow, PPSMC_MSG_SetDriverDramAddrLow,
lower_32_bits(priv->smu_tables.entry[TABLE_PPTABLE].mc_addr))) == 0, lower_32_bits(priv->smu_tables.entry[TABLE_PPTABLE].mc_addr))) == 0,
"[SetPPtabeDriverAddress] Attempt to Set Dram Addr Low Failed!", "[SetPPtabeDriverAddress] Attempt to Set Dram Addr Low Failed!",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment