Skip to contentSkip to conversation

drm/amdgpu: Init MMVM_CONTEXTS_DISABLE in gmc11 golden setting under SRIOV

PATCH In review Yifan Zha 2 participants 2 messages Mar 6, 2023 – Mar 14, 2023

Subsystems (2)
lore
Share & tools
lore

Yifan Zha

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Init MMVM_CONTEXTS_DISABLE in gmc11 golden setting under SRIOV

[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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c  | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 3 +++
 3 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
index 0305b660cd17..fad3034b35ee 100644
@@ -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;
 };
 
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +6 -0
index 0a31a341aa43..7481f2f2804c 100644
@@ -875,6 +875,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;
+	}
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +3 -0
index 164948c50ac3..17a792616979 100644
@@ -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;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

-----Original Message-----
From: Yifan Zha <[email protected]>
Sent: Monday, March 6, 2023 3:25 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Chen, Horace <[email protected]>; Chang, HaiJun <[email protected]>; Zha, YiFan(Even) <[email protected]>
Subject: [PATCH] drm/amdgpu: Init MMVM_CONTEXTS_DISABLE in gmc11 golden setting under SRIOV

[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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 2 ++  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c  | 6 ++++++  drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 3 +++
 3 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
index 0305b660cd17..fad3034b35ee 100644
@@ -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;  };
 
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +6 -0
index 0a31a341aa43..7481f2f2804c 100644
@@ -875,6 +875,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;
+       }
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +3 -1
index 164948c50ac3..17a792616979 100644
@@ -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;  }
 
--

2.25.1