[PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW.

Gavin Wan Gavin.Wan at amd.com
Wed Apr 13 15:26:41 UTC 2022


[why] These static variables saves the RLC Scratch registers address.
      When we installed multiple GPUs (for example: XGMI setting) and
      multiple GPUs call the function at same time. The RLC Scratch
      registers address are changed each other. Then it caused
      reading/writing to wrong GPU.

[fix] Removed the static from the variables. The variables are
      in stack.

Signed-off-by: Gavin Wan <Gavin.Wan at amd.com>
Change-Id: Iee78849291d4f7a9688ecc5165bec70ee85cdfbe
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index d5eea031c3e3..d18a05a20566 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -868,11 +868,11 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
 	uint32_t timeout = 50000;
 	uint32_t i, tmp;
 	uint32_t ret = 0;
-	static void *scratch_reg0;
-	static void *scratch_reg1;
-	static void *scratch_reg2;
-	static void *scratch_reg3;
-	static void *spare_int;
+	void *scratch_reg0;
+	void *scratch_reg1;
+	void *scratch_reg2;
+	void *scratch_reg3;
+	void *spare_int;
 
 	if (!adev->gfx.rlc.rlcg_reg_access_supported) {
 		dev_err(adev->dev,
-- 
2.32.0



More information about the amd-gfx mailing list