Skip to contentSkip to conversation

drm/amdgpu/mes: add compatibility checks for set_hw_resource_1

PATCH In review Alex Deucher 3 participants 3 messages Jun 17, 2025 – Jun 18, 2025

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu/mes: add compatibility checks for set_hw_resource_1

Seems some older MES firmware versions do not properly support this packet. Add back some the compatibility checks.

v2: switch to fw version check (Shaoyun)

Fixes f81cd793119e ("drm/amd/amdgpu: Fix MES init sequence")
Cc Shaoyun Liu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 10 ++++++----
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +6 -4
index c9eba537de094..28eb846280dd4 100644
@@ -1630,10 +1630,12 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		goto failure;
 
-	r = mes_v11_0_set_hw_resources_1(&adev->mes);
-	if (r) {
-		DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
-		goto failure;
+	if ((adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x50) {
+		r = mes_v11_0_set_hw_resources_1(&adev->mes);
+		if (r) {
+			DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
+			goto failure;
+		}
 	}
 
 	r = mes_v11_0_query_sched_status(&adev->mes);
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +2 -1
index 68bef36aae3b8..4b78e05a4615e 100644
@@ -1736,7 +1736,8 @@ static int mes_v12_0_hw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		goto failure;
 
-	mes_v12_0_set_hw_resources_1(&adev->mes, AMDGPU_MES_SCHED_PIPE);
+	if ((adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x4b)
+		mes_v12_0_set_hw_resources_1(&adev->mes, AMDGPU_MES_SCHED_PIPE);
 
 	mes_v12_0_init_aggregated_doorbell(&adev->mes);
 
Signature · 1 line
2.49.0
#1 lore raw

Ping?

Quoted 53 lines · Alex Deucher

Seems some older MES firmware versions do not properly support this packet. Add back some the compatibility checks.

v2: switch to fw version check (Shaoyun)

Fixes f81cd793119e ("drm/amd/amdgpu: Fix MES init sequence")
Cc Shaoyun Liu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 10 ++++++----
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +6 -4
index c9eba537de094..28eb846280dd4 100644
@@ -1630,10 +1630,12 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block *ip_block)
        if (r)
                goto failure;
 
-       r = mes_v11_0_set_hw_resources_1(&adev->mes);
-       if (r) {
-               DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
-               goto failure;
+       if ((adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x50) {
+               r = mes_v11_0_set_hw_resources_1(&adev->mes);
+               if (r) {
+                       DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
+                       goto failure;
+               }
        }
 
        r = mes_v11_0_query_sched_status(&adev->mes);
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +2 -2
index 68bef36aae3b8..4b78e05a4615e 100644
@@ -1736,7 +1736,8 @@ static int mes_v12_0_hw_init(struct amdgpu_ip_block *ip_block)
        if (r)
                goto failure;
 
-       mes_v12_0_set_hw_resources_1(&adev->mes, AMDGPU_MES_SCHED_PIPE);
+       if ((adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x4b)
+               mes_v12_0_set_hw_resources_1(&adev->mes, AMDGPU_MES_SCHED_PIPE);
 
        mes_v12_0_init_aggregated_doorbell(&adev->mes);
 
--

2.49.0

#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Looks good to me.
reviewed by shaoyun.liu <[email protected]>

获取 Outlook for iOS<https://aka.ms/o0ukef>
________________________________
发件人: Alex Deucher <[email protected]>
发送时间: Wednesday, June 18, 2025 10:18:06 AM
收件人: Deucher, Alexander <[email protected]>
抄送: [email protected] <[email protected]>; Liu, Shaoyun <[email protected]> 主题: Re: [PATCH] drm/amdgpu/mes: add compatibility checks for set_hw_resource_1

Ping?

Quoted 53 lines · Alex Deucher

Seems some older MES firmware versions do not properly support this packet. Add back some the compatibility checks.

v2: switch to fw version check (Shaoyun)

Fixes f81cd793119e ("drm/amd/amdgpu: Fix MES init sequence")
Cc Shaoyun Liu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 10 ++++++----
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +6 -4
index c9eba537de094..28eb846280dd4 100644
@@ -1630,10 +1630,12 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block *ip_block)
        if (r)
                goto failure;
 
-       r = mes_v11_0_set_hw_resources_1(&adev->mes);
-       if (r) {
-               DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
-               goto failure;
+       if ((adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x50) {
+               r = mes_v11_0_set_hw_resources_1(&adev->mes);
+               if (r) {
+                       DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
+                       goto failure;
+               }
        }
 
        r = mes_v11_0_query_sched_status(&adev->mes);
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +2 -2
index 68bef36aae3b8..4b78e05a4615e 100644
@@ -1736,7 +1736,8 @@ static int mes_v12_0_hw_init(struct amdgpu_ip_block *ip_block)
        if (r)
                goto failure;
 
-       mes_v12_0_set_hw_resources_1(&adev->mes, AMDGPU_MES_SCHED_PIPE);
+       if ((adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x4b)
+               mes_v12_0_set_hw_resources_1(&adev->mes, AMDGPU_MES_SCHED_PIPE);
 
        mes_v12_0_init_aggregated_doorbell(&adev->mes);
 
--

2.49.0