Skip to contentSkip to conversation

drm/amd: Add the capability to mark certain firmware as "required"

PATCH In review Mario Limonciello 3 participants 15 messages Dec 3, 2024 – Dec 5, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: Add the capability to mark certain firmware as "required"

Some of the firmware that is loaded by amdgpu is not actually required. For example the ISP firmware on some SoCs is optional, and if it's not present the ISP IP block just won't be initialized.

The firmware loader core however will show a warning when this happens like this:

```
Direct firmware load for amdgpu/isp_4_1_0.bin failed with error -2
```

To avoid confusion for non-required firmware, adjust the amd-ucode helper to take an extra argument indicating if the firmware is required or not.

On non-required firmware use firmware_request_nowarn() instead of request_firmware() to avoid the warnings.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c        |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c        |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c        | 18 ++++++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c      |  8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h      |  9 +++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c   |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c        |  8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c          |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c         |  5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c         |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c         |  5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c          |  4 ++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c          |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c          | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c          | 12 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c        |  7 +++++--
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v11_0.c         |  3 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v12_0.c         |  3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c         |  2 ++
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  6 ++++--
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c     |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |  3 ++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c   |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c |  3 ++-
 35 files changed, 136 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -1
index 16153d275d7a..68bce6a6d09d 100644
@@ -414,7 +414,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
 				return -EINVAL;
 			}
 
-			err = amdgpu_ucode_request(adev, &adev->pm.fw, "%s", fw_name);
+			err = amdgpu_ucode_request(adev, &adev->pm.fw,
+						   AMDGPU_UCODE_REQUIRED,
+						   "%s", fw_name);
 			if (err) {
 				DRM_ERROR("Failed to load firmware \"%s\"", fw_name);
 				amdgpu_ucode_release(&adev->pm.fw);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 16b9b3c4190c..83f0de30317e 100644
@@ -2483,6 +2483,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw,
+				   AMDGPU_UCODE_NOT_REQUIRED,
 				   "amdgpu/%s_gpu_info.bin", chip_name);
 	if (err) {
 		dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -1
index d52f18393970..56cc179fca26 100644
@@ -77,7 +77,8 @@ static int isp_load_fw_by_psp(struct amdgpu_device *adev)
 				       sizeof(ucode_prefix));
 
 	/* read isp fw */
-	r = amdgpu_ucode_request(adev, &adev->isp.fw, "amdgpu/%s.bin", ucode_prefix);
+	r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_NOT_REQUIRED,
+				"amdgpu/%s.bin", ucode_prefix);
 	if (r) {
 		amdgpu_ucode_release(&adev->isp.fw);
 		return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -1
index a67e6a52347f..bb946fa1e912 100644
@@ -1438,10 +1438,12 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
 			 pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name);
 	if (r && need_retry && pipe == AMDGPU_MES_SCHED_PIPE) {
 		dev_info(adev->dev, "try to fall back to %s_mes.bin\n", ucode_prefix);
 		r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe],
+					 AMDGPU_UCODE_REQUIRED,
 					 "amdgpu/%s_mes.bin", ucode_prefix);
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +12 -6
index 12832fd834fb..3043ec5d3a31 100644
@@ -3290,7 +3290,8 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name)
 	const struct psp_firmware_header_v1_0 *asd_hdr;
 	int err = 0;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, "amdgpu/%s_asd.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_asd.bin", chip_name);
 	if (err)
 		goto out;
 
@@ -3312,7 +3313,8 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name)
 	const struct psp_firmware_header_v1_0 *toc_hdr;
 	int err = 0;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, "amdgpu/%s_toc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_toc.bin", chip_name);
 	if (err)
 		goto out;
 
@@ -3475,7 +3477,8 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name)
 	uint8_t *ucode_array_start_addr;
 	int err = 0;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, "amdgpu/%s_sos.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_sos.bin", chip_name);
 	if (err)
 		goto out;
 
@@ -3751,7 +3754,8 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name)
 	struct amdgpu_device *adev = psp->adev;
 	int err;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, "amdgpu/%s_ta.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_ta.bin", chip_name);
 	if (err)
 		return err;
 
@@ -3786,7 +3790,8 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name)
 		return -EINVAL;
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, "amdgpu/%s_cap.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, AMDGPU_UCODE_NOT_REQUIRED,
+				   "amdgpu/%s_cap.bin", chip_name);
 	if (err) {
 		if (err == -ENODEV) {
 			dev_warn(adev->dev, "cap microcode does not exist, skip\n");
@@ -3909,7 +3914,8 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
 	if (!drm_dev_enter(ddev, &idx))
 		return -ENODEV;
 
-	ret = amdgpu_ucode_request(adev, &usbc_pd_fw, "amdgpu/%s", buf);
+	ret = amdgpu_ucode_request(adev, &usbc_pd_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s", buf);
 	if (ret)
 		goto fail;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +2 -0
index 113f0d242618..b3c032f249f5 100644
@@ -219,9 +219,11 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
 	amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix));
 	if (instance == 0)
 		err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s.bin", ucode_prefix);
 	else
 		err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s%d.bin", ucode_prefix, instance);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +6 -2
index d3cd76c6dab3..ffbb3377e0f6 100644
@@ -1434,6 +1434,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  *
  * @adev: amdgpu device
  * @fw: pointer to load firmware to
+ * @required: whether the firmware is required
  * @fmt: firmware name format string
  * @...: variable arguments
  *
@@ -1442,7 +1443,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  * 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 *fmt, ...)
+			 enum amdgpu_ucode_required required, const char *fmt, ...)
 {
 	char fname[AMDGPU_UCODE_NAME_MAX];
 	va_list ap;
@@ -1456,7 +1457,10 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
 		return -EOVERFLOW;
 	}
 
-	r = request_firmware(fw, fname, adev->dev);
+	if (required == AMDGPU_UCODE_REQUIRED)
+		r = request_firmware(fw, fname, adev->dev);
+	else
+		r = firmware_request_nowarn(fw, fname, adev->dev);
 	if (r)
 		return -ENODEV;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +7 -2
index 4150ec0aa10d..827d75185d83 100644
@@ -551,6 +551,11 @@ enum amdgpu_firmware_load_type {
 	AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO,
 };
 
+enum amdgpu_ucode_required {
+	AMDGPU_UCODE_NOT_REQUIRED,
+	AMDGPU_UCODE_REQUIRED,
+};
+
 /* conform to smu_ucode_xfer_cz.h */
 #define AMDGPU_SDMA0_UCODE_LOADED	0x00000001
 #define AMDGPU_SDMA1_UCODE_LOADED	0x00000002
@@ -604,9 +609,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)
+__printf(4, 5)
 int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
-			 const char *fmt, ...);
+			 enum amdgpu_ucode_required required, 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);
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +2 -1
index bd2d3863c3ed..dde15c6a96e1 100644
@@ -587,7 +587,8 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch)
 		break;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name);
 	if (r) {
 		release_firmware(adev->umsch_mm.fw);
 		adev->umsch_mm.fw = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index 31fd30dcd593..30e9869a0584 100644
@@ -260,7 +260,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->uvd.fw, "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->uvd.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
 	if (r) {
 		dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n",
 			fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index 599d3ca4e0ef..65387f6943b4 100644
@@ -158,7 +158,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
 		return -EINVAL;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->vce.fw, "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->vce.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
 	if (r) {
 		dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n",
 			fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -2
index 05f01f50194b..2455cc126e59 100644
@@ -99,9 +99,13 @@ int amdgpu_vcn_early_init(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix));
 	for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
 		if (i == 1 && amdgpu_ip_version(adev, UVD_HWIP, 0) ==  IP_VERSION(4, 0, 6))
-			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s_%d.bin", ucode_prefix, i);
+			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+						 AMDGPU_UCODE_REQUIRED,
+						 "amdgpu/%s_%d.bin", ucode_prefix, i);
 		else
-			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s.bin", ucode_prefix);
+			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+						 AMDGPU_UCODE_REQUIRED,
+						 "amdgpu/%s.bin", ucode_prefix);
 		if (r) {
 			amdgpu_ucode_release(&adev->vcn.inst[i].fw);
 			return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +2 -1
index 83cb9f565fe5..2c12840ea444 100644
@@ -236,7 +236,8 @@ int amdgpu_vpe_init_microcode(struct amdgpu_vpe *vpe)
 	int ret;
 
 	amdgpu_ucode_ip_version_decode(adev, VPE_HWIP, fw_prefix, sizeof(fw_prefix));
-	ret = amdgpu_ucode_request(adev, &adev->vpe.fw, "amdgpu/%s.bin", fw_prefix);
+	ret = amdgpu_ucode_request(adev, &adev->vpe.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", fw_prefix);
 	if (ret)
 		goto out;
 
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
index 1563e35da0fe..a5cd950c94be 100644
@@ -133,9 +133,11 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev)
 	for (i = 0; i < adev->sdma.num_instances; i++) {
 		if (i == 0)
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma1.bin", chip_name);
 		if (err)
 			goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -0
index f1b35b4a73ff..c4e15418e187 100644
@@ -4138,18 +4138,21 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
@@ -4173,6 +4176,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
@@ -4180,6 +4184,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
 	if (!err) {
 		amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -0
index f63a06661f86..67cd42031571 100644
@@ -641,6 +641,7 @@ static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *
 	int err = 0;
 
 	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_toc.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -690,6 +691,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -707,6 +709,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -722,9 +725,11 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 		if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 0) &&
 		    adev->pdev->revision == 0xCE)
 			err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/gc_11_0_0_rlc_1.bin");
 		else
 			err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_rlc.bin", ucode_prefix);
 		if (err)
 			goto out;
@@ -737,6 +742,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec.bin", ucode_prefix);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -0
index ebb09c363803..d0697b0869e3 100644
@@ -539,6 +539,7 @@ static int gfx_v12_0_init_toc_microcode(struct amdgpu_device *adev, const char *
 	int err = 0;
 
 	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_toc.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -568,6 +569,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -575,6 +577,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -583,6 +586,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 
 	if (!amdgpu_sriov_vf(adev)) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_rlc.bin", ucode_prefix);
 		if (err)
 			goto out;
@@ -595,6 +599,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec.bin", ucode_prefix);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +4 -0
index 81c185a8b3a0..1b4c0dcee7e1 100644
@@ -337,6 +337,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", chip_name);
 	if (err)
 		goto out;
@@ -345,6 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", chip_name);
 	if (err)
 		goto out;
@@ -353,6 +355,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce.bin", chip_name);
 	if (err)
 		goto out;
@@ -361,6 +364,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index 60931396f76b..17a07e1adffa 100644
@@ -934,33 +934,39 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", chip_name);
 	if (err)
 		goto out;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", chip_name);
 	if (err)
 		goto out;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce.bin", chip_name);
 	if (err)
 		goto out;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec.bin", chip_name);
 	if (err)
 		goto out;
 
 	if (adev->asic_type == CHIP_KAVERI) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_mec2.bin", chip_name);
 		if (err)
 			goto out;
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 out:
 	if (err) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +16 -0
index f15beb217b48..a2a45be68c24 100644
@@ -982,13 +982,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_pfp_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_pfp.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_pfp.bin", chip_name);
 	}
 	if (err)
@@ -999,13 +1002,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_me_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_me.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_me.bin", chip_name);
 	}
 	if (err)
@@ -1017,13 +1023,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_ce_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_ce.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_ce.bin", chip_name);
 	}
 	if (err)
@@ -1044,6 +1053,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 		adev->virt.chained_ib_support = false;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
@@ -1093,13 +1103,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_mec_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_mec.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_mec.bin", chip_name);
 	}
 	if (err)
@@ -1112,13 +1125,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 	    (adev->asic_type != CHIP_TOPAZ)) {
 		if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_NOT_REQUIRED,
 						   "amdgpu/%s_mec2_2.bin", chip_name);
 			if (err == -ENODEV) {
 				err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+							   AMDGPU_UCODE_REQUIRED,
 							   "amdgpu/%s_mec2.bin", chip_name);
 			}
 		} else {
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_mec2.bin", chip_name);
 		}
 		if (!err) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -1
index 4e27528b7e57..30d9b6dacb6e 100644
@@ -1429,18 +1429,21 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev,
 	int err;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", chip_name);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", chip_name);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce.bin", chip_name);
 	if (err)
 		goto out;
@@ -1476,6 +1479,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
 		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
 		((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_rlc_am4.bin", chip_name);
 	else if (!strcmp(chip_name, "raven") && (amdgpu_pm_load_smu_firmware(adev, &smu_version) == 0) &&
 		(smu_version >= 0x41e2b))
@@ -1483,9 +1487,11 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
 		*SMC is loaded by SBIOS on APU and it's able to get the SMU version directly.
 		*/
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_kicker_rlc.bin", chip_name);
 	else
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
@@ -1518,9 +1524,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
 
 	if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-					   "amdgpu/%s_sjt_mec.bin", chip_name);
+				   AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_sjt_mec.bin", chip_name);
 	else
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_mec.bin", chip_name);
 	if (err)
 		goto out;
@@ -1531,9 +1539,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
 	if (gfx_v9_0_load_mec2_fw_bin_support(adev)) {
 		if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sjt_mec2.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_mec2.bin", chip_name);
 		if (!err) {
 			amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +5 -2
index 8eccb080d56f..9c146e37c55e 100644
@@ -545,6 +545,7 @@ static int gfx_v9_4_3_init_rlc_microcode(struct amdgpu_device *adev,
 
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
@@ -578,10 +579,12 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
 
 	if (amdgpu_sriov_vf(adev))
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-				"amdgpu/%s_sjt_mec.bin", chip_name);
+					   AMDGPU_UCODE_REQUIRED,
+					   "amdgpu/%s_sjt_mec.bin", chip_name);
 	else
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-				"amdgpu/%s_mec.bin", chip_name);
+					   AMDGPU_UCODE_REQUIRED,
+					   "amdgpu/%s_mec.bin", chip_name);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -1
index 8e878ab44e76..2245dda92021 100644
@@ -131,7 +131,8 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
 	if (((RREG32(mmMC_SEQ_MISC0) & 0xff000000) >> 24) == 0x58)
 		chip_name = "si58";
 
-	err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_mc.bin", chip_name);
 	if (err) {
 		dev_err(adev->dev,
 		       "si_mc: Failed to load firmware \"%s_mc.bin\"\n",
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -1
index 347bccd92696..9aac4b1101e3 100644
@@ -157,7 +157,8 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_mc.bin", chip_name);
 	if (err) {
 		pr_err("cik_mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
 		amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -1
index 29ce36038b3f..d06585207c33 100644
@@ -259,7 +259,8 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_mc.bin", chip_name);
 	if (err) {
 		pr_err("mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
 		amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +2 -1
index d4f72e47ae9e..aeca5c08ea2f 100644
@@ -50,7 +50,8 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev)
 	DRM_DEBUG("\n");
 
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_imu.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +2 -1
index 1341f0292031..df898dbb746e 100644
@@ -47,7 +47,8 @@ static int imu_v12_0_init_microcode(struct amdgpu_device *adev)
 	DRM_DEBUG("\n");
 
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_imu.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
index c6af318908e4..269bf1e3337b 100644
@@ -145,9 +145,11 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)
 	for (i = 0; i < adev->sdma.num_instances; i++) {
 		if (i == 0)
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma1.bin", chip_name);
 		if (err)
 			goto out;
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
index d438f2f7a408..c9ad9ec48688 100644
@@ -305,9 +305,11 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
 	for (i = 0; i < adev->sdma.num_instances; i++) {
 		if (i == 0)
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma1.bin", chip_name);
 		if (err)
 			goto out;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
index 85f21db6ef24..fff5a1cdf474 100644
@@ -2338,7 +2338,8 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
 		return 0;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, "%s", fw_name_dmcu);
+	r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name_dmcu);
 	if (r == -ENODEV) {
 		/* DMCU firmware is not necessary, so don't raise a fuss if it's missing */
 		DRM_DEBUG_KMS("dm: DMCU firmware not found\n");
@@ -5306,7 +5307,8 @@ static int dm_init_microcode(struct amdgpu_device *adev)
 		/* ASIC doesn't support DMUB. */
 		return 0;
 	}
-	r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, "%s", fw_name_dmub);
+	r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name_dmub);
 	return r;
 }
 
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +2 -1
index 2bed85ba835e..a87dcf0974bc 100644
@@ -7709,7 +7709,8 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev)
 	default: BUG();
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s_smc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_smc.bin", chip_name);
 	if (err) {
 		DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s_smc.bin\"\n",
 			  err, chip_name);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -1
index 480cf3cb204d..189c6a32b6bd 100644
@@ -105,7 +105,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
 		return 0;
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
index bb506d15d787..7bb45ff6d5c8 100644
@@ -103,7 +103,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
 		return 0;
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -1
index 8344f54e6674..5b86df0c8536 100644
@@ -305,7 +305,8 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu)
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix,
 				       sizeof(ucode_prefix));
-	ret  = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	ret  = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				    "amdgpu/%s.bin", ucode_prefix);
 	if (ret)
 		goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +2 -1
index 4d083f7f772e..9b2f4fe1578b 100644
@@ -79,7 +79,8 @@ int smu_v14_0_init_microcode(struct smu_context *smu)
 		return 0;
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", ucode_prefix);
 	if (err)
 		goto out;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 233 lines · Mario Limonciello

Some of the firmware that is loaded by amdgpu is not actually required. For example the ISP firmware on some SoCs is optional, and if it's not present the ISP IP block just won't be initialized.

The firmware loader core however will show a warning when this happens like this:

```
Direct firmware load for amdgpu/isp_4_1_0.bin failed with error -2
```

To avoid confusion for non-required firmware, adjust the amd-ucode helper to take an extra argument indicating if the firmware is required or not.

On non-required firmware use firmware_request_nowarn() instead of request_firmware() to avoid the warnings.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c        |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c        |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c        | 18 ++++++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c      |  8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h      |  9 +++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c   |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c        |  8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c          |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c         |  5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c         |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c         |  5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c          |  4 ++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c          |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c          | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c          | 12 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c        |  7 +++++--
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v11_0.c         |  3 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v12_0.c         |  3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c         |  2 ++
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  6 ++++--
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c     |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |  3 ++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c   |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c |  3 ++-
 35 files changed, 136 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -1
index 16153d275d7a..68bce6a6d09d 100644
@@ -414,7 +414,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
                                return -EINVAL;
                        }
 
-                       err = amdgpu_ucode_request(adev, &adev->pm.fw, "%s", fw_name);
+                       err = amdgpu_ucode_request(adev, &adev->pm.fw,
+                                                  AMDGPU_UCODE_REQUIRED,
+                                                  "%s", fw_name);
                        if (err) {
                                DRM_ERROR("Failed to load firmware \"%s\"", fw_name);
                                amdgpu_ucode_release(&adev->pm.fw);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 16b9b3c4190c..83f0de30317e 100644
@@ -2483,6 +2483,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw,
+                                  AMDGPU_UCODE_NOT_REQUIRED,
                                   "amdgpu/%s_gpu_info.bin", chip_name);
        if (err) {
                dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -1
index d52f18393970..56cc179fca26 100644
@@ -77,7 +77,8 @@ static int isp_load_fw_by_psp(struct amdgpu_device *adev)
                                       sizeof(ucode_prefix));
 
        /* read isp fw */
-       r = amdgpu_ucode_request(adev, &adev->isp.fw, "amdgpu/%s.bin", ucode_prefix);
+       r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_NOT_REQUIRED,
+                               "amdgpu/%s.bin", ucode_prefix);
        if (r) {
                amdgpu_ucode_release(&adev->isp.fw);
                return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -1
index a67e6a52347f..bb946fa1e912 100644
@@ -1438,10 +1438,12 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
                         pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
        }
 
-       r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name);
        if (r && need_retry && pipe == AMDGPU_MES_SCHED_PIPE) {
                dev_info(adev->dev, "try to fall back to %s_mes.bin\n", ucode_prefix);
                r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe],
+                                        AMDGPU_UCODE_REQUIRED,
                                         "amdgpu/%s_mes.bin", ucode_prefix);
        }
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +12 -6
index 12832fd834fb..3043ec5d3a31 100644
@@ -3290,7 +3290,8 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name)
        const struct psp_firmware_header_v1_0 *asd_hdr;
        int err = 0;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, "amdgpu/%s_asd.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_asd.bin", chip_name);
        if (err)
                goto out;
 
@@ -3312,7 +3313,8 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name)
        const struct psp_firmware_header_v1_0 *toc_hdr;
        int err = 0;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, "amdgpu/%s_toc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_toc.bin", chip_name);
        if (err)
                goto out;
 
@@ -3475,7 +3477,8 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name)
        uint8_t *ucode_array_start_addr;
        int err = 0;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, "amdgpu/%s_sos.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_sos.bin", chip_name);
        if (err)
                goto out;
 
@@ -3751,7 +3754,8 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name)
        struct amdgpu_device *adev = psp->adev;
        int err;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, "amdgpu/%s_ta.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_ta.bin", chip_name);
        if (err)
                return err;
 
@@ -3786,7 +3790,8 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name)
                return -EINVAL;
        }
 
-       err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, "amdgpu/%s_cap.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, AMDGPU_UCODE_NOT_REQUIRED,
+                                  "amdgpu/%s_cap.bin", chip_name);
        if (err) {
                if (err == -ENODEV) {
                        dev_warn(adev->dev, "cap microcode does not exist, skip\n");
@@ -3909,7 +3914,8 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
        if (!drm_dev_enter(ddev, &idx))
                return -ENODEV;
 
-       ret = amdgpu_ucode_request(adev, &usbc_pd_fw, "amdgpu/%s", buf);
+       ret = amdgpu_ucode_request(adev, &usbc_pd_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s", buf);
        if (ret)
                goto fail;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +2 -0
index 113f0d242618..b3c032f249f5 100644
@@ -219,9 +219,11 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
        amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix));
        if (instance == 0)
                err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s.bin", ucode_prefix);
        else
                err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s%d.bin", ucode_prefix, instance);
        if (err)
                goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +6 -2
index d3cd76c6dab3..ffbb3377e0f6 100644
@@ -1434,6 +1434,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  *
  * @adev: amdgpu device
  * @fw: pointer to load firmware to
+ * @required: whether the firmware is required
  * @fmt: firmware name format string
  * @...: variable arguments
  *
@@ -1442,7 +1443,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  * 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 *fmt, ...)
+                        enum amdgpu_ucode_required required, const char *fmt, ...)
 {
        char fname[AMDGPU_UCODE_NAME_MAX];
        va_list ap;
@@ -1456,7 +1457,10 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
                return -EOVERFLOW;
        }
 
-       r = request_firmware(fw, fname, adev->dev);
+       if (required == AMDGPU_UCODE_REQUIRED)
+               r = request_firmware(fw, fname, adev->dev);
+       else
+               r = firmware_request_nowarn(fw, fname, adev->dev);
        if (r)
                return -ENODEV;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +0 -0
index 4150ec0aa10d..827d75185d83 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h enum amdgpu_firmware_load_type { · line 555

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
@@ -551,6 +551,11 @@ enum amdgpu_firmware_load_type {
        AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO,
 };
 
+enum amdgpu_ucode_required {
+       AMDGPU_UCODE_NOT_REQUIRED,

Maybe:
AMDGPU_UCODE_OPTIONAL instead? Either way.

Quoted 716 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +5 -2
+       AMDGPU_UCODE_REQUIRED,
+};
+
 /* conform to smu_ucode_xfer_cz.h */
 #define AMDGPU_SDMA0_UCODE_LOADED      0x00000001
 #define AMDGPU_SDMA1_UCODE_LOADED      0x00000002
@@ -604,9 +609,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)
+__printf(4, 5)
 int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
-                        const char *fmt, ...);
+                        enum amdgpu_ucode_required required, 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);
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +2 -1
index bd2d3863c3ed..dde15c6a96e1 100644
@@ -587,7 +587,8 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch)
                break;
        }
 
-       r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name);
        if (r) {
                release_firmware(adev->umsch_mm.fw);
                adev->umsch_mm.fw = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index 31fd30dcd593..30e9869a0584 100644
@@ -260,7 +260,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
                return -EINVAL;
        }
 
-       r = amdgpu_ucode_request(adev, &adev->uvd.fw, "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->uvd.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
        if (r) {
                dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n",
                        fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index 599d3ca4e0ef..65387f6943b4 100644
@@ -158,7 +158,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
                return -EINVAL;
        }
 
-       r = amdgpu_ucode_request(adev, &adev->vce.fw, "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->vce.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
        if (r) {
                dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n",
                        fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -2
index 05f01f50194b..2455cc126e59 100644
@@ -99,9 +99,13 @@ int amdgpu_vcn_early_init(struct amdgpu_device *adev)
        amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix));
        for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
                if (i == 1 && amdgpu_ip_version(adev, UVD_HWIP, 0) ==  IP_VERSION(4, 0, 6))
-                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s_%d.bin", ucode_prefix, i);
+                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+                                                AMDGPU_UCODE_REQUIRED,
+                                                "amdgpu/%s_%d.bin", ucode_prefix, i);
                else
-                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s.bin", ucode_prefix);
+                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+                                                AMDGPU_UCODE_REQUIRED,
+                                                "amdgpu/%s.bin", ucode_prefix);
                if (r) {
                        amdgpu_ucode_release(&adev->vcn.inst[i].fw);
                        return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +2 -1
index 83cb9f565fe5..2c12840ea444 100644
@@ -236,7 +236,8 @@ int amdgpu_vpe_init_microcode(struct amdgpu_vpe *vpe)
        int ret;
 
        amdgpu_ucode_ip_version_decode(adev, VPE_HWIP, fw_prefix, sizeof(fw_prefix));
-       ret = amdgpu_ucode_request(adev, &adev->vpe.fw, "amdgpu/%s.bin", fw_prefix);
+       ret = amdgpu_ucode_request(adev, &adev->vpe.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", fw_prefix);
        if (ret)
                goto out;
 
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
index 1563e35da0fe..a5cd950c94be 100644
@@ -133,9 +133,11 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev)
        for (i = 0; i < adev->sdma.num_instances; i++) {
                if (i == 0)
                        err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sdma.bin", chip_name);
                else
                        err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sdma1.bin", chip_name);
                if (err)
                        goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -0
index f1b35b4a73ff..c4e15418e187 100644
@@ -4138,18 +4138,21 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
        amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
        if (err)
                goto out;
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_me%s.bin", ucode_prefix, wks);
        if (err)
                goto out;
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
        if (err)
                goto out;
@@ -4173,6 +4176,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
        if (err)
                goto out;
@@ -4180,6 +4184,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
        if (!err) {
                amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -0
index f63a06661f86..67cd42031571 100644
@@ -641,6 +641,7 @@ static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *
        int err = 0;
 
        err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_toc.bin", ucode_prefix);
        if (err)
                goto out;
@@ -690,6 +691,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
        amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_pfp.bin", ucode_prefix);
        if (err)
                goto out;
@@ -707,6 +709,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_me.bin", ucode_prefix);
        if (err)
                goto out;
@@ -722,9 +725,11 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
                if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 0) &&
                    adev->pdev->revision == 0xCE)
                        err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/gc_11_0_0_rlc_1.bin");
                else
                        err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_rlc.bin", ucode_prefix);
                if (err)
                        goto out;
@@ -737,6 +742,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_mec.bin", ucode_prefix);
        if (err)
                goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -0
index ebb09c363803..d0697b0869e3 100644
@@ -539,6 +539,7 @@ static int gfx_v12_0_init_toc_microcode(struct amdgpu_device *adev, const char *
        int err = 0;
 
        err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_toc.bin", ucode_prefix);
        if (err)
                goto out;
@@ -568,6 +569,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
        amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_pfp.bin", ucode_prefix);
        if (err)
                goto out;
@@ -575,6 +577,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_me.bin", ucode_prefix);
        if (err)
                goto out;
@@ -583,6 +586,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 
        if (!amdgpu_sriov_vf(adev)) {
                err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_rlc.bin", ucode_prefix);
                if (err)
                        goto out;
@@ -595,6 +599,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_mec.bin", ucode_prefix);
        if (err)
                goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +4 -0
index 81c185a8b3a0..1b4c0dcee7e1 100644
@@ -337,6 +337,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_pfp.bin", chip_name);
        if (err)
                goto out;
@@ -345,6 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
        adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_me.bin", chip_name);
        if (err)
                goto out;
@@ -353,6 +355,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
        adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_ce.bin", chip_name);
        if (err)
                goto out;
@@ -361,6 +364,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
        adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_rlc.bin", chip_name);
        if (err)
                goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index 60931396f76b..17a07e1adffa 100644
@@ -934,33 +934,39 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_pfp.bin", chip_name);
        if (err)
                goto out;
 
        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_me.bin", chip_name);
        if (err)
                goto out;
 
        err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_ce.bin", chip_name);
        if (err)
                goto out;
 
        err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_mec.bin", chip_name);
        if (err)
                goto out;
 
        if (adev->asic_type == CHIP_KAVERI) {
                err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_mec2.bin", chip_name);
                if (err)
                        goto out;
        }
 
        err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_rlc.bin", chip_name);
 out:
        if (err) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +16 -0
index f15beb217b48..a2a45be68c24 100644
@@ -982,13 +982,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
        if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                           "amdgpu/%s_pfp_2.bin", chip_name);
                if (err == -ENODEV) {
                        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_pfp.bin", chip_name);
                }
        } else {
                err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_pfp.bin", chip_name);
        }
        if (err)
@@ -999,13 +1002,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
        if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                           "amdgpu/%s_me_2.bin", chip_name);
                if (err == -ENODEV) {
                        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_me.bin", chip_name);
                }
        } else {
                err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_me.bin", chip_name);
        }
        if (err)
@@ -1017,13 +1023,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
        if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                           "amdgpu/%s_ce_2.bin", chip_name);
                if (err == -ENODEV) {
                        err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_ce.bin", chip_name);
                }
        } else {
                err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_ce.bin", chip_name);
        }
        if (err)
@@ -1044,6 +1053,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
                adev->virt.chained_ib_support = false;
 
        err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_rlc.bin", chip_name);
        if (err)
                goto out;
@@ -1093,13 +1103,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
        if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                           "amdgpu/%s_mec_2.bin", chip_name);
                if (err == -ENODEV) {
                        err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_mec.bin", chip_name);
                }
        } else {
                err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_mec.bin", chip_name);
        }
        if (err)
@@ -1112,13 +1125,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
            (adev->asic_type != CHIP_TOPAZ)) {
                if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                        err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_NOT_REQUIRED,
                                                   "amdgpu/%s_mec2_2.bin", chip_name);
                        if (err == -ENODEV) {
                                err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                          AMDGPU_UCODE_REQUIRED,
                                                           "amdgpu/%s_mec2.bin", chip_name);
                        }
                } else {
                        err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_mec2.bin", chip_name);
                }
                if (!err) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -1
index 4e27528b7e57..30d9b6dacb6e 100644
@@ -1429,18 +1429,21 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev,
        int err;
 
        err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_pfp.bin", chip_name);
        if (err)
                goto out;
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_me.bin", chip_name);
        if (err)
                goto out;
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
        err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_ce.bin", chip_name);
        if (err)
                goto out;
@@ -1476,6 +1479,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
                (((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
                ((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
                err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_rlc_am4.bin", chip_name);
        else if (!strcmp(chip_name, "raven") && (amdgpu_pm_load_smu_firmware(adev, &smu_version) == 0) &&
                (smu_version >= 0x41e2b))
@@ -1483,9 +1487,11 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
                *SMC is loaded by SBIOS on APU and it's able to get the SMU version directly.
                */
                err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_kicker_rlc.bin", chip_name);
        else
                err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_rlc.bin", chip_name);
        if (err)
                goto out;
@@ -1518,9 +1524,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
 
        if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
                err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-                                          "amdgpu/%s_sjt_mec.bin", chip_name);
+                                  AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_sjt_mec.bin", chip_name);
        else
                err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                           "amdgpu/%s_mec.bin", chip_name);
        if (err)
                goto out;
@@ -1531,9 +1539,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
        if (gfx_v9_0_load_mec2_fw_bin_support(adev)) {
                if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
                        err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sjt_mec2.bin", chip_name);
                else
                        err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_mec2.bin", chip_name);
                if (!err) {
                        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +5 -2
index 8eccb080d56f..9c146e37c55e 100644
@@ -545,6 +545,7 @@ static int gfx_v9_4_3_init_rlc_microcode(struct amdgpu_device *adev,
 
 
        err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                   "amdgpu/%s_rlc.bin", chip_name);
        if (err)
                goto out;
@@ -578,10 +579,12 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
 
        if (amdgpu_sriov_vf(adev))
                err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-                               "amdgpu/%s_sjt_mec.bin", chip_name);
+                                          AMDGPU_UCODE_REQUIRED,
+                                          "amdgpu/%s_sjt_mec.bin", chip_name);
        else
                err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-                               "amdgpu/%s_mec.bin", chip_name);
+                                          AMDGPU_UCODE_REQUIRED,
+                                          "amdgpu/%s_mec.bin", chip_name);
        if (err)
                goto out;
        amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -1
index 8e878ab44e76..2245dda92021 100644
@@ -131,7 +131,8 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
        if (((RREG32(mmMC_SEQ_MISC0) & 0xff000000) >> 24) == 0x58)
                chip_name = "si58";
 
-       err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_mc.bin", chip_name);
        if (err) {
                dev_err(adev->dev,
                       "si_mc: Failed to load firmware \"%s_mc.bin\"\n",
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -1
index 347bccd92696..9aac4b1101e3 100644
@@ -157,7 +157,8 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
                return -EINVAL;
        }
 
-       err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_mc.bin", chip_name);
        if (err) {
                pr_err("cik_mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
                amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -1
index 29ce36038b3f..d06585207c33 100644
@@ -259,7 +259,8 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
                return -EINVAL;
        }
 
-       err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_mc.bin", chip_name);
        if (err) {
                pr_err("mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
                amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +2 -1
index d4f72e47ae9e..aeca5c08ea2f 100644
@@ -50,7 +50,8 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev)
        DRM_DEBUG("\n");
 
        amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_imu.bin", ucode_prefix);
        if (err)
                goto out;
 
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +2 -1
index 1341f0292031..df898dbb746e 100644
@@ -47,7 +47,8 @@ static int imu_v12_0_init_microcode(struct amdgpu_device *adev)
        DRM_DEBUG("\n");
 
        amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_imu.bin", ucode_prefix);
        if (err)
                goto out;
 
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
index c6af318908e4..269bf1e3337b 100644
@@ -145,9 +145,11 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)
        for (i = 0; i < adev->sdma.num_instances; i++) {
                if (i == 0)
                        err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sdma.bin", chip_name);
                else
                        err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sdma1.bin", chip_name);
                if (err)
                        goto out;
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
index d438f2f7a408..c9ad9ec48688 100644
@@ -305,9 +305,11 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
        for (i = 0; i < adev->sdma.num_instances; i++) {
                if (i == 0)
                        err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sdma.bin", chip_name);
                else
                        err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                   "amdgpu/%s_sdma1.bin", chip_name);
                if (err)
                        goto out;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
index 85f21db6ef24..fff5a1cdf474 100644
@@ -2338,7 +2338,8 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
                return 0;
        }
 
-       r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, "%s", fw_name_dmcu);
+       r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name_dmcu);
        if (r == -ENODEV) {
                /* DMCU firmware is not necessary, so don't raise a fuss if it's missing */
                DRM_DEBUG_KMS("dm: DMCU firmware not found\n");
@@ -5306,7 +5307,8 @@ static int dm_init_microcode(struct amdgpu_device *adev)
                /* ASIC doesn't support DMUB. */
                return 0;
        }
-       r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, "%s", fw_name_dmub);
+       r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name_dmub);
        return r;
 }
 
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +2 -1
index 2bed85ba835e..a87dcf0974bc 100644
@@ -7709,7 +7709,8 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev)
        default: BUG();
        }
 
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s_smc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_smc.bin", chip_name);
        if (err) {
                DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s_smc.bin\"\n",
                          err, chip_name);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -1
index 480cf3cb204d..189c6a32b6bd 100644
@@ -105,7 +105,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
                return 0;
 
        amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", ucode_prefix);
        if (err)
                goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
index bb506d15d787..7bb45ff6d5c8 100644
@@ -103,7 +103,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
                return 0;
 
        amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", ucode_prefix);
        if (err)
                goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -1
index 8344f54e6674..5b86df0c8536 100644
@@ -305,7 +305,8 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu)
 
        amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix,
                                       sizeof(ucode_prefix));
-       ret  = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       ret  = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                   "amdgpu/%s.bin", ucode_prefix);
        if (ret)
                goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +2 -2
index 4d083f7f772e..9b2f4fe1578b 100644
@@ -79,7 +79,8 @@ int smu_v14_0_init_microcode(struct smu_context *smu)
                return 0;
 
        amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", ucode_prefix);
        if (err)
                goto out;
 
--

2.34.1

#2 lore raw
Quoted 238 lines · Alex Deucher
Quoted 236 lines · Mario Limonciello

Some of the firmware that is loaded by amdgpu is not actually required. For example the ISP firmware on some SoCs is optional, and if it's not present the ISP IP block just won't be initialized.

The firmware loader core however will show a warning when this happens like this:

```
Direct firmware load for amdgpu/isp_4_1_0.bin failed with error -2
```

To avoid confusion for non-required firmware, adjust the amd-ucode helper to take an extra argument indicating if the firmware is required or not.

On non-required firmware use firmware_request_nowarn() instead of request_firmware() to avoid the warnings.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c        |  4 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c        |  3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c        |  4 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c        | 18 ++++++++++++------
  drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c       |  2 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c      |  8 ++++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h      |  9 +++++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c   |  3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c        |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c        |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c        |  8 ++++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c        |  3 ++-
  drivers/gpu/drm/amd/amdgpu/cik_sdma.c          |  2 ++
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c         |  5 +++++
  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c         |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c         |  5 +++++
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c          |  4 ++++
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c          |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c          | 16 ++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c          | 12 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c        |  7 +++++--
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c          |  3 ++-
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c          |  3 ++-
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c          |  3 ++-
  drivers/gpu/drm/amd/amdgpu/imu_v11_0.c         |  3 ++-
  drivers/gpu/drm/amd/amdgpu/imu_v12_0.c         |  3 ++-
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c         |  2 ++
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c         |  2 ++
  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  6 ++++--
  drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c     |  3 ++-
  drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c |  3 ++-
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |  3 ++-
  .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c   |  3 ++-
  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c |  3 ++-
  35 files changed, 136 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -1
index 16153d275d7a..68bce6a6d09d 100644
@@ -414,7 +414,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
                                 return -EINVAL;
                         }
 
-                       err = amdgpu_ucode_request(adev, &adev->pm.fw, "%s", fw_name);
+                       err = amdgpu_ucode_request(adev, &adev->pm.fw,
+                                                  AMDGPU_UCODE_REQUIRED,
+                                                  "%s", fw_name);
                         if (err) {
                                 DRM_ERROR("Failed to load firmware \"%s\"", fw_name);
                                 amdgpu_ucode_release(&adev->pm.fw);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 16b9b3c4190c..83f0de30317e 100644
@@ -2483,6 +2483,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw,
+                                  AMDGPU_UCODE_NOT_REQUIRED,
                                    "amdgpu/%s_gpu_info.bin", chip_name);
         if (err) {
                 dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -1
index d52f18393970..56cc179fca26 100644
@@ -77,7 +77,8 @@ static int isp_load_fw_by_psp(struct amdgpu_device *adev)
                                        sizeof(ucode_prefix));
 
         /* read isp fw */
-       r = amdgpu_ucode_request(adev, &adev->isp.fw, "amdgpu/%s.bin", ucode_prefix);
+       r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_NOT_REQUIRED,
+                               "amdgpu/%s.bin", ucode_prefix);
         if (r) {
                 amdgpu_ucode_release(&adev->isp.fw);
                 return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -1
index a67e6a52347f..bb946fa1e912 100644
@@ -1438,10 +1438,12 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
                          pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
         }
 
-       r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name);
         if (r && need_retry && pipe == AMDGPU_MES_SCHED_PIPE) {
                 dev_info(adev->dev, "try to fall back to %s_mes.bin\n", ucode_prefix);
                 r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe],
+                                        AMDGPU_UCODE_REQUIRED,
                                          "amdgpu/%s_mes.bin", ucode_prefix);
         }
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +12 -6
index 12832fd834fb..3043ec5d3a31 100644
@@ -3290,7 +3290,8 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name)
         const struct psp_firmware_header_v1_0 *asd_hdr;
         int err = 0;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, "amdgpu/%s_asd.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_asd.bin", chip_name);
         if (err)
                 goto out;
 
@@ -3312,7 +3313,8 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name)
         const struct psp_firmware_header_v1_0 *toc_hdr;
         int err = 0;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, "amdgpu/%s_toc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_toc.bin", chip_name);
         if (err)
                 goto out;
 
@@ -3475,7 +3477,8 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name)
         uint8_t *ucode_array_start_addr;
         int err = 0;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, "amdgpu/%s_sos.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_sos.bin", chip_name);
         if (err)
                 goto out;
 
@@ -3751,7 +3754,8 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name)
         struct amdgpu_device *adev = psp->adev;
         int err;
 
-       err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, "amdgpu/%s_ta.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_ta.bin", chip_name);
         if (err)
                 return err;
 
@@ -3786,7 +3790,8 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name)
                 return -EINVAL;
         }
 
-       err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, "amdgpu/%s_cap.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, AMDGPU_UCODE_NOT_REQUIRED,
+                                  "amdgpu/%s_cap.bin", chip_name);
         if (err) {
                 if (err == -ENODEV) {
                         dev_warn(adev->dev, "cap microcode does not exist, skip\n");
@@ -3909,7 +3914,8 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
         if (!drm_dev_enter(ddev, &idx))
                 return -ENODEV;
 
-       ret = amdgpu_ucode_request(adev, &usbc_pd_fw, "amdgpu/%s", buf);
+       ret = amdgpu_ucode_request(adev, &usbc_pd_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s", buf);
         if (ret)
                 goto fail;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +2 -0
index 113f0d242618..b3c032f249f5 100644
@@ -219,9 +219,11 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
         amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix));
         if (instance == 0)
                 err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s.bin", ucode_prefix);
         else
                 err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s%d.bin", ucode_prefix, instance);
         if (err)
                 goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +6 -2
index d3cd76c6dab3..ffbb3377e0f6 100644
@@ -1434,6 +1434,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
   *
   * @adev: amdgpu device
   * @fw: pointer to load firmware to
+ * @required: whether the firmware is required
   * @fmt: firmware name format string
   * @...: variable arguments
   *
@@ -1442,7 +1443,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
   * 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 *fmt, ...)
+                        enum amdgpu_ucode_required required, const char *fmt, ...)
  {
         char fname[AMDGPU_UCODE_NAME_MAX];
         va_list ap;
@@ -1456,7 +1457,10 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
                 return -EOVERFLOW;
         }
 
-       r = request_firmware(fw, fname, adev->dev);
+       if (required == AMDGPU_UCODE_REQUIRED)
+               r = request_firmware(fw, fname, adev->dev);
+       else
+               r = firmware_request_nowarn(fw, fname, adev->dev);
         if (r)
                 return -ENODEV;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +0 -0
index 4150ec0aa10d..827d75185d83 100644
@@ -551,6 +551,11 @@ enum amdgpu_firmware_load_type {
         AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO,
  };
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h enum amdgpu_firmware_load_type { · line 555

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
+enum amdgpu_ucode_required {
+       AMDGPU_UCODE_NOT_REQUIRED,

Maybe:
AMDGPU_UCODE_OPTIONAL instead? Either way.

I like OPTIONAL better too, thanks! I'll adjust it.

Quoted 718 lines
Quoted 716 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +5 -2
+       AMDGPU_UCODE_REQUIRED,
+};
+
  /* conform to smu_ucode_xfer_cz.h */
  #define AMDGPU_SDMA0_UCODE_LOADED      0x00000001
  #define AMDGPU_SDMA1_UCODE_LOADED      0x00000002
@@ -604,9 +609,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)
+__printf(4, 5)
  int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
-                        const char *fmt, ...);
+                        enum amdgpu_ucode_required required, 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);
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +2 -1
index bd2d3863c3ed..dde15c6a96e1 100644
@@ -587,7 +587,8 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch)
                 break;
         }
 
-       r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name);
         if (r) {
                 release_firmware(adev->umsch_mm.fw);
                 adev->umsch_mm.fw = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index 31fd30dcd593..30e9869a0584 100644
@@ -260,7 +260,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
                 return -EINVAL;
         }
 
-       r = amdgpu_ucode_request(adev, &adev->uvd.fw, "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->uvd.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
         if (r) {
                 dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n",
                         fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index 599d3ca4e0ef..65387f6943b4 100644
@@ -158,7 +158,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
                 return -EINVAL;
         }
 
-       r = amdgpu_ucode_request(adev, &adev->vce.fw, "%s", fw_name);
+       r = amdgpu_ucode_request(adev, &adev->vce.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
         if (r) {
                 dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n",
                         fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -2
index 05f01f50194b..2455cc126e59 100644
@@ -99,9 +99,13 @@ int amdgpu_vcn_early_init(struct amdgpu_device *adev)
         amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix));
         for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
                 if (i == 1 && amdgpu_ip_version(adev, UVD_HWIP, 0) ==  IP_VERSION(4, 0, 6))
-                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s_%d.bin", ucode_prefix, i);
+                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+                                                AMDGPU_UCODE_REQUIRED,
+                                                "amdgpu/%s_%d.bin", ucode_prefix, i);
                 else
-                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s.bin", ucode_prefix);
+                       r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+                                                AMDGPU_UCODE_REQUIRED,
+                                                "amdgpu/%s.bin", ucode_prefix);
                 if (r) {
                         amdgpu_ucode_release(&adev->vcn.inst[i].fw);
                         return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +2 -1
index 83cb9f565fe5..2c12840ea444 100644
@@ -236,7 +236,8 @@ int amdgpu_vpe_init_microcode(struct amdgpu_vpe *vpe)
         int ret;
 
         amdgpu_ucode_ip_version_decode(adev, VPE_HWIP, fw_prefix, sizeof(fw_prefix));
-       ret = amdgpu_ucode_request(adev, &adev->vpe.fw, "amdgpu/%s.bin", fw_prefix);
+       ret = amdgpu_ucode_request(adev, &adev->vpe.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", fw_prefix);
         if (ret)
                 goto out;
 
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
index 1563e35da0fe..a5cd950c94be 100644
@@ -133,9 +133,11 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev)
         for (i = 0; i < adev->sdma.num_instances; i++) {
                 if (i == 0)
                         err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sdma.bin", chip_name);
                 else
                         err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sdma1.bin", chip_name);
                 if (err)
                         goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -0
index f1b35b4a73ff..c4e15418e187 100644
@@ -4138,18 +4138,21 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
         amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
         if (err)
                 goto out;
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_me%s.bin", ucode_prefix, wks);
         if (err)
                 goto out;
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
         if (err)
                 goto out;
@@ -4173,6 +4176,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
         if (err)
                 goto out;
@@ -4180,6 +4184,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
         if (!err) {
                 amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -0
index f63a06661f86..67cd42031571 100644
@@ -641,6 +641,7 @@ static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *
         int err = 0;
 
         err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_toc.bin", ucode_prefix);
         if (err)
                 goto out;
@@ -690,6 +691,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
         amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_pfp.bin", ucode_prefix);
         if (err)
                 goto out;
@@ -707,6 +709,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_me.bin", ucode_prefix);
         if (err)
                 goto out;
@@ -722,9 +725,11 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
                 if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 0) &&
                     adev->pdev->revision == 0xCE)
                         err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/gc_11_0_0_rlc_1.bin");
                 else
                         err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_rlc.bin", ucode_prefix);
                 if (err)
                         goto out;
@@ -737,6 +742,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_mec.bin", ucode_prefix);
         if (err)
                 goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -0
index ebb09c363803..d0697b0869e3 100644
@@ -539,6 +539,7 @@ static int gfx_v12_0_init_toc_microcode(struct amdgpu_device *adev, const char *
         int err = 0;
 
         err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_toc.bin", ucode_prefix);
         if (err)
                 goto out;
@@ -568,6 +569,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
         amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_pfp.bin", ucode_prefix);
         if (err)
                 goto out;
@@ -575,6 +577,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_me.bin", ucode_prefix);
         if (err)
                 goto out;
@@ -583,6 +586,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 
         if (!amdgpu_sriov_vf(adev)) {
                 err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_rlc.bin", ucode_prefix);
                 if (err)
                         goto out;
@@ -595,6 +599,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_mec.bin", ucode_prefix);
         if (err)
                 goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +4 -0
index 81c185a8b3a0..1b4c0dcee7e1 100644
@@ -337,6 +337,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_pfp.bin", chip_name);
         if (err)
                 goto out;
@@ -345,6 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
         adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_me.bin", chip_name);
         if (err)
                 goto out;
@@ -353,6 +355,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
         adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_ce.bin", chip_name);
         if (err)
                 goto out;
@@ -361,6 +364,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
         adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_rlc.bin", chip_name);
         if (err)
                 goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index 60931396f76b..17a07e1adffa 100644
@@ -934,33 +934,39 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_pfp.bin", chip_name);
         if (err)
                 goto out;
 
         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_me.bin", chip_name);
         if (err)
                 goto out;
 
         err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_ce.bin", chip_name);
         if (err)
                 goto out;
 
         err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_mec.bin", chip_name);
         if (err)
                 goto out;
 
         if (adev->asic_type == CHIP_KAVERI) {
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_mec2.bin", chip_name);
                 if (err)
                         goto out;
         }
 
         err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_rlc.bin", chip_name);
  out:
         if (err) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +16 -0
index f15beb217b48..a2a45be68c24 100644
@@ -982,13 +982,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
         if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                 err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                            "amdgpu/%s_pfp_2.bin", chip_name);
                 if (err == -ENODEV) {
                         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_pfp.bin", chip_name);
                 }
         } else {
                 err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_pfp.bin", chip_name);
         }
         if (err)
@@ -999,13 +1002,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
         if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                 err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                            "amdgpu/%s_me_2.bin", chip_name);
                 if (err == -ENODEV) {
                         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_me.bin", chip_name);
                 }
         } else {
                 err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_me.bin", chip_name);
         }
         if (err)
@@ -1017,13 +1023,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
         if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                 err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                            "amdgpu/%s_ce_2.bin", chip_name);
                 if (err == -ENODEV) {
                         err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_ce.bin", chip_name);
                 }
         } else {
                 err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_ce.bin", chip_name);
         }
         if (err)
@@ -1044,6 +1053,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
                 adev->virt.chained_ib_support = false;
 
         err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_rlc.bin", chip_name);
         if (err)
                 goto out;
@@ -1093,13 +1103,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
         if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                          AMDGPU_UCODE_NOT_REQUIRED,
                                            "amdgpu/%s_mec_2.bin", chip_name);
                 if (err == -ENODEV) {
                         err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_mec.bin", chip_name);
                 }
         } else {
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_mec.bin", chip_name);
         }
         if (err)
@@ -1112,13 +1125,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
             (adev->asic_type != CHIP_TOPAZ)) {
                 if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
                         err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_NOT_REQUIRED,
                                                    "amdgpu/%s_mec2_2.bin", chip_name);
                         if (err == -ENODEV) {
                                 err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                          AMDGPU_UCODE_REQUIRED,
                                                            "amdgpu/%s_mec2.bin", chip_name);
                         }
                 } else {
                         err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_mec2.bin", chip_name);
                 }
                 if (!err) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -1
index 4e27528b7e57..30d9b6dacb6e 100644
@@ -1429,18 +1429,21 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev,
         int err;
 
         err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_pfp.bin", chip_name);
         if (err)
                 goto out;
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_me.bin", chip_name);
         if (err)
                 goto out;
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
         err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_ce.bin", chip_name);
         if (err)
                 goto out;
@@ -1476,6 +1479,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
                 (((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
                 ((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
                 err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_rlc_am4.bin", chip_name);
         else if (!strcmp(chip_name, "raven") && (amdgpu_pm_load_smu_firmware(adev, &smu_version) == 0) &&
                 (smu_version >= 0x41e2b))
@@ -1483,9 +1487,11 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
                 *SMC is loaded by SBIOS on APU and it's able to get the SMU version directly.
                 */
                 err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_kicker_rlc.bin", chip_name);
         else
                 err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_rlc.bin", chip_name);
         if (err)
                 goto out;
@@ -1518,9 +1524,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
 
         if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-                                          "amdgpu/%s_sjt_mec.bin", chip_name);
+                                  AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_sjt_mec.bin", chip_name);
         else
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+                                          AMDGPU_UCODE_REQUIRED,
                                            "amdgpu/%s_mec.bin", chip_name);
         if (err)
                 goto out;
@@ -1531,9 +1539,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
         if (gfx_v9_0_load_mec2_fw_bin_support(adev)) {
                 if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
                         err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sjt_mec2.bin", chip_name);
                 else
                         err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_mec2.bin", chip_name);
                 if (!err) {
                         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +5 -2
index 8eccb080d56f..9c146e37c55e 100644
@@ -545,6 +545,7 @@ static int gfx_v9_4_3_init_rlc_microcode(struct amdgpu_device *adev,
 
 
         err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+                                  AMDGPU_UCODE_REQUIRED,
                                    "amdgpu/%s_rlc.bin", chip_name);
         if (err)
                 goto out;
@@ -578,10 +579,12 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
 
         if (amdgpu_sriov_vf(adev))
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-                               "amdgpu/%s_sjt_mec.bin", chip_name);
+                                          AMDGPU_UCODE_REQUIRED,
+                                          "amdgpu/%s_sjt_mec.bin", chip_name);
         else
                 err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-                               "amdgpu/%s_mec.bin", chip_name);
+                                          AMDGPU_UCODE_REQUIRED,
+                                          "amdgpu/%s_mec.bin", chip_name);
         if (err)
                 goto out;
         amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -1
index 8e878ab44e76..2245dda92021 100644
@@ -131,7 +131,8 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
         if (((RREG32(mmMC_SEQ_MISC0) & 0xff000000) >> 24) == 0x58)
                 chip_name = "si58";
 
-       err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_mc.bin", chip_name);
         if (err) {
                 dev_err(adev->dev,
                        "si_mc: Failed to load firmware \"%s_mc.bin\"\n",
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -1
index 347bccd92696..9aac4b1101e3 100644
@@ -157,7 +157,8 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
                 return -EINVAL;
         }
 
-       err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_mc.bin", chip_name);
         if (err) {
                 pr_err("cik_mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
                 amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -1
index 29ce36038b3f..d06585207c33 100644
@@ -259,7 +259,8 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
                 return -EINVAL;
         }
 
-       err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_mc.bin", chip_name);
         if (err) {
                 pr_err("mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
                 amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +2 -1
index d4f72e47ae9e..aeca5c08ea2f 100644
@@ -50,7 +50,8 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev)
         DRM_DEBUG("\n");
 
         amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_imu.bin", ucode_prefix);
         if (err)
                 goto out;
 
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +2 -1
index 1341f0292031..df898dbb746e 100644
@@ -47,7 +47,8 @@ static int imu_v12_0_init_microcode(struct amdgpu_device *adev)
         DRM_DEBUG("\n");
 
         amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_imu.bin", ucode_prefix);
         if (err)
                 goto out;
 
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
index c6af318908e4..269bf1e3337b 100644
@@ -145,9 +145,11 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)
         for (i = 0; i < adev->sdma.num_instances; i++) {
                 if (i == 0)
                         err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sdma.bin", chip_name);
                 else
                         err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sdma1.bin", chip_name);
                 if (err)
                         goto out;
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
index d438f2f7a408..c9ad9ec48688 100644
@@ -305,9 +305,11 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
         for (i = 0; i < adev->sdma.num_instances; i++) {
                 if (i == 0)
                         err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sdma.bin", chip_name);
                 else
                         err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+                                                  AMDGPU_UCODE_REQUIRED,
                                                    "amdgpu/%s_sdma1.bin", chip_name);
                 if (err)
                         goto out;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
index 85f21db6ef24..fff5a1cdf474 100644
@@ -2338,7 +2338,8 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
                 return 0;
         }
 
-       r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, "%s", fw_name_dmcu);
+       r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name_dmcu);
         if (r == -ENODEV) {
                 /* DMCU firmware is not necessary, so don't raise a fuss if it's missing */
                 DRM_DEBUG_KMS("dm: DMCU firmware not found\n");
@@ -5306,7 +5307,8 @@ static int dm_init_microcode(struct amdgpu_device *adev)
                 /* ASIC doesn't support DMUB. */
                 return 0;
         }
-       r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, "%s", fw_name_dmub);
+       r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, AMDGPU_UCODE_REQUIRED,
+                                "%s", fw_name_dmub);
         return r;
  }
 
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +2 -1
index 2bed85ba835e..a87dcf0974bc 100644
@@ -7709,7 +7709,8 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev)
         default: BUG();
         }
 
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s_smc.bin", chip_name);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s_smc.bin", chip_name);
         if (err) {
                 DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s_smc.bin\"\n",
                           err, chip_name);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -1
index 480cf3cb204d..189c6a32b6bd 100644
@@ -105,7 +105,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
                 return 0;
 
         amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", ucode_prefix);
         if (err)
                 goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
index bb506d15d787..7bb45ff6d5c8 100644
@@ -103,7 +103,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
                 return 0;
 
         amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", ucode_prefix);
         if (err)
                 goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -1
index 8344f54e6674..5b86df0c8536 100644
@@ -305,7 +305,8 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu)
 
         amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix,
                                        sizeof(ucode_prefix));
-       ret  = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       ret  = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                   "amdgpu/%s.bin", ucode_prefix);
         if (ret)
                 goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +2 -2
index 4d083f7f772e..9b2f4fe1578b 100644
@@ -79,7 +79,8 @@ int smu_v14_0_init_microcode(struct smu_context *smu)
                 return 0;
 
         amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+       err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+                                  "amdgpu/%s.bin", ucode_prefix);
         if (err)
                 goto out;
 
--

2.34.1

#3 lore raw
In reply to Mario Limonciello
Quoted 232 lines · Mario Limonciello

Some of the firmware that is loaded by amdgpu is not actually required. For example the ISP firmware on some SoCs is optional, and if it's not present the ISP IP block just won't be initialized.

The firmware loader core however will show a warning when this happens like this:

```
Direct firmware load for amdgpu/isp_4_1_0.bin failed with error -2
```

To avoid confusion for non-required firmware, adjust the amd-ucode helper to take an extra argument indicating if the firmware is required or not.

On non-required firmware use firmware_request_nowarn() instead of request_firmware() to avoid the warnings.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c        |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c        |  4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c        | 18 ++++++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c       |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c      |  8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h      |  9 +++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c   |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c        |  8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c          |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c         |  5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c         |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c         |  5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c          |  4 ++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c          |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c          | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c          | 12 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c        |  7 +++++--
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c          |  3 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v11_0.c         |  3 ++-
 drivers/gpu/drm/amd/amdgpu/imu_v12_0.c         |  3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c         |  2 ++
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  6 ++++--
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c     |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |  3 ++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c   |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c |  3 ++-
 35 files changed, 136 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -1
index 16153d275d7a..68bce6a6d09d 100644
@@ -414,7 +414,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
 				return -EINVAL;
 			}
 
-			err = amdgpu_ucode_request(adev, &adev->pm.fw, "%s", fw_name);
+			err = amdgpu_ucode_request(adev, &adev->pm.fw,
+						   AMDGPU_UCODE_REQUIRED,
+						   "%s", fw_name);
 			if (err) {
 				DRM_ERROR("Failed to load firmware \"%s\"", fw_name);
 				amdgpu_ucode_release(&adev->pm.fw);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 16b9b3c4190c..83f0de30317e 100644
@@ -2483,6 +2483,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw,
+				   AMDGPU_UCODE_NOT_REQUIRED,
 				   "amdgpu/%s_gpu_info.bin", chip_name);
 	if (err) {
 		dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -1
index d52f18393970..56cc179fca26 100644
@@ -77,7 +77,8 @@ static int isp_load_fw_by_psp(struct amdgpu_device *adev)
 				       sizeof(ucode_prefix));
 
 	/* read isp fw */
-	r = amdgpu_ucode_request(adev, &adev->isp.fw, "amdgpu/%s.bin", ucode_prefix);
+	r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_NOT_REQUIRED,
+				"amdgpu/%s.bin", ucode_prefix);
 	if (r) {
 		amdgpu_ucode_release(&adev->isp.fw);
 		return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -1
index a67e6a52347f..bb946fa1e912 100644
@@ -1438,10 +1438,12 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
 			 pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name);
 	if (r && need_retry && pipe == AMDGPU_MES_SCHED_PIPE) {
 		dev_info(adev->dev, "try to fall back to %s_mes.bin\n", ucode_prefix);
 		r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe],
+					 AMDGPU_UCODE_REQUIRED,
 					 "amdgpu/%s_mes.bin", ucode_prefix);
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +12 -6
index 12832fd834fb..3043ec5d3a31 100644
@@ -3290,7 +3290,8 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name)
 	const struct psp_firmware_header_v1_0 *asd_hdr;
 	int err = 0;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, "amdgpu/%s_asd.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_asd.bin", chip_name);
 	if (err)
 		goto out;
 
@@ -3312,7 +3313,8 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name)
 	const struct psp_firmware_header_v1_0 *toc_hdr;
 	int err = 0;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, "amdgpu/%s_toc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_toc.bin", chip_name);
 	if (err)
 		goto out;
 
@@ -3475,7 +3477,8 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name)
 	uint8_t *ucode_array_start_addr;
 	int err = 0;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, "amdgpu/%s_sos.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_sos.bin", chip_name);
 	if (err)
 		goto out;
 
@@ -3751,7 +3754,8 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name)
 	struct amdgpu_device *adev = psp->adev;
 	int err;
 
-	err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, "amdgpu/%s_ta.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_ta.bin", chip_name);
 	if (err)
 		return err;
 
@@ -3786,7 +3790,8 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name)
 		return -EINVAL;
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, "amdgpu/%s_cap.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, AMDGPU_UCODE_NOT_REQUIRED,
+				   "amdgpu/%s_cap.bin", chip_name);
 	if (err) {
 		if (err == -ENODEV) {
 			dev_warn(adev->dev, "cap microcode does not exist, skip\n");
@@ -3909,7 +3914,8 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
 	if (!drm_dev_enter(ddev, &idx))
 		return -ENODEV;
 
-	ret = amdgpu_ucode_request(adev, &usbc_pd_fw, "amdgpu/%s", buf);
+	ret = amdgpu_ucode_request(adev, &usbc_pd_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s", buf);
 	if (ret)
 		goto fail;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +2 -0
index 113f0d242618..b3c032f249f5 100644
@@ -219,9 +219,11 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
 	amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix));
 	if (instance == 0)
 		err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s.bin", ucode_prefix);
 	else
 		err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s%d.bin", ucode_prefix, instance);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +6 -2
index d3cd76c6dab3..ffbb3377e0f6 100644
@@ -1434,6 +1434,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  *
  * @adev: amdgpu device
  * @fw: pointer to load firmware to
+ * @required: whether the firmware is required
  * @fmt: firmware name format string
  * @...: variable arguments
  *
@@ -1442,7 +1443,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
  * 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 *fmt, ...)
+			 enum amdgpu_ucode_required required, const char *fmt, ...)
 {
 	char fname[AMDGPU_UCODE_NAME_MAX];
 	va_list ap;
@@ -1456,7 +1457,10 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
 		return -EOVERFLOW;
 	}
 
-	r = request_firmware(fw, fname, adev->dev);
+	if (required == AMDGPU_UCODE_REQUIRED)
+		r = request_firmware(fw, fname, adev->dev);
+	else
+		r = firmware_request_nowarn(fw, fname, adev->dev);
 	if (r)
 		return -ENODEV;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +0 -0
index 4150ec0aa10d..827d75185d83 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h enum amdgpu_firmware_load_type { · line 556

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
@@ -551,6 +551,11 @@ enum amdgpu_firmware_load_type {
 	AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO,
 };
 
+enum amdgpu_ucode_required {
+	AMDGPU_UCODE_NOT_REQUIRED,
+	AMDGPU_UCODE_REQUIRED,

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

Thanks,
Lijo

Quoted 712 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +4 -2
+};
+
 /* conform to smu_ucode_xfer_cz.h */
 #define AMDGPU_SDMA0_UCODE_LOADED	0x00000001
 #define AMDGPU_SDMA1_UCODE_LOADED	0x00000002
@@ -604,9 +609,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)
+__printf(4, 5)
 int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
-			 const char *fmt, ...);
+			 enum amdgpu_ucode_required required, 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);
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +2 -1
index bd2d3863c3ed..dde15c6a96e1 100644
@@ -587,7 +587,8 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch)
 		break;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->umsch_mm.fw, AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name);
 	if (r) {
 		release_firmware(adev->umsch_mm.fw);
 		adev->umsch_mm.fw = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index 31fd30dcd593..30e9869a0584 100644
@@ -260,7 +260,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->uvd.fw, "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->uvd.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
 	if (r) {
 		dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n",
 			fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index 599d3ca4e0ef..65387f6943b4 100644
@@ -158,7 +158,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
 		return -EINVAL;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->vce.fw, "%s", fw_name);
+	r = amdgpu_ucode_request(adev, &adev->vce.fw, AMDGPU_UCODE_REQUIRED, "%s", fw_name);
 	if (r) {
 		dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n",
 			fw_name);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -2
index 05f01f50194b..2455cc126e59 100644
@@ -99,9 +99,13 @@ int amdgpu_vcn_early_init(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix));
 	for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
 		if (i == 1 && amdgpu_ip_version(adev, UVD_HWIP, 0) ==  IP_VERSION(4, 0, 6))
-			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s_%d.bin", ucode_prefix, i);
+			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+						 AMDGPU_UCODE_REQUIRED,
+						 "amdgpu/%s_%d.bin", ucode_prefix, i);
 		else
-			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw, "amdgpu/%s.bin", ucode_prefix);
+			r = amdgpu_ucode_request(adev, &adev->vcn.inst[i].fw,
+						 AMDGPU_UCODE_REQUIRED,
+						 "amdgpu/%s.bin", ucode_prefix);
 		if (r) {
 			amdgpu_ucode_release(&adev->vcn.inst[i].fw);
 			return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +2 -1
index 83cb9f565fe5..2c12840ea444 100644
@@ -236,7 +236,8 @@ int amdgpu_vpe_init_microcode(struct amdgpu_vpe *vpe)
 	int ret;
 
 	amdgpu_ucode_ip_version_decode(adev, VPE_HWIP, fw_prefix, sizeof(fw_prefix));
-	ret = amdgpu_ucode_request(adev, &adev->vpe.fw, "amdgpu/%s.bin", fw_prefix);
+	ret = amdgpu_ucode_request(adev, &adev->vpe.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", fw_prefix);
 	if (ret)
 		goto out;
 
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
index 1563e35da0fe..a5cd950c94be 100644
@@ -133,9 +133,11 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev)
 	for (i = 0; i < adev->sdma.num_instances; i++) {
 		if (i == 0)
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma1.bin", chip_name);
 		if (err)
 			goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -0
index f1b35b4a73ff..c4e15418e187 100644
@@ -4138,18 +4138,21 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
@@ -4173,6 +4176,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
 	if (err)
 		goto out;
@@ -4180,6 +4184,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
 	if (!err) {
 		amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -0
index f63a06661f86..67cd42031571 100644
@@ -641,6 +641,7 @@ static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *
 	int err = 0;
 
 	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_toc.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -690,6 +691,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -707,6 +709,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -722,9 +725,11 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 		if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 0) &&
 		    adev->pdev->revision == 0xCE)
 			err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/gc_11_0_0_rlc_1.bin");
 		else
 			err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_rlc.bin", ucode_prefix);
 		if (err)
 			goto out;
@@ -737,6 +742,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec.bin", ucode_prefix);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -0
index ebb09c363803..d0697b0869e3 100644
@@ -539,6 +539,7 @@ static int gfx_v12_0_init_toc_microcode(struct amdgpu_device *adev, const char *
 	int err = 0;
 
 	err = amdgpu_ucode_request(adev, &adev->psp.toc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_toc.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -568,6 +569,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -575,6 +577,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", ucode_prefix);
 	if (err)
 		goto out;
@@ -583,6 +586,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 
 	if (!amdgpu_sriov_vf(adev)) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_rlc.bin", ucode_prefix);
 		if (err)
 			goto out;
@@ -595,6 +599,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec.bin", ucode_prefix);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +4 -0
index 81c185a8b3a0..1b4c0dcee7e1 100644
@@ -337,6 +337,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", chip_name);
 	if (err)
 		goto out;
@@ -345,6 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", chip_name);
 	if (err)
 		goto out;
@@ -353,6 +355,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce.bin", chip_name);
 	if (err)
 		goto out;
@@ -361,6 +364,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index 60931396f76b..17a07e1adffa 100644
@@ -934,33 +934,39 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", chip_name);
 	if (err)
 		goto out;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", chip_name);
 	if (err)
 		goto out;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce.bin", chip_name);
 	if (err)
 		goto out;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_mec.bin", chip_name);
 	if (err)
 		goto out;
 
 	if (adev->asic_type == CHIP_KAVERI) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_mec2.bin", chip_name);
 		if (err)
 			goto out;
 	}
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 out:
 	if (err) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +16 -0
index f15beb217b48..a2a45be68c24 100644
@@ -982,13 +982,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_pfp_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_pfp.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_pfp.bin", chip_name);
 	}
 	if (err)
@@ -999,13 +1002,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_me_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_me.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_me.bin", chip_name);
 	}
 	if (err)
@@ -1017,13 +1023,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_ce_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_ce.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_ce.bin", chip_name);
 	}
 	if (err)
@@ -1044,6 +1053,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 		adev->virt.chained_ib_support = false;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
@@ -1093,13 +1103,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+					   AMDGPU_UCODE_NOT_REQUIRED,
 					   "amdgpu/%s_mec_2.bin", chip_name);
 		if (err == -ENODEV) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_mec.bin", chip_name);
 		}
 	} else {
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_mec.bin", chip_name);
 	}
 	if (err)
@@ -1112,13 +1125,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 	    (adev->asic_type != CHIP_TOPAZ)) {
 		if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_NOT_REQUIRED,
 						   "amdgpu/%s_mec2_2.bin", chip_name);
 			if (err == -ENODEV) {
 				err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+							   AMDGPU_UCODE_REQUIRED,
 							   "amdgpu/%s_mec2.bin", chip_name);
 			}
 		} else {
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_mec2.bin", chip_name);
 		}
 		if (!err) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -1
index 4e27528b7e57..30d9b6dacb6e 100644
@@ -1429,18 +1429,21 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev,
 	int err;
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_pfp.bin", chip_name);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.me_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_me.bin", chip_name);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_ce.bin", chip_name);
 	if (err)
 		goto out;
@@ -1476,6 +1479,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
 		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
 		((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_rlc_am4.bin", chip_name);
 	else if (!strcmp(chip_name, "raven") && (amdgpu_pm_load_smu_firmware(adev, &smu_version) == 0) &&
 		(smu_version >= 0x41e2b))
@@ -1483,9 +1487,11 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
 		*SMC is loaded by SBIOS on APU and it's able to get the SMU version directly.
 		*/
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_kicker_rlc.bin", chip_name);
 	else
 		err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
@@ -1518,9 +1524,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
 
 	if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-					   "amdgpu/%s_sjt_mec.bin", chip_name);
+				   AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_sjt_mec.bin", chip_name);
 	else
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
+					   AMDGPU_UCODE_REQUIRED,
 					   "amdgpu/%s_mec.bin", chip_name);
 	if (err)
 		goto out;
@@ -1531,9 +1539,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
 	if (gfx_v9_0_load_mec2_fw_bin_support(adev)) {
 		if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN))
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sjt_mec2.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_mec2.bin", chip_name);
 		if (!err) {
 			amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +5 -2
index 8eccb080d56f..9c146e37c55e 100644
@@ -545,6 +545,7 @@ static int gfx_v9_4_3_init_rlc_microcode(struct amdgpu_device *adev,
 
 
 	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw,
+				   AMDGPU_UCODE_REQUIRED,
 				   "amdgpu/%s_rlc.bin", chip_name);
 	if (err)
 		goto out;
@@ -578,10 +579,12 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
 
 	if (amdgpu_sriov_vf(adev))
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-				"amdgpu/%s_sjt_mec.bin", chip_name);
+					   AMDGPU_UCODE_REQUIRED,
+					   "amdgpu/%s_sjt_mec.bin", chip_name);
 	else
 		err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw,
-				"amdgpu/%s_mec.bin", chip_name);
+					   AMDGPU_UCODE_REQUIRED,
+					   "amdgpu/%s_mec.bin", chip_name);
 	if (err)
 		goto out;
 	amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -1
index 8e878ab44e76..2245dda92021 100644
@@ -131,7 +131,8 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
 	if (((RREG32(mmMC_SEQ_MISC0) & 0xff000000) >> 24) == 0x58)
 		chip_name = "si58";
 
-	err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_mc.bin", chip_name);
 	if (err) {
 		dev_err(adev->dev,
 		       "si_mc: Failed to load firmware \"%s_mc.bin\"\n",
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -1
index 347bccd92696..9aac4b1101e3 100644
@@ -157,7 +157,8 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_mc.bin", chip_name);
 	if (err) {
 		pr_err("cik_mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
 		amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -1
index 29ce36038b3f..d06585207c33 100644
@@ -259,7 +259,8 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->gmc.fw, "amdgpu/%s_mc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->gmc.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_mc.bin", chip_name);
 	if (err) {
 		pr_err("mc: Failed to load firmware \"%s_mc.bin\"\n", chip_name);
 		amdgpu_ucode_release(&adev->gmc.fw);
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +2 -1
index d4f72e47ae9e..aeca5c08ea2f 100644
@@ -50,7 +50,8 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev)
 	DRM_DEBUG("\n");
 
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_imu.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +2 -1
index 1341f0292031..df898dbb746e 100644
@@ -47,7 +47,8 @@ static int imu_v12_0_init_microcode(struct amdgpu_device *adev)
 	DRM_DEBUG("\n");
 
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, "amdgpu/%s_imu.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_imu.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
index c6af318908e4..269bf1e3337b 100644
@@ -145,9 +145,11 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)
 	for (i = 0; i < adev->sdma.num_instances; i++) {
 		if (i == 0)
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma1.bin", chip_name);
 		if (err)
 			goto out;
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
index d438f2f7a408..c9ad9ec48688 100644
@@ -305,9 +305,11 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
 	for (i = 0; i < adev->sdma.num_instances; i++) {
 		if (i == 0)
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma.bin", chip_name);
 		else
 			err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw,
+						   AMDGPU_UCODE_REQUIRED,
 						   "amdgpu/%s_sdma1.bin", chip_name);
 		if (err)
 			goto out;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
index 85f21db6ef24..fff5a1cdf474 100644
@@ -2338,7 +2338,8 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
 		return 0;
 	}
 
-	r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, "%s", fw_name_dmcu);
+	r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name_dmcu);
 	if (r == -ENODEV) {
 		/* DMCU firmware is not necessary, so don't raise a fuss if it's missing */
 		DRM_DEBUG_KMS("dm: DMCU firmware not found\n");
@@ -5306,7 +5307,8 @@ static int dm_init_microcode(struct amdgpu_device *adev)
 		/* ASIC doesn't support DMUB. */
 		return 0;
 	}
-	r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, "%s", fw_name_dmub);
+	r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, AMDGPU_UCODE_REQUIRED,
+				 "%s", fw_name_dmub);
 	return r;
 }
 
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +2 -1
index 2bed85ba835e..a87dcf0974bc 100644
@@ -7709,7 +7709,8 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev)
 	default: BUG();
 	}
 
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s_smc.bin", chip_name);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s_smc.bin", chip_name);
 	if (err) {
 		DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s_smc.bin\"\n",
 			  err, chip_name);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -1
index 480cf3cb204d..189c6a32b6bd 100644
@@ -105,7 +105,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
 		return 0;
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
index bb506d15d787..7bb45ff6d5c8 100644
@@ -103,7 +103,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
 		return 0;
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", ucode_prefix);
 	if (err)
 		goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -1
index 8344f54e6674..5b86df0c8536 100644
@@ -305,7 +305,8 @@ static int smu_v13_0_6_init_microcode(struct smu_context *smu)
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix,
 				       sizeof(ucode_prefix));
-	ret  = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	ret  = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				    "amdgpu/%s.bin", ucode_prefix);
 	if (ret)
 		goto out;
 
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +2 -1
index 4d083f7f772e..9b2f4fe1578b 100644
@@ -79,7 +79,8 @@ int smu_v14_0_init_microcode(struct smu_context *smu)
 		return 0;
 
 	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	err = amdgpu_ucode_request(adev, &adev->pm.fw, "amdgpu/%s.bin", ucode_prefix);
+	err = amdgpu_ucode_request(adev, &adev->pm.fw, AMDGPU_UCODE_REQUIRED,
+				   "amdgpu/%s.bin", ucode_prefix);
 	if (err)
 		goto out;
 
#4 lore raw
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h enum amdgpu_firmware_load_type { · line 556

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
+enum amdgpu_ucode_required {
+	AMDGPU_UCODE_NOT_REQUIRED,
+	AMDGPU_UCODE_REQUIRED,

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

Alex - what's your take?

#5 lore raw
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines

+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,

Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#6 lore raw
Quoted 18 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

Quoted 7 lines

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

The cap firmware is definitely optional. Some customers use it, some don't.

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#7 lore raw
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Quoted 6 lines
Quoted 3 lines

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

The cap firmware is definitely optional. Some customers use it, some don't.

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#8 lore raw
Quoted 31 lines · Lijo
Quoted 27 lines · Alex Deucher
Quoted 25 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

Quoted 8 lines
Quoted 2 lines

The cap firmware is definitely optional. Some customers use it, some don't.

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

I guess if the customer expects it, they can make sure it's there. I'm not sure how you can have both without it being optional. For customers that don't use it, requiring it would break them if it wasn't present.

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#9 lore raw
Quoted 38 lines · Alex Deucher
Quoted 37 lines · Lijo
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
(quoted diff) +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Quoted 6 lines
Quoted 3 lines

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

The cap firmware is definitely optional. Some customers use it, some don't.

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

Quoted 8 lines
Quoted 2 lines

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

I guess if the customer expects it, they can make sure it's there. I'm not sure how you can have both without it being optional. For customers that don't use it, requiring it would break them if it wasn't present.

Besides those, there were a few others I marked as optional too. We have a few cases that we do a "fallback" firmware. If that one isn't found try to get another filename.

I marked the first one as optional and the fallback one as required.
So effectively if both are missing they'll get exactly one message in the logs about missing firmware.

Quoted 16 lines

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#10 lore raw
In reply to Alex Deucher
Quoted 35 lines · Alex Deucher
Quoted 34 lines · Lijo
Quoted 29 lines · Alex Deucher
Quoted 18 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
(quoted diff) +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

Quoted 7 lines

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

The cap firmware is definitely optional. Some customers use it, some don't.

Quoted 7 lines
Quoted 5 lines

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

I guess if the customer expects it, they can make sure it's there.

I don't think customer really can do that without any diagnostic message from the driver. Driver has to show the right message. If it passes that silently and fails at some other point, it could be a totally different signature.

Quoted 4 lines

I'm not sure how you can have both without it being optional. For customers that don't use it, requiring it would break them if it wasn't present.

It's working so far. Having all is better as long as loading that is harmless.

Thanks,
Lijo

Quoted 16 lines

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#11 lore raw
Quoted 45 lines · Lijo
Quoted 41 lines · Alex Deucher
Quoted 39 lines · Lijo
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
(quoted diff) +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Quoted 6 lines
Quoted 3 lines

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

The cap firmware is definitely optional. Some customers use it, some don't.

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

Quoted 6 lines
Quoted 1 line

I guess if the customer expects it, they can make sure it's there.

I don't think customer really can do that without any diagnostic message from the driver. Driver has to show the right message. If it passes that silently and fails at some other point, it could be a totally different signature.

yeah, I haven't seen any bug reports about the cap firmware so the current behavior seems to be fine.

Alex

Quoted 29 lines
Quoted 5 lines

I'm not sure how you can have both without it being optional. For customers that don't use it, requiring it would break them if it wasn't present.

It's working so far. Having all is better as long as loading that is harmless.

Thanks,
Lijo

Quoted 16 lines

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#12 lore raw
Quoted 48 lines · Alex Deucher
Quoted 47 lines · Lijo
Quoted 42 lines · Alex Deucher
Quoted 31 lines · Lijo
Quoted 27 lines · Alex Deucher
Quoted 25 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
(quoted diff) +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

Quoted 8 lines
Quoted 2 lines

The cap firmware is definitely optional. Some customers use it, some don't.

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

I guess if the customer expects it, they can make sure it's there.

Quoted 8 lines
Quoted 4 lines

I don't think customer really can do that without any diagnostic message from the driver. Driver has to show the right message. If it passes that silently and fails at some other point, it could be a totally different signature.

yeah, I haven't seen any bug reports about the cap firmware so the current behavior seems to be fine.

In this case, need to have a info level message when a firmware classified as optional is not found. As it is only during driver load, I don't think that message will be an annoyance. On the other hand, it gives useful info if it runs into trouble at a later point during load.

Thanks,
Lijo

Quoted 31 lines

Alex

Quoted 29 lines
Quoted 5 lines

I'm not sure how you can have both without it being optional. For customers that don't use it, requiring it would break them if it wasn't present.

It's working so far. Having all is better as long as loading that is harmless.

Thanks,
Lijo

Quoted 16 lines

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#13 lore raw
Quoted 56 lines · Lijo
Quoted 53 lines · Alex Deucher
Quoted 51 lines · Lijo
Quoted 35 lines · Alex Deucher
Quoted 34 lines · Lijo
Quoted 29 lines · Alex Deucher
Quoted 18 lines · Lijo
Quoted 5 lines · Mario Limonciello
Quoted 5 lines
Quoted 4 lines
(quoted diff) +3 -0
+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,
Quoted 8 lines
Quoted 4 lines

Couldn't this be handled in another API instead of having to flag every load? By default, every ucode is required and if optional may be skipped with amdgpu_ucode_request_optional() API?

I guess this would be a smaller patch, but 6 eggs one hand, half dozen in the other?

Quoted 7 lines

I thought only ISP and gpu_info (no longer there for newer SOCs) fall into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That is not optional.

The cap firmware is definitely optional. Some customers use it, some don't.

Quoted 7 lines
Quoted 5 lines

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

I guess if the customer expects it, they can make sure it's there.

I don't think customer really can do that without any diagnostic message from the driver. Driver has to show the right message. If it passes that silently and fails at some other point, it could be a totally different signature.

Quoted 8 lines
Quoted 3 lines

yeah, I haven't seen any bug reports about the cap firmware so the current behavior seems to be fine.

In this case, need to have a info level message when a firmware classified as optional is not found. As it is only during driver load, I don't think that message will be an annoyance. On the other hand, it gives useful info if it runs into trouble at a later point during load.

This series stemmed from concerns being raised about the WARN level message from the core but there is no way to message to the user from the core it's optional.

Do you think something like:

drm_info(adev->dev, "Optional firmware %s not found\n", name);

In the failure path for the optional is fine?

Quoted 36 lines

Thanks,
Lijo

Quoted 31 lines

Alex

Quoted 29 lines
Quoted 5 lines

I'm not sure how you can have both without it being optional. For customers that don't use it, requiring it would break them if it wasn't present.

It's working so far. Having all is better as long as loading that is harmless.

Thanks,
Lijo

Quoted 16 lines

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?

#14 lore raw
Quoted 80 lines · Mario Limonciello
Quoted 66 lines · Lijo
Quoted 63 lines · Alex Deucher
Quoted 61 lines · Lijo
Quoted 43 lines · Alex Deucher
Quoted 41 lines · Lijo
Quoted 36 lines · Alex Deucher
Quoted 21 lines · Lijo
Quoted 12 lines · Mario Limonciello
Quoted 11 lines
Quoted 4 lines

+enum amdgpu_ucode_required {
+    AMDGPU_UCODE_NOT_REQUIRED,
+    AMDGPU_UCODE_REQUIRED,

Couldn't this be handled in another API instead of having to flag every
load? By default, every ucode is required and if optional may be skipped
with amdgpu_ucode_request_optional() API?

Quoted 4 lines

I guess this would be a smaller patch, but 6 eggs one hand, half dozen
in the other?

Quoted 9 lines

I thought only ISP and gpu_info (no longer there for newer SOCs) fall
into the optional ones so far. The usage is rare, similar to the nowarn() API usage.

Also, as far as I know, the cap microcode is a must whenever used. That
is not optional.

The cap firmware is definitely optional.  Some customers use it, some don't.

Quoted 7 lines
Quoted 5 lines

I thought optional is something that can be ignored even if FW is not found and then driver load proceeds.

What is the expected driver action if we classify cap firmware as optional and then it fails on a customer system that expects it?

I guess if the customer expects it, they can make sure it's there.

I don't think customer really can do that without any diagnostic message
from the driver. Driver has to show the right message. If it passes that
silently and fails at some other point, it could be a totally different signature.

Quoted 8 lines
Quoted 3 lines

yeah, I haven't seen any bug reports about the cap firmware so the current behavior seems to be fine.

In this case, need to have a info level message when a firmware classified as optional is not found. As it is only during driver load, I don't think that message will be an annoyance. On the other hand, it gives useful info if it runs into trouble at a later point during load.

This series stemmed from concerns being raised about the WARN level message from the core but there is no way to message to the user from the core it's optional.

Quoted 6 lines

Do you think something like:

drm_info(adev->dev, "Optional firmware %s not found\n", name);

In the failure path for the optional is fine?

Yes, this will help.

Thanks,
Lijo

Quoted 37 lines
Quoted 36 lines

Thanks,
Lijo

Quoted 31 lines

Alex

Quoted 29 lines
Quoted 5 lines

I'm not sure how you can have both without it being optional.  For customers that don't use it, requiring it would break them if it wasn't present.

It's working so far. Having all is better as long as loading that is harmless.

Thanks,
Lijo

Quoted 16 lines

Alex

Quoted 14 lines

Thanks,
Lijo

Quoted 8 lines

Alex

Quoted 5 lines

Thanks,
Lijo

Quoted 1 line

Alex - what's your take?