]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: Fixing "Indirect register access for Navi12 sriov" for vega10
authorPeng Ju Zhou <PengJu.Zhou@amd.com>
Mon, 7 Jun 2021 05:40:56 +0000 (13:40 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Jun 2021 18:57:38 +0000 (14:57 -0400)
The NV12 and VEGA10 share the same interface W/RREG32_SOC15*,
the callback functions in these macros may not be defined,
so NULL pointer must be checked but not in
macro __WREG32_SOC15_RLC__, fixing the lock of NULL pointer check.

Signed-off-by: Peng Ju Zhou <PengJu.Zhou@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/soc15_common.h

index fe5908f708cc34b20bcd846842b402133f65345e..044076ec1d03632e5c1ab5a9b808f9d2d4f2519e 100644 (file)
@@ -790,7 +790,8 @@ static void gfx_v9_0_rlcg_w(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 static void gfx_v9_0_rlcg_wreg(struct amdgpu_device *adev, u32 offset,
                               u32 v, u32 acc_flags, u32 hwip)
 {
-       if (amdgpu_sriov_fullaccess(adev)) {
+       if ((acc_flags & AMDGPU_REGS_RLC) &&
+           amdgpu_sriov_fullaccess(adev)) {
                gfx_v9_0_rlcg_w(adev, offset, v, acc_flags);
 
                return;
index f6cf70e69cceb4ce3ac199e63acbd234f78129eb..0eeb5e073be81f77bf9d3085d9924bb9fa7e2364 100644 (file)
 #define SOC15_REG_OFFSET(ip, inst, reg)        (adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg)
 
 #define __WREG32_SOC15_RLC__(reg, value, flag, hwip) \
-       ((amdgpu_sriov_runtime(adev) && adev->gfx.rlc.funcs->rlcg_wreg) ? \
+       ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_wreg) ? \
         adev->gfx.rlc.funcs->rlcg_wreg(adev, reg, value, flag, hwip) : \
         WREG32(reg, value))
 
 #define __RREG32_SOC15_RLC__(reg, flag, hwip) \
-       ((amdgpu_sriov_runtime(adev) && adev->gfx.rlc.funcs->rlcg_rreg) ? \
+       ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_rreg) ? \
         adev->gfx.rlc.funcs->rlcg_rreg(adev, reg, flag, hwip) : \
         RREG32(reg))