From: Niranjana Vishwanathapura <niranjana.vishwanathap...@intel.com>

At vm creation time, add a flag to indicate that the new vm will use
vm_bind only for object binding.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathap...@intel.com>
Signed-off-by: Ramalingam C <ramalinga...@intel.com>
Signed-off-by: Andi Shyti <andi.sh...@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 5 ++++-
 drivers/gpu/drm/i915/gt/intel_gtt.h         | 8 ++++++++
 include/uapi/drm/i915_drm.h                 | 3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index fdd3e3bfd4088..2e25341f78ab6 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -1808,7 +1808,7 @@ int i915_gem_vm_create_ioctl(struct drm_device *dev, void 
*data,
        if (!HAS_FULL_PPGTT(i915))
                return -ENODEV;
 
-       if (args->flags)
+       if (args->flags & I915_VM_CREATE_FLAGS_UNKNOWN)
                return -EINVAL;
 
        ppgtt = i915_ppgtt_create(to_gt(i915), 0);
@@ -1828,6 +1828,9 @@ int i915_gem_vm_create_ioctl(struct drm_device *dev, void 
*data,
        if (err)
                goto err_put;
 
+       if (args->flags & I915_VM_CREATE_FLAGS_USE_VM_BIND)
+               ppgtt->vm.vm_bind_mode = true;
+
        GEM_BUG_ON(id == 0); /* reserved for invalid/unassigned ppgtt */
        args->vm_id = id;
        return 0;
diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h 
b/drivers/gpu/drm/i915/gt/intel_gtt.h
index e639434e97fdb..da21088890b3b 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -271,6 +271,14 @@ struct i915_address_space {
        /* Skip pte rewrite on unbind for suspend. Protected by @mutex */
        bool skip_pte_rewrite:1;
 
+       /**
+        * @vm_bind_mode: flag to indicate vm_bind method of binding
+        *
+        * True: allow only vm_bind method of binding.
+        * False: allow only legacy execbuff method of binding.
+        */
+       bool vm_bind_mode:1;
+
        u8 top;
        u8 pd_shift;
        u8 scratch_order;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 520ad2691a99d..12435db751eb8 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -2522,7 +2522,8 @@ struct drm_i915_gem_vm_control {
        /** @extensions: Zero-terminated chain of extensions. */
        __u64 extensions;
 
-       /** @flags: reserved for future usage, currently MBZ */
+#define I915_VM_CREATE_FLAGS_USE_VM_BIND       (1u << 0)
+#define I915_VM_CREATE_FLAGS_UNKNOWN   (-(I915_VM_CREATE_FLAGS_USE_VM_BIND << 
1))
        __u32 flags;
 
        /** @vm_id: Id of the VM created or to be destroyed */
-- 
2.34.1

Reply via email to