Skip to contentSkip to conversation

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

PATCH In review Emily Deng 1 participant 2 messages Aug 14, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 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

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +13 -1
index 6999042..b66371d 100644
@@ -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);
 
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): 1534228335-24285-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Hi all,
Please ignore this patch, will send another patch.

Best wishes
Emily Deng

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Emily Deng
Sent: Tuesday, August 14, 2018 2:32 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
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

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +13 -2
index 6999042..b66371d 100644
@@ -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

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