aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/0985-drm-amd-powerplay-support-BOOTUP_DEFAULT-power-profi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/0985-drm-amd-powerplay-support-BOOTUP_DEFAULT-power-profi.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/0985-drm-amd-powerplay-support-BOOTUP_DEFAULT-power-profi.patch192
1 files changed, 192 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/0985-drm-amd-powerplay-support-BOOTUP_DEFAULT-power-profi.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/0985-drm-amd-powerplay-support-BOOTUP_DEFAULT-power-profi.patch
new file mode 100644
index 00000000..21c99b0e
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/0985-drm-amd-powerplay-support-BOOTUP_DEFAULT-power-profi.patch
@@ -0,0 +1,192 @@
+From f5024db1e5daa2e5ceb0c19ce7de40d036d9ceb4 Mon Sep 17 00:00:00 2001
+From: Evan Quan <evan.quan@amd.com>
+Date: Thu, 27 Dec 2018 14:23:30 +0800
+Subject: [PATCH 0985/2940] 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>
+---
+ .../gpu/drm/amd/include/kgd_pp_interface.h | 13 +++++-----
+ drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 24 ++++++++++---------
+ .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 8 ++++---
+ .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 12 ++++++----
+ .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 10 +++++---
+ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 +-
+ 6 files changed, 40 insertions(+), 29 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+index 1479ea1dc3e7..789c4f288485 100644
+--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
++++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+@@ -127,12 +127,13 @@ enum amd_pp_task {
+ };
+
+ enum PP_SMC_POWER_PROFILE {
+- PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x0,
+- PP_SMC_POWER_PROFILE_POWERSAVING = 0x1,
+- PP_SMC_POWER_PROFILE_VIDEO = 0x2,
+- PP_SMC_POWER_PROFILE_VR = 0x3,
+- PP_SMC_POWER_PROFILE_COMPUTE = 0x4,
+- PP_SMC_POWER_PROFILE_CUSTOM = 0x5,
++ PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0,
++ PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1,
++ PP_SMC_POWER_PROFILE_POWERSAVING = 0x2,
++ PP_SMC_POWER_PROFILE_VIDEO = 0x3,
++ PP_SMC_POWER_PROFILE_VR = 0x4,
++ PP_SMC_POWER_PROFILE_COMPUTE = 0x5,
++ PP_SMC_POWER_PROFILE_CUSTOM = 0x6,
+ };
+
+ enum {
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+index 2b8e10eddeab..9dc7d7bd7d51 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+@@ -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)
+ {
+- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 2;
+- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 0;
+- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 1;
+- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 3;
+- hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 4;
+-
+- hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_POWERSAVING;
+- hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_VIDEO;
+- hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
+- hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VR;
+- hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_COMPUTE;
++ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0;
++ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1;
++ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2;
++ hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 3;
++ 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_BOOTUP_DEFAULT;
++ hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
++ hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING;
++ hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VIDEO;
++ 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)
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+index d91390459326..c8f5c00dd1e7 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+@@ -77,8 +77,9 @@
+ #define PCIE_BUS_CLK 10000
+ #define TCLK (PCIE_BUS_CLK / 10)
+
+-static const struct profile_mode_setting smu7_profiling[6] =
+- {{1, 0, 100, 30, 1, 0, 100, 10},
++static const struct profile_mode_setting smu7_profiling[7] =
++ {{0, 0, 0, 0, 0, 0, 0, 0},
++ {1, 0, 100, 30, 1, 0, 100, 10},
+ {1, 10, 0, 30, 0, 0, 0, 0},
+ {0, 0, 0, 0, 1, 10, 16, 31},
+ {1, 0, 11, 50, 1, 0, 100, 10},
+@@ -4889,7 +4890,8 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
+ uint32_t i, size = 0;
+ 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",
+ "VIDEO",
+ "VR",
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+index 79c86247d0ac..91e3bbe6d61d 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+@@ -804,9 +804,9 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
+
+ hwmgr->backend = data;
+
+- hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO];
+- hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;
+- hwmgr->default_power_profile_mode = 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_BOOTUP_DEFAULT;
++ hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
+
+ vega10_set_default_registry_data(hwmgr);
+ data->disable_dpm_mask = 0xff;
+@@ -4668,13 +4668,15 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
+ {
+ struct vega10_hwmgr *data = hwmgr->backend;
+ 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,},
+ {70, 60, 0, 0,},
+ {70, 90, 0, 0,},
+ {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",
+ "VIDEO",
+ "VR",
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+index 26154f9b2178..264ce8fe545f 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+@@ -390,9 +390,9 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
+
+ hwmgr->backend = data;
+
+- hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO];
+- hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;
+- hwmgr->default_power_profile_mode = 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_BOOTUP_DEFAULT;
++ hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
+
+ vega20_set_default_registry_data(hwmgr);
+
+@@ -3261,6 +3261,9 @@ static int conv_power_profile_to_pplib_workload(int power_profile)
+ int pplib_workload = 0;
+
+ switch (power_profile) {
++ case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT:
++ pplib_workload = WORKLOAD_DEFAULT_BIT;
++ break;
+ case PP_SMC_POWER_PROFILE_FULLSCREEN3D:
+ pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT;
+ break;
+@@ -3290,6 +3293,7 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
+ uint32_t i, size = 0;
+ uint16_t workload_type = 0;
+ static const char *profile_name[] = {
++ "BOOTUP_DEFAULT",
+ "3D_FULL_SCREEN",
+ "POWER_SAVING",
+ "VIDEO",
+diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+index 0d298a0409f5..8cb831b6a016 100644
+--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
++++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+@@ -705,7 +705,7 @@ enum PP_TABLE_VERSION {
+ /**
+ * The main hardware manager structure.
+ */
+-#define Workload_Policy_Max 5
++#define Workload_Policy_Max 6
+
+ struct pp_hwmgr {
+ void *adev;
+--
+2.17.1
+