Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Skip some registers config for SRIOV

Some registers are not accessible to virtual function setup, so
skip their initialization when in VF-SRIOV mode.

v2: move SRIOV VF check into specify functions;
modify commit description and comment.

Signed-off-by: Liu ChengZhe <ChengZhe.Liu@amd.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Liu ChengZhe and committed by
Alex Deucher
d5bbb476 78484d7c

+38
+19
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
··· 135 135 { 136 136 uint32_t tmp; 137 137 138 + /* These registers are not accessible to VF-SRIOV. 139 + * The PF will program them instead. 140 + */ 141 + if (amdgpu_sriov_vf(adev)) 142 + return; 143 + 138 144 /* Setup L2 cache */ 139 145 tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_CNTL); 140 146 tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL, ENABLE_L2_CACHE, 1); ··· 196 190 197 191 static void gfxhub_v2_1_disable_identity_aperture(struct amdgpu_device *adev) 198 192 { 193 + /* These registers are not accessible to VF-SRIOV. 194 + * The PF will program them instead. 195 + */ 196 + if (amdgpu_sriov_vf(adev)) 197 + return; 198 + 199 199 WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32, 200 200 0xFFFFFFFF); 201 201 WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32, ··· 338 326 bool value) 339 327 { 340 328 u32 tmp; 329 + 330 + /* These registers are not accessible to VF-SRIOV. 331 + * The PF will program them instead. 332 + */ 333 + if (amdgpu_sriov_vf(adev)) 334 + return; 335 + 341 336 tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL); 342 337 tmp = REG_SET_FIELD(tmp, GCVM_L2_PROTECTION_FAULT_CNTL, 343 338 RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
+19
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
··· 134 134 { 135 135 uint32_t tmp; 136 136 137 + /* These registers are not accessible to VF-SRIOV. 138 + * The PF will program them instead. 139 + */ 140 + if (amdgpu_sriov_vf(adev)) 141 + return; 142 + 137 143 /* Setup L2 cache */ 138 144 tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL); 139 145 tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL, ENABLE_L2_CACHE, 1); ··· 195 189 196 190 static void mmhub_v2_0_disable_identity_aperture(struct amdgpu_device *adev) 197 191 { 192 + /* These registers are not accessible to VF-SRIOV. 193 + * The PF will program them instead. 194 + */ 195 + if (amdgpu_sriov_vf(adev)) 196 + return; 197 + 198 198 WREG32_SOC15(MMHUB, 0, 199 199 mmMMVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32, 200 200 0xFFFFFFFF); ··· 330 318 void mmhub_v2_0_set_fault_enable_default(struct amdgpu_device *adev, bool value) 331 319 { 332 320 u32 tmp; 321 + 322 + /* These registers are not accessible to VF-SRIOV. 323 + * The PF will program them instead. 324 + */ 325 + if (amdgpu_sriov_vf(adev)) 326 + return; 327 + 333 328 tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_PROTECTION_FAULT_CNTL); 334 329 tmp = REG_SET_FIELD(tmp, MMVM_L2_PROTECTION_FAULT_CNTL, 335 330 RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);