[PATCH 06/12] drm/amd/pm: correct the checks for sriov(pp_one_vf)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By setting pm_enabled as false for non pp_one_vf sriov case,
we can avoid the check for (amdgpu_sriov_vf(adev) &&
!amdgpu_sriov_is_pp_one_vf(adev)) in every routine.

Signed-off-by: Evan Quan <evan.quan@xxxxxxx>
Change-Id: I3859529183cd26dce98c57dc87eab5273ecc949b
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 97c57a6cf314..8b8feaf7aa0e 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -543,7 +543,8 @@ static int smu_early_init(void *handle)
 		return -ENOMEM;
 
 	smu->adev = adev;
-	smu->pm_enabled = !!amdgpu_dpm;
+	smu->pm_enabled = amdgpu_dpm &&
+			  (!amdgpu_sriov_vf(adev) || amdgpu_sriov_is_pp_one_vf(adev));
 	smu->is_apu = false;
 	smu->smu_baco.state = SMU_BACO_STATE_EXIT;
 	smu->smu_baco.platform_support = false;
@@ -1257,10 +1258,8 @@ static int smu_hw_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = adev->powerplay.pp_handle;
 
-	if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) {
-		smu->pm_enabled = false;
+	if (!smu->pm_enabled)
 		return 0;
-	}
 
 	ret = smu_start_smc_engine(smu);
 	if (ret) {
@@ -1274,9 +1273,6 @@ static int smu_hw_init(void *handle)
 		smu_set_gfx_cgpg(smu, true);
 	}
 
-	if (!smu->pm_enabled)
-		return 0;
-
 	/* get boot_values from vbios to set revision, gfxclk, and etc. */
 	ret = smu_get_vbios_bootup_values(smu);
 	if (ret) {
@@ -1428,7 +1424,7 @@ static int smu_hw_fini(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = adev->powerplay.pp_handle;
 
-	if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
+	if (!smu->pm_enabled)
 		return 0;
 
 	smu_dpm_set_vcn_enable(smu, false);
@@ -1437,9 +1433,6 @@ static int smu_hw_fini(void *handle)
 	adev->vcn.cur_state = AMD_PG_STATE_GATE;
 	adev->jpeg.cur_state = AMD_PG_STATE_GATE;
 
-	if (!smu->pm_enabled)
-		return 0;
-
 	adev->pm.dpm_enabled = false;
 
 	return smu_smc_hw_cleanup(smu);
@@ -1479,9 +1472,6 @@ static int smu_suspend(void *handle)
 	struct smu_context *smu = adev->powerplay.pp_handle;
 	int ret;
 
-	if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
-		return 0;
-
 	if (!smu->pm_enabled)
 		return 0;
 
@@ -1504,9 +1494,6 @@ static int smu_resume(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = adev->powerplay.pp_handle;
 
-	if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
-		return 0;
-
 	if (!smu->pm_enabled)
 		return 0;
 
-- 
2.29.0




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux