drm/amd/powerplay: support BOOTUP_DEFAULT power profile mode

This can avoid unexpected profile mode change after running
compute workload.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Evan Quan 2018-12-27 14:23:30 +08:00 committed by Alex Deucher
parent baf3c982df
commit 048b9b0f5c
6 changed files with 39 additions and 28 deletions

View File

@ -127,12 +127,13 @@ enum amd_pp_task {
}; };
enum PP_SMC_POWER_PROFILE { enum PP_SMC_POWER_PROFILE {
PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x0, PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0,
PP_SMC_POWER_PROFILE_POWERSAVING = 0x1, PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1,
PP_SMC_POWER_PROFILE_VIDEO = 0x2, PP_SMC_POWER_PROFILE_POWERSAVING = 0x2,
PP_SMC_POWER_PROFILE_VR = 0x3, PP_SMC_POWER_PROFILE_VIDEO = 0x3,
PP_SMC_POWER_PROFILE_COMPUTE = 0x4, PP_SMC_POWER_PROFILE_VR = 0x4,
PP_SMC_POWER_PROFILE_CUSTOM = 0x5, PP_SMC_POWER_PROFILE_COMPUTE = 0x5,
PP_SMC_POWER_PROFILE_CUSTOM = 0x6,
}; };
enum { enum {

View File

@ -64,17 +64,19 @@ static int ci_set_asic_special_caps(struct pp_hwmgr *hwmgr);
static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr) static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr)
{ {
hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 2; hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0;
hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 0; hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1;
hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 1; hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2;
hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 3; hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 3;
hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 4; hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 4;
hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 5;
hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_POWERSAVING; hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_VIDEO; hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_FULLSCREEN3D; hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING;
hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VR; hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VIDEO;
hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_COMPUTE; hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_VR;
hwmgr->workload_setting[5] = PP_SMC_POWER_PROFILE_COMPUTE;
} }
int hwmgr_early_init(struct pp_hwmgr *hwmgr) int hwmgr_early_init(struct pp_hwmgr *hwmgr)

View File

@ -77,8 +77,9 @@
#define PCIE_BUS_CLK 10000 #define PCIE_BUS_CLK 10000
#define TCLK (PCIE_BUS_CLK / 10) #define TCLK (PCIE_BUS_CLK / 10)
static const struct profile_mode_setting smu7_profiling[6] = static const struct profile_mode_setting smu7_profiling[7] =
{{1, 0, 100, 30, 1, 0, 100, 10}, {{0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 100, 30, 1, 0, 100, 10},
{1, 10, 0, 30, 0, 0, 0, 0}, {1, 10, 0, 30, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 10, 16, 31}, {0, 0, 0, 0, 1, 10, 16, 31},
{1, 0, 11, 50, 1, 0, 100, 10}, {1, 0, 11, 50, 1, 0, 100, 10},
@ -4885,7 +4886,8 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
uint32_t i, size = 0; uint32_t i, size = 0;
uint32_t len; uint32_t len;
static const char *profile_name[6] = {"3D_FULL_SCREEN", static const char *profile_name[7] = {"BOOTUP_DEFAULT",
"3D_FULL_SCREEN",
"POWER_SAVING", "POWER_SAVING",
"VIDEO", "VIDEO",
"VR", "VR",

View File

@ -804,9 +804,9 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
hwmgr->backend = data; hwmgr->backend = data;
hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO]; hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];
hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
vega10_set_default_registry_data(hwmgr); vega10_set_default_registry_data(hwmgr);
data->disable_dpm_mask = 0xff; data->disable_dpm_mask = 0xff;
@ -4664,13 +4664,15 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
{ {
struct vega10_hwmgr *data = hwmgr->backend; struct vega10_hwmgr *data = hwmgr->backend;
uint32_t i, size = 0; uint32_t i, size = 0;
static const uint8_t profile_mode_setting[5][4] = {{70, 60, 1, 3,}, static const uint8_t profile_mode_setting[6][4] = {{70, 60, 0, 0,},
{70, 60, 1, 3,},
{90, 60, 0, 0,}, {90, 60, 0, 0,},
{70, 60, 0, 0,}, {70, 60, 0, 0,},
{70, 90, 0, 0,}, {70, 90, 0, 0,},
{30, 60, 0, 6,}, {30, 60, 0, 6,},
}; };
static const char *profile_name[6] = {"3D_FULL_SCREEN", static const char *profile_name[7] = {"BOOTUP_DEFAULT",
"3D_FULL_SCREEN",
"POWER_SAVING", "POWER_SAVING",
"VIDEO", "VIDEO",
"VR", "VR",

View File

@ -390,9 +390,9 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
hwmgr->backend = data; hwmgr->backend = data;
hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO]; hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];
hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
vega20_set_default_registry_data(hwmgr); vega20_set_default_registry_data(hwmgr);
@ -3251,6 +3251,9 @@ static int conv_power_profile_to_pplib_workload(int power_profile)
int pplib_workload = 0; int pplib_workload = 0;
switch (power_profile) { switch (power_profile) {
case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT:
pplib_workload = WORKLOAD_DEFAULT_BIT;
break;
case PP_SMC_POWER_PROFILE_FULLSCREEN3D: case PP_SMC_POWER_PROFILE_FULLSCREEN3D:
pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT; pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT;
break; break;
@ -3280,6 +3283,7 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
uint32_t i, size = 0; uint32_t i, size = 0;
uint16_t workload_type = 0; uint16_t workload_type = 0;
static const char *profile_name[] = { static const char *profile_name[] = {
"BOOTUP_DEFAULT",
"3D_FULL_SCREEN", "3D_FULL_SCREEN",
"POWER_SAVING", "POWER_SAVING",
"VIDEO", "VIDEO",

View File

@ -705,7 +705,7 @@ enum PP_TABLE_VERSION {
/** /**
* The main hardware manager structure. * The main hardware manager structure.
*/ */
#define Workload_Policy_Max 5 #define Workload_Policy_Max 6
struct pp_hwmgr { struct pp_hwmgr {
void *adev; void *adev;