<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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:11pt;color:#0078D7;margin:5pt;" 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);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Evan Quan <evan.quan@amd.com><br>
<b>Sent:</b> Monday, March 22, 2021 2:11 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/pm: drop redundant and unneeded BACO APIs V2</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Use other APIs which are with the same functionality but much<br>
more clean.<br>
<br>
V2: drop mediate unneeded interface<br>
<br>
Change-Id: I5e9e0ab5d39b49b02434f18e12392b13931396be<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/nv.c | 25 +-----<br>
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 9 ---<br>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 95 -----------------------<br>
3 files changed, 3 insertions(+), 126 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c<br>
index e9cc3201054f..46d4bbabce75 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/nv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c<br>
@@ -515,21 +515,9 @@ static int nv_asic_mode2_reset(struct amdgpu_device *adev)<br>
return ret;<br>
}<br>
<br>
-static bool nv_asic_supports_baco(struct amdgpu_device *adev)<br>
-{<br>
- struct smu_context *smu = &adev->smu;<br>
-<br>
- if (smu_baco_is_support(smu))<br>
- return true;<br>
- else<br>
- return false;<br>
-}<br>
-<br>
static enum amd_reset_method<br>
nv_asic_reset_method(struct amdgpu_device *adev)<br>
{<br>
- struct smu_context *smu = &adev->smu;<br>
-<br>
if (amdgpu_reset_method == AMD_RESET_METHOD_MODE1 ||<br>
amdgpu_reset_method == AMD_RESET_METHOD_MODE2 ||<br>
amdgpu_reset_method == AMD_RESET_METHOD_BACO ||<br>
@@ -548,7 +536,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)<br>
case CHIP_DIMGREY_CAVEFISH:<br>
return AMD_RESET_METHOD_MODE1;<br>
default:<br>
- if (smu_baco_is_support(smu))<br>
+ if (amdgpu_dpm_is_baco_supported(adev))<br>
return AMD_RESET_METHOD_BACO;<br>
else<br>
return AMD_RESET_METHOD_MODE1;<br>
@@ -558,7 +546,6 @@ nv_asic_reset_method(struct amdgpu_device *adev)<br>
static int nv_asic_reset(struct amdgpu_device *adev)<br>
{<br>
int ret = 0;<br>
- struct smu_context *smu = &adev->smu;<br>
<br>
switch (nv_asic_reset_method(adev)) {<br>
case AMD_RESET_METHOD_PCI:<br>
@@ -567,13 +554,7 @@ static int nv_asic_reset(struct amdgpu_device *adev)<br>
break;<br>
case AMD_RESET_METHOD_BACO:<br>
dev_info(adev->dev, "BACO reset\n");<br>
-<br>
- ret = smu_baco_enter(smu);<br>
- if (ret)<br>
- return ret;<br>
- ret = smu_baco_exit(smu);<br>
- if (ret)<br>
- return ret;<br>
+ ret = amdgpu_dpm_baco_reset(adev);<br>
break;<br>
case AMD_RESET_METHOD_MODE2:<br>
dev_info(adev->dev, "MODE2 reset\n");<br>
@@ -981,7 +962,7 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =<br>
.need_full_reset = &nv_need_full_reset,<br>
.need_reset_on_init = &nv_need_reset_on_init,<br>
.get_pcie_replay_count = &nv_get_pcie_replay_count,<br>
- .supports_baco = &nv_asic_supports_baco,<br>
+ .supports_baco = &amdgpu_dpm_is_baco_supported,<br>
.pre_asic_init = &nv_pre_asic_init,<br>
.update_umd_stable_pstate = &nv_update_umd_stable_pstate,<br>
.query_video_codecs = &nv_query_video_codecs,<br>
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
index 517f333fbc4b..02675155028d 100644<br>
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
@@ -1285,15 +1285,6 @@ int smu_get_power_limit(struct smu_context *smu,<br>
uint32_t *limit,<br>
enum smu_ppt_limit_level limit_level);<br>
<br>
-int smu_set_azalia_d3_pme(struct smu_context *smu);<br>
-<br>
-bool smu_baco_is_support(struct smu_context *smu);<br>
-<br>
-int smu_baco_get_state(struct smu_context *smu, enum smu_baco_state *state);<br>
-<br>
-int smu_baco_enter(struct smu_context *smu);<br>
-int smu_baco_exit(struct smu_context *smu);<br>
-<br>
bool smu_mode1_reset_is_support(struct smu_context *smu);<br>
bool smu_mode2_reset_is_support(struct smu_context *smu);<br>
int smu_mode1_reset(struct smu_context *smu);<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
index 4120d28f782b..1bb0c0966e3d 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
@@ -2682,48 +2682,6 @@ static int smu_set_xgmi_pstate(void *handle,<br>
return ret;<br>
}<br>
<br>
-int smu_set_azalia_d3_pme(struct smu_context *smu)<br>
-{<br>
- int ret = 0;<br>
-<br>
- if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)<br>
- return -EOPNOTSUPP;<br>
-<br>
- mutex_lock(&smu->mutex);<br>
-<br>
- if (smu->ppt_funcs->set_azalia_d3_pme)<br>
- ret = smu->ppt_funcs->set_azalia_d3_pme(smu);<br>
-<br>
- mutex_unlock(&smu->mutex);<br>
-<br>
- return ret;<br>
-}<br>
-<br>
-/*<br>
- * On system suspending or resetting, the dpm_enabled<br>
- * flag will be cleared. So that those SMU services which<br>
- * are not supported will be gated.<br>
- *<br>
- * However, the baco/mode1 reset should still be granted<br>
- * as they are still supported and necessary.<br>
- */<br>
-bool smu_baco_is_support(struct smu_context *smu)<br>
-{<br>
- bool ret = false;<br>
-<br>
- if (!smu->pm_enabled)<br>
- return false;<br>
-<br>
- mutex_lock(&smu->mutex);<br>
-<br>
- if (smu->ppt_funcs && smu->ppt_funcs->baco_is_support)<br>
- ret = smu->ppt_funcs->baco_is_support(smu);<br>
-<br>
- mutex_unlock(&smu->mutex);<br>
-<br>
- return ret;<br>
-}<br>
-<br>
static int smu_get_baco_capability(void *handle, bool *cap)<br>
{<br>
struct smu_context *smu = handle;<br>
@@ -2744,59 +2702,6 @@ static int smu_get_baco_capability(void *handle, bool *cap)<br>
return ret;<br>
}<br>
<br>
-<br>
-int smu_baco_get_state(struct smu_context *smu, enum smu_baco_state *state)<br>
-{<br>
- if (smu->ppt_funcs->baco_get_state)<br>
- return -EINVAL;<br>
-<br>
- mutex_lock(&smu->mutex);<br>
- *state = smu->ppt_funcs->baco_get_state(smu);<br>
- mutex_unlock(&smu->mutex);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
-int smu_baco_enter(struct smu_context *smu)<br>
-{<br>
- int ret = 0;<br>
-<br>
- if (!smu->pm_enabled)<br>
- return -EOPNOTSUPP;<br>
-<br>
- mutex_lock(&smu->mutex);<br>
-<br>
- if (smu->ppt_funcs->baco_enter)<br>
- ret = smu->ppt_funcs->baco_enter(smu);<br>
-<br>
- mutex_unlock(&smu->mutex);<br>
-<br>
- if (ret)<br>
- dev_err(smu->adev->dev, "Failed to enter BACO state!\n");<br>
-<br>
- return ret;<br>
-}<br>
-<br>
-int smu_baco_exit(struct smu_context *smu)<br>
-{<br>
- int ret = 0;<br>
-<br>
- if (!smu->pm_enabled)<br>
- return -EOPNOTSUPP;<br>
-<br>
- mutex_lock(&smu->mutex);<br>
-<br>
- if (smu->ppt_funcs->baco_exit)<br>
- ret = smu->ppt_funcs->baco_exit(smu);<br>
-<br>
- mutex_unlock(&smu->mutex);<br>
-<br>
- if (ret)<br>
- dev_err(smu->adev->dev, "Failed to exit BACO state!\n");<br>
-<br>
- return ret;<br>
-}<br>
-<br>
static int smu_baco_set_state(void *handle, int state)<br>
{<br>
struct smu_context *smu = handle;<br>
-- <br>
2.29.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7Cda2f33ff4e934846b74508d8ecf9584a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637519902972470482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=A5gcNSzu1elCbA8Xc6UB3wbKI0a1cIOvedgAzpVlMQs%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7Cda2f33ff4e934846b74508d8ecf9584a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637519902972470482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=A5gcNSzu1elCbA8Xc6UB3wbKI0a1cIOvedgAzpVlMQs%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>