Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/pm: power up or down vcn by instance

For smu ip with multiple vcn instances (smu 11/13/14), remove all the
for loop in dpm_set_vcn_enable() functions. And use the instance
argument to power up/down vcn for the given instance only, instead
of powering up/down for all vcn instances.

v2: remove all duplicated functions in v1.

remove for-loop from each ip, and temporarily move to dpm_set_vcn_enable,
in order to keep the exact same logic as before, until further separation
in the next patch.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Boyuan Zhang and committed by
Alex Deucher
8aaf1667 a3300782

+35 -45
+6 -3
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 242 242 { 243 243 struct smu_power_context *smu_power = &smu->smu_power; 244 244 struct smu_power_gate *power_gate = &smu_power->power_gate; 245 + struct amdgpu_device *adev = smu->adev; 245 246 int ret = 0; 246 247 247 248 /* ··· 257 256 if (atomic_read(&power_gate->vcn_gated) ^ enable) 258 257 return 0; 259 258 260 - ret = smu->ppt_funcs->dpm_set_vcn_enable(smu, enable, 0xff); 261 - if (!ret) 262 - atomic_set(&power_gate->vcn_gated, !enable); 259 + for (int i = 0; i < adev->vcn.num_vcn_inst; i++) { 260 + ret = smu->ppt_funcs->dpm_set_vcn_enable(smu, enable, i); 261 + if (ret) 262 + return ret; 263 + } 263 264 264 265 return ret; 265 266 }
+8 -12
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
··· 1157 1157 int inst) 1158 1158 { 1159 1159 struct amdgpu_device *adev = smu->adev; 1160 - int i, ret = 0; 1160 + int ret = 0; 1161 1161 1162 - for (i = 0; i < adev->vcn.num_vcn_inst; i++) { 1163 - if (adev->vcn.harvest_config & (1 << i)) 1164 - continue; 1165 - /* vcn dpm on is a prerequisite for vcn power gate messages */ 1166 - if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) { 1167 - ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1168 - SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, 1169 - 0x10000 * i, NULL); 1170 - if (ret) 1171 - return ret; 1172 - } 1162 + if (adev->vcn.harvest_config & (1 << inst)) 1163 + return ret; 1164 + /* vcn dpm on is a prerequisite for vcn power gate messages */ 1165 + if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) { 1166 + ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1167 + SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, 1168 + 0x10000 * inst, NULL); 1173 1169 } 1174 1170 1175 1171 return ret;
+6 -10
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 2108 2108 int inst) 2109 2109 { 2110 2110 struct amdgpu_device *adev = smu->adev; 2111 - int i, ret = 0; 2111 + int ret = 0; 2112 2112 2113 - for (i = 0; i < adev->vcn.num_vcn_inst; i++) { 2114 - if (adev->vcn.harvest_config & (1 << i)) 2115 - continue; 2113 + if (adev->vcn.harvest_config & (1 << inst)) 2114 + return ret; 2116 2115 2117 - ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 2118 - SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, 2119 - i << 16U, NULL); 2120 - if (ret) 2121 - return ret; 2122 - } 2116 + ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 2117 + SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, 2118 + inst << 16U, NULL); 2123 2119 2124 2120 return ret; 2125 2121 }
+15 -20
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
··· 1511 1511 int inst) 1512 1512 { 1513 1513 struct amdgpu_device *adev = smu->adev; 1514 - int i, ret = 0; 1514 + int ret = 0; 1515 1515 1516 - for (i = 0; i < adev->vcn.num_vcn_inst; i++) { 1517 - if (adev->vcn.harvest_config & (1 << i)) 1518 - continue; 1516 + if (adev->vcn.harvest_config & (1 << inst)) 1517 + return ret; 1519 1518 1520 - if (smu->is_apu) { 1521 - if (i == 0) 1522 - ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1523 - SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0, 1524 - i << 16U, NULL); 1525 - else if (i == 1) 1526 - ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1527 - SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1, 1528 - i << 16U, NULL); 1529 - } else { 1519 + if (smu->is_apu) { 1520 + if (inst == 0) 1530 1521 ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1531 - SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, 1532 - i << 16U, NULL); 1533 - } 1534 - 1535 - if (ret) 1536 - return ret; 1522 + SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0, 1523 + inst << 16U, NULL); 1524 + else if (inst == 1) 1525 + ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1526 + SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1, 1527 + inst << 16U, NULL); 1528 + } else { 1529 + ret = smu_cmn_send_smc_msg_with_param(smu, enable ? 1530 + SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, 1531 + inst << 16U, NULL); 1537 1532 } 1538 1533 1539 1534 return ret;