Skip to content

Commit 7656168

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Add bootloader status check
Add a function to wait till bootloader has reached steady state. Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Reviewed-by: Asad Kamal <[email protected]> Tested-by: Asad Kamal <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8c97e87 commit 7656168

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,20 @@ static void amdgpu_block_invalid_wreg(struct amdgpu_device *adev,
885885
*/
886886
static int amdgpu_device_asic_init(struct amdgpu_device *adev)
887887
{
888+
int ret;
889+
888890
amdgpu_asic_pre_asic_init(adev);
889891

890892
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3) ||
891-
adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0))
892-
return amdgpu_atomfirmware_asic_init(adev, true);
893-
else
893+
adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0)) {
894+
amdgpu_psp_wait_for_bootloader(adev);
895+
ret = amdgpu_atomfirmware_asic_init(adev, true);
896+
return ret;
897+
} else {
894898
return amdgpu_atom_asic_init(adev->mode_info.atom_context);
899+
}
900+
901+
return 0;
895902
}
896903

897904
/**
@@ -4697,6 +4704,9 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
46974704
dev_err(adev->dev, "GPU mode1 reset failed\n");
46984705

46994706
amdgpu_device_load_pci_state(adev->pdev);
4707+
ret = amdgpu_psp_wait_for_bootloader(adev);
4708+
if (ret)
4709+
return ret;
47004710

47014711
/* wait for asic to come out of reset */
47024712
for (i = 0; i < adev->usec_timeout; i++) {
@@ -4708,6 +4718,7 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
47084718
}
47094719

47104720
amdgpu_atombios_scratch_regs_engine_hung(adev, false);
4721+
47114722
return ret;
47124723
}
47134724

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,17 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
20782078
}
20792079
/* SECUREDISPLAY end */
20802080

2081+
int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev)
2082+
{
2083+
struct psp_context *psp = &adev->psp;
2084+
int ret = 0;
2085+
2086+
if (!amdgpu_sriov_vf(adev) && psp->funcs && psp->funcs->wait_for_bootloader != NULL)
2087+
ret = psp->funcs->wait_for_bootloader(psp);
2088+
2089+
return ret;
2090+
}
2091+
20812092
static int psp_hw_start(struct psp_context *psp)
20822093
{
20832094
struct amdgpu_device *adev = psp->adev;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ enum psp_reg_prog_id {
109109

110110
struct psp_funcs {
111111
int (*init_microcode)(struct psp_context *psp);
112+
int (*wait_for_bootloader)(struct psp_context *psp);
112113
int (*bootloader_load_kdb)(struct psp_context *psp);
113114
int (*bootloader_load_spl)(struct psp_context *psp);
114115
int (*bootloader_load_sysdrv)(struct psp_context *psp);
@@ -533,4 +534,6 @@ int psp_spatial_partition(struct psp_context *psp, int mode);
533534

534535
int is_psp_fw_valid(struct psp_bin_desc bin);
535536

537+
int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev);
538+
536539
#endif

0 commit comments

Comments
 (0)