summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-07-29 11:03:47 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-07-29 11:03:47 +0000
commit5e803e86454cacf2e06ce1d44fe4cc7cf29092f9 (patch)
tree3c0b849ff1466fb965466384a04576db3493ab75 /sys
parent26a536725767b105bc96de61d710cfd1d259b207 (diff)
drm/amd/powerplay: fix a crash when overclocking Vega M
From Qiu Wenbo b00f624573229df95e68308162da6c419ef0b2b2 in linux 5.7.y/5.7.11 88bb16ad998a0395fe4b346b7d3f621aaa0a2324 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/amd/powerplay/smumgr/vegam_smumgr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/amd/powerplay/smumgr/vegam_smumgr.c b/sys/dev/pci/drm/amd/powerplay/smumgr/vegam_smumgr.c
index b0e0d67cd54..2a081a792c6 100644
--- a/sys/dev/pci/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/sys/dev/pci/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -642,9 +642,6 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
/* sclk is bigger than max sclk in the dependence table */
*voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;
- vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
- (dep_table->entries[i - 1].vddc -
- (uint16_t)VDDC_VDDCI_DELTA));
if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)
*voltage |= (data->vbios_boot_state.vddci_bootup_value *
@@ -652,8 +649,13 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
else if (dep_table->entries[i - 1].vddci)
*voltage |= (dep_table->entries[i - 1].vddci *
VOLTAGE_SCALE) << VDDC_SHIFT;
- else
+ else {
+ vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
+ (dep_table->entries[i - 1].vddc -
+ (uint16_t)VDDC_VDDCI_DELTA));
+
*voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
+ }
if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)
*mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;