From 5e803e86454cacf2e06ce1d44fe4cc7cf29092f9 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 29 Jul 2020 11:03:47 +0000 Subject: 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 --- sys/dev/pci/drm/amd/powerplay/smumgr/vegam_smumgr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys') 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; -- cgit v1.2.3