Skip to contentSkip to conversation

drm/amdgpu: Improve error checking in amdgpu_virt_rlcg_reg_rw

PATCH In review Victor Lu 5 participants 11 messages Jan 2, 2024 – Feb 23, 2024 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Victor Lu

author
#0 lore raw

PATCH 1/4 drm/amdgpu: Improve error checking in amdgpu_virt_rlcg_reg_rw

The current error detection only looks for a timeout. This should be changed to also check scratch_reg1 for any errors returned from RLCG.

Also add a new error value.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 ++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6 -2
index 0dcff2889e25..3cd085569515 100644
@@ -1022,7 +1022,7 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 		 * SCRATCH_REG0 	= read/write value
 		 * SCRATCH_REG1[30:28]	= command
 		 * SCRATCH_REG1[19:0]	= address in dword
-		 * SCRATCH_REG1[26:24]	= Error reporting
+		 * SCRATCH_REG1[27:24]	= Error reporting
 		 */
 		writel(v, scratch_reg0);
 		writel((offset | flag), scratch_reg1);
@@ -1036,7 +1036,8 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 			udelay(10);
 		}
 
-		if (i >= timeout) {
+		tmp = readl(scratch_reg1);
+		if (i >= timeout || (tmp & AMDGPU_RLCG_SCRATCH1_ERROR_MASK) != 0) {
 			if (amdgpu_sriov_rlcg_error_report_enabled(adev)) {
 				if (tmp & AMDGPU_RLCG_VFGATE_DISABLED) {
 					dev_err(adev->dev,
@@ -1047,6 +1048,9 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 				} else if (tmp & AMDGPU_RLCG_REG_NOT_IN_RANGE) {
 					dev_err(adev->dev,
 						"register is not in range, rlcg failed to program reg: 0x%05x\n", offset);
+				} else if (tmp & AMDGPU_RLCG_INVALID_XCD_ACCESS) {
+					dev_err(adev->dev,
+						"invalid xcd access, rlcg failed to program reg: 0x%05x\n", offset);
 				} else {
 					dev_err(adev->dev,
 						"unknown error type, rlcg failed to program reg: 0x%05x\n", offset);
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
index d4207e44141f..447af2e4aef0 100644
@@ -40,11 +40,13 @@
 #define AMDGPU_RLCG_MMHUB_WRITE        (0x2 << 28)
 
 /* error code for indirect register access path supported by rlcg for sriov */
+#define AMDGPU_RLCG_INVALID_XCD_ACCESS		0x8000000
 #define AMDGPU_RLCG_VFGATE_DISABLED		0x4000000
 #define AMDGPU_RLCG_WRONG_OPERATION_TYPE	0x2000000
 #define AMDGPU_RLCG_REG_NOT_IN_RANGE		0x1000000
 
 #define AMDGPU_RLCG_SCRATCH1_ADDRESS_MASK	0xFFFFF
+#define AMDGPU_RLCG_SCRATCH1_ERROR_MASK	0xF000000
 
 /* all asic after AI use this offset */
 #define mmRCC_IOV_FUNC_IDENTIFIER 0xDE5
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/4 drm/amdgpu: Do not program SQ_TIMEOUT_CONFIG in SRIOV

VF should not program this register.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -0
index 00b21ece081f..30cc155f20d4 100644
@@ -3888,6 +3888,9 @@ static void gfx_v9_4_3_inst_enable_watchdog_timer(struct amdgpu_device *adev,
 	uint32_t i;
 	uint32_t data;
 
+	if (amdgpu_sriov_vf(adev))
+		return;
+
 	data = RREG32_SOC15(GC, GET_INST(GC, 0), regSQ_TIMEOUT_CONFIG);
 	data = REG_SET_FIELD(data, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE,
 			     amdgpu_watchdog_timer.timeout_fatal_disable ? 1 : 0);
Signature · 1 line
2.34.1
Reviewed-by on v1 2/4
#2 lore raw

RE: [PATCH 2/4] drm/amdgpu: Do not program SQ_TIMEOUT_CONFIG in SRIOV

[AMD Official Use Only - General]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Victor Lu
Sent: Tuesday, January 2, 2024 12:30 PM
To: [email protected]
Cc: Chander, Vignesh <[email protected]>; Lu, Victor Cheng Chi (Victor) <[email protected]>
Subject: [PATCH 2/4] drm/amdgpu: Do not program SQ_TIMEOUT_CONFIG in SRIOV

VF should not program this register.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -0
index 00b21ece081f..30cc155f20d4 100644
@@ -3888,6 +3888,9 @@ static void gfx_v9_4_3_inst_enable_watchdog_timer(struct amdgpu_device *adev,
        uint32_t i;
        uint32_t data;
 
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        data = RREG32_SOC15(GC, GET_INST(GC, 0), regSQ_TIMEOUT_CONFIG);
        data = REG_SET_FIELD(data, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE,
                             amdgpu_watchdog_timer.timeout_fatal_disable ? 1 : 0);

--
2.34.1

A message that is not in the archive (sent off-list or not yet received): PH7PR12MB59745A45653A1B10F9C1653AFA4C2@PH7PR12MB5974.namprd12.prod.outlook.com

#4 lore raw

RE: [PATCH 2/4] drm/amdgpu: Do not program SQ_TIMEOUT_CONFIG in SRIOV

[AMD Official Use Only - General]

Reviewed By Zhigang Luo <[email protected]<mailto:[email protected]>>

From: Lu, Victor Cheng Chi (Victor) <[email protected]>
Sent: Friday, February 16, 2024 1:50 PM
To: Luo, Zhigang <[email protected]>
Subject: Fw: [PATCH 2/4] drm/amdgpu: Do not program SQ_TIMEOUT_CONFIG in SRIOV

[AMD Official Use Only - General]

________________________________
From: Lu, Victor Cheng Chi (Victor) <[email protected]<mailto:[email protected]>>
Sent: Tuesday, January 2, 2024 12:30 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Chander, Vignesh <[email protected]<mailto:[email protected]>>; Lu, Victor Cheng Chi (Victor) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 2/4] drm/amdgpu: Do not program SQ_TIMEOUT_CONFIG in SRIOV

VF should not program this register.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -0
index 00b21ece081f..30cc155f20d4 100644
@@ -3888,6 +3888,9 @@ static void gfx_v9_4_3_inst_enable_watchdog_timer(struct amdgpu_device *adev,
         uint32_t i;
         uint32_t data;
 
+       if (amdgpu_sriov_vf(adev))
+               return;
+
         data = RREG32_SOC15(GC, GET_INST(GC, 0), regSQ_TIMEOUT_CONFIG);
         data = REG_SET_FIELD(data, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE,
                              amdgpu_watchdog_timer.timeout_fatal_disable ? 1 : 0);

--
2.34.1

author
#5 lore raw

PATCH 3/4 drm/amdgpu: Use correct SRIOV macro for gmc_v9_0_vm_fault_interrupt_state

In reply to Victor Lu

Under SRIOV, programming to VM_CONTEXT*_CNTL regs failed because the current macro does not pass through the correct xcc instance. Use the *REG32_XCC macro in this case.

The behaviour without SRIOV is the same.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -4
index 473a774294ce..e2e14d40109c 100644
@@ -496,14 +496,14 @@ static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
 				if (j >= AMDGPU_MMHUB0(0))
 					tmp = RREG32_SOC15_IP(MMHUB, reg);
 				else
-					tmp = RREG32_SOC15_IP(GC, reg);
+					tmp = RREG32_XCC(reg, j);
 
 				tmp &= ~bits;
 
 				if (j >= AMDGPU_MMHUB0(0))
 					WREG32_SOC15_IP(MMHUB, reg, tmp);
 				else
-					WREG32_SOC15_IP(GC, reg, tmp);
+					WREG32_XCC(reg, tmp, j);
 			}
 		}
 		break;
@@ -524,14 +524,14 @@ static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
 				if (j >= AMDGPU_MMHUB0(0))
 					tmp = RREG32_SOC15_IP(MMHUB, reg);
 				else
-					tmp = RREG32_SOC15_IP(GC, reg);
+					tmp = RREG32_XCC(reg, j);
 
 				tmp |= bits;
 
 				if (j >= AMDGPU_MMHUB0(0))
 					WREG32_SOC15_IP(MMHUB, reg, tmp);
 				else
-					WREG32_SOC15_IP(GC, reg, tmp);
+					WREG32_XCC(reg, tmp, j);
 			}
 		}
 		break;
Signature · 1 line
2.34.1

A message that is not in the archive (sent off-list or not yet received): PH7PR12MB5974D8CA3E8119960CD0F7BEFA4C2@PH7PR12MB5974.namprd12.prod.outlook.com

#7 lore raw

RE: [PATCH 3/4] drm/amdgpu: Use correct SRIOV macro for gmc_v9_0_vm_fault_interrupt_state

[AMD Official Use Only - General]

Reviewed By Zhigang Luo <[email protected]>

From: Lu, Victor Cheng Chi (Victor) <[email protected]>
Sent: Friday, February 16, 2024 1:50 PM
To: Luo, Zhigang <[email protected]>
Subject: Fw: [PATCH 3/4] drm/amdgpu: Use correct SRIOV macro for gmc_v9_0_vm_fault_interrupt_state

[AMD Official Use Only - General]

________________________________
From: Lu, Victor Cheng Chi (Victor) <[email protected]<mailto:[email protected]>>
Sent: Tuesday, January 2, 2024 12:30 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Chander, Vignesh <[email protected]<mailto:[email protected]>>; Lu, Victor Cheng Chi (Victor) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 3/4] drm/amdgpu: Use correct SRIOV macro for gmc_v9_0_vm_fault_interrupt_state

Under SRIOV, programming to VM_CONTEXT*_CNTL regs failed because the current macro does not pass through the correct xcc instance. Use the *REG32_XCC macro in this case.

The behaviour without SRIOV is the same.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -4
index 473a774294ce..e2e14d40109c 100644
@@ -496,14 +496,14 @@ static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
                                 if (j >= AMDGPU_MMHUB0(0))
                                         tmp = RREG32_SOC15_IP(MMHUB, reg);
                                 else
-                                       tmp = RREG32_SOC15_IP(GC, reg);
+                                       tmp = RREG32_XCC(reg, j);
 
                                 tmp &= ~bits;
 
                                 if (j >= AMDGPU_MMHUB0(0))
                                         WREG32_SOC15_IP(MMHUB, reg, tmp);
                                 else
-                                       WREG32_SOC15_IP(GC, reg, tmp);
+                                       WREG32_XCC(reg, tmp, j);
                         }
                 }
                 break;
@@ -524,14 +524,14 @@ static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
                                 if (j >= AMDGPU_MMHUB0(0))
                                         tmp = RREG32_SOC15_IP(MMHUB, reg);
                                 else
-                                       tmp = RREG32_SOC15_IP(GC, reg);
+                                       tmp = RREG32_XCC(reg, j);
 
                                 tmp |= bits;
 
                                 if (j >= AMDGPU_MMHUB0(0))
                                         WREG32_SOC15_IP(MMHUB, reg, tmp);
                                 else
-                                       WREG32_SOC15_IP(GC, reg, tmp);
+                                       WREG32_XCC(reg, tmp, j);
                         }
                 }
                 break;

--
2.34.1

author
#8 lore raw

PATCH 4/4 drm/amdgpu: Do not program VM_L2_CNTL under SRIOV

In reply to Victor Lu

VM_L2_CNTL* should not be programmed on driver unload under SRIOV. These regs are skipped during SRIOV driver init.

---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +6 -4
index 55423ff1bb49..20e800bc0b68 100644
@@ -454,10 +454,12 @@ static void gfxhub_v1_2_xcc_gart_disable(struct amdgpu_device *adev,
 		WREG32_SOC15_RLC(GC, GET_INST(GC, j), regMC_VM_MX_L1_TLB_CNTL, tmp);
 
 		/* Setup L2 cache */
-		tmp = RREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL);
-		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
-		WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL, tmp);
-		WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL3, 0);
+		if (!amdgpu_sriov_vf(adev)) {
+			tmp = RREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL);
+			tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
+			WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL, tmp);
+			WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL3, 0);
+		}
 	}
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 4/4
#9 lore raw

RE: [PATCH 4/4] drm/amdgpu: Do not program VM_L2_CNTL under SRIOV

[AMD Official Use Only - General]

-----Original Message-----
From: Victor Lu <[email protected]>
Sent: Tuesday, January 2, 2024 12:30 PM
To: [email protected]
Cc: Chander, Vignesh <[email protected]>; Lu, Victor Cheng Chi (Victor) <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Do not program VM_L2_CNTL under SRIOV

VM_L2_CNTL* should not be programmed on driver unload under SRIOV. These regs are skipped during SRIOV driver init.

---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +6 -4
index 55423ff1bb49..20e800bc0b68 100644
@@ -454,10 +454,12 @@ static void gfxhub_v1_2_xcc_gart_disable(struct amdgpu_device *adev,
                WREG32_SOC15_RLC(GC, GET_INST(GC, j), regMC_VM_MX_L1_TLB_CNTL, tmp);
 
                /* Setup L2 cache */
-               tmp = RREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL);
-               tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
-               WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL, tmp);
-               WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL3, 0);
+               if (!amdgpu_sriov_vf(adev)) {
+                       tmp = RREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL);
+                       tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
+                       WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL, tmp);
+                       WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL3, 0);
+               }
        }
 }
 

--
2.34.1

Reviewed-by on v1 4/4
#10 lore raw

RE: [PATCH 4/4] drm/amdgpu: Do not program VM_L2_CNTL under SRIOV

In reply to Victor Lu

[AMD Official Use Only - General]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Victor Lu
Sent: Tuesday, January 2, 2024 12:30 PM
To: [email protected]
Cc: Chander, Vignesh <[email protected]>; Lu, Victor Cheng Chi (Victor) <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Do not program VM_L2_CNTL under SRIOV

VM_L2_CNTL* should not be programmed on driver unload under SRIOV. These regs are skipped during SRIOV driver init.

---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +6 -4
index 55423ff1bb49..20e800bc0b68 100644
@@ -454,10 +454,12 @@ static void gfxhub_v1_2_xcc_gart_disable(struct amdgpu_device *adev,
                WREG32_SOC15_RLC(GC, GET_INST(GC, j), regMC_VM_MX_L1_TLB_CNTL, tmp);
 
                /* Setup L2 cache */
-               tmp = RREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL);
-               tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
-               WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL, tmp);
-               WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL3, 0);
+               if (!amdgpu_sriov_vf(adev)) {
+                       tmp = RREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL);
+                       tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
+                       WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL, tmp);
+                       WREG32_SOC15(GC, GET_INST(GC, j), regVM_L2_CNTL3, 0);
+               }
        }
 }
 

--
2.34.1

author
#11 lore raw

PATCH 1/1 drm/amdgpu: Improve error checking in amdgpu_virt_rlcg_reg_rw (v2)

In reply to Victor Lu

The current error detection only looks for a timeout. This should be changed to also check scratch_reg1 for any errors returned from RLCG.

v2: remove new error value

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 5 +++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -2
index 6ff7d3fb2008..7a4eae36778a 100644
@@ -979,7 +979,7 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 		 * SCRATCH_REG0 	= read/write value
 		 * SCRATCH_REG1[30:28]	= command
 		 * SCRATCH_REG1[19:0]	= address in dword
-		 * SCRATCH_REG1[26:24]	= Error reporting
+		 * SCRATCH_REG1[27:24]	= Error reporting
 		 */
 		writel(v, scratch_reg0);
 		writel((offset | flag), scratch_reg1);
@@ -993,7 +993,8 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 			udelay(10);
 		}
 
-		if (i >= timeout) {
+		tmp = readl(scratch_reg1);
+		if (i >= timeout || (tmp & AMDGPU_RLCG_SCRATCH1_ERROR_MASK) != 0) {
 			if (amdgpu_sriov_rlcg_error_report_enabled(adev)) {
 				if (tmp & AMDGPU_RLCG_VFGATE_DISABLED) {
 					dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -0
index fa7be5f277b9..3f59b7b5523f 100644
@@ -45,6 +45,7 @@
 #define AMDGPU_RLCG_REG_NOT_IN_RANGE		0x1000000
 
 #define AMDGPU_RLCG_SCRATCH1_ADDRESS_MASK	0xFFFFF
+#define AMDGPU_RLCG_SCRATCH1_ERROR_MASK	0xF000000
 
 /* all asic after AI use this offset */
 #define mmRCC_IOV_FUNC_IDENTIFIER 0xDE5
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#12 lore raw

Re: [PATCH] drm/amdgpu: Improve error checking in amdgpu_virt_rlcg_reg_rw (v2)

Quoted 8 lines · Victor Lu

The current error detection only looks for a timeout. This should be changed to also check scratch_reg1 for any errors returned from RLCG.

v2: remove new error value

Quoted 43 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 5 +++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -2
index 6ff7d3fb2008..7a4eae36778a 100644
@@ -979,7 +979,7 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
                 * SCRATCH_REG0         = read/write value
                 * SCRATCH_REG1[30:28]  = command
                 * SCRATCH_REG1[19:0]   = address in dword
-                * SCRATCH_REG1[26:24]  = Error reporting
+                * SCRATCH_REG1[27:24]  = Error reporting
                 */
                writel(v, scratch_reg0);
                writel((offset | flag), scratch_reg1);
@@ -993,7 +993,8 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
                        udelay(10);
                }
 
-               if (i >= timeout) {
+               tmp = readl(scratch_reg1);
+               if (i >= timeout || (tmp & AMDGPU_RLCG_SCRATCH1_ERROR_MASK) != 0) {
                        if (amdgpu_sriov_rlcg_error_report_enabled(adev)) {
                                if (tmp & AMDGPU_RLCG_VFGATE_DISABLED) {
                                        dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -1
index fa7be5f277b9..3f59b7b5523f 100644
@@ -45,6 +45,7 @@
 #define AMDGPU_RLCG_REG_NOT_IN_RANGE           0x1000000
 
 #define AMDGPU_RLCG_SCRATCH1_ADDRESS_MASK      0xFFFFF
+#define AMDGPU_RLCG_SCRATCH1_ERROR_MASK        0xF000000
 
 /* all asic after AI use this offset */
 #define mmRCC_IOV_FUNC_IDENTIFIER 0xDE5
--

2.34.1