drm/amd/pm: Add ip version check for smu_v13_0_12 functions
authorAsad Kamal <asad.kamal@amd.com>
Thu, 20 Mar 2025 07:31:59 +0000 (15:31 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Apr 2025 22:08:16 +0000 (18:08 -0400)
Add ip version check to use smu_v13_0_12 specific functions

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

index 8d845b5..96fb6c1 100644 (file)
@@ -748,7 +748,8 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu)
        int ret, i, retry = 100;
        uint32_t table_version;
 
-       if (smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
+       if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12) &&
+           smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
                return smu_v13_0_12_setup_driver_pptable(smu);
 
        /* Store one-time values in driver PPTable */
@@ -1131,7 +1132,8 @@ static int smu_v13_0_6_get_smu_metrics_data(struct smu_context *smu,
        if (ret)
                return ret;
 
-       if (smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
+       if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12) &&
+           smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
                return smu_v13_0_12_get_smu_metrics_data(smu, member, value);
 
        /* For clocks with multiple instances, only report the first one */
@@ -2496,7 +2498,8 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
                return ret;
        }
 
-       if (smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
+       if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12) &&
+           smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
                return smu_v13_0_12_get_gpu_metrics(smu, table);
 
        metrics_v1 = (MetricsTableV1_t *)metrics_v0;