DRM_I915_GEM_VM_BIND/UNBIND ioctls allows UMD to bind/unbind GEM buffer objects (BOs) or sections of a BOs at specified GPU virtual addresses on a specified address space (VM). Multiple mappings can map to the same physical pages of an object (aliasing). These mappings (also referred to as persistent mappings) will be persistent across multiple GPU submissions (execbuf calls) issued by the UMD, without user having to provide a list of all required mappings during each submission (as required by older execbuf mode). This patch series support VM_BIND version 1, as described by the param I915_PARAM_VM_BIND_VERSION. Add new execbuf3 ioctl (I915_GEM_EXECBUFFER3) which only works in vm_bind mode. The vm_bind mode only works with this new execbuf3 ioctl. The new execbuf3 ioctl will not have any execlist support and all the legacy support like relocations etc., are removed. TODOs: * Support out fence for VM_UNBIND ioctl. * Async VM_UNBIND support. * Share code between execbuf2 and execbuf3 where possible. * Cleanups and optimizations. NOTEs: * It is based on below VM_BIND design+uapi patch series. https://lists.freedesktop.org/archives/intel-gfx/2022-July/300760.html * The IGT RFC series is posted as, [RFC 0/5] vm_bind: Add VM_BIND validation support Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@xxxxxxxxx> Niranjana Vishwanathapura (10): drm/i915/vm_bind: Introduce VM_BIND ioctl drm/i915/vm_bind: Bind and unbind mappings drm/i915/vm_bind: Support private and shared BOs drm/i915/vm_bind: Add out fence support drm/i915/vm_bind: Handle persistent vmas drm/i915/vm_bind: Add I915_GEM_EXECBUFFER3 ioctl drm/i915/vm_bind: Handle persistent vmas in execbuf3 drm/i915/vm_bind: userptr dma-resv changes drm/i915/vm_bind: Skip vma_lookup for persistent vmas drm/i915/vm_bind: Fix vm->vm_bind_mutex and vm->mutex nesting drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gem/i915_gem_context.c | 20 +- drivers/gpu/drm/i915/gem/i915_gem_context.h | 15 + drivers/gpu/drm/i915/gem/i915_gem_create.c | 51 +- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 6 + .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 5 + .../gpu/drm/i915/gem/i915_gem_execbuffer3.c | 1270 +++++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ioctls.h | 2 + drivers/gpu/drm/i915/gem/i915_gem_object.c | 1 + drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 3 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 + drivers/gpu/drm/i915/gem/i915_gem_vm_bind.h | 54 + .../drm/i915/gem/i915_gem_vm_bind_object.c | 342 +++++ drivers/gpu/drm/i915/gt/intel_gtt.c | 37 +- drivers/gpu/drm/i915/gt/intel_gtt.h | 20 + drivers/gpu/drm/i915/i915_driver.c | 38 + drivers/gpu/drm/i915/i915_gem_gtt.h | 22 + drivers/gpu/drm/i915/i915_getparam.c | 3 + drivers/gpu/drm/i915/i915_vma.c | 59 +- drivers/gpu/drm/i915/i915_vma.h | 80 +- drivers/gpu/drm/i915/i915_vma_types.h | 40 + include/uapi/drm/i915_drm.h | 289 +++- 23 files changed, 2316 insertions(+), 48 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_execbuffer3.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_vm_bind.h create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_vm_bind_object.c -- 2.21.0.rc0.32.g243a4c7e27