Subject: linux-next: manual merge of the drm tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 1 Jul 2021 10:52:02 +1000

Hi all,

Today's linux-next merge of the drm tree got a conflict in:

  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

between commit:

  da68547d3692 ("drm/amdgpu: use vma_lookup() in amdgpu_ttm_tt_get_user_pages()")

from Linus' tree and commit:

  04d8d73dbcbe ("drm/amdgpu: add common HMM get pages function")

from the drm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 61c4fb1b87fe,6a214a4dfe04..000000000000
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@@ -689,30 -680,12 +680,12 @@@ int amdgpu_ttm_tt_get_user_pages(struc
  	if (!mmget_not_zero(mm)) /* Happens during process shutdown */
  		return -ESRCH;
  
- 	range = kzalloc(sizeof(*range), GFP_KERNEL);
- 	if (unlikely(!range)) {
- 		r = -ENOMEM;
- 		goto out;
- 	}
- 	range->notifier = &bo->notifier;
- 	range->start = bo->notifier.interval_tree.start;
- 	range->end = bo->notifier.interval_tree.last + 1;
- 	range->default_flags = HMM_PFN_REQ_FAULT;
- 	if (!amdgpu_ttm_tt_is_readonly(ttm))
- 		range->default_flags |= HMM_PFN_REQ_WRITE;
- 
- 	range->hmm_pfns = kvmalloc_array(ttm->num_pages,
- 					 sizeof(*range->hmm_pfns), GFP_KERNEL);
- 	if (unlikely(!range->hmm_pfns)) {
- 		r = -ENOMEM;
- 		goto out_free_ranges;
- 	}
- 
  	mmap_read_lock(mm);
 -	vma = find_vma(mm, start);
 +	vma = vma_lookup(mm, start);
+ 	mmap_read_unlock(mm);
 -	if (unlikely(!vma || start < vma->vm_start)) {
 +	if (unlikely(!vma)) {
  		r = -EFAULT;
- 		goto out_unlock;
+ 		goto out_putmm;
  	}
  	if (unlikely((gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) &&
  		vma->vm_file)) {