@@ -68,9 +68,20 @@ int i915_gem_vm_bind_svm_obj(struct i915_address_space *vm,
* and we don't need to store va_start.
*/
mutex_lock(&vm->svm_mutex);
+ if (i915_vm_is_active(vm)) {
+ u64 pin_flags = vma->va_start |
+ PIN_OFFSET_FIXED | PIN_USER;
+
+ ret = i915_vma_pin(vma, 0, 0, pin_flags);
+ if (ret) {
+ mutex_unlock(&vm->mutex);
+ goto put_obj;
+ }
+ }
list_add(&vma->svm_link, &vm->svm_list);
mutex_unlock(&vm->svm_mutex);
} else {
+ /* FIXME: Do async unbind if vm is active */
vma = i915_gem_vm_lookup_svm_vma(vm, obj, va);
if (vma) {
__i915_vma_unpin(vma);
Initial attempt at supporting VM_BIND for endless batch buffer. Not tested. Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Chris P Wilson <chris.p.wilson@intel.com> Cc: Sudeep Dutt <sudeep.dutt@intel.com> Cc: Stuart Summers <stuart.summers@intel.com> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> --- drivers/gpu/drm/i915/gem/i915_gem_svm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)