<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
send error, please ignore this patch.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kevin</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Sent:</b> Wednesday, May 6, 2020 2:20 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhang, Hawking <Hawking.Zhang@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: cleanup not_vf & pp_not_vf in powerplay</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
---<br>
drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 14 +++++++-------<br>
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 6 +++---<br>
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 +<br>
3 files changed, 11 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
index fc31499c2e5c..5d22a80c4dea 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
@@ -47,7 +47,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)<br>
return -ENOMEM;<br>
<br>
hwmgr->adev = adev;<br>
- hwmgr->not_vf = !amdgpu_sriov_vf(adev);<br>
+ hwmgr->vf_mode = amdgpu_virt_get_sriov_vf_mode(adev);<br>
hwmgr->device = amdgpu_cgs_create_device(adev);<br>
mutex_init(&hwmgr->smu_lock);<br>
mutex_init(&hwmgr->msg_lock);<br>
@@ -1438,12 +1438,12 @@ static int pp_get_asic_baco_capability(void *handle, bool *cap)<br>
if (!hwmgr)<br>
return -EINVAL;<br>
<br>
- if (!(hwmgr->not_vf && amdgpu_dpm) ||<br>
- !hwmgr->hwmgr_func->get_asic_baco_capability)<br>
+ if (!hwmgr->pm_en)<br>
return 0;<br>
<br>
mutex_lock(&hwmgr->smu_lock);<br>
- hwmgr->hwmgr_func->get_asic_baco_capability(hwmgr, cap);<br>
+ if (hwmgr->hwmgr_func->get_asic_baco_capability)<br>
+ hwmgr->hwmgr_func->get_asic_baco_capability(hwmgr, cap);<br>
mutex_unlock(&hwmgr->smu_lock);<br>
<br>
return 0;<br>
@@ -1473,12 +1473,12 @@ static int pp_set_asic_baco_state(void *handle, int state)<br>
if (!hwmgr)<br>
return -EINVAL;<br>
<br>
- if (!(hwmgr->not_vf && amdgpu_dpm) ||<br>
- !hwmgr->hwmgr_func->set_asic_baco_state)<br>
+ if (!hwmgr->pm_en)<br>
return 0;<br>
<br>
mutex_lock(&hwmgr->smu_lock);<br>
- hwmgr->hwmgr_func->set_asic_baco_state(hwmgr, (enum BACO_STATE)state);<br>
+ if (hwmgr->hwmgr_func->set_asic_baco_state)<br>
+ hwmgr->hwmgr_func->set_asic_baco_state(hwmgr, (enum BACO_STATE)state);<br>
mutex_unlock(&hwmgr->smu_lock);<br>
<br>
return 0;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
index f48fdc7f0382..e2379efcd621 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
@@ -221,9 +221,9 @@ int hwmgr_hw_init(struct pp_hwmgr *hwmgr)<br>
{<br>
int ret = 0;<br>
<br>
- hwmgr->pp_one_vf = amdgpu_sriov_is_pp_one_vf((struct amdgpu_device *)hwmgr->adev);<br>
- hwmgr->pm_en = (amdgpu_dpm && (hwmgr->not_vf || hwmgr->pp_one_vf))<br>
- ? true : false;<br>
+ hwmgr->pm_en = (amdgpu_dpm && vf_mode == SRIOV_VF_MODE_NORMAL)<br>
+ ? true : false;<br>
+<br>
if (!hwmgr->pm_en)<br>
return 0;<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
index 15ed6cbdf366..9edb70933c46 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
@@ -742,6 +742,7 @@ struct pp_hwmgr {<br>
bool not_vf;<br>
bool pm_en;<br>
bool pp_one_vf;<br>
+ enum amdgpu_sriov_vf_mode vf_mode;<br>
struct mutex smu_lock;<br>
struct mutex msg_lock;<br>
<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>