Skip to contentSkip to conversation

drm/amdgpu: Add fw minimum version check for usermode queue

PATCH In review Arvind Yadav 4 participants 6 messages Apr 10, 2025

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

PATCH 1/2 drm/amdgpu: Add fw minimum version check for usermode queue

This patch is load usermode queue based on FW support for gfx11. CP Ucode FW version: [PFP = 2530, ME = 2390, MEC = 2600, MES = 120]

Cc Alex Deucher <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +15 -2
index 91d29f482c3c..d7a401ff79db 100644
@@ -81,6 +81,11 @@
 #define regCP_HQD_PERSISTENT_STATE_DEFAULT                                        0x0be05501
 #define regCP_HQD_IB_CONTROL_DEFAULT                                              0x00300000
 
+#define GFX11_ME_FW_MIN_VERSION							0x00000956
+#define GFX11_PFP_FW_MIN_VERSION						0x000009e2
+#define GFX11_MEC_FW_MIN_VERSION						0x00000a28
+#define GFX11_MES_FW_MIN_VERSION						0x00000078
+
 MODULE_FIRMWARE("amdgpu/gc_11_0_0_pfp.bin");
 MODULE_FIRMWARE("amdgpu/gc_11_0_0_me.bin");
 MODULE_FIRMWARE("amdgpu/gc_11_0_0_mec.bin");
@@ -1590,6 +1595,14 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev)
 	}
 }
 
+static bool gfx_v11_0_is_userq_supported(struct amdgpu_device *adev)
+{
+	return (adev->gfx.me_fw_version >= GFX11_ME_FW_MIN_VERSION &&
+		adev->gfx.pfp_fw_version >= GFX11_PFP_FW_MIN_VERSION &&
+		adev->gfx.mec_fw_version >= GFX11_MEC_FW_MIN_VERSION &&
+		adev->mes.fw_version[0] >= GFX11_MES_FW_MIN_VERSION);
+}
+
 static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
 {
 	int i, j, k, r, ring_id;
@@ -1632,7 +1645,7 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
 	case IP_VERSION(11, 0, 3):
 #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
 		/* add firmware version checks here */
-		if (0) {
+		if (gfx_v11_0_is_userq_supported(adev)) {
 			adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
 			adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
 		}
@@ -1646,7 +1659,7 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
 	case IP_VERSION(11, 5, 3):
 #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
 		/* add firmware version checks here */
-		if (0) {
+		if (gfx_v11_0_is_userq_supported(adev)) {
 			adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
 			adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
 		}
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: Add fw minimum version check for usermode queue

This patch is load usermode queue based on FW support for gfx12. CP Ucode FW Vesion: [PFP = 2840, ME = 2780, MEC = 2600, MES = 123]

Cc Alex Deucher <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +14 -1
index 3d87e445270e..c31c96fc13f0 100644
@@ -69,6 +69,10 @@
 #define regCP_HQD_PERSISTENT_STATE_DEFAULT                                        0x0be05501
 #define regCP_HQD_IB_CONTROL_DEFAULT                                              0x00300000
 
+#define GFX12_ME_FW_MIN_VERSION							0x00000adc
+#define GFX12_PFP_FW_MIN_VERSION						0x00000b18
+#define GFX12_MEC_FW_MIN_VERSION						0x00000bea
+#define GFX12_MES_FW_MIN_VERSION						0x0000007b
 
 MODULE_FIRMWARE("amdgpu/gc_12_0_0_pfp.bin");
 MODULE_FIRMWARE("amdgpu/gc_12_0_0_me.bin");
@@ -1383,6 +1387,15 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
 	}
 }
 
+static bool gfx_v12_0_is_userq_supported(struct amdgpu_device *adev)
+{
+	return (adev->gfx.me_fw_version >= GFX12_ME_FW_MIN_VERSION &&
+		adev->gfx.pfp_fw_version >= GFX12_PFP_FW_MIN_VERSION &&
+		adev->gfx.mec_fw_version >= GFX12_MEC_FW_MIN_VERSION &&
+		adev->mes.fw_version[0] >= GFX12_MES_FW_MIN_VERSION);
+}
+
+
 static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
 {
 	int i, j, k, r, ring_id = 0;
@@ -1418,7 +1431,7 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
 	case IP_VERSION(12, 0, 1):
 #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
 		/* add firmware version checks here */
-		if (0) {
+		if (gfx_v12_0_is_userq_supported(adev)) {
 			adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
 			adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
 		}
Signature · 1 line
2.34.1
Reviewed-by Sunil Khatri on v1 2/2
#2 lore raw

Apart from minor comment LGTM.  Also lets wait for Alex to review the series.

Quoted 17 lines · Arvind Yadav

This patch is load usermode queue based on FW support for gfx12. CP Ucode FW Vesion: [PFP = 2840, ME = 2780, MEC = 2600, MES = 123]

Cc Alex Deucher <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +0 -0
index 3d87e445270e..c31c96fc13f0 100644

drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c line 72

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1 -0
@@ -69,6 +69,10 @@
  #define regCP_HQD_PERSISTENT_STATE_DEFAULT                                        0x0be05501
  #define regCP_HQD_IB_CONTROL_DEFAULT                                              0x00300000
 
+#define GFX12_ME_FW_MIN_VERSION							0x00000adc

Alignment issue here.

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -0
+#define GFX12_PFP_FW_MIN_VERSION						0x00000b18
+#define GFX12_MEC_FW_MIN_VERSION						0x00000bea
+#define GFX12_MES_FW_MIN_VERSION						0x0000007b
 
  MODULE_FIRMWARE("amdgpu/gc_12_0_0_pfp.bin");
  MODULE_FIRMWARE("amdgpu/gc_12_0_0_me.bin");
@@ -1383,6 +1387,15 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
  	}
  }

drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev) · line 1398

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +9 -0
 
+static bool gfx_v12_0_is_userq_supported(struct amdgpu_device *adev)
+{
+	return (adev->gfx.me_fw_version >= GFX12_ME_FW_MIN_VERSION &&
+		adev->gfx.pfp_fw_version >= GFX12_PFP_FW_MIN_VERSION &&
+		adev->gfx.mec_fw_version >= GFX12_MEC_FW_MIN_VERSION &&
+		adev->mes.fw_version[0] >= GFX12_MES_FW_MIN_VERSION);
+}
+
+

an extra empty line not needed here.

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1 -1
  static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
  {
  	int i, j, k, r, ring_id = 0;
@@ -1418,7 +1431,7 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
  	case IP_VERSION(12, 0, 1):
  #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
  		/* add firmware version checks here */
-		if (0) {
+		if (gfx_v12_0_is_userq_supported(adev)) {
  			adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
  			adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
  		}
#3 lore raw
In reply to Arvind Yadav
Quoted 45 lines · Arvind Yadav

This patch is load usermode queue based on FW support for gfx12. CP Ucode FW Vesion: [PFP = 2840, ME = 2780, MEC = 2600, MES = 123]

Cc Alex Deucher <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +13 -0
index 3d87e445270e..c31c96fc13f0 100644
@@ -69,6 +69,10 @@
 #define regCP_HQD_PERSISTENT_STATE_DEFAULT                                        0x0be05501
 #define regCP_HQD_IB_CONTROL_DEFAULT                                              0x00300000
 
+#define GFX12_ME_FW_MIN_VERSION                                                        0x00000adc
+#define GFX12_PFP_FW_MIN_VERSION                                               0x00000b18
+#define GFX12_MEC_FW_MIN_VERSION                                               0x00000bea
+#define GFX12_MES_FW_MIN_VERSION                                               0x0000007b
 
 MODULE_FIRMWARE("amdgpu/gc_12_0_0_pfp.bin");
 MODULE_FIRMWARE("amdgpu/gc_12_0_0_me.bin");
@@ -1383,6 +1387,15 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
        }
 }
 
+static bool gfx_v12_0_is_userq_supported(struct amdgpu_device *adev)
+{
+       return (adev->gfx.me_fw_version >= GFX12_ME_FW_MIN_VERSION &&
+               adev->gfx.pfp_fw_version >= GFX12_PFP_FW_MIN_VERSION &&
+               adev->gfx.mec_fw_version >= GFX12_MEC_FW_MIN_VERSION &&
+               adev->mes.fw_version[0] >= GFX12_MES_FW_MIN_VERSION);
+}
+
+
 static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
 {
        int i, j, k, r, ring_id = 0;

drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block) · line 1434

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1 -1
@@ -1418,7 +1431,7 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
        case IP_VERSION(12, 0, 1):
 #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
                /* add firmware version checks here */
-               if (0) {
+               if (gfx_v12_0_is_userq_supported(adev)) {

I would just check the firmware versions directly here rather than adding a helper function. The fw versions will be different for other GFX11 chips. Also no need to define macros for the versions for the same reasons. there will likely be different versions for each gfx11 IP version.

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +0 -1
                        adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
                        adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
                }
--

2.34.1

#4 lore raw
Quoted 47 lines · Alex Deucher
Quoted 46 lines · Arvind Yadav

This patch is load usermode queue based on FW support for gfx12. CP Ucode FW Vesion: [PFP = 2840, ME = 2780, MEC = 2600, MES = 123]

Cc Alex Deucher <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +13 -0
index 3d87e445270e..c31c96fc13f0 100644
@@ -69,6 +69,10 @@
  #define regCP_HQD_PERSISTENT_STATE_DEFAULT                                        0x0be05501
  #define regCP_HQD_IB_CONTROL_DEFAULT                                              0x00300000
 
+#define GFX12_ME_FW_MIN_VERSION                                                        0x00000adc
+#define GFX12_PFP_FW_MIN_VERSION                                               0x00000b18
+#define GFX12_MEC_FW_MIN_VERSION                                               0x00000bea
+#define GFX12_MES_FW_MIN_VERSION                                               0x0000007b
 
  MODULE_FIRMWARE("amdgpu/gc_12_0_0_pfp.bin");
  MODULE_FIRMWARE("amdgpu/gc_12_0_0_me.bin");
@@ -1383,6 +1387,15 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
         }
  }
 
+static bool gfx_v12_0_is_userq_supported(struct amdgpu_device *adev)
+{
+       return (adev->gfx.me_fw_version >= GFX12_ME_FW_MIN_VERSION &&
+               adev->gfx.pfp_fw_version >= GFX12_PFP_FW_MIN_VERSION &&
+               adev->gfx.mec_fw_version >= GFX12_MEC_FW_MIN_VERSION &&
+               adev->mes.fw_version[0] >= GFX12_MES_FW_MIN_VERSION);
+}
+
+
  static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
  {
         int i, j, k, r, ring_id = 0;
@@ -1418,7 +1431,7 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block)
         case IP_VERSION(12, 0, 1):
  #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block) · line 1434

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1 -1
                 /* add firmware version checks here */
-               if (0) {
+               if (gfx_v12_0_is_userq_supported(adev)) {

I would just check the firmware versions directly here rather than adding a helper function. The fw versions will be different for other GFX11 chips. Also no need to define macros for the versions for the same reasons. there will likely be different versions for each gfx11 IP version.

Noted.

Quoted 9 lines

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +0 -1
                         adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
                         adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
                 }
--

2.34.1

Reviewed-by Sunil Khatri on v1 1/2
#5 lore raw
In reply to Arvind Yadav

Apart from a minor alignment issue LGTM.

Quoted 17 lines · Arvind Yadav

This patch is load usermode queue based on FW support for gfx11. CP Ucode FW version: [PFP = 2530, ME = 2390, MEC = 2600, MES = 120]

Cc Alex Deucher <[email protected]>
Cc Christian Koenig <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 +++++++++++++++--
  1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -0
index 91d29f482c3c..d7a401ff79db 100644

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c line 84

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
@@ -81,6 +81,11 @@
  #define regCP_HQD_PERSISTENT_STATE_DEFAULT                                        0x0be05501
  #define regCP_HQD_IB_CONTROL_DEFAULT                                              0x00300000
 
+#define GFX11_ME_FW_MIN_VERSION							0x00000956

Looks like some alignment issues here  ?

Quoted 40 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +14 -2
+#define GFX11_PFP_FW_MIN_VERSION						0x000009e2
+#define GFX11_MEC_FW_MIN_VERSION						0x00000a28
+#define GFX11_MES_FW_MIN_VERSION						0x00000078
+
  MODULE_FIRMWARE("amdgpu/gc_11_0_0_pfp.bin");
  MODULE_FIRMWARE("amdgpu/gc_11_0_0_me.bin");
  MODULE_FIRMWARE("amdgpu/gc_11_0_0_mec.bin");
@@ -1590,6 +1595,14 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev)
  	}
  }
 
+static bool gfx_v11_0_is_userq_supported(struct amdgpu_device *adev)
+{
+	return (adev->gfx.me_fw_version >= GFX11_ME_FW_MIN_VERSION &&
+		adev->gfx.pfp_fw_version >= GFX11_PFP_FW_MIN_VERSION &&
+		adev->gfx.mec_fw_version >= GFX11_MEC_FW_MIN_VERSION &&
+		adev->mes.fw_version[0] >= GFX11_MES_FW_MIN_VERSION);
+}
+
  static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
  {
  	int i, j, k, r, ring_id;
@@ -1632,7 +1645,7 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
  	case IP_VERSION(11, 0, 3):
  #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
  		/* add firmware version checks here */
-		if (0) {
+		if (gfx_v11_0_is_userq_supported(adev)) {
  			adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
  			adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
  		}
@@ -1646,7 +1659,7 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
  	case IP_VERSION(11, 5, 3):
  #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
  		/* add firmware version checks here */
-		if (0) {
+		if (gfx_v11_0_is_userq_supported(adev)) {
  			adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs;
  			adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs;
  		}