drm/amdgpu: Disable DPM in virtualization
authorTrigger Huang <trigger.huang@amd.com>
Wed, 16 Nov 2016 15:13:45 +0000 (10:13 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Nov 2016 20:08:46 +0000 (15:08 -0500)
This patch is used for virtualization support. In virtualization,
only SMU manager is needed, DPM should be disabled. This is a
use case for commit 2f9346b6f984
("drm/amdgpu/powerplay: pp module only enable smu when dpm disabled.")

Signed-off-by: Trigger Huang <trigger.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
drivers/gpu/drm/amd/powerplay/amd_powerplay.c

index e2f0507eaac1a7aa307ee705dde1ff7bcc9be7ee..fc592c2b0e166825100c1908691f02ac2f49a642 100644 (file)
@@ -184,7 +184,7 @@ static int amdgpu_pp_hw_init(void *handle)
                ret = adev->powerplay.ip_funcs->hw_init(
                                        adev->powerplay.pp_handle);
 
-       if (amdgpu_dpm != 0)
+       if ((amdgpu_dpm != 0) && !amdgpu_sriov_vf(adev))
                adev->pm.dpm_enabled = true;
 
        return ret;
index 4a4f97b37dcb029bc8df1ad3b8fafb016023d643..51a36077b9939bc52f2c2c9ea0700b9c2bcaa744 100644 (file)
@@ -911,7 +911,8 @@ static int amd_pp_instance_init(struct amd_pp_init *pp_init,
 
        amd_pp->pp_handle = handle;
 
-       if (amdgpu_dpm == 0)
+       if ((amdgpu_dpm == 0)
+               || cgs_is_virtualization_enabled(pp_init->device))
                return 0;
 
        ret = hwmgr_init(pp_init, handle);
@@ -940,7 +941,8 @@ static int amd_pp_instance_fini(void *handle)
        if (instance == NULL)
                return -EINVAL;
 
-       if (amdgpu_dpm != 0) {
+       if ((amdgpu_dpm != 0)
+               && !cgs_is_virtualization_enabled(instance->smu_mgr->device)) {
                eventmgr_fini(instance->eventmgr);
                hwmgr_fini(instance->hwmgr);
        }
@@ -1004,7 +1006,8 @@ int amd_powerplay_reset(void *handle)
 
        hw_init_power_state_table(instance->hwmgr);
 
-       if (amdgpu_dpm == 0)
+       if ((amdgpu_dpm == 0)
+               || cgs_is_virtualization_enabled(instance->smu_mgr->device))
                return 0;
 
        if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL)