path: root/drivers/gpu/drm/amd/include
diff options
authorFelix Kuehling <>2018-02-06 20:32:35 -0500
committerOded Gabbay <>2018-02-06 20:32:35 -0500
commitd8d019ccffb838bb0dd98e583b5c25ccc0bc6ece (patch)
tree660d1ea42b915579fc4b12ad717bcbcaf49254f6 /drivers/gpu/drm/amd/include
parent1029a3f33678afb8978285209ec5cfe153fe44ef (diff)
drm/amdgpu: Add KFD eviction fence
This fence is used by KFD to keep memory resident while user mode queues are enabled. Trying to evict memory will trigger the enable_signaling callback, which starts a KFD eviction, which involves preempting user mode queues before signaling the fence. There is one such fence per process. v2: * Grab a reference to mm_struct * Dereference fence after NULL check * Simplify fence release, no need to signal without anyone waiting * Added signed-off-by Harish, who is the original author of this code v3: * update MAINTAINERS file * change amd_kfd_ prefix to amdkfd_ * remove useless initialization of variable to NULL v4: * set amdkfd_fence_ops to be static * Suggested by: Fengguang Wu <> Signed-off-by: Harish Kasiviswanathan <> Signed-off-by: Felix Kuehling <> Reviewed-by: Oded Gabbay <> Signed-off-by: Oded Gabbay <>
Diffstat (limited to 'drivers/gpu/drm/amd/include')
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index 94eab54864bf..9e352499c409 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -30,6 +30,7 @@
#include <linux/types.h>
#include <linux/bitmap.h>
+#include <linux/dma-fence.h>
struct pci_dev;
@@ -286,6 +287,9 @@ struct kfd2kgd_calls {
* @resume: Notifies amdkfd about a resume action done to a kgd device
+ * @schedule_evict_and_restore_process: Schedules work queue that will prepare
+ * for safe eviction of KFD BOs that belong to the specified process.
+ *
* This structure contains function callback pointers so the kgd driver
* will notify to the amdkfd about certain status changes.
@@ -300,6 +304,8 @@ struct kgd2kfd_calls {
void (*interrupt)(struct kfd_dev *kfd, const void *ih_ring_entry);
void (*suspend)(struct kfd_dev *kfd);
int (*resume)(struct kfd_dev *kfd);
+ int (*schedule_evict_and_restore_process)(struct mm_struct *mm,
+ struct dma_fence *fence);
int kgd2kfd_init(unsigned interface_version,