aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1638-drm-amdkfd-Enable-quiesce-resume_mm-of-multiple-kfd_.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/1638-drm-amdkfd-Enable-quiesce-resume_mm-of-multiple-kfd_.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/1638-drm-amdkfd-Enable-quiesce-resume_mm-of-multiple-kfd_.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/1638-drm-amdkfd-Enable-quiesce-resume_mm-of-multiple-kfd_.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/1638-drm-amdkfd-Enable-quiesce-resume_mm-of-multiple-kfd_.patch
new file mode 100644
index 00000000..9f39eced
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/1638-drm-amdkfd-Enable-quiesce-resume_mm-of-multiple-kfd_.patch
@@ -0,0 +1,145 @@
+From b517d9ab9a68af163b7467a143b78b464ce9dcb7 Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Tue, 21 Mar 2017 11:47:11 -0400
+Subject: [PATCH 1638/4131] drm/amdkfd: Enable quiesce/resume_mm of multiple
+ kfd_devs
+
+If kfd_dev* passed to the quiesce_mm/resume_mm functions is NULL,
+quiesce or resume all devices. This capability will be used by a
+rewritten MMU-notifier.
+
+Change-Id: Ifffd7083d6c4ebe1646bc4cd215b11d41dd0736d
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 108 ++++++++++++++++----------------
+ 1 file changed, 54 insertions(+), 54 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+index 1d10eed..0e95fb2 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+@@ -721,60 +721,6 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry)
+ spin_unlock(&kfd->interrupt_lock);
+ }
+
+-int kgd2kfd_quiesce_mm(struct kfd_dev *kfd, struct mm_struct *mm)
+-{
+- struct kfd_process *p;
+- struct kfd_process_device *pdd;
+- int r;
+-
+- BUG_ON(kfd == NULL);
+- if (!kfd->init_complete)
+- return 0;
+-
+- /* Because we are called from arbitrary context (workqueue) as opposed
+- * to process context, kfd_process could attempt to exit while we are
+- * running so the lookup function increments the process ref count.
+- */
+- p = kfd_lookup_process_by_mm(mm);
+- if (!p)
+- return -ENODEV;
+-
+- r = -ENODEV;
+- pdd = kfd_get_process_device_data(kfd, p);
+- if (pdd)
+- r = process_evict_queues(kfd->dqm, &pdd->qpd);
+-
+- kfd_unref_process(p);
+- return r;
+-}
+-
+-int kgd2kfd_resume_mm(struct kfd_dev *kfd, struct mm_struct *mm)
+-{
+- struct kfd_process *p;
+- struct kfd_process_device *pdd;
+- int r;
+-
+- BUG_ON(kfd == NULL);
+- if (!kfd->init_complete)
+- return 0;
+-
+- /* Because we are called from arbitrary context (workqueue) as opposed
+- * to process context, kfd_process could attempt to exit while we are
+- * running so the lookup function increments the process ref count.
+- */
+- p = kfd_lookup_process_by_mm(mm);
+- if (!p)
+- return -ENODEV;
+-
+- r = -ENODEV;
+- pdd = kfd_get_process_device_data(kfd, p);
+- if (pdd)
+- r = process_restore_queues(kfd->dqm, &pdd->qpd);
+-
+- kfd_unref_process(p);
+- return r;
+-}
+-
+ /* quiesce_process_mm -
+ * Quiesce all user queues that belongs to given process p
+ */
+@@ -839,6 +785,60 @@ static int resume_process_mm(struct kfd_process *p)
+ return ret;
+ }
+
++int kgd2kfd_quiesce_mm(struct kfd_dev *kfd, struct mm_struct *mm)
++{
++ struct kfd_process *p;
++ struct kfd_process_device *pdd;
++ int r;
++
++ /* Because we are called from arbitrary context (workqueue) as opposed
++ * to process context, kfd_process could attempt to exit while we are
++ * running so the lookup function increments the process ref count.
++ */
++ p = kfd_lookup_process_by_mm(mm);
++ if (!p)
++ return -ENODEV;
++
++ if (kfd) {
++ r = -ENODEV;
++ pdd = kfd_get_process_device_data(kfd, p);
++ if (pdd)
++ r = process_evict_queues(kfd->dqm, &pdd->qpd);
++ } else {
++ r = quiesce_process_mm(p);
++ }
++
++ kfd_unref_process(p);
++ return r;
++}
++
++int kgd2kfd_resume_mm(struct kfd_dev *kfd, struct mm_struct *mm)
++{
++ struct kfd_process *p;
++ struct kfd_process_device *pdd;
++ int r;
++
++ /* Because we are called from arbitrary context (workqueue) as opposed
++ * to process context, kfd_process could attempt to exit while we are
++ * running so the lookup function increments the process ref count.
++ */
++ p = kfd_lookup_process_by_mm(mm);
++ if (!p)
++ return -ENODEV;
++
++ if (kfd) {
++ r = -ENODEV;
++ pdd = kfd_get_process_device_data(kfd, p);
++ if (pdd)
++ r = process_restore_queues(kfd->dqm, &pdd->qpd);
++ } else {
++ r = resume_process_mm(p);
++ }
++
++ kfd_unref_process(p);
++ return r;
++}
++
+
+ void kfd_restore_bo_worker(struct work_struct *work)
+ {
+--
+2.7.4
+