diff options
| author | Alex Deucher <alexander.deucher@amd.com> | 2018-07-12 09:38:09 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2018-07-13 12:42:45 -0400 |
| commit | 02ce6ce2e1d07e31e8314c761a2caa087ea094ce (patch) | |
| tree | 84de0b4de7b0206ae97eb780fc84ca2d03e1dacd /drivers/gpu | |
| parent | 8d4235f71513cdccd9dc52b674323c3591552bc1 (diff) | |
drm/amdgpu/pp/smu7: use a local variable for toc indexing
Rather than using the index variable stored in vram. If
the device fails to come back online after a resume cycle,
reads from vram will return all 1s which will cause a
segfault. Based on a patch from Thomas Martitz <kugel@rockbox.org>.
This avoids the segfault, but we still need to sort out
why the GPU does not come back online after a resume.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105760
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c index d644a9bb9078..9f407c48d4f0 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | |||
| @@ -381,6 +381,7 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr) | |||
| 381 | uint32_t fw_to_load; | 381 | uint32_t fw_to_load; |
| 382 | int result = 0; | 382 | int result = 0; |
| 383 | struct SMU_DRAMData_TOC *toc; | 383 | struct SMU_DRAMData_TOC *toc; |
| 384 | uint32_t num_entries = 0; | ||
| 384 | 385 | ||
| 385 | if (!hwmgr->reload_fw) { | 386 | if (!hwmgr->reload_fw) { |
| 386 | pr_info("skip reloading...\n"); | 387 | pr_info("skip reloading...\n"); |
| @@ -422,41 +423,41 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr) | |||
| 422 | } | 423 | } |
| 423 | 424 | ||
| 424 | toc = (struct SMU_DRAMData_TOC *)smu_data->header; | 425 | toc = (struct SMU_DRAMData_TOC *)smu_data->header; |
| 425 | toc->num_entries = 0; | ||
| 426 | toc->structure_version = 1; | 426 | toc->structure_version = 1; |
| 427 | 427 | ||
| 428 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 428 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 429 | UCODE_ID_RLC_G, &toc->entry[toc->num_entries++]), | 429 | UCODE_ID_RLC_G, &toc->entry[num_entries++]), |
| 430 | "Failed to Get Firmware Entry.", return -EINVAL); | 430 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 431 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 431 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 432 | UCODE_ID_CP_CE, &toc->entry[toc->num_entries++]), | 432 | UCODE_ID_CP_CE, &toc->entry[num_entries++]), |
| 433 | "Failed to Get Firmware Entry.", return -EINVAL); | 433 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 434 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 434 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 435 | UCODE_ID_CP_PFP, &toc->entry[toc->num_entries++]), | 435 | UCODE_ID_CP_PFP, &toc->entry[num_entries++]), |
| 436 | "Failed to Get Firmware Entry.", return -EINVAL); | 436 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 437 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 437 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 438 | UCODE_ID_CP_ME, &toc->entry[toc->num_entries++]), | 438 | UCODE_ID_CP_ME, &toc->entry[num_entries++]), |
| 439 | "Failed to Get Firmware Entry.", return -EINVAL); | 439 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 440 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 440 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 441 | UCODE_ID_CP_MEC, &toc->entry[toc->num_entries++]), | 441 | UCODE_ID_CP_MEC, &toc->entry[num_entries++]), |
| 442 | "Failed to Get Firmware Entry.", return -EINVAL); | 442 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 443 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 443 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 444 | UCODE_ID_CP_MEC_JT1, &toc->entry[toc->num_entries++]), | 444 | UCODE_ID_CP_MEC_JT1, &toc->entry[num_entries++]), |
| 445 | "Failed to Get Firmware Entry.", return -EINVAL); | 445 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 446 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 446 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 447 | UCODE_ID_CP_MEC_JT2, &toc->entry[toc->num_entries++]), | 447 | UCODE_ID_CP_MEC_JT2, &toc->entry[num_entries++]), |
| 448 | "Failed to Get Firmware Entry.", return -EINVAL); | 448 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 449 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 449 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 450 | UCODE_ID_SDMA0, &toc->entry[toc->num_entries++]), | 450 | UCODE_ID_SDMA0, &toc->entry[num_entries++]), |
| 451 | "Failed to Get Firmware Entry.", return -EINVAL); | 451 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 452 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 452 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 453 | UCODE_ID_SDMA1, &toc->entry[toc->num_entries++]), | 453 | UCODE_ID_SDMA1, &toc->entry[num_entries++]), |
| 454 | "Failed to Get Firmware Entry.", return -EINVAL); | 454 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 455 | if (!hwmgr->not_vf) | 455 | if (!hwmgr->not_vf) |
| 456 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, | 456 | PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr, |
| 457 | UCODE_ID_MEC_STORAGE, &toc->entry[toc->num_entries++]), | 457 | UCODE_ID_MEC_STORAGE, &toc->entry[num_entries++]), |
| 458 | "Failed to Get Firmware Entry.", return -EINVAL); | 458 | "Failed to Get Firmware Entry.", return -EINVAL); |
| 459 | 459 | ||
| 460 | toc->num_entries = num_entries; | ||
| 460 | smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, upper_32_bits(smu_data->header_buffer.mc_addr)); | 461 | smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, upper_32_bits(smu_data->header_buffer.mc_addr)); |
| 461 | smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, lower_32_bits(smu_data->header_buffer.mc_addr)); | 462 | smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, lower_32_bits(smu_data->header_buffer.mc_addr)); |
| 462 | 463 | ||
