]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/pm: Add VCN reset support check capability
authorJesse.Zhang <Jesse.Zhang@amd.com>
Wed, 13 Aug 2025 02:36:58 +0000 (10:36 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Aug 2025 17:04:25 +0000 (13:04 -0400)
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>
drivers/gpu/drm/amd/pm/amdgpu_dpm.c
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h

index 6e0d711820ea6d8a3aaf758646ef4cdab215dc1c..518d07afc7df2e181ace853bb09151d900ebf0aa 100644 (file)
@@ -820,6 +820,21 @@ int amdgpu_dpm_reset_vcn(struct amdgpu_device *adev, uint32_t inst_mask)
        return ret;
 }
 
+bool amdgpu_dpm_reset_vcn_is_supported(struct amdgpu_device *adev)
+{
+       struct smu_context *smu = adev->powerplay.pp_handle;
+       bool ret;
+
+       if (!is_support_sw_smu(adev))
+               return false;
+
+       mutex_lock(&adev->pm.mutex);
+       ret = smu_reset_vcn_is_supported(smu);
+       mutex_unlock(&adev->pm.mutex);
+
+       return ret;
+}
+
 int amdgpu_dpm_get_dpm_freq_range(struct amdgpu_device *adev,
                                  enum pp_clock_type type,
                                  uint32_t *min,
index 09962db988d66b56b75042c2d7f503419fbcfe2d..9748744133d961233dc44e352c71d0bc6b22a501 100644 (file)
@@ -615,6 +615,7 @@ ssize_t amdgpu_dpm_get_pm_policy_info(struct amdgpu_device *adev,
 int amdgpu_dpm_reset_sdma(struct amdgpu_device *adev, uint32_t inst_mask);
 bool amdgpu_dpm_reset_sdma_is_supported(struct amdgpu_device *adev);
 int amdgpu_dpm_reset_vcn(struct amdgpu_device *adev, uint32_t inst_mask);
+bool amdgpu_dpm_reset_vcn_is_supported(struct amdgpu_device *adev);
 bool amdgpu_dpm_is_temp_metrics_supported(struct amdgpu_device *adev,
                                          enum smu_temp_metric_type type);
 
index 0a40ab817634f135078c8285fc4602bec61dc739..c5965924e7c6a2155bc675ffc8cbc9243ba80f24 100644 (file)
@@ -4124,6 +4124,16 @@ int smu_reset_sdma(struct smu_context *smu, uint32_t inst_mask)
        return ret;
 }
 
+bool smu_reset_vcn_is_supported(struct smu_context *smu)
+{
+       bool ret = false;
+
+       if (smu->ppt_funcs && smu->ppt_funcs->reset_vcn_is_supported)
+               ret = smu->ppt_funcs->reset_vcn_is_supported(smu);
+
+       return ret;
+}
+
 int smu_reset_vcn(struct smu_context *smu, uint32_t inst_mask)
 {
        if (smu->ppt_funcs && smu->ppt_funcs->dpm_reset_vcn)
index 2edd867f203e96b946f33aab63813e548af9f64e..5dd49eca598d68d25b81efadf7f331d8c8c7d3fd 100644 (file)
@@ -1435,6 +1435,10 @@ struct pptable_funcs {
         * @reset_vcn: message SMU to soft reset vcn instance.
         */
        int (*dpm_reset_vcn)(struct smu_context *smu, uint32_t inst_mask);
+       /**
+        * @reset_vcn_is_supported: Check if support resets vcn.
+        */
+       bool (*reset_vcn_is_supported)(struct smu_context *smu);
 
        /**
         * @get_ecc_table:  message SMU to get ECC INFO table.
@@ -1776,6 +1780,7 @@ int smu_send_rma_reason(struct smu_context *smu);
 int smu_reset_sdma(struct smu_context *smu, uint32_t inst_mask);
 bool smu_reset_sdma_is_supported(struct smu_context *smu);
 int smu_reset_vcn(struct smu_context *smu, uint32_t inst_mask);
+bool smu_reset_vcn_is_supported(struct smu_context *smu);
 int smu_set_pm_policy(struct smu_context *smu, enum pp_pm_policy p_type,
                      int level);
 ssize_t smu_get_pm_policy_info(struct smu_context *smu,