[PATCH 2/3] drm/amd: Introduce new enum for BAMACO
Lazar, Lijo
lijo.lazar at amd.com
Wed Nov 29 10:55:18 UTC 2023
On 11/29/2023 12:22 AM, Mario Limonciello wrote:
> Rather than plumbing module parameter deep into IP declare BAMACO
> runpm mode at amdgpu_driver_set_runtime_pm_mode() and then detect
> this mode in consumers.
>
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
> drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 1 +
> drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 +-
> drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 5 +++--
> 4 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 29381da08fd5..c6c87ab71d94 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -143,7 +143,7 @@ static void amdgpu_driver_set_runtime_pm_mode(struct amdgpu_device *adev)
> case 2:
> // TODO: adjust plumbing to be able to pull PP table to check MACO support as well
> if (amdgpu_device_supports_baco(dev))
> - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
> + adev->pm.rpm_mode = AMDGPU_RUNPM_BAMACO;
> else
> dev_err(adev->dev, "BAMACO is not supported on this ASIC\n");
> return;
> diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> index d76b0a60db44..3434c31b434b 100644
> --- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> +++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> @@ -50,6 +50,7 @@ enum amdgpu_runpm_mode {
> AMDGPU_RUNPM_PX,
> AMDGPU_RUNPM_BOCO,
> AMDGPU_RUNPM_BACO,
> + AMDGPU_RUNPM_BAMACO,
> };
>
> struct amdgpu_ps {
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> index 5a314d0316c1..64c8783b4118 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> @@ -1597,7 +1597,7 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state)
> case IP_VERSION(11, 0, 11):
> case IP_VERSION(11, 0, 12):
> case IP_VERSION(11, 0, 13):
> - if (amdgpu_runtime_pm == 2)
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)
> ret = smu_cmn_send_smc_msg_with_param(smu,
> SMU_MSG_EnterBaco,
> D3HOT_BAMACO_SEQUENCE,
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> index 3c595ac897d6..b77763d6c72f 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> @@ -2259,7 +2259,8 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
> if (state == SMU_BACO_STATE_ENTER) {
> ret = smu_cmn_send_smc_msg_with_param(smu,
> SMU_MSG_EnterBaco,
> - (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
> + (smu_baco->maco_support &&
> + adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO) ?
This also doesn't work as per the legacy logic. In legacy logic, BAMACO
is given preference if supported or if BACO is not forced when both are
supported. As per the new logic, BAMACO is preferred only if forced
through module param.
Thanks,
Lijo
> BACO_SEQ_BAMACO : BACO_SEQ_BACO,
> NULL);
> } else {
> @@ -2288,7 +2289,7 @@ int smu_v13_0_baco_enter(struct smu_context *smu)
>
> if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
> return smu_v13_0_baco_set_armd3_sequence(smu,
> - (smu_baco->maco_support && amdgpu_runtime_pm != 1) ?
> + (smu_baco->maco_support && adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO) ?
> BACO_SEQ_BAMACO : BACO_SEQ_BACO);
> } else {
> ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_ENTER);
More information about the amd-gfx
mailing list