29
29
#include <linux/mm.h>
30
30
#include <linux/kthread.h>
31
31
#include <linux/workqueue.h>
32
+ #include <linux/mmu_notifier.h>
32
33
#include <kgd_kfd_interface.h>
33
34
#include <drm/ttm/ttm_execbuf_util.h>
34
35
#include "amdgpu_sync.h"
@@ -65,6 +66,7 @@ struct kgd_mem {
65
66
struct mutex lock ;
66
67
struct amdgpu_bo * bo ;
67
68
struct dma_buf * dmabuf ;
69
+ struct hmm_range * range ;
68
70
struct list_head attachments ;
69
71
/* protected by amdkfd_process_info.lock */
70
72
struct ttm_validate_buffer validate_list ;
@@ -75,7 +77,7 @@ struct kgd_mem {
75
77
76
78
uint32_t alloc_flags ;
77
79
78
- atomic_t invalid ;
80
+ uint32_t invalid ;
79
81
struct amdkfd_process_info * process_info ;
80
82
81
83
struct amdgpu_sync sync ;
@@ -131,7 +133,8 @@ struct amdkfd_process_info {
131
133
struct amdgpu_amdkfd_fence * eviction_fence ;
132
134
133
135
/* MMU-notifier related fields */
134
- atomic_t evicted_bos ;
136
+ struct mutex notifier_lock ;
137
+ uint32_t evicted_bos ;
135
138
struct delayed_work restore_userptr_work ;
136
139
struct pid * pid ;
137
140
bool block_mmu_notifications ;
@@ -180,7 +183,8 @@ int kfd_debugfs_kfd_mem_limits(struct seq_file *m, void *data);
180
183
bool amdkfd_fence_check_mm (struct dma_fence * f , struct mm_struct * mm );
181
184
struct amdgpu_amdkfd_fence * to_amdgpu_amdkfd_fence (struct dma_fence * f );
182
185
int amdgpu_amdkfd_remove_fence_on_pt_pd_bos (struct amdgpu_bo * bo );
183
- int amdgpu_amdkfd_evict_userptr (struct kgd_mem * mem , struct mm_struct * mm );
186
+ int amdgpu_amdkfd_evict_userptr (struct mmu_interval_notifier * mni ,
187
+ unsigned long cur_seq , struct kgd_mem * mem );
184
188
#else
185
189
static inline
186
190
bool amdkfd_fence_check_mm (struct dma_fence * f , struct mm_struct * mm )
@@ -201,7 +205,8 @@ int amdgpu_amdkfd_remove_fence_on_pt_pd_bos(struct amdgpu_bo *bo)
201
205
}
202
206
203
207
static inline
204
- int amdgpu_amdkfd_evict_userptr (struct kgd_mem * mem , struct mm_struct * mm )
208
+ int amdgpu_amdkfd_evict_userptr (struct mmu_interval_notifier * mni ,
209
+ unsigned long cur_seq , struct kgd_mem * mem )
205
210
{
206
211
return 0 ;
207
212
}
0 commit comments