All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Dave Airlie <airlied@redhat.com>, DRI <dri-devel@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Shahyan Soltani <shahyan.soltani@amd.com>,
	Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Subject: linux-next: manual merge of the drm tree with the origin tree
Date: Fri, 31 Jul 2026 15:01:09 +0100	[thread overview]
Message-ID: <amyqpXv6_drYUPPt@sirena.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 6467 bytes --]

Hi 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.

diff --combined drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index dc6a9d7dd0b28,aac8ace9d7a63..0000000000000
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@@ -2506,14 -2506,16 +2506,16 @@@ amdgpu_vm_get_task_info_vm(struct amdgp
  struct 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;
  }
@@@ -2554,7 -2556,6 +2556,6 @@@ void amdgpu_vm_set_task_info(struct amd
   * @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.
   *
@@@ -2562,7 -2563,7 +2563,7 @@@
   * 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;
@@@ -2637,26 -2638,12 +2638,12 @@@
  	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);
@@@ -2763,11 -2750,6 +2750,6 @@@ void amdgpu_vm_fini(struct amdgpu_devic
  
  	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);
@@@ -2863,8 -2845,6 +2845,6 @@@ void amdgpu_vm_manager_init(struct amdg
  #else
  	adev->vm_manager.vm_update_mode = 0;
  #endif
- 
- 	xa_init_flags(&adev->vm_manager.pasids, XA_FLAGS_LOCK_IRQ);
  }
  
  /**
@@@ -2876,9 -2856,6 +2856,6 @@@
   */
  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();
  }
@@@ -2935,14 -2912,16 +2912,16 @@@ struct amdgpu_vm *amdgpu_vm_lock_by_pas
  					  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;
@@@ -2954,11 -2933,17 +2933,17 @@@
  	}
  
  	/* 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);
@@@ -3010,8 -2995,6 +2995,8 @@@ bool amdgpu_vm_handle_fault(struct amdg
  	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
@@@ -3157,12 -3140,14 +3142,14 @@@ void amdgpu_vm_update_fault_cache(struc
  				  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
@@@ -3195,7 -3180,7 +3182,7 @@@
  			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,

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2026-07-31 14:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 14:01 Mark Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-08-03 14:31 linux-next: manual merge of the drm tree with the origin tree Mark Brown
2026-08-03 14:31 Mark Brown
2026-07-20 14:44 Mark Brown
2026-07-20 14:44 Mark Brown
2026-06-09 17:53 Mark Brown
2026-06-04 14:13 Mark Brown
2026-05-18 12:47 Mark Brown
2026-04-14 13:08 Mark Brown
2026-04-14 13:12 ` Miguel Ojeda
2026-03-30 15:49 Mark Brown
2026-03-27 20:56 Mark Brown
2026-03-23 15:55 Mark Brown
2026-03-23 15:55 Mark Brown
2026-03-23 15:49 Mark Brown
2026-03-23 15:01 Mark Brown
2026-02-08 22:47 Mark Brown
2026-02-08 22:46 Mark Brown
2026-02-02 14:29 Mark Brown
2026-01-19 17:03 Mark Brown
2026-01-19 16:53 Mark Brown
2025-10-02 12:07 Mark Brown
2025-10-02 12:05 Mark Brown
2025-10-02 12:30 ` Danilo Krummrich
2025-09-26 12:38 Mark Brown
2024-06-28 16:51 Mark Brown
2024-06-27 15:06 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amyqpXv6_drYUPPt@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=shahyan.soltani@amd.com \
    --cc=srinivasan.shanmugam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.