drm/amd/powerplay: retrieve the enabled feature mask from cache
This is why those feature mask members designed for. And this can reduce the SMU workload. Signed-off-by: Evan Quan <evan.quan@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e42877b8ba
commit
6a876844e4
@ -1319,7 +1319,7 @@ failed:
|
|||||||
|
|
||||||
static int smu_stop_dpms(struct smu_context *smu)
|
static int smu_stop_dpms(struct smu_context *smu)
|
||||||
{
|
{
|
||||||
return smu_send_smc_msg(smu, SMU_MSG_DisableAllSmuFeatures);
|
return smu_system_features_control(smu, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smu_hw_fini(void *handle)
|
static int smu_hw_fini(void *handle)
|
||||||
|
@ -835,27 +835,33 @@ int smu_v11_0_get_enabled_mask(struct smu_context *smu,
|
|||||||
uint32_t *feature_mask, uint32_t num)
|
uint32_t *feature_mask, uint32_t num)
|
||||||
{
|
{
|
||||||
uint32_t feature_mask_high = 0, feature_mask_low = 0;
|
uint32_t feature_mask_high = 0, feature_mask_low = 0;
|
||||||
|
struct smu_feature *feature = &smu->smu_feature;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!feature_mask || num < 2)
|
if (!feature_mask || num < 2)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = smu_send_smc_msg(smu, SMU_MSG_GetEnabledSmuFeaturesHigh);
|
if (bitmap_empty(feature->enabled, feature->feature_num)) {
|
||||||
if (ret)
|
ret = smu_send_smc_msg(smu, SMU_MSG_GetEnabledSmuFeaturesHigh);
|
||||||
return ret;
|
if (ret)
|
||||||
ret = smu_read_smc_arg(smu, &feature_mask_high);
|
return ret;
|
||||||
if (ret)
|
ret = smu_read_smc_arg(smu, &feature_mask_high);
|
||||||
return ret;
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = smu_send_smc_msg(smu, SMU_MSG_GetEnabledSmuFeaturesLow);
|
ret = smu_send_smc_msg(smu, SMU_MSG_GetEnabledSmuFeaturesLow);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret = smu_read_smc_arg(smu, &feature_mask_low);
|
ret = smu_read_smc_arg(smu, &feature_mask_low);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
feature_mask[0] = feature_mask_low;
|
feature_mask[0] = feature_mask_low;
|
||||||
feature_mask[1] = feature_mask_high;
|
feature_mask[1] = feature_mask_high;
|
||||||
|
} else {
|
||||||
|
bitmap_copy((unsigned long *)feature_mask, feature->enabled,
|
||||||
|
feature->feature_num);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -867,21 +873,24 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
|
|||||||
uint32_t feature_mask[2];
|
uint32_t feature_mask[2];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (smu->pm_enabled) {
|
ret = smu_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
|
||||||
ret = smu_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
|
SMU_MSG_DisableAllSmuFeatures));
|
||||||
SMU_MSG_DisableAllSmuFeatures));
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
|
if (en) {
|
||||||
feature->feature_num);
|
ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
|
||||||
bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
|
if (ret)
|
||||||
feature->feature_num);
|
return ret;
|
||||||
|
|
||||||
|
bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
|
||||||
|
feature->feature_num);
|
||||||
|
bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
|
||||||
|
feature->feature_num);
|
||||||
|
} else {
|
||||||
|
bitmap_zero(feature->enabled, feature->feature_num);
|
||||||
|
bitmap_zero(feature->supported, feature->feature_num);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user