drm/amdgpu: Init MMVM_CONTEXTS_DISABLE in gmc11 golden setting under SRIOV
authorYifan Zha <Yifan.Zha@amd.com>
Mon, 6 Mar 2023 06:54:05 +0000 (14:54 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 15 Mar 2023 22:45:26 +0000 (18:45 -0400)
[Why]
If disable the mmhub vm contexts(set MMVM_CONTEXTS_DISABLE to 0xffff),
driver loading failed on vf due to fence fallback timer expired on all rings.
FLR cannot reset MMVM_CONTEXTS_DISABLE.
So this vf can not be recovered anymore unless trigger a whole gpu reset.

[How]
Under SRIOV, init MMVM_CONTEXTS_DISABLE in gmc11 golden register setting.

Signed-off-by: Yifan Zha <Yifan.Zha@amd.com>
Reviewed-by: Horace Chen <Horace.Chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c

index f1773ab..232523e 100644 (file)
@@ -104,6 +104,8 @@ struct amdgpu_vmhub {
        uint32_t        vm_cntx_cntl_vm_fault;
        uint32_t        vm_l2_bank_select_reserved_cid2;
 
+       uint32_t        vm_contexts_disable;
+
        const struct amdgpu_vmhub_funcs *vmhub_funcs;
 };
 
index 1c585cc..fad199e 100644 (file)
@@ -862,6 +862,12 @@ static int gmc_v11_0_sw_fini(void *handle)
 
 static void gmc_v11_0_init_golden_registers(struct amdgpu_device *adev)
 {
+       if (amdgpu_sriov_vf(adev)) {
+               struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0];
+
+               WREG32(hub->vm_contexts_disable, 0);
+               return;
+       }
 }
 
 /**
index 164948c..17a7926 100644 (file)
@@ -517,6 +517,9 @@ static void mmhub_v3_0_init(struct amdgpu_device *adev)
        hub->vm_l2_bank_select_reserved_cid2 =
                SOC15_REG_OFFSET(MMHUB, 0, regMMVM_L2_BANK_SELECT_RESERVED_CID2);
 
+       hub->vm_contexts_disable =
+               SOC15_REG_OFFSET(MMHUB, 0, regMMVM_CONTEXTS_DISABLE);
+
        hub->vmhub_funcs = &mmhub_v3_0_vmhub_funcs;
 }