mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
amdkfd: find kfd_process by filep->private_data in kfd_mmap
This commit finds the proper kfd_process by filep->private_data in kfd_mmap, because the function kfd_get_process() can not locate a specific kfd process among multiple contexts. Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
fac682a1d1
commit
4eb38fc0f1
@@ -3414,16 +3414,19 @@ static int kfd_mmio_mmap(struct kfd_node *dev, struct kfd_process *process,
|
||||
}
|
||||
|
||||
|
||||
static int kfd_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
static int kfd_mmap(struct file *filep, struct vm_area_struct *vma)
|
||||
{
|
||||
struct kfd_process *process;
|
||||
struct kfd_node *dev = NULL;
|
||||
unsigned long mmap_offset;
|
||||
unsigned int gpu_id;
|
||||
|
||||
process = kfd_get_process(current);
|
||||
if (IS_ERR(process))
|
||||
return PTR_ERR(process);
|
||||
process = filep->private_data;
|
||||
if (!process)
|
||||
return -ESRCH;
|
||||
|
||||
if (process->lead_thread != current->group_leader)
|
||||
return -EBADF;
|
||||
|
||||
mmap_offset = vma->vm_pgoff << PAGE_SHIFT;
|
||||
gpu_id = KFD_MMAP_GET_GPU_ID(mmap_offset);
|
||||
|
||||
Reference in New Issue
Block a user