AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Likun Gao <Likun.Gao@amd.com>,
	Hawking Zhang <Hawking.Zhang@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Subject: [PATCH 3/9] drm/amdgpu: use spirom update wait_for helper for psp v14
Date: Mon, 12 Feb 2024 12:58:43 -0500	[thread overview]
Message-ID: <20240212175849.433812-3-alexander.deucher@amd.com> (raw)
In-Reply-To: <20240212175849.433812-1-alexander.deucher@amd.com>

From: Likun Gao <Likun.Gao@amd.com>

Spirom update typically requires extremely long
duration for command execution, and special helper
function to wait for it's completion.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 6 +++++-
 drivers/gpu/drm/amd/amdgpu/psp_v14_0.h | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
index fc4caf752687..998758a1b209 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
@@ -577,7 +577,11 @@ static int psp_v14_0_exec_spi_cmd(struct psp_context *psp, int cmd)
 	WREG32_SOC15(MP0, 0, regMPASP_SMN_C2PMSG_73, 1);
 
 	if (cmd == C2PMSG_CMD_SPI_UPDATE_FLASH_IMAGE)
-		return 0;
+		ret = psp_wait_for_spirom_update(psp, SOC15_REG_OFFSET(MP0, 0, regMPASP_SMN_C2PMSG_115),
+						 MBOX_READY_FLAG, MBOX_READY_MASK, PSP_SPIROM_UPDATE_TIMEOUT);
+	else
+		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMPASP_SMN_C2PMSG_115),
+				   MBOX_READY_FLAG, MBOX_READY_MASK, false);
 
 	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMPASP_SMN_C2PMSG_115),
 				MBOX_READY_FLAG, MBOX_READY_MASK, false);
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h
index cb7ee54529b4..dd18ba2cfad5 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h
@@ -25,6 +25,8 @@
 
 #include "amdgpu_psp.h"
 
+#define PSP_SPIROM_UPDATE_TIMEOUT   60000   /* 60s */
+
 void psp_v14_0_set_psp_funcs(struct psp_context *psp);
 
 #endif
-- 
2.42.0


  parent reply	other threads:[~2024-02-12 17:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 17:58 [PATCH 0/9] PSP 14.0 support Alex Deucher
2024-02-12 17:58 ` [PATCH 2/9] drm/amdgpu: Add psp v14_0 ip block support Alex Deucher
2024-02-12 17:58 ` Alex Deucher [this message]
2024-02-12 17:58 ` [PATCH 4/9] drm/amdgpu: support psp ip block for psp v14 Alex Deucher
2024-02-12 17:58 ` [PATCH 5/9] drm/amdgpu/psp: set autoload support by default Alex Deucher
2024-02-12 17:58 ` [PATCH 6/9] drm/amdgpu/psp: handle TMR type via flag Alex Deucher
2024-02-12 17:58 ` [PATCH 7/9] drm/amdgpu/psp: set boot_time_tmr flag Alex Deucher
2024-02-12 17:58 ` [PATCH 8/9] drm/amdgpu: add psp_timeout to limit PSP related operation Alex Deucher
2024-02-12 17:58 ` [PATCH 9/9] drm/amdgpu: support psp ip block discovery for psp v14 Alex Deucher
2024-02-16 12:26 ` [PATCH 0/9] PSP 14.0 support Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240212175849.433812-3-alexander.deucher@amd.com \
    --to=alexander.deucher@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Likun.Gao@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox