Re: [PATCH v5 3/3] drm/amdgpu: Drop vm_manager PASID to VM mapping
Christian König <[email protected]>
| Newsgroups | org.freedesktop.lists.amd-gfx |
|---|---|
| Message-ID | <[email protected]> |
On 7/8/26 17:27, Srinivasan Shanmugam wrote: > VM lookup users now resolve DRM PASIDs through the global PASID xarray: > > PASID -> fpriv -> VM > > The per-device vm_manager.pasids xarray is no longer needed. > > Remove PASID registration and removal from the VM init/fini paths, drop > vm_manager PASID initialization/cleanup, and remove the xarray from > struct amdgpu_vm_manager. > > Cc: Alex Deucher <[email protected]> > Cc: Christian König <[email protected]> > Signed-off-by: Srinivasan Shanmugam <[email protected]> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 25 ++----------------------- > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ---- > 2 files changed, 2 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > index 11822bf832f8..579dbceecdc4 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > @@ -2642,14 +2642,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, > 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; > - } > + vm->pasid = pasid; Yeah please remove the pasid parameter from amdgpu_vm_init() and nuke all the related code. Apart from that the patch look good to me. Regards, Christian. > > amdgpu_bo_unreserve(vm->root.bo); > amdgpu_bo_unref(&root_bo); > @@ -2657,11 +2650,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, > 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; > - } > + vm->pasid = 0; > amdgpu_vm_pt_free_root(adev, vm); > amdgpu_bo_unreserve(vm->root.bo); > amdgpu_bo_unref(&root_bo); > @@ -2768,11 +2757,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) > > 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); > @@ -2868,8 +2852,6 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) > #else > adev->vm_manager.vm_update_mode = 0; > #endif > - > - xa_init_flags(&adev->vm_manager.pasids, XA_FLAGS_LOCK_IRQ); > } > > /** > @@ -2881,9 +2863,6 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) > */ > 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(); > } > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h > index 939f639cd8bf..f63364f128bf 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h > @@ -481,10 +481,6 @@ struct amdgpu_vm_manager { > */ > int vm_update_mode; > > - /* PASID to VM mapping, will be used in interrupt context to > - * look up VM of a page fault > - */ > - struct xarray pasids; > /* Global registration of recent page fault information */ > struct amdgpu_vm_fault_info fault_info; > };