Skip to content

Commit 8879ec6

Browse files
lyndonlialexdeucher
authored andcommitted
drm/amdgpu: Fix the warning info when removing amdgpu device
Actually, the drm_dev_enter in psp_cmd_submit_buf does not protect anything. If DRM device is unplugged, it will always check the condition in WARN_ON. So drop drm_dev_enter and drm_dev_exit in psp_cmd_submit_buf. When removing amdgpu, the calling order is as follows: amdgpu_pci_remove drm_dev_unplug amdgpu_driver_unload_kms amdgpu_device_fini_hw amdgpu_device_ip_fini_early psp_hw_fini psp_ras_terminate psp_ta_unloadye psp_cmd_submit_buf [ 4507.740388] Call Trace: [ 4507.740389] <TASK> [ 4507.740391] psp_ta_unload+0x44/0x70 [amdgpu] [ 4507.740485] psp_ras_terminate+0x4d/0x70 [amdgpu] [ 4507.740575] psp_hw_fini+0x28/0xa0 [amdgpu] [ 4507.740662] amdgpu_device_fini_hw+0x328/0x442 [amdgpu] [ 4507.740791] amdgpu_driver_unload_kms+0x51/0x60 [amdgpu] [ 4507.740875] amdgpu_pci_remove+0x5a/0x140 [amdgpu] [ 4507.740962] ? _raw_spin_unlock_irqrestore+0x27/0x43 [ 4507.740965] ? __pm_runtime_resume+0x60/0x90 [ 4507.740968] pci_device_remove+0x39/0xb0 [ 4507.740971] device_remove+0x46/0x70 [ 4507.740972] device_release_driver_internal+0xd1/0x160 [ 4507.740974] driver_detach+0x4a/0x90 [ 4507.740975] bus_remove_driver+0x6c/0xf0 [ 4507.740976] driver_unregister+0x31/0x50 [ 4507.740977] pci_unregister_driver+0x40/0x90 [ 4507.740978] amdgpu_exit+0x15/0x120 [amdgpu] v2: fix commit message style issue Signed-off-by: lyndonli <[email protected]> Reviewed-by: Guchun Chen <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 20534db commit 8879ec6

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -602,27 +602,14 @@ psp_cmd_submit_buf(struct psp_context *psp,
602602
struct psp_gfx_cmd_resp *cmd, uint64_t fence_mc_addr)
603603
{
604604
int ret;
605-
int index, idx;
605+
int index;
606606
int timeout = 20000;
607607
bool ras_intr = false;
608608
bool skip_unsupport = false;
609-
bool dev_entered;
610609

611610
if (psp->adev->no_hw_access)
612611
return 0;
613612

614-
dev_entered = drm_dev_enter(adev_to_drm(psp->adev), &idx);
615-
/*
616-
* We allow sending PSP messages LOAD_ASD and UNLOAD_TA without acquiring
617-
* a lock in drm_dev_enter during driver unload because we must call
618-
* drm_dev_unplug as the beginning of unload driver sequence . It is very
619-
* crucial that userspace can't access device instances anymore.
620-
*/
621-
if (!dev_entered)
622-
WARN_ON(psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_LOAD_ASD &&
623-
psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_UNLOAD_TA &&
624-
psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_INVOKE_CMD);
625-
626613
memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);
627614

628615
memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp));
@@ -686,8 +673,6 @@ psp_cmd_submit_buf(struct psp_context *psp,
686673
}
687674

688675
exit:
689-
if (dev_entered)
690-
drm_dev_exit(idx);
691676
return ret;
692677
}
693678

0 commit comments

Comments
 (0)