When the driver is reloaded, amdgpu_device_init() resets the ASIC but
does not post it again, because BIOS scratch register 7 still reports
ATOM_S7_ASIC_INIT_COMPLETE after the reset.  psp_sw_init() can then
read the PSP runtime database before the PSP is ready.  SCPM is
detected as disabled and the PPTable upload fails with "Failed to
transfer pptable to SMC!".

how to fix:
Set has_hw_reset after a successful reset on init, so that
amdgpu_device_need_post() returns true and amdgpu_device_asic_init()
is called.  The ASIC init returns only after the PSP is ready, so the
PSP runtime database is valid when it is read.

Signed-off-by: chong li <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 9fbe1c75897a..b4b149e1ad00 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4105,6 +4105,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                                amdgpu_reset_method = AMD_RESET_METHOD_NONE;
                                r = amdgpu_asic_reset(adev);
                                amdgpu_reset_method = tmp;
+                               /* Post again so that the PSP is ready before 
it is used */
+                               if (!r)
+                                       adev->has_hw_reset = true;
                }
 
                if (r) {
-- 
2.48.1

Reply via email to