Commit a12d9216 authored by Matthew Brost's avatar Matthew Brost Committed by Rodrigo Vivi

drm/xe: Only set VM->asid for platforms that support a ASID

This will help with TLB invalidation as the ASID in TLB invalidate
should be zero for platforms that do not support a ASID.
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
parent 38224c00
...@@ -1429,10 +1429,12 @@ static void vm_destroy_work_func(struct work_struct *w) ...@@ -1429,10 +1429,12 @@ static void vm_destroy_work_func(struct work_struct *w)
xe_device_mem_access_put(xe); xe_device_mem_access_put(xe);
xe_pm_runtime_put(xe); xe_pm_runtime_put(xe);
mutex_lock(&xe->usm.lock); if (xe->info.supports_usm) {
lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid); mutex_lock(&xe->usm.lock);
XE_WARN_ON(lookup != vm); lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid);
mutex_unlock(&xe->usm.lock); XE_WARN_ON(lookup != vm);
mutex_unlock(&xe->usm.lock);
}
} }
/* /*
...@@ -1917,16 +1919,18 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data, ...@@ -1917,16 +1919,18 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
return err; return err;
} }
mutex_lock(&xe->usm.lock); if (xe->info.supports_usm) {
err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm, mutex_lock(&xe->usm.lock);
XA_LIMIT(0, XE_MAX_ASID - 1), err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
&xe->usm.next_asid, GFP_KERNEL); XA_LIMIT(0, XE_MAX_ASID - 1),
mutex_unlock(&xe->usm.lock); &xe->usm.next_asid, GFP_KERNEL);
if (err) { mutex_unlock(&xe->usm.lock);
xe_vm_close_and_put(vm); if (err) {
return err; xe_vm_close_and_put(vm);
return err;
}
vm->usm.asid = asid;
} }
vm->usm.asid = asid;
args->vm_id = id; args->vm_id = id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment