Skip to content

Commit a12d921

Browse files
mbrost05rodrigovivi
authored andcommitted
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: Matthew Brost <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> Reviewed-by: Niranjana Vishwanathapura <[email protected]>
1 parent 38224c0 commit a12d921

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,10 +1429,12 @@ static void vm_destroy_work_func(struct work_struct *w)
14291429
xe_device_mem_access_put(xe);
14301430
xe_pm_runtime_put(xe);
14311431

1432-
mutex_lock(&xe->usm.lock);
1433-
lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid);
1434-
XE_WARN_ON(lookup != vm);
1435-
mutex_unlock(&xe->usm.lock);
1432+
if (xe->info.supports_usm) {
1433+
mutex_lock(&xe->usm.lock);
1434+
lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid);
1435+
XE_WARN_ON(lookup != vm);
1436+
mutex_unlock(&xe->usm.lock);
1437+
}
14361438
}
14371439

14381440
/*
@@ -1917,16 +1919,18 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
19171919
return err;
19181920
}
19191921

1920-
mutex_lock(&xe->usm.lock);
1921-
err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
1922-
XA_LIMIT(0, XE_MAX_ASID - 1),
1923-
&xe->usm.next_asid, GFP_KERNEL);
1924-
mutex_unlock(&xe->usm.lock);
1925-
if (err) {
1926-
xe_vm_close_and_put(vm);
1927-
return err;
1922+
if (xe->info.supports_usm) {
1923+
mutex_lock(&xe->usm.lock);
1924+
err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
1925+
XA_LIMIT(0, XE_MAX_ASID - 1),
1926+
&xe->usm.next_asid, GFP_KERNEL);
1927+
mutex_unlock(&xe->usm.lock);
1928+
if (err) {
1929+
xe_vm_close_and_put(vm);
1930+
return err;
1931+
}
1932+
vm->usm.asid = asid;
19281933
}
1929-
vm->usm.asid = asid;
19301934

19311935
args->vm_id = id;
19321936

0 commit comments

Comments
 (0)