Skip to contentSkip to conversation

drm/amdgpu: Fix infinite loop in gfxhub_v1_2_xcc_gart_enable (v2)

PATCH In review Victor Lu 2 participants 2 messages Jul 19, 2023

Subsystems (3)
lore
Share & tools
lore

Victor Lu

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Fix infinite loop in gfxhub_v1_2_xcc_gart_enable (v2)

An instance of for_each_inst() was not changed to match its new behaviour and is causing a loop.

v2: remove tmp_mask variable

Fixes 50c1d81d6365 ("drm/amdgpu: Modify for_each_inst macro")
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c |  5 +-
 scripts/package/builddeb                 | 60 ++++++++++++------------
 2 files changed, 31 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +1 -4
index 47f95ec218a3..dbdee1a0aefe 100644
@@ -402,18 +402,15 @@ static void gfxhub_v1_2_xcc_program_invalidation(struct amdgpu_device *adev,
 static int gfxhub_v1_2_xcc_gart_enable(struct amdgpu_device *adev,
 				       uint32_t xcc_mask)
 {
-	uint32_t tmp_mask;
 	int i;
 
-	tmp_mask = xcc_mask;
 	/*
 	 * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, because they are
 	 * VF copy registers so vbios post doesn't program them, for
 	 * SRIOV driver need to program them
 	 */
 	if (amdgpu_sriov_vf(adev)) {
-		for_each_inst(i, tmp_mask) {
-			i = ffs(tmp_mask) - 1;
+		for_each_inst(i, xcc_mask) {
 			WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_BASE,
 				     adev->gmc.vram_start >> 24);
 			WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_TOP,
scripts/package/builddeb +30 -30

71 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Acked-by on v2 1/1
#1 lore raw

[Public]

With the scripts/package/builddeb changes dropped, the patch is:

________________________________
From: amd-gfx <[email protected]> on behalf of Victor Lu <[email protected]>
Sent: Wednesday, July 19, 2023 10:52 AM
To: [email protected] <[email protected]>
Cc: Skvortsov, Victor <[email protected]>; Zhou, Bob <[email protected]>; Lazar, Lijo <[email protected]>; Lu, Victor Cheng Chi (Victor) <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Fix infinite loop in gfxhub_v1_2_xcc_gart_enable (v2)

An instance of for_each_inst() was not changed to match its new behaviour and is causing a loop.

v2: remove tmp_mask variable

Fixes 50c1d81d6365 ("drm/amdgpu: Modify for_each_inst macro")
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c |  5 +-
 scripts/package/builddeb                 | 60 ++++++++++++------------
 2 files changed, 31 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +1 -4
index 47f95ec218a3..dbdee1a0aefe 100644
@@ -402,18 +402,15 @@ static void gfxhub_v1_2_xcc_program_invalidation(struct amdgpu_device *adev,
 static int gfxhub_v1_2_xcc_gart_enable(struct amdgpu_device *adev,
                                        uint32_t xcc_mask)
 {
-       uint32_t tmp_mask;
         int i;
 
-       tmp_mask = xcc_mask;
         /*
          * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, because they are
          * VF copy registers so vbios post doesn't program them, for
          * SRIOV driver need to program them
          */
         if (amdgpu_sriov_vf(adev)) {
-               for_each_inst(i, tmp_mask) {
-                       i = ffs(tmp_mask) - 1;
+               for_each_inst(i, xcc_mask) {
                         WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_BASE,
                                      adev->gmc.vram_start >> 24);
                         WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_TOP,
scripts/package/builddeb +30 -30

71 lines not on this page · raw message

--
2.34.1