Skip to content

Commit d392aa0

Browse files
Liu ChengZhealexdeucher
authored andcommitted
drm amdgpu: Skip tmr load for SRIOV
1. For Navi12, CHIP_SIENNA_CICHLID, skip tmr load operation; 2. Check pointer before release firmware. v2: use CHIP_SIENNA_CICHLID instead v3: remove local "bool ret"; fix grammer issue v4: use my name instead of "root" v5: fix grammer issue and indent issue Signed-off-by: Liu ChengZhe <[email protected]> Reviewed-by: Luben Tuikov <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6b6124b commit d392aa0

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

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

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,18 @@ static int psp_sw_fini(void *handle)
193193
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
194194

195195
psp_memory_training_fini(&adev->psp);
196-
release_firmware(adev->psp.sos_fw);
197-
adev->psp.sos_fw = NULL;
198-
release_firmware(adev->psp.asd_fw);
199-
adev->psp.asd_fw = NULL;
200-
release_firmware(adev->psp.ta_fw);
201-
adev->psp.ta_fw = NULL;
196+
if (adev->psp.sos_fw) {
197+
release_firmware(adev->psp.sos_fw);
198+
adev->psp.sos_fw = NULL;
199+
}
200+
if (adev->psp.asd_fw) {
201+
release_firmware(adev->psp.asd_fw);
202+
adev->psp.asd_fw = NULL;
203+
}
204+
if (adev->psp.ta_fw) {
205+
release_firmware(adev->psp.ta_fw);
206+
adev->psp.ta_fw = NULL;
207+
}
202208

203209
if (adev->asic_type == CHIP_NAVI10)
204210
psp_sysfs_fini(adev);
@@ -409,11 +415,28 @@ static int psp_clear_vf_fw(struct psp_context *psp)
409415
return ret;
410416
}
411417

418+
static bool psp_skip_tmr(struct psp_context *psp)
419+
{
420+
switch (psp->adev->asic_type) {
421+
case CHIP_NAVI12:
422+
case CHIP_SIENNA_CICHLID:
423+
return true;
424+
default:
425+
return false;
426+
}
427+
}
428+
412429
static int psp_tmr_load(struct psp_context *psp)
413430
{
414431
int ret;
415432
struct psp_gfx_cmd_resp *cmd;
416433

434+
/* For Navi12 and CHIP_SIENNA_CICHLID SRIOV, do not set up TMR.
435+
* Already set up by host driver.
436+
*/
437+
if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
438+
return 0;
439+
417440
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
418441
if (!cmd)
419442
return -ENOMEM;

0 commit comments

Comments
 (0)