Skip to content

Commit 0c56c86

Browse files
crab2313alexdeucher
authored andcommitted
drm/amd/powerplay: fix a crash when overclocking Vega M
Avoid kernel crash when vddci_control is SMU7_VOLTAGE_CONTROL_NONE and vddci_voltage_table is empty. It has been tested on Intel Hades Canyon (i7-8809G). Bug: https://bugzilla.kernel.org/show_bug.cgi?id=208489 Fixes: ac7822b ("drm/amd/powerplay: add smumgr support for VEGAM (v2)") Reviewed-by: Evan Quan <[email protected]> Signed-off-by: Qiu Wenbo <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 85dec71 commit 0c56c86

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,18 +644,20 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
644644

645645
/* sclk is bigger than max sclk in the dependence table */
646646
*voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;
647-
vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
648-
(dep_table->entries[i - 1].vddc -
649-
(uint16_t)VDDC_VDDCI_DELTA));
650647

651648
if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)
652649
*voltage |= (data->vbios_boot_state.vddci_bootup_value *
653650
VOLTAGE_SCALE) << VDDCI_SHIFT;
654651
else if (dep_table->entries[i - 1].vddci)
655652
*voltage |= (dep_table->entries[i - 1].vddci *
656653
VOLTAGE_SCALE) << VDDC_SHIFT;
657-
else
654+
else {
655+
vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
656+
(dep_table->entries[i - 1].vddc -
657+
(uint16_t)VDDC_VDDCI_DELTA));
658+
658659
*voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
660+
}
659661

660662
if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)
661663
*mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;

0 commit comments

Comments
 (0)