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

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
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -1429,11 +1429,13 @@ static void vm_destroy_work_func(struct work_struct *w)
		xe_device_mem_access_put(xe);
		xe_pm_runtime_put(xe);

		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);
		}
	}

	/*
	 * XXX: We delay destroying the PT root until the VM if freed as PT root
@@ -1917,6 +1919,7 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
		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),
@@ -1927,6 +1930,7 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
			return err;
		}
		vm->usm.asid = asid;
	}

	args->vm_id = id;