[PATCH v3] drm/amd/pm: only poweron/off vcn/jpeg when they are valid.
Quan, Evan
Evan.Quan at amd.com
Thu Aug 31 07:15:39 UTC 2023
[AMD Official Use Only - General]
> -----Original Message-----
> From: Zhang, Yifan <Yifan1.Zhang at amd.com>
> Sent: Thursday, August 31, 2023 2:27 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Quan, Evan <Evan.Quan at amd.com>; Ma, Li <Li.Ma at amd.com>; Zhang,
> Yifan <Yifan1.Zhang at amd.com>
> Subject: [PATCH v3] drm/amd/pm: only poweron/off vcn/jpeg when they are
> valid.
>
> If vcn is disabled in kernel parameters, don't touch vcn,
> otherwise it may cause vcn hang.
>
> v2: delete unnecessary logs
> v3: move "is_vcn_enabled" check to smu_dpm_setvcn/jpeg_enable (Evan)
>
> Signed-off-by: Yifan Zhang <yifan1.zhang at amd.com>
> ---
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 24
> +++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index f005a90c35af..e3e1f69643ce 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -215,6 +215,21 @@ static int smu_set_gfx_imu_enable(struct
> smu_context *smu)
> return smu_set_gfx_power_up_by_imu(smu);
> }
>
> +static bool is_vcn_enabled(struct amdgpu_device *adev)
> +{
> + int i;
> +
> + for (i = 0; i < adev->num_ip_blocks; i++) {
> + if ((adev->ip_blocks[i].version->type ==
> AMD_IP_BLOCK_TYPE_VCN ||
> + adev->ip_blocks[i].version->type ==
> AMD_IP_BLOCK_TYPE_JPEG) &&
> + !adev->ip_blocks[i].status.valid)
> +
There seems an extra empty line here. With this dropped, the patch is reviewed-by: Evan Quan <evan.quan at amd.com>
Evan
> + return false;
> + }
> +
> + return true;
> +}
> +
> static int smu_dpm_set_vcn_enable(struct smu_context *smu,
> bool enable)
> {
> @@ -222,6 +237,12 @@ static int smu_dpm_set_vcn_enable(struct
> smu_context *smu,
> struct smu_power_gate *power_gate = &smu_power->power_gate;
> int ret = 0;
>
> + /*
> + * don't poweron vcn/jpeg when they are skipped.
> + */
> + if (!is_vcn_enabled(smu->adev))
> + return 0;
> +
> if (!smu->ppt_funcs->dpm_set_vcn_enable)
> return 0;
>
> @@ -242,6 +263,9 @@ static int smu_dpm_set_jpeg_enable(struct
> smu_context *smu,
> struct smu_power_gate *power_gate = &smu_power->power_gate;
> int ret = 0;
>
> + if (!is_vcn_enabled(smu->adev))
> + return 0;
> +
> if (!smu->ppt_funcs->dpm_set_jpeg_enable)
> return 0;
>
> --
> 2.37.3
More information about the amd-gfx
mailing list