OSDN Git Service

drm/amd/amdgpu: Remove static from variable in RLCG Reg RW
authorGavin Wan <Gavin.Wan@amd.com>
Wed, 13 Apr 2022 15:09:22 +0000 (11:09 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 14 Apr 2022 19:29:20 +0000 (15:29 -0400)
[why]
These static variables save the RLC Scratch registers address.
When we install 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 from/to wrong GPU.

[how]
Removed the static from the variables. The variables are
on the stack.

Fixes: 5d447e29670148 ("drm/amdgpu: add helper for rlcg indirect reg access")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

index ab95bea..ea92edc 100644 (file)
@@ -870,11 +870,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,