aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/0501-drm-amdgpu-powerplay-endian-fixes-for-vega20_process.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/0501-drm-amdgpu-powerplay-endian-fixes-for-vega20_process.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/0501-drm-amdgpu-powerplay-endian-fixes-for-vega20_process.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/0501-drm-amdgpu-powerplay-endian-fixes-for-vega20_process.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/0501-drm-amdgpu-powerplay-endian-fixes-for-vega20_process.patch
new file mode 100644
index 00000000..eb89d8af
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/0501-drm-amdgpu-powerplay-endian-fixes-for-vega20_process.patch
@@ -0,0 +1,106 @@
+From 2f544147e050c441a13fc42412933d179dbc2746 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Tue, 9 Oct 2018 15:50:38 -0500
+Subject: [PATCH 0501/2940] drm/amdgpu/powerplay: endian fixes for
+ vega20_processpptables.c
+
+Properly swap data from vbios.
+
+Reviewed-by: Evan Quan <evan.quan@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ .../powerplay/hwmgr/vega20_processpptables.c | 41 +++++++++++--------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
+index c9b93e6487e4..956aa6aff28d 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
+@@ -676,7 +676,7 @@ static int copy_clock_limits_array(
+ return -ENOMEM;
+
+ for (i = 0; i < power_saving_clock_count; i++)
+- table[i] = pptable_array[i];
++ table[i] = le32_to_cpu(pptable_array[i]);
+
+ *pptable_info_array = table;
+
+@@ -698,7 +698,7 @@ static int copy_overdrive_settings_limits_array(
+ return -ENOMEM;
+
+ for (i = 0; i < od_setting_count; i++)
+- table[i] = pptable_array[i];
++ table[i] = le32_to_cpu(pptable_array[i]);
+
+ *pptable_info_array = table;
+
+@@ -721,7 +721,7 @@ static int copy_overdrive_feature_capabilities_array(
+ return -ENOMEM;
+
+ for (i = 0; i < od_feature_count; i++) {
+- table[i] = pptable_array[i];
++ table[i] = le32_to_cpu(pptable_array[i]);
+ if (table[i])
+ od_supported = true;
+ }
+@@ -844,10 +844,16 @@ static int init_powerplay_table_information(
+ phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
+
+ if (powerplay_table->OverDrive8Table.ucODTableRevision == 1) {
+- od_feature_count = (powerplay_table->OverDrive8Table.ODFeatureCount > ATOM_VEGA20_ODFEATURE_COUNT) ?
+- ATOM_VEGA20_ODFEATURE_COUNT : powerplay_table->OverDrive8Table.ODFeatureCount;
+- od_setting_count = (powerplay_table->OverDrive8Table.ODSettingCount > ATOM_VEGA20_ODSETTING_COUNT) ?
+- ATOM_VEGA20_ODSETTING_COUNT : powerplay_table->OverDrive8Table.ODSettingCount;
++ od_feature_count =
++ (le32_to_cpu(powerplay_table->OverDrive8Table.ODFeatureCount) >
++ ATOM_VEGA20_ODFEATURE_COUNT) ?
++ ATOM_VEGA20_ODFEATURE_COUNT :
++ le32_to_cpu(powerplay_table->OverDrive8Table.ODFeatureCount);
++ od_setting_count =
++ (le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingCount) >
++ ATOM_VEGA20_ODSETTING_COUNT) ?
++ ATOM_VEGA20_ODSETTING_COUNT :
++ le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingCount);
+
+ copy_overdrive_feature_capabilities_array(hwmgr,
+ &pptable_information->od_feature_capabilities,
+@@ -863,15 +869,15 @@ static int init_powerplay_table_information(
+ od_setting_count);
+ }
+
+- pptable_information->us_small_power_limit1 = powerplay_table->usSmallPowerLimit1;
+- pptable_information->us_small_power_limit2 = powerplay_table->usSmallPowerLimit2;
+- pptable_information->us_boost_power_limit = powerplay_table->usBoostPowerLimit;
+- pptable_information->us_od_turbo_power_limit = powerplay_table->usODTurboPowerLimit;
+- pptable_information->us_od_powersave_power_limit = powerplay_table->usODPowerSavePowerLimit;
++ pptable_information->us_small_power_limit1 = le16_to_cpu(powerplay_table->usSmallPowerLimit1);
++ pptable_information->us_small_power_limit2 = le16_to_cpu(powerplay_table->usSmallPowerLimit2);
++ pptable_information->us_boost_power_limit = le16_to_cpu(powerplay_table->usBoostPowerLimit);
++ pptable_information->us_od_turbo_power_limit = le16_to_cpu(powerplay_table->usODTurboPowerLimit);
++ pptable_information->us_od_powersave_power_limit = le16_to_cpu(powerplay_table->usODPowerSavePowerLimit);
+
+- pptable_information->us_software_shutdown_temp = powerplay_table->usSoftwareShutdownTemp;
++ pptable_information->us_software_shutdown_temp = le16_to_cpu(powerplay_table->usSoftwareShutdownTemp);
+
+- hwmgr->platform_descriptor.TDPODLimit = (uint16_t)powerplay_table->OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE];
++ hwmgr->platform_descriptor.TDPODLimit = le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE]);
+
+ disable_power_control = 0;
+ if (!disable_power_control && hwmgr->platform_descriptor.TDPODLimit)
+@@ -879,8 +885,11 @@ static int init_powerplay_table_information(
+ phm_cap_set(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PowerControl);
+
+ if (powerplay_table->PowerSavingClockTable.ucTableRevision == 1) {
+- power_saving_clock_count = (powerplay_table->PowerSavingClockTable.PowerSavingClockCount >= ATOM_VEGA20_PPCLOCK_COUNT) ?
+- ATOM_VEGA20_PPCLOCK_COUNT : powerplay_table->PowerSavingClockTable.PowerSavingClockCount;
++ power_saving_clock_count =
++ (le32_to_cpu(powerplay_table->PowerSavingClockTable.PowerSavingClockCount) >=
++ ATOM_VEGA20_PPCLOCK_COUNT) ?
++ ATOM_VEGA20_PPCLOCK_COUNT :
++ le32_to_cpu(powerplay_table->PowerSavingClockTable.PowerSavingClockCount);
+ copy_clock_limits_array(hwmgr,
+ &pptable_information->power_saving_clock_max,
+ powerplay_table->PowerSavingClockTable.PowerSavingClockMax,
+--
+2.17.1
+