aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1582-drm-amdgpu-Ignore-eviction-fence-during-map-and-vali.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1582-drm-amdgpu-Ignore-eviction-fence-during-map-and-vali.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1582-drm-amdgpu-Ignore-eviction-fence-during-map-and-vali.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1582-drm-amdgpu-Ignore-eviction-fence-during-map-and-vali.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1582-drm-amdgpu-Ignore-eviction-fence-during-map-and-vali.patch
new file mode 100644
index 00000000..f9fa574e
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1582-drm-amdgpu-Ignore-eviction-fence-during-map-and-vali.patch
@@ -0,0 +1,80 @@
+From 31c1e65cee3dae4b591e90481a4bd41a0e1263af Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Fri, 3 Feb 2017 10:55:42 -0500
+Subject: [PATCH 1582/4131] drm/amdgpu: Ignore eviction fence during map and
+ validate
+
+Temporarily remove eviction fence before map and validate. This is
+necessary because during map new PTs are created and cleared. Validate
+needs to wait on move fences. The eviction fence shouldn't interfere in
+both these activities.
+
+Change-Id: I97720ca1a413f0b4b2fe5a53c34dd0fa0a6c7360
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 22 ++++++++++++++--------
+ 1 file changed, 14 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index 370daae..d08d25c6 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -449,17 +449,12 @@ static int amdgpu_amdkfd_bo_invalidate(struct amdgpu_bo *bo)
+ static int validate_pt_pd_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm)
+ {
+ struct amdgpu_bo *pd = vm->page_directory;
+- struct amdkfd_vm *kvm = container_of(vm, struct amdkfd_vm, base);
+ struct amdgpu_vm_parser param;
+ int ret;
+
+ param.domain = AMDGPU_GEM_DOMAIN_VRAM;
+ param.wait = true;
+
+- /* Remove eviction fence so that validate can wait on move fences */
+- amdgpu_amdkfd_remove_eviction_fence(pd, kvm->eviction_fence,
+- NULL, NULL);
+-
+ ret = amdgpu_vm_validate_pt_bos(adev, vm, amdgpu_amdkfd_validate,
+ &param);
+
+@@ -471,9 +466,6 @@ static int validate_pt_pd_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm)
+ pr_err("amdgpu: failed to validate PD\n");
+ }
+
+- /* Add the eviction fence back */
+- amdgpu_bo_fence(pd, &kvm->master->eviction_fence->base, true);
+-
+ vm->last_eviction_counter = atomic64_read(&adev->num_evictions);
+
+ return ret;
+@@ -944,6 +936,17 @@ static int map_bo_to_gpuvm(struct amdgpu_device *adev,
+ {
+ int ret;
+ struct amdgpu_bo *bo = entry->bo_va->bo;
++ struct amdkfd_vm *kvm = container_of(entry->bo_va->vm,
++ struct amdkfd_vm, base);
++ struct amdgpu_bo *pd = entry->bo_va->vm->page_directory;
++
++ /* Remove eviction fence from PD (and thereby from PTs too as they
++ * share the resv. object. This is necessary because new PTs are
++ * cleared and validate needs to wait on move fences. The eviction
++ * fence shouldn't interfere in both these activities
++ */
++ amdgpu_amdkfd_remove_eviction_fence(pd, kvm->master->eviction_fence,
++ NULL, NULL);
+
+ /* Set virtual address for the allocation, allocate PTs,
+ * if needed, and zero them.
+@@ -966,6 +969,9 @@ static int map_bo_to_gpuvm(struct amdgpu_device *adev,
+ return ret;
+ }
+
++ /* Add the eviction fence back */
++ amdgpu_bo_fence(pd, &kvm->master->eviction_fence->base, true);
++
+ ret = update_gpuvm_pte(adev, entry, sync);
+ if (ret != 0) {
+ pr_err("update_gpuvm_pte() failed\n");
+--
+2.7.4
+