linux-next: manual merge of the drm tree with the origin tree
Subsystems (3)
Mark Brown
maintainerHi all,
Today's linux-next merge of the drm tree got a conflict in:
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
between commit:
04cc4aa3617b0 ("drm/amdgpu: fix lifetime issue of amdgpu_vm_get_task_info_pasid()")
from the origin tree and commit:
b0ae60ea3f3f1 ("drm/amdgpu: Resolve VM through DRM PASID ownership")
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.
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
@@@ -2506,14 -2506,16 +2506,16 @@@ amdgpu_vm_get_task_info_vm(struct amdgpstruct amdgpu_task_info * amdgpu_vm_get_task_info_pasid(struct amdgpu_device *adev, u32 pasid) { +struct amdgpu_fpriv *fpriv; struct amdgpu_task_info *ti; struct amdgpu_vm *vm; unsigned long flags; - xa_lock_irqsave(&adev->vm_manager.pasids, flags); -vm = xa_load(&adev->vm_manager.pasids, pasid); +amdgpu_pasid_lock(&flags); +fpriv = amdgpu_pasid_get_fpriv_locked(pasid); +vm = fpriv ? &fpriv->vm : NULL; ti = amdgpu_vm_get_task_info_vm(vm); -xa_unlock_irqrestore(&adev->vm_manager.pasids, flags); +amdgpu_pasid_unlock(flags); return ti; } * @adev: amdgpu_device pointer * @vm: requested vm * @xcp_id: GPU partition selection id -* @pasid: the pasid the VM is using on this GPU * * Init @vm fields. * * 0 for success, error for failure. */ int amdgpu_vm_init (struct amdgpu_device *adev,struct amdgpu_vm *vm, -int32_t xcp_id,uint32_t pasid) +int32_t xcp_id) {struct amdgpu_bo *root_bo;struct amdgpu_bo_vm *root;if (r)dev_dbg (adev->dev,"Failed to create task info for VM\n" ); -/* Store new PASID in XArray (if non-zero) */ -if (pasid !=0 ) { - r =xa_err (xa_store_irq (&adev->vm_manager.pasids, pasid, vm,GFP_KERNEL )); -if (r <0 ) - goto error_free_root; - - vm->pasid = pasid; - } -amdgpu_bo_unreserve (vm->root.bo);amdgpu_bo_unref (&root_bo);return 0 ; error_free_root: -/* If PASID was partially set, erase it from XArray before failing */ -if (vm->pasid !=0 ) { -xa_erase_irq (&adev->vm_manager.pasids, vm->pasid); - vm->pasid =0 ; - }amdgpu_vm_pt_free_root (adev, vm);amdgpu_bo_unreserve (vm->root.bo);amdgpu_bo_unref (&root_bo); root =amdgpu_bo_ref (vm->root.bo);amdgpu_bo_reserve (root, true); -/* Remove PASID mapping before destroying VM */ -if (vm->pasid !=0 ) { -xa_erase_irq (&adev->vm_manager.pasids, vm->pasid); - vm->pasid =0 ; - }dma_fence_wait (vm->last_unlocked, false);dma_fence_put (vm->last_unlocked);dma_fence_wait (vm->last_tlb_flush, false);#else adev->vm_manager.vm_update_mode =0 ;#endif - -xa_init_flags (&adev->vm_manager.pasids,XA_FLAGS_LOCK_IRQ ); }/** */ void amdgpu_vm_manager_fini (struct amdgpu_device *adev) { -WARN_ON (!xa_empty (&adev->vm_manager.pasids)); -xa_destroy (&adev->vm_manager.pasids); -amdgpu_vmid_mgr_fini (adev);amdgpu_pasid_mgr_cleanup (); } u32 pasid, struct drm_exec *exec) { unsigned long irqflags; +struct amdgpu_fpriv *fpriv;struct amdgpu_bo *root;struct amdgpu_vm *vm;int r; -xa_lock_irqsave (&adev->vm_manager.pasids, irqflags); - vm =xa_load (&adev->vm_manager.pasids, pasid); - root = vm ?amdgpu_bo_ref (vm->root.bo) :NULL ; -xa_unlock_irqrestore (&adev->vm_manager.pasids, irqflags); +amdgpu_pasid_lock (&irqflags); + fpriv =amdgpu_pasid_get_fpriv_locked (pasid); + vm = fpriv ? &fpriv->vm :NULL ; + root = vm && vm->root.bo ?amdgpu_bo_ref (vm->root.bo) :NULL ; +amdgpu_pasid_unlock (irqflags);if (!root) return NULL; }/* Double check that the VM still exists */ -xa_lock_irqsave (&adev->vm_manager.pasids, irqflags); - vm =xa_load (&adev->vm_manager.pasids, pasid); -if (vm && vm->root.bo != root) +amdgpu_pasid_lock (&irqflags); + fpriv =amdgpu_pasid_get_fpriv_locked (pasid); +if (!fpriv) { vm =NULL ; -xa_unlock_irqrestore (&adev->vm_manager.pasids, irqflags); + }else { + vm = &fpriv->vm; +if (vm->root.bo != root) + vm =NULL ; + } +amdgpu_pasid_unlock (irqflags); +if (!vm) {drm_exec_unlock_obj (exec, &root->tbo.base);amdgpu_bo_unref (&root); is_compute_context = vm->is_compute_context;if (is_compute_context) { + __label__ drm_exec_retry; +/* Release the root PD lock since svm_range_restore_pages * might try to take it. * TODO: rework svm_range_restore_pages so that this isn't uint32_t status, unsigned int vmhub) { +struct amdgpu_fpriv *fpriv; struct amdgpu_vm *vm; unsigned long flags; - xa_lock_irqsave(&adev->vm_manager.pasids, flags); +amdgpu_pasid_lock(&flags); - vm = xa_load(&adev->vm_manager.pasids, pasid); +fpriv = amdgpu_pasid_get_fpriv_locked(pasid); +vm = fpriv ? &fpriv->vm : NULL; /* Don't update the fault cache if status is 0. In the multiple * fault case, subsequent faults will return a 0 status which is * useless for userspace and replaces the useful fault status, so WARN_ONCE(1, "Invalid vmhub %u\n", vmhub); } } -xa_unlock_irqrestore(&adev->vm_manager.pasids, flags); +amdgpu_pasid_unlock(flags); } void amdgpu_vm_print_task_info(struct amdgpu_device *adev,