Skip to contentSkip to conversation

drm/amd/amdgpu: introduce gc_*_mes_2.bin

PATCH In review Jack Xiao 2 participants 2 messages Mar 29, 2023

Subsystems (2)
lore
Share & tools
lore

Jack Xiao

author
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: introduce gc_*_mes_2.bin

To avoid new mes fw running with old driver, rename mes schq fw to gc_*_mes_2.bin.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 26 +++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +22 -4
index 0e55823ef6ca..f0f00466b59f 100644
@@ -1434,13 +1434,31 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
 	struct amdgpu_firmware_info *info;
 	char ucode_prefix[30];
 	char fw_name[40];
+	bool need_retry = false;
 	int r;
 
-	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
-		ucode_prefix,
-		pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
+	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix,
+				       sizeof(ucode_prefix));
+	if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0)) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
+			 ucode_prefix,
+			 pipe == AMDGPU_MES_SCHED_PIPE ? "_2" : "1");
+		need_retry = true;
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
+			 ucode_prefix,
+			 pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
+	}
+
 	r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], fw_name);
+	if (r && need_retry && pipe == AMDGPU_MES_SCHED_PIPE) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin",
+			 ucode_prefix);
+		DRM_INFO("try to fall back to %s\n", fw_name);
+		r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe],
+					 fw_name);
+	}
+
 	if (r)
 		goto out;
 
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jack Xiao

To avoid new mes fw running with old driver, rename mes schq fw to gc_*_mes_2.bin.

Please add the necessary MODULE_FIRMWARE() declaration as well. With that, the patch is:

Quoted 47 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 26 +++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +22 -5
index 0e55823ef6ca..f0f00466b59f 100644
@@ -1434,13 +1434,31 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
        struct amdgpu_firmware_info *info;
        char ucode_prefix[30];
        char fw_name[40];
+       bool need_retry = false;
        int r;
 
-       amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
-               ucode_prefix,
-               pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
+       amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix,
+                                      sizeof(ucode_prefix));
+       if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0)) {
+               snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
+                        ucode_prefix,
+                        pipe == AMDGPU_MES_SCHED_PIPE ? "_2" : "1");
+               need_retry = true;
+       } else {
+               snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
+                        ucode_prefix,
+                        pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
+       }
+
        r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], fw_name);
+       if (r && need_retry && pipe == AMDGPU_MES_SCHED_PIPE) {
+               snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin",
+                        ucode_prefix);
+               DRM_INFO("try to fall back to %s\n", fw_name);
+               r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe],
+                                        fw_name);
+       }
+
        if (r)
                goto out;
 
--

2.37.3