Skip to contentSkip to conversation

drm/amdgpu: Check SQ_CONFIG register support on SRIOV

PATCH In review Tony Yi 2 participants 2 messages Jun 20, 2025 – Jul 14, 2025

Subsystems (2)
lore
Share & tools
lore

Tony Yi

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Check SQ_CONFIG register support on SRIOV

On SRIOV environments, check if RLCG supports
SQ_CONFIG register programming.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    | 8 +++++++-
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c     | 4 +++-
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +7 -1
index 9320461bb486..3da3ebb1d9a1 100644
@@ -152,8 +152,10 @@ enum AMDGIM_REG_ACCESS_FLAG {
 	AMDGIM_FEATURE_MMHUB_REG_RLC_EN   = (1 << 1),
 	/* Use RLC to program GC regs */
 	AMDGIM_FEATURE_GC_REG_RLC_EN      = (1 << 2),
-	/* Use PSP to program L1_TLB_CNTL*/
+	/* Use PSP to program L1_TLB_CNTL */
 	AMDGIM_FEATURE_L1_TLB_CNTL_PSP_EN = (1 << 3),
+	/* Use RLCG to program SQ_CONFIG1 */
+	AMDGIM_FEATURE_REG_ACCESS_SQ_CONFIG = (1 << 4),
 };
 
 struct amdgim_pf2vf_info_v1 {
@@ -346,6 +348,10 @@ struct amdgpu_video_codec_info;
 #define amdgpu_sriov_rlcg_error_report_enabled(adev) \
         (amdgpu_sriov_reg_indirect_mmhub(adev) || amdgpu_sriov_reg_indirect_gc(adev))
 
+#define amdgpu_sriov_reg_access_sq_config(adev) \
+(amdgpu_sriov_vf((adev)) && \
+	((adev)->virt.reg_access & (AMDGIM_FEATURE_REG_ACCESS_SQ_CONFIG)))
+
 #define amdgpu_passthrough(adev) \
 ((adev)->virt.caps & AMDGPU_PASSTHROUGH_MODE)
 
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +2 -1
index 92ca13097aaa..33edad1f9dcd 100644
@@ -113,7 +113,8 @@ union amd_sriov_reg_access_flags {
 		uint32_t vf_reg_access_mmhub		: 1;
 		uint32_t vf_reg_access_gc		: 1;
 		uint32_t vf_reg_access_l1_tlb_cntl	: 1;
-		uint32_t reserved			: 28;
+		uint32_t vf_reg_access_sq_config	: 1;
+		uint32_t reserved			: 27;
 	} flags;
 	uint32_t all;
 };
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -1
index c233edf60569..4a5fc5b8ac6a 100644
@@ -1349,7 +1349,9 @@ static void gfx_v9_4_3_constants_init(struct amdgpu_device *adev)
 	switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
 	/* ToDo: GC 9.4.4 */
 	case IP_VERSION(9, 4, 3):
-		if (adev->gfx.mec_fw_version >= 184)
+		if (adev->gfx.mec_fw_version >= 184 &&
+		    (amdgpu_sriov_reg_access_sq_config(adev) ||
+		     !amdgpu_sriov_vf(adev)))
 			adev->gmc.xnack_flags |= AMDGPU_GMC_XNACK_FLAG_CHAIN;
 		break;
 	case IP_VERSION(9, 5, 0):
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 85 lines

-----Original Message-----
From: Yi, Tony <[email protected]>
Sent: Friday, June 20, 2025 11:55 AM
To: Yi, Tony <[email protected]>; Skvortsov, Victor <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Luo, Zhigang <[email protected]>; Gande, Shravan kumar <[email protected]>; Chan, Hing Pong <[email protected]>
Cc: Yi, Tony <[email protected]>
Subject: [PATCH] drm/amdgpu: Check SQ_CONFIG register support on SRIOV

On SRIOV environments, check if RLCG supports SQ_CONFIG register programming.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    | 8 +++++++-
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c     | 4 +++-
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +7 -1
index 9320461bb486..3da3ebb1d9a1 100644
@@ -152,8 +152,10 @@ enum AMDGIM_REG_ACCESS_FLAG {
      AMDGIM_FEATURE_MMHUB_REG_RLC_EN   = (1 << 1),
      /* Use RLC to program GC regs */
      AMDGIM_FEATURE_GC_REG_RLC_EN      = (1 << 2),
-     /* Use PSP to program L1_TLB_CNTL*/
+     /* Use PSP to program L1_TLB_CNTL */
      AMDGIM_FEATURE_L1_TLB_CNTL_PSP_EN = (1 << 3),
+     /* Use RLCG to program SQ_CONFIG1 */
+     AMDGIM_FEATURE_REG_ACCESS_SQ_CONFIG = (1 << 4),
 };
 
 struct amdgim_pf2vf_info_v1 {
@@ -346,6 +348,10 @@ struct amdgpu_video_codec_info;  #define
 amdgpu_sriov_rlcg_error_report_enabled(adev) \
         (amdgpu_sriov_reg_indirect_mmhub(adev) ||
 amdgpu_sriov_reg_indirect_gc(adev))
 
+#define amdgpu_sriov_reg_access_sq_config(adev) \
+(amdgpu_sriov_vf((adev)) && \
+     ((adev)->virt.reg_access &
 (AMDGIM_FEATURE_REG_ACCESS_SQ_CONFIG)))
+
 #define amdgpu_passthrough(adev) \

((adev)->virt.caps & AMDGPU_PASSTHROUGH_MODE)

drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +2 -1
index 92ca13097aaa..33edad1f9dcd 100644
@@ -113,7 +113,8 @@ union amd_sriov_reg_access_flags {
              uint32_t vf_reg_access_mmhub            : 1;
              uint32_t vf_reg_access_gc               : 1;
              uint32_t vf_reg_access_l1_tlb_cntl      : 1;
-             uint32_t reserved                       : 28;
+             uint32_t vf_reg_access_sq_config        : 1;
+             uint32_t reserved                       : 27;
      } flags;
      uint32_t all;
 };
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -1
index c233edf60569..4a5fc5b8ac6a 100644
@@ -1349,7 +1349,9 @@ static void gfx_v9_4_3_constants_init(struct
 amdgpu_device *adev)
      switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
      /* ToDo: GC 9.4.4 */
      case IP_VERSION(9, 4, 3):
-             if (adev->gfx.mec_fw_version >= 184)
+             if (adev->gfx.mec_fw_version >= 184 &&
+                 (amdgpu_sriov_reg_access_sq_config(adev) ||
+                  !amdgpu_sriov_vf(adev)))
                      adev->gmc.xnack_flags |=
 AMDGPU_GMC_XNACK_FLAG_CHAIN;
              break;
      case IP_VERSION(9, 5, 0):

--
2.34.1