Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu:add MEC_STORAGE ucode id for sriov

for sriov, SMC need MEC_STORAGE reserved in fw bo.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Frank Min <frank.min@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Monk Liu and committed by
Alex Deucher
bed5712e ac00bbf3

+23
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
··· 696 696 case CGS_UCODE_ID_RLC_G: 697 697 result = AMDGPU_UCODE_ID_RLC_G; 698 698 break; 699 + case CGS_UCODE_ID_STORAGE: 700 + result = AMDGPU_UCODE_ID_STORAGE; 701 + break; 699 702 default: 700 703 DRM_ERROR("Firmware type not supported\n"); 701 704 }
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
··· 228 228 ucode->mc_addr = mc_addr; 229 229 ucode->kaddr = kptr; 230 230 231 + if (ucode->ucode_id == AMDGPU_UCODE_ID_STORAGE) 232 + return 0; 233 + 231 234 header = (const struct common_firmware_header *)ucode->fw->data; 232 235 memcpy(ucode->kaddr, (void *)((uint8_t *)ucode->fw->data + 233 236 le32_to_cpu(header->ucode_array_offset_bytes)),
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
··· 130 130 AMDGPU_UCODE_ID_CP_MEC1, 131 131 AMDGPU_UCODE_ID_CP_MEC2, 132 132 AMDGPU_UCODE_ID_RLC_G, 133 + AMDGPU_UCODE_ID_STORAGE, 133 134 AMDGPU_UCODE_ID_MAXIMUM, 134 135 }; 135 136
+8
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 1058 1058 adev->firmware.fw_size += 1059 1059 ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); 1060 1060 1061 + if (amdgpu_sriov_vf(adev)) { 1062 + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_STORAGE]; 1063 + info->ucode_id = AMDGPU_UCODE_ID_STORAGE; 1064 + info->fw = adev->gfx.mec_fw; 1065 + adev->firmware.fw_size += 1066 + ALIGN(le32_to_cpu(64 * PAGE_SIZE), PAGE_SIZE); 1067 + } 1068 + 1061 1069 if (adev->gfx.mec2_fw) { 1062 1070 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2]; 1063 1071 info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
+1
drivers/gpu/drm/amd/include/cgs_common.h
··· 106 106 CGS_UCODE_ID_CP_MEC_JT2, 107 107 CGS_UCODE_ID_GMCON_RENG, 108 108 CGS_UCODE_ID_RLC_G, 109 + CGS_UCODE_ID_STORAGE, 109 110 CGS_UCODE_ID_MAXIMUM, 110 111 }; 111 112
+7
drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
··· 278 278 case UCODE_ID_RLC_G: 279 279 result = CGS_UCODE_ID_RLC_G; 280 280 break; 281 + case UCODE_ID_MEC_STORAGE: 282 + result = CGS_UCODE_ID_STORAGE; 283 + break; 281 284 default: 282 285 break; 283 286 } ··· 454 451 "Failed to Get Firmware Entry.", return -EINVAL); 455 452 PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(smumgr, 456 453 UCODE_ID_SDMA1, &toc->entry[toc->num_entries++]), 454 + "Failed to Get Firmware Entry.", return -EINVAL); 455 + if (cgs_is_virtualization_enabled(smumgr->device)) 456 + PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(smumgr, 457 + UCODE_ID_MEC_STORAGE, &toc->entry[toc->num_entries++]), 457 458 "Failed to Get Firmware Entry.", return -EINVAL); 458 459 459 460 smu7_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, smu_data->header_buffer.mc_addr_high);