aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorYintian Tao <yttao@amd.com>2019-04-09 08:33:20 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-04-10 14:53:27 -0400
commitbb5a2bdf36a8df79e1437b443299b7fe1ea3abfc (patch)
tree74af2ad9ead13464b323b6c22d95453af597dd87 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parentb0960c3592a39f1cc6fcab1793158f3850f72c77 (diff)
drm/amdgpu: support dpm level modification under virtualization v3
Under vega10 virtualuzation, smu ip block will not be added. Therefore, we need add pp clk query and force dpm level function at amdgpu_virt_ops to support the feature. v2: add get_pp_clk existence check and use kzalloc to allocate buf v3: return -ENOMEM for allocation failure and correct the coding style Signed-off-by: Yintian Tao <yttao@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 88362019d1dd..4b7a076eea9c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -327,6 +327,18 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
327 goto fail; 327 goto fail;
328 } 328 }
329 329
330 if (amdgpu_sriov_vf(adev)) {
331 if (amdgim_is_hwperf(adev) &&
332 adev->virt.ops->force_dpm_level) {
333 mutex_lock(&adev->pm.mutex);
334 adev->virt.ops->force_dpm_level(adev, level);
335 mutex_unlock(&adev->pm.mutex);
336 return count;
337 } else {
338 return -EINVAL;
339 }
340 }
341
330 if (current_level == level) 342 if (current_level == level)
331 return count; 343 return count;
332 344
@@ -790,6 +802,10 @@ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,
790 struct drm_device *ddev = dev_get_drvdata(dev); 802 struct drm_device *ddev = dev_get_drvdata(dev);
791 struct amdgpu_device *adev = ddev->dev_private; 803 struct amdgpu_device *adev = ddev->dev_private;
792 804
805 if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) &&
806 adev->virt.ops->get_pp_clk)
807 return adev->virt.ops->get_pp_clk(adev, PP_SCLK, buf);
808
793 if (is_support_sw_smu(adev)) 809 if (is_support_sw_smu(adev))
794 return smu_print_clk_levels(&adev->smu, PP_SCLK, buf); 810 return smu_print_clk_levels(&adev->smu, PP_SCLK, buf);
795 else if (adev->powerplay.pp_funcs->print_clock_levels) 811 else if (adev->powerplay.pp_funcs->print_clock_levels)