Skip to content

Commit 5e3f50f

Browse files
Hawking Zhangalexdeucher
authored andcommitted
drm/amdgpu: Extend psp_skip_tmr for bare-metal and sriov
In SRIOV, guest drivers no longer setup/destory VMR starting from mp0 v11_0_7. In bare-metal, if boot-time TMR is enabled, some generation (e.g., mp0 v13_0_x) don’t need runtime TMR allocation but still require SETUP_TMR command with tmr address 0 for backward compatibility. some newer generations require neither SETUP_TMR nor DESTROY_TMR and will return errors if they are sent. Driver relies on boot_time_tmr and autoload_supported to handle these cases correctly. Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Likun Gao <Likun.Gao@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 698fa62 commit 5e3f50f

1 file changed

Lines changed: 12 additions & 28 deletions

File tree

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

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -902,31 +902,20 @@ static int psp_tmr_init(struct psp_context *psp)
902902

903903
static bool psp_skip_tmr(struct psp_context *psp)
904904
{
905-
switch (amdgpu_ip_version(psp->adev, MP0_HWIP, 0)) {
906-
case IP_VERSION(11, 0, 9):
907-
case IP_VERSION(11, 0, 7):
908-
case IP_VERSION(13, 0, 2):
909-
case IP_VERSION(13, 0, 6):
910-
case IP_VERSION(13, 0, 10):
911-
case IP_VERSION(13, 0, 12):
912-
case IP_VERSION(13, 0, 14):
913-
case IP_VERSION(15, 0, 0):
914-
case IP_VERSION(15, 0, 8):
915-
return true;
916-
default:
917-
return false;
918-
}
905+
u32 ip_version = amdgpu_ip_version(psp->adev, MP0_HWIP, 0);
906+
907+
if (amdgpu_sriov_vf(psp->adev))
908+
return (ip_version >= IP_VERSION(11, 0, 7)) ? true : false;
909+
else
910+
return (!psp->boot_time_tmr || !psp->autoload_supported) ? false : true;
919911
}
920912

921913
static int psp_tmr_load(struct psp_context *psp)
922914
{
923915
int ret;
924916
struct psp_gfx_cmd_resp *cmd;
925917

926-
/* For Navi12 and CHIP_SIENNA_CICHLID SRIOV, do not set up TMR.
927-
* Already set up by host driver.
928-
*/
929-
if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
918+
if (psp_skip_tmr(psp))
930919
return 0;
931920

932921
cmd = acquire_psp_cmd_buf(psp);
@@ -958,10 +947,7 @@ static int psp_tmr_unload(struct psp_context *psp)
958947
int ret;
959948
struct psp_gfx_cmd_resp *cmd;
960949

961-
/* skip TMR unload for Navi12 and CHIP_SIENNA_CICHLID SRIOV,
962-
* as TMR is not loaded at all
963-
*/
964-
if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
950+
if (psp_skip_tmr(psp))
965951
return 0;
966952

967953
cmd = acquire_psp_cmd_buf(psp);
@@ -2632,12 +2618,10 @@ static int psp_hw_start(struct psp_context *psp)
26322618
return ret;
26332619
}
26342620

2635-
if (!psp->boot_time_tmr || !psp->autoload_supported) {
2636-
ret = psp_tmr_load(psp);
2637-
if (ret) {
2638-
dev_err(adev->dev, "PSP load tmr failed!\n");
2639-
return ret;
2640-
}
2621+
ret = psp_tmr_load(psp);
2622+
if (ret) {
2623+
dev_err(adev->dev, "PSP load tmr failed!\n");
2624+
return ret;
26412625
}
26422626

26432627
return 0;

0 commit comments

Comments
 (0)