[Intel-xe] [PATCH 10/22] drm/xe: Only set VM->asid for platforms that support a ASID
Rodrigo Vivi
rodrigo.vivi at intel.com
Fri Feb 3 20:23:57 UTC 2023
From: Matthew Brost <matthew.brost at intel.com>
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: Matthew Brost <matthew.brost at intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
drivers/gpu/drm/xe/xe_vm.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 4c0080d081f3..2b1e79e65dbf 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1371,10 +1371,12 @@ static void vm_destroy_work_func(struct work_struct *w)
xe_device_mem_access_put(xe);
xe_pm_runtime_put(xe);
- mutex_lock(&xe->usm.lock);
- lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid);
- XE_WARN_ON(lookup != vm);
- mutex_unlock(&xe->usm.lock);
+ if (xe->info.supports_usm) {
+ mutex_lock(&xe->usm.lock);
+ lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid);
+ XE_WARN_ON(lookup != vm);
+ mutex_unlock(&xe->usm.lock);
+ }
}
/*
@@ -1859,16 +1861,18 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
return err;
}
- mutex_lock(&xe->usm.lock);
- err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
- XA_LIMIT(0, XE_MAX_ASID - 1),
- &xe->usm.next_asid, GFP_KERNEL);
- mutex_unlock(&xe->usm.lock);
- if (err) {
- xe_vm_close_and_put(vm);
- return err;
+ if (xe->info.supports_usm) {
+ mutex_lock(&xe->usm.lock);
+ err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
+ XA_LIMIT(0, XE_MAX_ASID - 1),
+ &xe->usm.next_asid, GFP_KERNEL);
+ mutex_unlock(&xe->usm.lock);
+ if (err) {
+ xe_vm_close_and_put(vm);
+ return err;
+ }
+ vm->usm.asid = asid;
}
- vm->usm.asid = asid;
args->vm_id = id;
--
2.39.1
More information about the Intel-xe
mailing list