Skip to contentSkip to conversation

drm/amdgpu: adjust HDP write queue flushing for tlb invalidation

PATCH In review Alex Deucher 2 participants 3 messages Jan 5, 2018 1 message not in the archive

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

PATCH 1/2 drm/amdgpu: adjust HDP write queue flushing for tlb invalidation

Separate tlb invalidation and hdp flushing and move the HDP flush to the caller.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c   | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c    | 2 --
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c    | 3 ---
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c    | 3 ---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 3 ---
 6 files changed, 4 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +2 -0
index 0a4f34afaaaa..d0617f1c252f 100644
@@ -247,6 +247,7 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
 		}
 	}
 	mb();
+	amdgpu_asic_flush_hdp(adev);
 	amdgpu_gart_flush_gpu_tlb(adev, 0);
 	return 0;
 }
@@ -329,6 +330,7 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
 		return r;
 
 	mb();
+	amdgpu_asic_flush_hdp(adev);
 	amdgpu_gart_flush_gpu_tlb(adev, 0);
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
index cd1752b6afa9..2d5c1aa7322a 100644
@@ -856,6 +856,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
 	if (vm->use_cpu_for_update) {
 		/* Flush HDP */
 		mb();
+		amdgpu_asic_flush_hdp(adev);
 		amdgpu_gart_flush_gpu_tlb(adev, 0);
 	} else if (params.ib->length_dw == 0) {
 		amdgpu_job_free(job);
@@ -1453,6 +1454,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	if (vm->use_cpu_for_update) {
 		/* Flush HDP */
 		mb();
+		amdgpu_asic_flush_hdp(adev);
 		amdgpu_gart_flush_gpu_tlb(adev, 0);
 	}
 
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -2
index 8e28270d1ea9..da708356eefc 100644
@@ -359,8 +359,6 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
 static void gmc_v6_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
 					uint32_t vmid)
 {
-	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 0);
-
 	WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
 }
 
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -3
index 86e9d682c59e..b73599912b42 100644
@@ -431,9 +431,6 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
 static void gmc_v7_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
 					uint32_t vmid)
 {
-	/* flush hdp cache */
-	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 0);
-
 	/* bits 0-15 are the VM contexts0-15 */
 	WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
 }
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -3
index 9a813d834f1a..287228315b76 100644
@@ -606,9 +606,6 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
 static void gmc_v8_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
 					uint32_t vmid)
 {
-	/* flush hdp cache */
-	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 0);
-
 	/* bits 0-15 are the VM contexts0-15 */
 	WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
 }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -3
index eb8b1bb66389..7ec54c23c07d 100644
@@ -329,9 +329,6 @@ static void gmc_v9_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
 	const unsigned eng = 17;
 	unsigned i, j;
 
-	/* flush hdp cache */
-	adev->nbio_funcs->hdp_flush(adev);
-
 	spin_lock(&adev->mc.invalidate_lock);
 
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
Signature · 6 lines
2.13.6

_______________________________________________
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): 20180105155900.10998-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: drop extra tlb invalidation in gpuvm

We only need to flush the HDP here, not invalidate the TLB.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -2
index 2d5c1aa7322a..7b1dae663bd0 100644
@@ -857,7 +857,6 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
 		/* Flush HDP */
 		mb();
 		amdgpu_asic_flush_hdp(adev);
-		amdgpu_gart_flush_gpu_tlb(adev, 0);
 	} else if (params.ib->length_dw == 0) {
 		amdgpu_job_free(job);
 	} else {
@@ -1455,7 +1454,6 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		/* Flush HDP */
 		mb();
 		amdgpu_asic_flush_hdp(adev);
-		amdgpu_gart_flush_gpu_tlb(adev, 0);
 	}
 
 	spin_lock(&vm->status_lock);
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#3 lore raw
In reply to a message not in the archive

Am 05.01.2018 um 16:58 schrieb Alex Deucher:

Quoted 4 lines

Separate tlb invalidation and hdp flushing and move the HDP flush to the caller.

Quoted 95 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 2 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c   | 2 ++
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c    | 2 --
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c    | 3 ---
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c    | 3 ---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 3 ---
  6 files changed, 4 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +2 -0
index 0a4f34afaaaa..d0617f1c252f 100644
@@ -247,6 +247,7 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
  		}
  	}
  	mb();
+	amdgpu_asic_flush_hdp(adev);
  	amdgpu_gart_flush_gpu_tlb(adev, 0);
  	return 0;
  }
@@ -329,6 +330,7 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
  		return r;
 
  	mb();
+	amdgpu_asic_flush_hdp(adev);
  	amdgpu_gart_flush_gpu_tlb(adev, 0);
  	return 0;
  }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
index cd1752b6afa9..2d5c1aa7322a 100644
@@ -856,6 +856,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
  	if (vm->use_cpu_for_update) {
  		/* Flush HDP */
  		mb();
+		amdgpu_asic_flush_hdp(adev);
  		amdgpu_gart_flush_gpu_tlb(adev, 0);
  	} else if (params.ib->length_dw == 0) {
  		amdgpu_job_free(job);
@@ -1453,6 +1454,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  	if (vm->use_cpu_for_update) {
  		/* Flush HDP */
  		mb();
+		amdgpu_asic_flush_hdp(adev);
  		amdgpu_gart_flush_gpu_tlb(adev, 0);
  	}
 
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -2
index 8e28270d1ea9..da708356eefc 100644
@@ -359,8 +359,6 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
  static void gmc_v6_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
  					uint32_t vmid)
  {
-	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 0);
-
  	WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
  }
 
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -3
index 86e9d682c59e..b73599912b42 100644
@@ -431,9 +431,6 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
  static void gmc_v7_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
  					uint32_t vmid)
  {
-	/* flush hdp cache */
-	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 0);
-
  	/* bits 0-15 are the VM contexts0-15 */
  	WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
  }
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -3
index 9a813d834f1a..287228315b76 100644
@@ -606,9 +606,6 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
  static void gmc_v8_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
  					uint32_t vmid)
  {
-	/* flush hdp cache */
-	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 0);
-
  	/* bits 0-15 are the VM contexts0-15 */
  	WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
  }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index eb8b1bb66389..7ec54c23c07d 100644

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_gart_flush_gpu_tlb(struct amdgpu_device *adev, · line 334

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -3
@@ -329,9 +329,6 @@ static void gmc_v9_0_gart_flush_gpu_tlb(struct amdgpu_device *adev,
  	const unsigned eng = 17;
  	unsigned i, j;
 
-	/* flush hdp cache */
-	adev->nbio_funcs->hdp_flush(adev);
-
  	spin_lock(&adev->mc.invalidate_lock);
 
  	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {

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