Skip to content

Commit d5bbb47

Browse files
Liu ChengZhealexdeucher
authored andcommitted
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 <[email protected]> Reviewed-by: Luben Tuikov <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 78484d7 commit d5bbb47

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ static void gfxhub_v2_1_init_cache_regs(struct amdgpu_device *adev)
135135
{
136136
uint32_t tmp;
137137

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+
138144
/* Setup L2 cache */
139145
tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_CNTL);
140146
tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL, ENABLE_L2_CACHE, 1);
@@ -190,6 +196,12 @@ static void gfxhub_v2_1_enable_system_domain(struct amdgpu_device *adev)
190196

191197
static void gfxhub_v2_1_disable_identity_aperture(struct amdgpu_device *adev)
192198
{
199+
/* These registers are not accessible to VF-SRIOV.
200+
* The PF will program them instead.
201+
*/
202+
if (amdgpu_sriov_vf(adev))
203+
return;
204+
193205
WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,
194206
0xFFFFFFFF);
195207
WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32,
@@ -326,6 +338,13 @@ void gfxhub_v2_1_set_fault_enable_default(struct amdgpu_device *adev,
326338
bool value)
327339
{
328340
u32 tmp;
341+
342+
/* These registers are not accessible to VF-SRIOV.
343+
* The PF will program them instead.
344+
*/
345+
if (amdgpu_sriov_vf(adev))
346+
return;
347+
329348
tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL);
330349
tmp = REG_SET_FIELD(tmp, GCVM_L2_PROTECTION_FAULT_CNTL,
331350
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);

drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ static void mmhub_v2_0_init_cache_regs(struct amdgpu_device *adev)
134134
{
135135
uint32_t tmp;
136136

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+
137143
/* Setup L2 cache */
138144
tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL);
139145
tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL, ENABLE_L2_CACHE, 1);
@@ -189,6 +195,12 @@ static void mmhub_v2_0_enable_system_domain(struct amdgpu_device *adev)
189195

190196
static void mmhub_v2_0_disable_identity_aperture(struct amdgpu_device *adev)
191197
{
198+
/* These registers are not accessible to VF-SRIOV.
199+
* The PF will program them instead.
200+
*/
201+
if (amdgpu_sriov_vf(adev))
202+
return;
203+
192204
WREG32_SOC15(MMHUB, 0,
193205
mmMMVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,
194206
0xFFFFFFFF);
@@ -318,6 +330,13 @@ void mmhub_v2_0_gart_disable(struct amdgpu_device *adev)
318330
void mmhub_v2_0_set_fault_enable_default(struct amdgpu_device *adev, bool value)
319331
{
320332
u32 tmp;
333+
334+
/* These registers are not accessible to VF-SRIOV.
335+
* The PF will program them instead.
336+
*/
337+
if (amdgpu_sriov_vf(adev))
338+
return;
339+
321340
tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_PROTECTION_FAULT_CNTL);
322341
tmp = REG_SET_FIELD(tmp, MMVM_L2_PROTECTION_FAULT_CNTL,
323342
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);

0 commit comments

Comments
 (0)