AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/18] drm/amdgpu: enhance amdgpu_ucode_request() function flexibility
@ 2024-05-31  6:52 Yang Wang
  2024-05-31  6:52 ` [PATCH 02/18] drm/amdgpu: refine gpu_info firmware loading Yang Wang
                   ` (17 more replies)
  0 siblings, 18 replies; 23+ messages in thread
From: Yang Wang @ 2024-05-31  6:52 UTC (permalink / raw)
  To: amd-gfx; +Cc: hawking.zhang, alexander.deucher

Adding formatting string feature to improve function flexibility.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 30 +++++++++++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  3 ++-
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index a9de78bb96e2..a452d9b6afdb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -28,6 +28,8 @@
 #include "amdgpu.h"
 #include "amdgpu_ucode.h"
 
+#define AMDGPU_MAX_FW_NAME_LEN		(128)
+
 static void amdgpu_ucode_print_common_hdr(const struct common_firmware_header *hdr)
 {
 	DRM_DEBUG("size_bytes: %u\n", le32_to_cpu(hdr->size_bytes));
@@ -1432,28 +1434,40 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  *
  * @adev: amdgpu device
  * @fw: pointer to load firmware to
- * @fw_name: firmware to load
+ * @fmt: firmware name format string
+ * @...: variable arguments
  *
  * This is a helper that will use request_firmware and amdgpu_ucode_validate
  * to load and run basic validation on firmware. If the load fails, remap
  * the error code to -ENODEV, so that early_init functions will fail to load.
  */
 int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
-			 const char *fw_name)
+			 const char *fmt, ...)
 {
-	int err = request_firmware(fw, fw_name, adev->dev);
+	char fname[AMDGPU_MAX_FW_NAME_LEN];
+	va_list ap;
+	int r;
+
+	va_start(ap, fmt);
+	r = vsnprintf(fname, sizeof(fname), fmt, ap);
+	va_end(ap);
+	if (r == sizeof(fname)) {
+		dev_warn(adev->dev, "amdgpu firmware name buffer overflow\n");
+		return -EOVERFLOW;
+	}
 
-	if (err)
+	r = request_firmware(fw, fname, adev->dev);
+	if (r)
 		return -ENODEV;
 
-	err = amdgpu_ucode_validate(*fw);
-	if (err) {
-		dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name);
+	r = amdgpu_ucode_validate(*fw);
+	if (r) {
+		dev_dbg(adev->dev, "\"%s\" failed to validate\n", fname);
 		release_firmware(*fw);
 		*fw = NULL;
 	}
 
-	return err;
+	return r;
 }
 
 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
index db745ab7b0c8..5bc37acd3981 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
@@ -594,8 +594,9 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
 void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
 void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr);
 void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr);
+__printf(3, 4)
 int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
-			 const char *fw_name);
+			 const char *fmt, ...);
 void amdgpu_ucode_release(const struct firmware **fw);
 bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,
 				uint16_t hdr_major, uint16_t hdr_minor);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [PATCH 00/18] Enhance amdgpu_firmware_request() to improve function flexibility
@ 2024-06-03  1:41 Yang Wang
  2024-06-03  1:41 ` [PATCH 01/18] drm/amdgpu: enhance amdgpu_ucode_request() " Yang Wang
  0 siblings, 1 reply; 23+ messages in thread
From: Yang Wang @ 2024-06-03  1:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: hawking.zhang, alexander.deucher

Adding variable parameter support to function amdgpu_firmware_request()
to improve function flexibility.

Yang Wang (18):
  drm/amdgpu: enhance amdgpu_ucode_request() function flexibility
  drm/amdgpu: refine gpu_info firmware loading
  drm/amdgpu: refine isp firmware loading
  drm/amdgpu: refine mes firmware loading
  drm/amdgpu: refine psp firmware loading
  drm/amdgpu: refine sdma firmware loading
  drm/amdgpu: refine imu firmware loading
  drm/amdgpu: refine pmfw/smu firmware loading
  drm/amdgpu: refine gmc firmware loading
  drm/amdgpu: refine vcn firmware loading
  drm/amdgpu: refine vpe firmware loading
  drm/amdgpu: refine gfx6 firmware loading
  drm/amdgpu: refine gfx7 firmware loading
  drm/amdgpu: refine gfx8 firmware loading
  drm/amdgpu: refine gfx9 firmware loading
  drm/amdgpu: refine gfx10 firmware loading
  drm/amdgpu: refine gfx11 firmware loading
  drm/amdgpu: refine gfx12 firmware loading

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  9 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c       |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c       |  6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c       | 26 ++-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c      |  8 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c     | 30 +++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h     |  3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c       | 14 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c       |  6 +-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c         | 11 +--
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 25 ++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c        | 26 ++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c        | 22 +++---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c         | 19 +++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c         | 27 ++++----
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c         | 69 +++++++++----------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c         | 45 ++++++------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c       | 11 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c         | 14 ++--
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c         |  7 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c         |  6 +-
 drivers/gpu/drm/amd/amdgpu/imu_v11_0.c        | 10 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v12_0.c        | 10 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c        | 11 +--
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c        | 11 +--
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c    |  8 +--
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    |  6 +-
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  6 +-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  |  6 +-
 .../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c    |  6 +-
 30 files changed, 205 insertions(+), 257 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-06-06  7:40 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31  6:52 [PATCH 01/18] drm/amdgpu: enhance amdgpu_ucode_request() function flexibility Yang Wang
2024-05-31  6:52 ` [PATCH 02/18] drm/amdgpu: refine gpu_info firmware loading Yang Wang
2024-05-31  6:52 ` [PATCH 03/18] drm/amdgpu: refine isp " Yang Wang
2024-05-31  6:52 ` [PATCH 04/18] drm/amdgpu: refine mes " Yang Wang
2024-05-31 14:24   ` Deucher, Alexander
2024-05-31 14:49     ` Wang, Yang(Kevin)
2024-05-31  6:52 ` [PATCH 05/18] drm/amdgpu: refine psp " Yang Wang
2024-05-31  6:52 ` [PATCH 06/18] drm/amdgpu: refine sdma " Yang Wang
2024-05-31  6:52 ` [PATCH 07/18] drm/amdgpu: refine imu " Yang Wang
2024-05-31  6:52 ` [PATCH 08/18] drm/amdgpu: refine pmfw/smu " Yang Wang
2024-05-31  6:52 ` [PATCH 09/18] drm/amdgpu: refine gmc " Yang Wang
2024-05-31  6:52 ` [PATCH 10/18] drm/amdgpu: refine vcn " Yang Wang
2024-05-31  6:52 ` [PATCH 11/18] drm/amdgpu: refine vpe " Yang Wang
2024-05-31  6:52 ` [PATCH 12/18] drm/amdgpu: refine gfx6 " Yang Wang
2024-05-31  6:52 ` [PATCH 13/18] drm/amdgpu: refine gfx7 " Yang Wang
2024-05-31  6:52 ` [PATCH 14/18] drm/amdgpu: refine gfx8 " Yang Wang
2024-05-31  6:52 ` [PATCH 15/18] drm/amdgpu: refine gfx9 " Yang Wang
2024-05-31  6:52 ` [PATCH 16/18] drm/amdgpu: refine gfx10 " Yang Wang
2024-05-31  6:52 ` [PATCH 17/18] drm/amdgpu: refine gfx11 " Yang Wang
2024-05-31  6:52 ` [PATCH 18/18] drm/amdgpu: refine gfx12 " Yang Wang
2024-06-03 11:05 ` [PATCH 01/18] drm/amdgpu: enhance amdgpu_ucode_request() function flexibility Christian König
  -- strict thread matches above, loose matches on Subject: below --
2024-06-03  1:41 [PATCH 00/18] Enhance amdgpu_firmware_request() to improve " Yang Wang
2024-06-03  1:41 ` [PATCH 01/18] drm/amdgpu: enhance amdgpu_ucode_request() " Yang Wang
2024-06-06  7:40   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox