AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <Lang.Yu@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Lang Yu <Lang.Yu@amd.com>
Subject: [PATCH 1/2] drm/amdgpu: extract a PSP function to execute IP FW loading commands
Date: Tue, 27 Jun 2023 12:48:32 +0800	[thread overview]
Message-ID: <20230627044833.3668402-1-Lang.Yu@amd.com> (raw)

This function is more general and easy to use by more clients.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 29 +++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  6 +++++
 2 files changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index a33c155dddcf..a1cb541f315f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -2445,6 +2445,35 @@ static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode,
 	return ret;
 }
 
+int psp_execute_load_ip_fw_cmd_buf(struct amdgpu_device *adev,
+				   struct amdgpu_firmware_info *ucode,
+				   uint32_t ucode_id,
+				   uint64_t cmd_buf_gpu_addr,
+				   int cmd_buf_size)
+{
+	struct amdgpu_firmware_info fw_info = {
+		.ucode_id = ucode_id,
+		.mc_addr = cmd_buf_gpu_addr,
+		.ucode_size = cmd_buf_size,
+	};
+	struct psp_context *psp = &adev->psp;
+	struct psp_gfx_cmd_resp *cmd =
+		acquire_psp_cmd_buf(psp);
+	int ret;
+
+	if (!ucode)
+		ucode = &fw_info;
+
+	ret = psp_prep_load_ip_fw_cmd_buf(ucode, cmd);
+	if (!ret)
+		ret = psp_cmd_submit_buf(psp, ucode, cmd,
+					 psp->fence_buf_mc_addr);
+
+	release_psp_cmd_buf(psp);
+
+	return ret;
+}
+
 static int psp_execute_non_psp_fw_load(struct psp_context *psp,
 				  struct amdgpu_firmware_info *ucode)
 {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 4847aacdf9dc..bd324fed6237 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -462,6 +462,12 @@ int psp_gpu_reset(struct amdgpu_device *adev);
 int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx,
 			uint64_t cmd_gpu_addr, int cmd_size);
 
+int psp_execute_load_ip_fw_cmd_buf(struct amdgpu_device *adev,
+				   struct amdgpu_firmware_info *ucode,
+				   uint32_t ucode_id,
+				   uint64_t cmd_buf_gpu_addr,
+				   int cmd_buf_size);
+
 int psp_ta_init_shared_buf(struct psp_context *psp,
 				  struct ta_mem_context *mem_ctx);
 void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx);
-- 
2.25.1


             reply	other threads:[~2023-06-27  4:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27  4:48 Lang Yu [this message]
2023-06-27  4:48 ` [PATCH 2/2] drm/amdgpu: use psp_execute_load_ip_fw_cmd_buf instead Lang Yu
2023-06-29  8:14   ` Lang Yu
2023-07-07 10:42     ` Lazar, Lijo
2023-07-07 11:11       ` Lang Yu
2023-07-05 20:10   ` Leo Liu
2023-06-29  8:14 ` [PATCH 1/2] drm/amdgpu: extract a PSP function to execute IP FW loading commands Lang Yu
2023-07-05 16:05 ` Gopalakrishnan, Veerabadhran (Veera)

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=20230627044833.3668402-1-Lang.Yu@amd.com \
    --to=lang.yu@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