drm/amd/powerplay: enable swSMU mgpu fan boost support
authorEvan Quan <evan.quan@amd.com>
Wed, 12 Aug 2020 04:08:56 +0000 (12:08 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Aug 2020 20:22:40 +0000 (16:22 -0400)
Enable mgpu fan boost feature on swSMU routines.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h

index 27417f8..240c440 100644 (file)
@@ -1222,9 +1222,12 @@ int amdgpu_dpm_enable_mgpu_fan_boost(struct amdgpu_device *adev)
        void *pp_handle = adev->powerplay.pp_handle;
        const struct amd_pm_funcs *pp_funcs =
                        adev->powerplay.pp_funcs;
+       struct smu_context *smu = &adev->smu;
        int ret = 0;
 
-       if (pp_funcs && pp_funcs->enable_mgpu_fan_boost)
+       if (is_support_sw_smu(adev))
+               ret = smu_enable_mgpu_fan_boost(smu);
+       else if (pp_funcs && pp_funcs->enable_mgpu_fan_boost)
                ret = pp_funcs->enable_mgpu_fan_boost(pp_handle);
 
        return ret;
index 1ffacc7..f87a73c 100644 (file)
@@ -2652,3 +2652,20 @@ ssize_t smu_sys_get_gpu_metrics(struct smu_context *smu,
 
        return size;
 }
+
+int smu_enable_mgpu_fan_boost(struct smu_context *smu)
+{
+       int ret = 0;
+
+       if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+               return -EOPNOTSUPP;
+
+       mutex_lock(&smu->mutex);
+
+       if (smu->ppt_funcs->enable_mgpu_fan_boost)
+               ret = smu->ppt_funcs->enable_mgpu_fan_boost(smu);
+
+       mutex_unlock(&smu->mutex);
+
+       return ret;
+}
index 23c2279..bbe4a34 100644 (file)
@@ -595,6 +595,7 @@ struct pptable_funcs {
        size_t (*get_pp_feature_mask)(struct smu_context *smu, char *buf);
        int (*set_pp_feature_mask)(struct smu_context *smu, uint64_t new_mask);
        ssize_t (*get_gpu_metrics)(struct smu_context *smu, void **table);
+       int (*enable_mgpu_fan_boost)(struct smu_context *smu);
 };
 
 typedef enum {
@@ -799,5 +800,7 @@ int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value);
 
 ssize_t smu_sys_get_gpu_metrics(struct smu_context *smu, void **table);
 
+int smu_enable_mgpu_fan_boost(struct smu_context *smu);
+
 #endif
 #endif