Subject: linux-next: manual merge of the amdgpu tree with the drm-misc tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 21 May 2021 11:20:13 +1000

Hi all,

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

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

between commit:

  f89f8c6bafd0 ("drm/amdgpu: Guard against write accesses after device removal")

from the drm-misc tree and commit:

  0ccc3ccf5b3a ("drm/amdgpu: re-apply "use the new cursor in the VM code" v2")

from the amdgpu 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_vm.c
index 90c34491f85d,57a6ad04118c..000000000000
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@@ -1594,23 -1618,21 +1620,24 @@@ static int amdgpu_vm_update_ptes(struc
   * Returns:
   * 0 for success, -EINVAL for failure.
   */
- static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
- 				       struct amdgpu_device *bo_adev,
- 				       struct amdgpu_vm *vm, bool immediate,
- 				       bool unlocked, struct dma_resv *resv,
- 				       uint64_t start, uint64_t last,
- 				       uint64_t flags, uint64_t offset,
- 				       struct drm_mm_node *nodes,
- 				       dma_addr_t *pages_addr,
- 				       struct dma_fence **fence)
+ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
+ 				struct amdgpu_device *bo_adev,
+ 				struct amdgpu_vm *vm, bool immediate,
+ 				bool unlocked, struct dma_resv *resv,
+ 				uint64_t start, uint64_t last,
+ 				uint64_t flags, uint64_t offset,
+ 				struct ttm_resource *res,
+ 				dma_addr_t *pages_addr,
+ 				struct dma_fence **fence,
+ 				bool *table_freed)
  {
  	struct amdgpu_vm_update_params params;
+ 	struct amdgpu_res_cursor cursor;
  	enum amdgpu_sync_mode sync_mode;
- 	uint64_t pfn;
 -	int r;
 +	int r, idx;
 +
 +	if (!drm_dev_enter(&adev->ddev, &idx))
 +		return -ENODEV;
  
  	memset(&params, 0, sizeof(params));
  	params.adev = adev;
@@@ -1717,9 -1722,11 +1727,12 @@@
  
  	r = vm->update_funcs->commit(&params, fence);
  
+ 	if (table_freed)
+ 		*table_freed = params.table_freed;
+ 
  error_unlock:
  	amdgpu_vm_eviction_unlock(vm);
 +	drm_dev_exit(idx);
  	return r;
  }