Skip to content

Commit

Permalink
drm/amdgpu: Add userptr support for KFD
Browse files Browse the repository at this point in the history
This adds support for allocating, mapping, unmapping and freeing
userptr BOs, and for handling MMU notifiers.

v2: updated a comment

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>
  • Loading branch information
Felix Kuehling authored and Oded Gabbay committed Mar 23, 2018
1 parent 6b95e79 commit 5ae0283
Show file tree
Hide file tree
Showing 2 changed files with 554 additions and 24 deletions.
11 changes: 11 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/mmu_context.h>
#include <linux/workqueue.h>
#include <kgd_kfd_interface.h>
#include <drm/ttm/ttm_execbuf_util.h>
#include "amdgpu_sync.h"
Expand Down Expand Up @@ -59,7 +60,9 @@ struct kgd_mem {

uint32_t mapping_flags;

atomic_t invalid;
struct amdkfd_process_info *process_info;
struct page **user_pages;

struct amdgpu_sync sync;

Expand All @@ -84,13 +87,21 @@ struct amdkfd_process_info {
struct list_head vm_list_head;
/* List head for all KFD BOs that belong to a KFD process. */
struct list_head kfd_bo_list;
/* List of userptr BOs that are valid or invalid */
struct list_head userptr_valid_list;
struct list_head userptr_inval_list;
/* Lock to protect kfd_bo_list */
struct mutex lock;

/* Number of VMs */
unsigned int n_vms;
/* Eviction Fence */
struct amdgpu_amdkfd_fence *eviction_fence;

/* MMU-notifier related fields */
atomic_t evicted_bos;
struct delayed_work restore_userptr_work;
struct pid *pid;
};

int amdgpu_amdkfd_init(void);
Expand Down
Loading

0 comments on commit 5ae0283

Please sign in to comment.