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 teardown from 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 9092ff227a55..74836240edbb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2647,14 +2647,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;
 
        amdgpu_bo_unreserve(vm->root.bo);
        amdgpu_bo_unref(&root_bo);
@@ -2662,11 +2655,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);
@@ -2773,11 +2762,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);
@@ -2873,8 +2857,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);
 }
 
 /**
@@ -2886,9 +2868,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;
 };
-- 
2.34.1

Reply via email to