<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">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</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> Thursday, December 27, 2018 2:50:38 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Quan, Evan<br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: support BOOTUP_DEFAULT power profile mode</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This can avoid unexpected profile mode change after running<br>
compute workload.<br>
<br>
Change-Id: I138e8747e4f588a6fb38b9c68f765bb653556dc0<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
.../gpu/drm/amd/include/kgd_pp_interface.h | 13 +++++-----<br>
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 24 ++++++++++---------<br>
.../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 8 ++++---<br>
.../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 12 ++++++----<br>
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 10 +++++---<br>
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 +-<br>
6 files changed, 40 insertions(+), 29 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
index 1479ea1dc3e7..789c4f288485 100644<br>
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
@@ -127,12 +127,13 @@ enum amd_pp_task {<br>
};<br>
<br>
enum PP_SMC_POWER_PROFILE {<br>
- PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x0,<br>
- PP_SMC_POWER_PROFILE_POWERSAVING = 0x1,<br>
- PP_SMC_POWER_PROFILE_VIDEO = 0x2,<br>
- PP_SMC_POWER_PROFILE_VR = 0x3,<br>
- PP_SMC_POWER_PROFILE_COMPUTE = 0x4,<br>
- PP_SMC_POWER_PROFILE_CUSTOM = 0x5,<br>
+ PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0,<br>
+ PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1,<br>
+ PP_SMC_POWER_PROFILE_POWERSAVING = 0x2,<br>
+ PP_SMC_POWER_PROFILE_VIDEO = 0x3,<br>
+ PP_SMC_POWER_PROFILE_VR = 0x4,<br>
+ PP_SMC_POWER_PROFILE_COMPUTE = 0x5,<br>
+ PP_SMC_POWER_PROFILE_CUSTOM = 0x6,<br>
};<br>
<br>
enum {<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
index 0173d0480024..310b102a9292 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
@@ -64,17 +64,19 @@ static int ci_set_asic_special_caps(struct pp_hwmgr *hwmgr);<br>
<br>
static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr)<br>
{<br>
- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 2;<br>
- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 0;<br>
- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 1;<br>
- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 3;<br>
- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 4;<br>
-<br>
- hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_POWERSAVING;<br>
- hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_VIDEO;<br>
- hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;<br>
- hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VR;<br>
- hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_COMPUTE;<br>
+ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0;<br>
+ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1;<br>
+ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2;<br>
+ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 3;<br>
+ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 4;<br>
+ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 5;<br>
+<br>
+ hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;<br>
+ hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;<br>
+ hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING;<br>
+ hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VIDEO;<br>
+ hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_VR;<br>
+ hwmgr->workload_setting[5] = PP_SMC_POWER_PROFILE_COMPUTE;<br>
}<br>
<br>
int hwmgr_early_init(struct pp_hwmgr *hwmgr)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
index d91390459326..c8f5c00dd1e7 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
@@ -77,8 +77,9 @@<br>
#define PCIE_BUS_CLK 10000<br>
#define TCLK (PCIE_BUS_CLK / 10)<br>
<br>
-static const struct profile_mode_setting smu7_profiling[6] =<br>
- {{1, 0, 100, 30, 1, 0, 100, 10},<br>
+static const struct profile_mode_setting smu7_profiling[7] =<br>
+ {{0, 0, 0, 0, 0, 0, 0, 0},<br>
+ {1, 0, 100, 30, 1, 0, 100, 10},<br>
{1, 10, 0, 30, 0, 0, 0, 0},<br>
{0, 0, 0, 0, 1, 10, 16, 31},<br>
{1, 0, 11, 50, 1, 0, 100, 10},<br>
@@ -4889,7 +4890,8 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)<br>
uint32_t i, size = 0;<br>
uint32_t len;<br>
<br>
- static const char *profile_name[6] = {"3D_FULL_SCREEN",<br>
+ static const char *profile_name[7] = {"BOOTUP_DEFAULT",<br>
+ "3D_FULL_SCREEN",<br>
"POWER_SAVING",<br>
"VIDEO",<br>
"VR",<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
index 79c86247d0ac..91e3bbe6d61d 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
@@ -804,9 +804,9 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)<br>
<br>
hwmgr->backend = data;<br>
<br>
- hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO];<br>
- hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;<br>
- hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;<br>
+ hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];<br>
+ hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;<br>
+ hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;<br>
<br>
vega10_set_default_registry_data(hwmgr);<br>
data->disable_dpm_mask = 0xff;<br>
@@ -4668,13 +4668,15 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)<br>
{<br>
struct vega10_hwmgr *data = hwmgr->backend;<br>
uint32_t i, size = 0;<br>
- static const uint8_t profile_mode_setting[5][4] = {{70, 60, 1, 3,},<br>
+ static const uint8_t profile_mode_setting[6][4] = {{70, 60, 0, 0,},<br>
+ {70, 60, 1, 3,},<br>
{90, 60, 0, 0,},<br>
{70, 60, 0, 0,},<br>
{70, 90, 0, 0,},<br>
{30, 60, 0, 6,},<br>
};<br>
- static const char *profile_name[6] = {"3D_FULL_SCREEN",<br>
+ static const char *profile_name[7] = {"BOOTUP_DEFAULT",<br>
+ "3D_FULL_SCREEN",<br>
"POWER_SAVING",<br>
"VIDEO",<br>
"VR",<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
index 26154f9b2178..264ce8fe545f 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
@@ -390,9 +390,9 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)<br>
<br>
hwmgr->backend = data;<br>
<br>
- hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO];<br>
- hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;<br>
- hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;<br>
+ hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];<br>
+ hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;<br>
+ hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;<br>
<br>
vega20_set_default_registry_data(hwmgr);<br>
<br>
@@ -3261,6 +3261,9 @@ static int conv_power_profile_to_pplib_workload(int power_profile)<br>
int pplib_workload = 0;<br>
<br>
switch (power_profile) {<br>
+ case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT:<br>
+ pplib_workload = WORKLOAD_DEFAULT_BIT;<br>
+ break;<br>
case PP_SMC_POWER_PROFILE_FULLSCREEN3D:<br>
pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT;<br>
break;<br>
@@ -3290,6 +3293,7 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)<br>
uint32_t i, size = 0;<br>
uint16_t workload_type = 0;<br>
static const char *profile_name[] = {<br>
+ "BOOTUP_DEFAULT",<br>
"3D_FULL_SCREEN",<br>
"POWER_SAVING",<br>
"VIDEO",<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
index 0d298a0409f5..8cb831b6a016 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
@@ -705,7 +705,7 @@ enum PP_TABLE_VERSION {<br>
/**<br>
* The main hardware manager structure.<br>
*/<br>
-#define Workload_Policy_Max 5<br>
+#define Workload_Policy_Max 6<br>
<br>
struct pp_hwmgr {<br>
void *adev;<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>