<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:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</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> Friday, March 27, 2020 3:57 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 2/2] drm/amd/powerplay: move the ASIC specific nbio operation out of smu_v11_0.c</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This is ASIC specific and should be placed in _ppt.c of each ASIC.<br>
<br>
Change-Id: If2b29ccf0dfc0dc90e1636a806b13ce2efed58c6<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 15 ++++++++++++++-<br>
drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 18 ++++++++++++++++--<br>
drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 10 +---------<br>
drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 14 +++++++++++++-<br>
4 files changed, 44 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
index c6d3bef15320..5db8c56066ee 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
@@ -35,6 +35,7 @@<br>
#include "arcturus_ppt.h"<br>
#include "smu_v11_0_pptable.h"<br>
#include "arcturus_ppsmc.h"<br>
+#include "nbio/nbio_7_4_offset.h"<br>
#include "nbio/nbio_7_4_sh_mask.h"<br>
#include "amdgpu_xgmi.h"<br>
#include <linux/i2c.h><br>
@@ -2210,6 +2211,18 @@ static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)<br>
i2c_del_adapter(control);<br>
}<br>
<br>
+static bool arcturus_is_baco_supported(struct smu_context *smu)<br>
+{<br>
+ struct amdgpu_device *adev = smu->adev;<br>
+ uint32_t val;<br>
+<br>
+ if (!smu_v11_0_baco_is_support(smu))<br>
+ return false;<br>
+<br>
+ val = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP0);<br>
+ return (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : false;<br>
+}<br>
+<br>
static uint32_t arcturus_get_pptable_power_limit(struct smu_context *smu)<br>
{<br>
PPTable_t *pptable = smu->smu_table.driver_pptable;<br>
@@ -2321,7 +2334,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {<br>
.register_irq_handler = smu_v11_0_register_irq_handler,<br>
.set_azalia_d3_pme = smu_v11_0_set_azalia_d3_pme,<br>
.get_max_sustainable_clocks_by_dc = smu_v11_0_get_max_sustainable_clocks_by_dc,<br>
- .baco_is_support= smu_v11_0_baco_is_support,<br>
+ .baco_is_support= arcturus_is_baco_supported,<br>
.baco_get_state = smu_v11_0_baco_get_state,<br>
.baco_set_state = smu_v11_0_baco_set_state,<br>
.baco_enter = smu_v11_0_baco_enter,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
index 1112e4c5f4d7..c94270f7c198 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
@@ -28,13 +28,15 @@<br>
#include "smu_internal.h"<br>
#include "atomfirmware.h"<br>
#include "amdgpu_atomfirmware.h"<br>
+#include "soc15_common.h"<br>
#include "smu_v11_0.h"<br>
#include "smu11_driver_if_navi10.h"<br>
#include "atom.h"<br>
#include "navi10_ppt.h"<br>
#include "smu_v11_0_pptable.h"<br>
#include "smu_v11_0_ppsmc.h"<br>
-#include "nbio/nbio_7_4_sh_mask.h"<br>
+#include "nbio/nbio_2_3_offset.h"<br>
+#include "nbio/nbio_2_3_sh_mask.h"<br>
<br>
#include "asic_reg/mp/mp_11_0_sh_mask.h"<br>
<br>
@@ -1942,6 +1944,18 @@ static int navi10_setup_od_limits(struct smu_context *smu) {<br>
return 0;<br>
}<br>
<br>
+static bool navi10_is_baco_supported(struct smu_context *smu)<br>
+{<br>
+ struct amdgpu_device *adev = smu->adev;<br>
+ uint32_t val;<br>
+<br>
+ if (!smu_v11_0_baco_is_support(smu))<br>
+ return false;<br>
+<br>
+ val = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP0);<br>
+ return (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : false;<br>
+}<br>
+<br>
static int navi10_set_default_od_settings(struct smu_context *smu, bool initialize) {<br>
OverDriveTable_t *od_table, *boot_od_table;<br>
int ret = 0;<br>
@@ -2318,7 +2332,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {<br>
.register_irq_handler = smu_v11_0_register_irq_handler,<br>
.set_azalia_d3_pme = smu_v11_0_set_azalia_d3_pme,<br>
.get_max_sustainable_clocks_by_dc = smu_v11_0_get_max_sustainable_clocks_by_dc,<br>
- .baco_is_support= smu_v11_0_baco_is_support,<br>
+ .baco_is_support= navi10_is_baco_supported,<br>
.baco_get_state = smu_v11_0_baco_get_state,<br>
.baco_set_state = smu_v11_0_baco_set_state,<br>
.baco_enter = smu_v11_0_baco_enter,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
index 31b93cff19d5..655ba4fb05dc 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
@@ -42,8 +42,6 @@<br>
#include "asic_reg/thm/thm_11_0_2_sh_mask.h"<br>
#include "asic_reg/mp/mp_11_0_offset.h"<br>
#include "asic_reg/mp/mp_11_0_sh_mask.h"<br>
-#include "asic_reg/nbio/nbio_7_4_offset.h"<br>
-#include "asic_reg/nbio/nbio_7_4_sh_mask.h"<br>
#include "asic_reg/smuio/smuio_11_0_0_offset.h"<br>
#include "asic_reg/smuio/smuio_11_0_0_sh_mask.h"<br>
<br>
@@ -1662,9 +1660,7 @@ static int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu, enum smu_v<br>
<br>
bool smu_v11_0_baco_is_support(struct smu_context *smu)<br>
{<br>
- struct amdgpu_device *adev = smu->adev;<br>
struct smu_baco_context *smu_baco = &smu->smu_baco;<br>
- uint32_t val;<br>
bool baco_support;<br>
<br>
mutex_lock(&smu_baco->mutex);<br>
@@ -1679,11 +1675,7 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)<br>
!smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))<br>
return false;<br>
<br>
- val = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP0);<br>
- if (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK)<br>
- return true;<br>
-<br>
- return false;<br>
+ return true;<br>
}<br>
<br>
enum smu_baco_state smu_v11_0_baco_get_state(struct smu_context *smu)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
index 49ff3756bd9f..3f1044326dcb 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
@@ -35,6 +35,7 @@<br>
#include "vega20_ppt.h"<br>
#include "vega20_pptable.h"<br>
#include "vega20_ppsmc.h"<br>
+#include "nbio/nbio_7_4_offset.h"<br>
#include "nbio/nbio_7_4_sh_mask.h"<br>
#include "asic_reg/thm/thm_11_0_2_offset.h"<br>
#include "asic_reg/thm/thm_11_0_2_sh_mask.h"<br>
@@ -3174,6 +3175,17 @@ static int vega20_update_pcie_parameters(struct smu_context *smu,<br>
return ret;<br>
}<br>
<br>
+static bool vega20_is_baco_supported(struct smu_context *smu)<br>
+{<br>
+ struct amdgpu_device *adev = smu->adev;<br>
+ uint32_t val;<br>
+<br>
+ if (!smu_v11_0_baco_is_support(smu))<br>
+ return false;<br>
+<br>
+ val = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP0);<br>
+ return (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : false;<br>
+}<br>
<br>
static const struct pptable_funcs vega20_ppt_funcs = {<br>
.tables_init = vega20_tables_init,<br>
@@ -3262,7 +3274,7 @@ static const struct pptable_funcs vega20_ppt_funcs = {<br>
.register_irq_handler = smu_v11_0_register_irq_handler,<br>
.set_azalia_d3_pme = smu_v11_0_set_azalia_d3_pme,<br>
.get_max_sustainable_clocks_by_dc = smu_v11_0_get_max_sustainable_clocks_by_dc,<br>
- .baco_is_support= smu_v11_0_baco_is_support,<br>
+ .baco_is_support= vega20_is_baco_supported,<br>
.baco_get_state = smu_v11_0_baco_get_state,<br>
.baco_set_state = smu_v11_0_baco_set_state,<br>
.baco_enter = smu_v11_0_baco_enter,<br>
-- <br>
2.26.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=02%7C01%7Calexander.deucher%40amd.com%7Ccb038ac52dd74c4deb8b08d7d2247db2%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637208926495509214&sdata=RWdMDhBZwNdo5bjDkf1RQXahEuulClXOCtwKD5i3fmw%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7Ccb038ac52dd74c4deb8b08d7d2247db2%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637208926495509214&sdata=RWdMDhBZwNdo5bjDkf1RQXahEuulClXOCtwKD5i3fmw%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>