[PATCH] drm/amd/ras: skip the RAS firmware reload when the block is down

Xiang Liu <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
A reset on init lowers the init level to the minimal XGMI set, which
leaves out the RAS IP block, so its hw_init never runs and the PSP
buffers stay unallocated. The resume that follows the reset tries to
reload the RAS firmware into those buffers, fails with -ENOMEM and
aborts the whole resume, taking every device of the hive down with it.

There is nothing to reload in that case. Leave the block alone and let
amdgpu_ras_resume_after_reset() bring it up, which is where it has to
happen anyway: the RAS hardware init reads the EEPROM and so takes the
reset domain lock for read, while the reset on init path still holds it
for write, so doing it here deadlocks.

Signed-off-by: Xiang Liu <[email protected]>
---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c
index 3d806e35382a..b41117deb5f3 100644
--- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c
+++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c
@@ -518,6 +518,13 @@ static int amdgpu_ras_mgr_resume(struct amdgpu_ip_block *ip_block)
 	if (!ras_mgr || !ras_mgr->ras_core)
 		return 0;
 
+	/* Nothing was loaded, so nothing to reload. The hw_init has to run
+	 * from amdgpu_ras_resume_after_reset() instead: it reads the EEPROM,
+	 * which takes the reset domain lock that reset on init still holds.
+	 */
+	if (!ras_mgr->ras_is_ready)
+		return 0;
+
 	ret = ras_psp_reload_firmwares(ras_mgr->ras_core, 0);
 	if (ret)
 		RAS_DEV_ERR(adev,
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.