int kgd2kfd_quiesce_mm(struct mm_struct *mm, uint32_t trigger);
int kgd2kfd_resume_mm(struct mm_struct *mm);
int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
- struct dma_fence *fence);
+ u16 context_id, struct dma_fence *fence);
#if IS_ENABLED(CONFIG_HSA_AMD)
int kgd2kfd_init(void);
void kgd2kfd_exit(void);
if (dma_fence_is_signaled(f))
return true;
+ /* if fence->svm_bo is NULL, means this fence is created through
+ * init_kfd_vm() or amdgpu_amdkfd_gpuvm_restore_process_bos().
+ * Therefore, this fence is amdgpu_amdkfd_fence->eviction_fence.
+ */
if (!fence->svm_bo) {
- if (!kgd2kfd_schedule_evict_and_restore_process(fence->mm, f))
+ if (!kgd2kfd_schedule_evict_and_restore_process(fence->mm, fence->context_id, f))
return true;
} else {
if (!svm_range_schedule_evict_svm_bo(fence))
* prepare for safe eviction of KFD BOs that belong to the specified
* process.
*
- * @mm: mm_struct that identifies the specified KFD process
+ * @mm: mm_struct that identifies a group of KFD processes
+ * @context_id: an id that identifies a specific KFD context in the above kfd process group
* @fence: eviction fence attached to KFD process BOs
*
*/
int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
- struct dma_fence *fence)
+ u16 context_id, struct dma_fence *fence)
{
struct kfd_process *p;
unsigned long active_time;
if (dma_fence_is_signaled(fence))
return 0;
- p = kfd_lookup_process_by_mm(mm);
+ p = kfd_lookup_process_by_id(mm, context_id);
if (!p)
return -ENODEV;