Skip to contentSkip to conversation

drm/amdgpu: fix gfx ib test failed in sriov

PATCH In review Huang, JinHuiEric 2 participants 2 messages Aug 28, 2019 – Aug 29, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix gfx ib test failed in sriov

It partially reverts the regression of

commit e4a67e6cf14c258619f
("drm/amdgpu/psp: move TMR to cpu invisible vram region")

which causes gfx ib test failed when driver loading in sriov system.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 16 ++++++++++++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 +
 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +12 -4
index 9f7cc5b..9f91ced 100644
@@ -261,9 +261,14 @@ static int psp_tmr_init(struct psp_context *psp)
 		}
 	}
 
-	ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
-				      AMDGPU_GEM_DOMAIN_VRAM,
-				      &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
+	if (amdgpu_sriov_vf(psp->adev))
+		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
+			      AMDGPU_GEM_DOMAIN_VRAM,
+			      &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+	else
+		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
+			      AMDGPU_GEM_DOMAIN_VRAM,
+			      &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 
 	return ret;
 }
@@ -1216,7 +1221,10 @@ static int psp_hw_fini(void *handle)
 
 	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
-	amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
+	if (amdgpu_sriov_vf(adev))
+		amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+	else
+		amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 	amdgpu_bo_free_kernel(&psp->fw_pri_bo,
 			      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
 	amdgpu_bo_free_kernel(&psp->fence_buf_bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1 -0
index bc0947f..b73d4aa 100644
@@ -171,6 +171,7 @@ struct psp_context
 	/* tmr buffer */
 	struct amdgpu_bo		*tmr_bo;
 	uint64_t			tmr_mc_addr;
+	void				*tmr_buf;
 
 	/* asd firmware and buffer */
 	const struct firmware		*asd_fw;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1567004342-10726-1-git-send-email-JinhuiEric.Huang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Hi Eric,

Yin has already proposed patches for fixing this a few days ago. Please help to review those instead.

Thanks,
Christian

Am 28.08.19 um 16:59 schrieb Huang, JinHuiEric:

Quoted 53 lines

It partially reverts the regression of

commit e4a67e6cf14c258619f
("drm/amdgpu/psp: move TMR to cpu invisible vram region")

which causes gfx ib test failed when driver loading in sriov system.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 16 ++++++++++++----
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 +
  2 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +12 -4
index 9f7cc5b..9f91ced 100644
@@ -261,9 +261,14 @@ static int psp_tmr_init(struct psp_context *psp)
  		}
  	}
 
-	ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
-				      AMDGPU_GEM_DOMAIN_VRAM,
-				      &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
+	if (amdgpu_sriov_vf(psp->adev))
+		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
+			      AMDGPU_GEM_DOMAIN_VRAM,
+			      &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+	else
+		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,
+			      AMDGPU_GEM_DOMAIN_VRAM,
+			      &psp->tmr_bo, &psp->tmr_mc_addr, NULL);
 
  	return ret;
  }
@@ -1216,7 +1221,10 @@ static int psp_hw_fini(void *handle)
 
  	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
-	amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
+	if (amdgpu_sriov_vf(adev))
+		amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
+	else
+		amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);
  	amdgpu_bo_free_kernel(&psp->fw_pri_bo,
  			      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
  	amdgpu_bo_free_kernel(&psp->fence_buf_bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -0
index bc0947f..b73d4aa 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h struct psp_context · line 177

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1 -0
@@ -171,6 +171,7 @@ struct psp_context
  	/* tmr buffer */
  	struct amdgpu_bo		*tmr_bo;
  	uint64_t			tmr_mc_addr;
+	void				*tmr_buf;
 
  	/* asd firmware and buffer */
  	const struct firmware		*asd_fw;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx