[PATCH] drm/amdgpu: cleanup not_vf & pp_not_vf in powerplay

Wang, Kevin(Yang) Kevin1.Wang at amd.com
Wed May 6 06:22:26 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

send error, please ignore this patch.

Best Regards,
Kevin
________________________________
From: Wang, Kevin(Yang) <Kevin1.Wang at amd.com>
Sent: Wednesday, May 6, 2020 2:20 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Liu, Monk <Monk.Liu at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>; Wang, Kevin(Yang) <Kevin1.Wang at amd.com>
Subject: [PATCH] drm/amdgpu: cleanup not_vf & pp_not_vf in powerplay

Signed-off-by: Kevin Wang <kevin1.wang at amd.com>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 14 +++++++-------
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c   |  6 +++---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h     |  1 +
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index fc31499c2e5c..5d22a80c4dea 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -47,7 +47,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)
                 return -ENOMEM;

         hwmgr->adev = adev;
-       hwmgr->not_vf = !amdgpu_sriov_vf(adev);
+       hwmgr->vf_mode = amdgpu_virt_get_sriov_vf_mode(adev);
         hwmgr->device = amdgpu_cgs_create_device(adev);
         mutex_init(&hwmgr->smu_lock);
         mutex_init(&hwmgr->msg_lock);
@@ -1438,12 +1438,12 @@ static int pp_get_asic_baco_capability(void *handle, bool *cap)
         if (!hwmgr)
                 return -EINVAL;

-       if (!(hwmgr->not_vf && amdgpu_dpm) ||
-               !hwmgr->hwmgr_func->get_asic_baco_capability)
+       if (!hwmgr->pm_en)
                 return 0;

         mutex_lock(&hwmgr->smu_lock);
-       hwmgr->hwmgr_func->get_asic_baco_capability(hwmgr, cap);
+       if (hwmgr->hwmgr_func->get_asic_baco_capability)
+               hwmgr->hwmgr_func->get_asic_baco_capability(hwmgr, cap);
         mutex_unlock(&hwmgr->smu_lock);

         return 0;
@@ -1473,12 +1473,12 @@ static int pp_set_asic_baco_state(void *handle, int state)
         if (!hwmgr)
                 return -EINVAL;

-       if (!(hwmgr->not_vf && amdgpu_dpm) ||
-               !hwmgr->hwmgr_func->set_asic_baco_state)
+       if (!hwmgr->pm_en)
                 return 0;

         mutex_lock(&hwmgr->smu_lock);
-       hwmgr->hwmgr_func->set_asic_baco_state(hwmgr, (enum BACO_STATE)state);
+       if (hwmgr->hwmgr_func->set_asic_baco_state)
+               hwmgr->hwmgr_func->set_asic_baco_state(hwmgr, (enum BACO_STATE)state);
         mutex_unlock(&hwmgr->smu_lock);

         return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index f48fdc7f0382..e2379efcd621 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -221,9 +221,9 @@ int hwmgr_hw_init(struct pp_hwmgr *hwmgr)
 {
         int ret = 0;

-       hwmgr->pp_one_vf = amdgpu_sriov_is_pp_one_vf((struct amdgpu_device *)hwmgr->adev);
-       hwmgr->pm_en = (amdgpu_dpm && (hwmgr->not_vf || hwmgr->pp_one_vf))
-                       ? true : false;
+       hwmgr->pm_en = (amdgpu_dpm && vf_mode == SRIOV_VF_MODE_NORMAL)
+               ? true : false;
+
         if (!hwmgr->pm_en)
                 return 0;

diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index 15ed6cbdf366..9edb70933c46 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -742,6 +742,7 @@ struct pp_hwmgr {
         bool not_vf;
         bool pm_en;
         bool pp_one_vf;
+       enum amdgpu_sriov_vf_mode vf_mode;
         struct mutex smu_lock;
         struct mutex msg_lock;

--
2.17.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20200506/aa502d6d/attachment.htm>


More information about the amd-gfx mailing list