The xe_device_mem_access_get() should be all that's needed here and
should now work as expected, without any strange races. In theory should
be no functional changes here.
Reported-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
 
        INIT_LIST_HEAD(&vm->extobj.list);
 
-       if (!(flags & XE_VM_FLAG_MIGRATION)) {
-               /* We need to immeditatelly exit from any D3 state */
-               xe_pm_runtime_get(xe);
+       if (!(flags & XE_VM_FLAG_MIGRATION))
                xe_device_mem_access_get(xe);
-       }
 
        vm_resv_obj = drm_gpuvm_resv_object_alloc(&xe->drm);
        if (!vm_resv_obj) {
 
 err_no_resv:
        kfree(vm);
-       if (!(flags & XE_VM_FLAG_MIGRATION)) {
+       if (!(flags & XE_VM_FLAG_MIGRATION))
                xe_device_mem_access_put(xe);
-               xe_pm_runtime_put(xe);
-       }
        return ERR_PTR(err);
 }
 
 
        if (!(vm->flags & XE_VM_FLAG_MIGRATION)) {
                xe_device_mem_access_put(xe);
-               xe_pm_runtime_put(xe);
 
                if (xe->info.has_asid) {
                        mutex_lock(&xe->usm.lock);