drm/amdgpu/sriov: For sriov runtime, use kiq to do invalidate tlb

Submitted by Deng, Emily on Aug. 14, 2018, 6:58 a.m.

Details

Message ID CY4PR12MB1125A1E1615F8F299A3554668F380@CY4PR12MB1125.namprd12.prod.outlook.com
State New
Headers show
Series "drm/amdgpu/sriov: For sriov runtime, use kiq to do invalidate tlb" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Deng, Emily Aug. 14, 2018, 6:58 a.m.
Hi all,
     Please ignore this patch, will send another patch.

Best wishes
Emily Deng

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Emily Deng

Sent: Tuesday, August 14, 2018 2:32 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deng, Emily <Emily.Deng@amd.com>
Subject: [PATCH] drm/amdgpu/sriov: For sriov runtime, use kiq to do invalidate tlb

To avoid the tlb flush not interrupted by world switch, use kiq and one command to do tlb invalidate.

SWDEV-161497

Signed-off-by: Emily Deng <Emily.Deng@amd.com>

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 6999042..b66371d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -330,13 +330,25 @@  static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev,  {
 	/* Use register 17 for GART */
 	const unsigned eng = 17;
-	unsigned i, j;
+	unsigned i, j, r;
 
 	spin_lock(&adev->gmc.invalidate_lock);
 
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
 		struct amdgpu_vmhub *hub = &adev->vmhub[i];
 		u32 tmp = gmc_v9_0_get_invalidate_req(vmid);
+		struct amdgpu_ring *ring = &(adev->gfx.kiq.ring);
+
+		if (amdgpu_sriov_vf(adev) && amdgpu_sriov_runtime(adev)) {
+			r = amdgpu_ring_alloc(ring, 7);
+			if (r)
+				DRM_ERROR("amdgpu: tlb flush alloc kiq ring fail.\n");
+			amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
+					    hub->vm_inv_eng0_ack + eng,
+					    tmp, 1 << vmid);
+			amdgpu_ring_commit(ring);
+			continue;
+		}
 
 		WREG32_NO_KIQ(hub->vm_inv_eng0_req + eng, tmp);
 
--
2.7.4