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

drm/amd/pm: Add VCN reset support check capability

This change introduces infrastructure to check whether VCN reset
is supported by the SMU firmware. Key changes include:

1. Added new functions to query VCN reset support:
- amdgpu_dpm_reset_vcn_is_supported()
- smu_reset_vcn_is_supported()
- pptable_funcs.reset_vcn_is_supported callback

2. Implemented proper locking in the DPM layer with mutex protection

3. Maintained consistency with existing SDMA reset support checks

The new capability allows callers to check for VCN reset support
before attempting the operation, preventing unnecessary attempts
on unsupported platforms.

v2: clean up debug info(Alex)

Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Ruili Ji <ruiliji2@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jesse.Zhang and committed by
Alex Deucher
37b9257b 859958a7

+31
+15
drivers/gpu/drm/amd/pm/amdgpu_dpm.c
··· 820 820 return ret; 821 821 } 822 822 823 + bool amdgpu_dpm_reset_vcn_is_supported(struct amdgpu_device *adev) 824 + { 825 + struct smu_context *smu = adev->powerplay.pp_handle; 826 + bool ret; 827 + 828 + if (!is_support_sw_smu(adev)) 829 + return false; 830 + 831 + mutex_lock(&adev->pm.mutex); 832 + ret = smu_reset_vcn_is_supported(smu); 833 + mutex_unlock(&adev->pm.mutex); 834 + 835 + return ret; 836 + } 837 + 823 838 int amdgpu_dpm_get_dpm_freq_range(struct amdgpu_device *adev, 824 839 enum pp_clock_type type, 825 840 uint32_t *min,
+1
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
··· 615 615 int amdgpu_dpm_reset_sdma(struct amdgpu_device *adev, uint32_t inst_mask); 616 616 bool amdgpu_dpm_reset_sdma_is_supported(struct amdgpu_device *adev); 617 617 int amdgpu_dpm_reset_vcn(struct amdgpu_device *adev, uint32_t inst_mask); 618 + bool amdgpu_dpm_reset_vcn_is_supported(struct amdgpu_device *adev); 618 619 bool amdgpu_dpm_is_temp_metrics_supported(struct amdgpu_device *adev, 619 620 enum smu_temp_metric_type type); 620 621
+10
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 4124 4124 return ret; 4125 4125 } 4126 4126 4127 + bool smu_reset_vcn_is_supported(struct smu_context *smu) 4128 + { 4129 + bool ret = false; 4130 + 4131 + if (smu->ppt_funcs && smu->ppt_funcs->reset_vcn_is_supported) 4132 + ret = smu->ppt_funcs->reset_vcn_is_supported(smu); 4133 + 4134 + return ret; 4135 + } 4136 + 4127 4137 int smu_reset_vcn(struct smu_context *smu, uint32_t inst_mask) 4128 4138 { 4129 4139 if (smu->ppt_funcs && smu->ppt_funcs->dpm_reset_vcn)
+5
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
··· 1435 1435 * @reset_vcn: message SMU to soft reset vcn instance. 1436 1436 */ 1437 1437 int (*dpm_reset_vcn)(struct smu_context *smu, uint32_t inst_mask); 1438 + /** 1439 + * @reset_vcn_is_supported: Check if support resets vcn. 1440 + */ 1441 + bool (*reset_vcn_is_supported)(struct smu_context *smu); 1438 1442 1439 1443 /** 1440 1444 * @get_ecc_table: message SMU to get ECC INFO table. ··· 1780 1776 int smu_reset_sdma(struct smu_context *smu, uint32_t inst_mask); 1781 1777 bool smu_reset_sdma_is_supported(struct smu_context *smu); 1782 1778 int smu_reset_vcn(struct smu_context *smu, uint32_t inst_mask); 1779 + bool smu_reset_vcn_is_supported(struct smu_context *smu); 1783 1780 int smu_set_pm_policy(struct smu_context *smu, enum pp_pm_policy p_type, 1784 1781 int level); 1785 1782 ssize_t smu_get_pm_policy_info(struct smu_context *smu,