Skip to content

Commit e67b8af

Browse files
frank98753alexdeucher
authored andcommitted
drm/amdgpu: Add PSP fw version check for fw reserve GFX command
The fw reserved GFX command is only supported starting from PSP fw version 0x3a0e14 and 0x3b0e0d. Older versions do not support this command. Add a version guard to ensure the command is only used when the running PSP fw meets the minimum version requirement. This ensures backward compatibility and safe operation across fw revisions. Fixes: a3b7f9c ("drm/amdgpu: reclaim psp fw reservation memory region") Signed-off-by: Frank Min <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 065e231)
1 parent 8f5ae30 commit e67b8af

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,15 +1039,28 @@ int psp_update_fw_reservation(struct psp_context *psp)
10391039
{
10401040
int ret;
10411041
uint64_t reserv_addr, reserv_addr_ext;
1042-
uint32_t reserv_size, reserv_size_ext;
1042+
uint32_t reserv_size, reserv_size_ext, mp0_ip_ver;
10431043
struct amdgpu_device *adev = psp->adev;
10441044

1045+
mp0_ip_ver = amdgpu_ip_version(adev, MP0_HWIP, 0);
1046+
10451047
if (amdgpu_sriov_vf(psp->adev))
10461048
return 0;
10471049

1048-
if ((amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(14, 0, 2)) &&
1049-
(amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(14, 0, 3)))
1050+
switch (mp0_ip_ver) {
1051+
case IP_VERSION(14, 0, 2):
1052+
if (adev->psp.sos.fw_version < 0x3b0e0d)
1053+
return 0;
1054+
break;
1055+
1056+
case IP_VERSION(14, 0, 3):
1057+
if (adev->psp.sos.fw_version < 0x3a0e14)
1058+
return 0;
1059+
break;
1060+
1061+
default:
10501062
return 0;
1063+
}
10511064

10521065
ret = psp_get_fw_reservation_info(psp, GFX_CMD_ID_FB_FW_RESERV_ADDR, &reserv_addr, &reserv_size);
10531066
if (ret)

0 commit comments

Comments
 (0)