diff options
| author | Alex Deucher <alexander.deucher@amd.com> | 2016-11-09 17:52:42 -0500 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2016-11-10 11:11:40 -0500 |
| commit | 0f12f73c5175d39445fa10cdca4481f80efdef49 (patch) | |
| tree | 3f94b56726218c7f44614953451d7cfaf27a6880 /drivers/gpu | |
| parent | 90ebf11857c2743fab1b2b64140aff24e256e758 (diff) | |
drm/amd/powerplay/smu7: fix checks in smu7_get_evv_voltages (v2)
Only check if the tables exist in relevant configs. This
fixes a failure on V0 tables.
v2: fix version check as suggested by Rex
bugs:
https://bugzilla.kernel.org/show_bug.cgi?id=185681
https://bugs.freedesktop.org/show_bug.cgi?id=98357
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index 51fb86f20c21..f41cddf2a16b 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
| @@ -1460,19 +1460,19 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr) | |||
| 1460 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = NULL; | 1460 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = NULL; |
| 1461 | 1461 | ||
| 1462 | 1462 | ||
| 1463 | if (table_info == NULL) | ||
| 1464 | return -EINVAL; | ||
| 1465 | |||
| 1466 | sclk_table = table_info->vdd_dep_on_sclk; | ||
| 1467 | |||
| 1468 | for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) { | 1463 | for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) { |
| 1469 | vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; | 1464 | vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; |
| 1470 | 1465 | ||
| 1471 | if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) { | 1466 | if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) { |
| 1472 | if (0 == phm_get_sclk_for_voltage_evv(hwmgr, | 1467 | if ((hwmgr->pp_table_version == PP_TABLE_V1) |
| 1468 | && !phm_get_sclk_for_voltage_evv(hwmgr, | ||
| 1473 | table_info->vddgfx_lookup_table, vv_id, &sclk)) { | 1469 | table_info->vddgfx_lookup_table, vv_id, &sclk)) { |
| 1474 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 1470 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
| 1475 | PHM_PlatformCaps_ClockStretcher)) { | 1471 | PHM_PlatformCaps_ClockStretcher)) { |
| 1472 | if (table_info == NULL) | ||
| 1473 | return -EINVAL; | ||
| 1474 | sclk_table = table_info->vdd_dep_on_sclk; | ||
| 1475 | |||
| 1476 | for (j = 1; j < sclk_table->count; j++) { | 1476 | for (j = 1; j < sclk_table->count; j++) { |
| 1477 | if (sclk_table->entries[j].clk == sclk && | 1477 | if (sclk_table->entries[j].clk == sclk && |
| 1478 | sclk_table->entries[j].cks_enable == 0) { | 1478 | sclk_table->entries[j].cks_enable == 0) { |
| @@ -1498,12 +1498,15 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr) | |||
| 1498 | } | 1498 | } |
| 1499 | } | 1499 | } |
| 1500 | } else { | 1500 | } else { |
| 1501 | |||
| 1502 | if ((hwmgr->pp_table_version == PP_TABLE_V0) | 1501 | if ((hwmgr->pp_table_version == PP_TABLE_V0) |
| 1503 | || !phm_get_sclk_for_voltage_evv(hwmgr, | 1502 | || !phm_get_sclk_for_voltage_evv(hwmgr, |
| 1504 | table_info->vddc_lookup_table, vv_id, &sclk)) { | 1503 | table_info->vddc_lookup_table, vv_id, &sclk)) { |
| 1505 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 1504 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
| 1506 | PHM_PlatformCaps_ClockStretcher)) { | 1505 | PHM_PlatformCaps_ClockStretcher)) { |
| 1506 | if (table_info == NULL) | ||
| 1507 | return -EINVAL; | ||
| 1508 | sclk_table = table_info->vdd_dep_on_sclk; | ||
| 1509 | |||
| 1507 | for (j = 1; j < sclk_table->count; j++) { | 1510 | for (j = 1; j < sclk_table->count; j++) { |
| 1508 | if (sclk_table->entries[j].clk == sclk && | 1511 | if (sclk_table->entries[j].clk == sclk && |
| 1509 | sclk_table->entries[j].cks_enable == 0) { | 1512 | sclk_table->entries[j].cks_enable == 0) { |
