Commit 9b5f9891 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/pm: enable SCPM support for SMU

With SCPM enabled, the pptable used will be signed. It cannot
be used directly by driver. To get the raw pptable, we need to
rely on the combo pptable(and its revelant SMU message).

Also, the pptable transferring(to SMU) will be performed by PSP.
Some SMU messages will be not available to driver any more.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b37c41f2
...@@ -488,8 +488,20 @@ static int smu_sys_set_pp_table(void *handle, ...@@ -488,8 +488,20 @@ static int smu_sys_set_pp_table(void *handle,
static int smu_get_driver_allowed_feature_mask(struct smu_context *smu) static int smu_get_driver_allowed_feature_mask(struct smu_context *smu)
{ {
struct smu_feature *feature = &smu->smu_feature; struct smu_feature *feature = &smu->smu_feature;
int ret = 0;
uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32]; uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];
int ret = 0;
/*
* With SCPM enabled, the allowed featuremasks setting(via
* PPSMC_MSG_SetAllowedFeaturesMaskLow/High) is not permitted.
* That means there is no way to let PMFW knows the settings below.
* Thus, we just assume all the features are allowed under
* such scenario.
*/
if (smu->adev->scpm_enabled) {
bitmap_fill(feature->allowed, SMU_FEATURE_MAX);
return 0;
}
bitmap_zero(feature->allowed, SMU_FEATURE_MAX); bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
...@@ -1155,6 +1167,11 @@ static int smu_smc_hw_setup(struct smu_context *smu) ...@@ -1155,6 +1167,11 @@ static int smu_smc_hw_setup(struct smu_context *smu)
/* smu_dump_pptable(smu); */ /* smu_dump_pptable(smu); */
/*
* With SCPM enabled, PSP is responsible for the PPTable transferring
* (to SMU). Driver involvement is not needed and permitted.
*/
if (!adev->scpm_enabled) {
/* /*
* Copy pptable bo in the vram to smc with SMU MSGs such as * Copy pptable bo in the vram to smc with SMU MSGs such as
* SetDriverDramAddr and TransferTableDram2Smu. * SetDriverDramAddr and TransferTableDram2Smu.
...@@ -1164,17 +1181,24 @@ static int smu_smc_hw_setup(struct smu_context *smu) ...@@ -1164,17 +1181,24 @@ static int smu_smc_hw_setup(struct smu_context *smu)
dev_err(adev->dev, "Failed to transfer pptable to SMC!\n"); dev_err(adev->dev, "Failed to transfer pptable to SMC!\n");
return ret; return ret;
} }
}
/* issue Run*Btc msg */ /* issue Run*Btc msg */
ret = smu_run_btc(smu); ret = smu_run_btc(smu);
if (ret) if (ret)
return ret; return ret;
/*
* With SCPM enabled, these actions(and relevant messages) are
* not needed and permitted.
*/
if (!adev->scpm_enabled) {
ret = smu_feature_set_allowed_mask(smu); ret = smu_feature_set_allowed_mask(smu);
if (ret) { if (ret) {
dev_err(adev->dev, "Failed to set driver allowed features mask!\n"); dev_err(adev->dev, "Failed to set driver allowed features mask!\n");
return ret; return ret;
} }
}
ret = smu_system_features_control(smu, true); ret = smu_system_features_control(smu, true);
if (ret) { if (ret) {
...@@ -1422,10 +1446,13 @@ static int smu_disable_dpms(struct smu_context *smu) ...@@ -1422,10 +1446,13 @@ static int smu_disable_dpms(struct smu_context *smu)
if (ret) if (ret)
dev_err(adev->dev, "Failed to disable smu features except BACO.\n"); dev_err(adev->dev, "Failed to disable smu features except BACO.\n");
} else { } else {
/* DisableAllSmuFeatures message is not permitted with SCPM enabled */
if (!adev->scpm_enabled) {
ret = smu_system_features_control(smu, false); ret = smu_system_features_control(smu, false);
if (ret) if (ret)
dev_err(adev->dev, "Failed to disable smu features.\n"); dev_err(adev->dev, "Failed to disable smu features.\n");
} }
}
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 4, 2) && if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 4, 2) &&
adev->gfx.rlc.funcs->stop) adev->gfx.rlc.funcs->stop)
......
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