aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3381-drm-amdkfd-Avoid-calling-amd_iommu_unbind_pasid-when.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3381-drm-amdkfd-Avoid-calling-amd_iommu_unbind_pasid-when.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3381-drm-amdkfd-Avoid-calling-amd_iommu_unbind_pasid-when.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3381-drm-amdkfd-Avoid-calling-amd_iommu_unbind_pasid-when.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3381-drm-amdkfd-Avoid-calling-amd_iommu_unbind_pasid-when.patch
new file mode 100644
index 00000000..b73c5cf9
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3381-drm-amdkfd-Avoid-calling-amd_iommu_unbind_pasid-when.patch
@@ -0,0 +1,66 @@
+From 95851fbe15e57bd908572b1adc15a016cdde7dc4 Mon Sep 17 00:00:00 2001
+From: Yong Zhao <yong.zhao@amd.com>
+Date: Wed, 1 Nov 2017 19:21:28 -0400
+Subject: [PATCH 3381/4131] drm/amdkfd: Avoid calling amd_iommu_unbind_pasid()
+ when suspending
+
+When kfd suspending on APU, we do not need to call
+amd_iommu_unbind_pasid(), because pasid will be unbound automatically
+when power goes off.
+
+On the other hand, calling amd_iommu_unbind_pasid() will trigger
+kfd_process_iommu_unbind_callback() if the process is not terminating.
+By design, kfd_process_iommu_unbind_callback() should only be called
+for process terminating. So we would rather not to call
+amd_iommu_unbind_pasid() when suspending.
+
+Signed-off-by: Yong Zhao <yong.zhao@amd.com>
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
+Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_process.c | 14 +++++---------
+ 1 file changed, 5 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+index 946f4d6..b81ad816 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+@@ -423,29 +423,25 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev)
+ }
+
+ /*
+- * Temporarily unbind currently bound processes from the device and
+- * mark them as PDD_BOUND_SUSPENDED. These processes will be restored
+- * to PDD_BOUND state in kfd_bind_processes_to_device.
++ * Mark currently bound processes as PDD_BOUND_SUSPENDED. These
++ * processes will be restored to PDD_BOUND state in
++ * kfd_bind_processes_to_device.
+ */
+ void kfd_unbind_processes_from_device(struct kfd_dev *dev)
+ {
+ struct kfd_process_device *pdd;
+ struct kfd_process *p;
+- unsigned int temp, temp_bound, temp_pasid;
++ unsigned int temp;
+
+ int idx = srcu_read_lock(&kfd_processes_srcu);
+
+ hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
+ mutex_lock(&p->mutex);
+ pdd = kfd_get_process_device_data(dev, p);
+- temp_bound = pdd->bound;
+- temp_pasid = p->pasid;
++
+ if (pdd->bound == PDD_BOUND)
+ pdd->bound = PDD_BOUND_SUSPENDED;
+ mutex_unlock(&p->mutex);
+-
+- if (temp_bound == PDD_BOUND)
+- amd_iommu_unbind_pasid(dev->pdev, temp_pasid);
+ }
+
+ srcu_read_unlock(&kfd_processes_srcu, idx);
+--
+2.7.4
+