Skip to contentSkip to conversation

drm/i915: Add TTM offset argument to mmap.

PATCH In review Maarten Lankhorst 4 participants 10 messages Jul 9, 2021 – Jul 12, 2021

Subsystems (3)
lore
Share & tools
lore

Maarten Lankhorst

author maintainer
#0 lore raw

PATCH v2 1/1 drm/i915: Add TTM offset argument to mmap.

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +16 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
 		return -ENODEV;
 
 	if (obj->ops->mmap_offset)  {
+		if (mmap_type != I915_MMAP_TYPE_TTM)
+			return -ENODEV;
+
 		*offset = obj->ops->mmap_offset(obj);
 		return 0;
 	}
 
+	if (mmap_type == I915_MMAP_TYPE_TTM)
+		return -ENODEV;
+
 	if (mmap_type != I915_MMAP_TYPE_GTT &&
 	    !i915_gem_object_has_struct_page(obj) &&
 	    !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
 	enum i915_mmap_type mmap_type;
 
-	if (boot_cpu_has(X86_FEATURE_PAT))
+	if (HAS_LMEM(to_i915(dev)))
+		mmap_type = I915_MMAP_TYPE_TTM;
+	else if (boot_cpu_has(X86_FEATURE_PAT))
 		mmap_type = I915_MMAP_TYPE_WC;
 	else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
 		return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
 		type = I915_MMAP_TYPE_UC;
 		break;
 
+	case I915_MMAP_OFFSET_TTM:
+		type = I915_MMAP_TYPE_TTM;
+		break;
+
 	default:
 		return -EINVAL;
 	}
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 		vma->vm_ops = &vm_ops_cpu;
 		break;
 
+	case I915_MMAP_TYPE_TTM:
+		GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);
+		/* fall-through */
 	case I915_MMAP_TYPE_WB:
 		vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
 		vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
 	I915_MMAP_TYPE_WC,
 	I915_MMAP_TYPE_WB,
 	I915_MMAP_TYPE_UC,
+	I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +25 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
 	return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+	if (HAS_LMEM(i915))
+		return I915_MMAP_TYPE_TTM;
+
+	return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
 			       unsigned long size,
 			       int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
 	if (IS_ERR(obj))
 		return expected && expected == PTR_ERR(obj);
 
-	ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+	ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
 	i915_gem_object_put(obj);
 
 	return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
 		goto out;
 	}
 
-	err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+	err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
 	if (err) {
 		pr_err("Unable to insert object into reclaimed hole\n");
 		goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	bool no_map;
 
+	if (HAS_LMEM(i915))
+		return type == I915_MMAP_TYPE_TTM;
+	else if (type == I915_MMAP_TYPE_TTM)
+		return false;
+
 	if (type == I915_MMAP_TYPE_GTT &&
 	    !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
 		return false;
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
 			err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
 			if (err == 0)
 				err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+			if (err == 0)
+				err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);
 
 			i915_gem_object_put(obj);
 			if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
 	case I915_MMAP_TYPE_WB: return "wb";
 	case I915_MMAP_TYPE_WC: return "wc";
 	case I915_MMAP_TYPE_UC: return "uc";
+	case I915_MMAP_TYPE_TTM: return "ttm";
 	default: return "unknown";
 	}
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
 			err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
 		if (err == 0)
 			err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+		if (err == 0)
+			err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
 		i915_gem_object_put(obj);
 		if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
 		err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
 		if (err == 0)
 			err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+		if (err == 0)
+			err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
 		i915_gem_object_put(obj);
 		if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
 		err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
 		if (err == 0)
 			err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+		if (err == 0)
+			err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
 		i915_gem_object_put(obj);
 		if (err)
include/uapi/drm/i915_drm.h +40 -11

71 lines not on this page · raw message

Signature · 6 lines
2.31.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add TTM offset argument to mmap. (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915: Add TTM offset argument to mmap. (rev2)
URL : https://patchwork.freedesktop.org/series/92103/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
53107c2bf2c8 drm/i915: Add TTM offset argument to mmap.
-:66: WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment
#66: FILE: drivers/gpu/drm/i915/gem/i915_gem_mman.c:985:
+		/* fall-through */

total: 0 errors, 1 warnings, 0 checks, 206 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Add TTM offset argument to mmap. (rev2)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm/i915: Add TTM offset argument to mmap. (rev2)
URL : https://patchwork.freedesktop.org/series/92103/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10324 -> Patchwork_20562
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/index.html

Known issues
------------

Here are the changes found in Patchwork_20562 that come from known issues:

### IGT changes ###

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3717]: https://gitlab.freedesktop.org/drm/intel/issues/3717
[i915#3744]: https://gitlab.freedesktop.org/drm/intel/issues/3744

Participating hosts (40 -> 39)
------------------------------

Missing (1): fi-bsw-cyan

Build changes
-------------

* Linux: CI_DRM_10324 -> Patchwork_20562

CI-20190529: 20190529
CI_DRM_10324: 1db44678139ded724c2cd42b6b1c95574fe36047 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6133: b5c6b973e7f7d33e7521825e39ddd380e80af01a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20562: 53107c2bf2c8fd4aa4469649d2cc183bba2f8933 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

53107c2bf2c8 drm/i915: Add TTM offset argument to mmap.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v2 1/1
#3 lore raw
In reply to Maarten Lankhorst
Quoted 62 lines · Maarten Lankhorst

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +13 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
                return -ENODEV;
 
        if (obj->ops->mmap_offset)  {
+               if (mmap_type != I915_MMAP_TYPE_TTM)
+                       return -ENODEV;
+
                *offset = obj->ops->mmap_offset(obj);
                return 0;
        }
 
+       if (mmap_type == I915_MMAP_TYPE_TTM)
+               return -ENODEV;
+
        if (mmap_type != I915_MMAP_TYPE_GTT &&
            !i915_gem_object_has_struct_page(obj) &&
            !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
        enum i915_mmap_type mmap_type;
 
-       if (boot_cpu_has(X86_FEATURE_PAT))
+       if (HAS_LMEM(to_i915(dev)))
+               mmap_type = I915_MMAP_TYPE_TTM;
+       else if (boot_cpu_has(X86_FEATURE_PAT))
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                type = I915_MMAP_TYPE_UC;
                break;
 
+       case I915_MMAP_OFFSET_TTM:
+               type = I915_MMAP_TYPE_TTM;
+               break;
+
        default:
                return -EINVAL;
        }

drivers/gpu/drm/i915/gem/i915_gem_mman.c int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma) · line 984

Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_mman.c +2 -0
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &vm_ops_cpu;
                break;
 
+       case I915_MMAP_TYPE_TTM:
+               GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);

This makse no sense at all, or at least it's very confused - the conditiona is always 1, so just put that in there.. Also the ttm case is taken care of a bit earlier, it would be good to maybe have another check that the mmap_type is TTM.

Also long-term I think would be neat if we could just outright move to the standard handler again, and leave this mess to old platforms.

Quoted 69 lines
drivers/gpu/drm/i915/gem/i915_gem_mman.c +1 -0
+               /* fall-through */
        case I915_MMAP_TYPE_WB:
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
                vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
        I915_MMAP_TYPE_WC,
        I915_MMAP_TYPE_WB,
        I915_MMAP_TYPE_UC,
+       I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +16 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
        return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+       if (HAS_LMEM(i915))
+               return I915_MMAP_TYPE_TTM;
+
+       return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
                               unsigned long size,
                               int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return expected && expected == PTR_ERR(obj);
 
-       ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        i915_gem_object_put(obj);
 
        return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
                goto out;
        }
 
-       err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        if (err) {
                pr_err("Unable to insert object into reclaimed hole\n");
                goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        bool no_map;
 
+       if (HAS_LMEM(i915))
+               return type == I915_MMAP_TYPE_TTM;
+       else if (type == I915_MMAP_TYPE_TTM)
+               return false;
+
        if (type == I915_MMAP_TYPE_GTT &&
            !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
                return false;

drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c static int igt_mmap(void *arg) · line 988

Quoted 5 lines
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +2 -0
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
                        err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
                        if (err == 0)
                                err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+                       if (err == 0)
+                               err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);

Would be nice to have a wrapper for this. We probably need the same fallback for igt in userspace. Something like igt_mmap_wc_fallbacks (since on some really old platforms WC mmaps are not actually very reliable and you really want the GTT wc).

Quoted 67 lines
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +7 -0
                        i915_gem_object_put(obj);
                        if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
        case I915_MMAP_TYPE_WB: return "wb";
        case I915_MMAP_TYPE_WC: return "wc";
        case I915_MMAP_TYPE_UC: return "uc";
+       case I915_MMAP_TYPE_TTM: return "ttm";
        default: return "unknown";
        }
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
                if (err == 0)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+               if (err == 0)
+                       err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
                err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
                err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
include/uapi/drm/i915_drm.h +13 -2
index e334a8b14ef2..1610ed40b4b5 100644
@@ -849,31 +849,60 @@ struct drm_i915_gem_mmap_gtt {
        __u64 offset;
 };
 
+/**
+ * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
+ *
+ * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
+ * and is used to retrieve the fake offset to mmap an object specified by &handle.
+ *
+ * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
+ * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
+ * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
+ */
 struct drm_i915_gem_mmap_offset {
-       /** Handle for the object being mapped. */
+       /** @handle: Handle for the object being mapped. */
        __u32 handle;
+       /** @pad: Must be zero */
        __u32 pad;
        /**
-        * Fake offset to use for subsequent mmap call
+        * @offset: The fake offset to use for subsequent mmap call
         *
         * This is a fixed-size type for 32/64 compatibility.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 879

Quoted 10 lines
include/uapi/drm/i915_drm.h +5 -1
         */
        __u64 offset;
 
        /**
-        * Flags for extended behaviour.
+        * @flags: Flags for extended behaviour.
+        *
+        * It is mandatory that one of the `MMAP_OFFSET` types
+        * should be included:
+        * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT.

GTT mmaps are also always WC.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 884

Quoted 5 lines
include/uapi/drm/i915_drm.h +5 -0
+        * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
+        * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
+        * - `I915_MMAP_OFFSET_TTM`: Use TTM to determine caching based on object placement.
+        *
+        * Only on devices with local memory is `I915_MMAP_OFFSET_TTM` valid. On

"On devices with local memory only I915_MMAP_OFFSET_TTM is valid."

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 889

Quoted 7 lines
include/uapi/drm/i915_drm.h +4 -2
+        * devices without local memory, this caching mode is invalid.
         *
-        * It is mandatory that one of the MMAP_OFFSET types
-        * (GTT, WC, WB, UC, etc) should be included.
+        * As caching mode when specifying `I915_MMAP_OFFSET_TTM`, WC or WB will
+        * be used, depending on the object placement. WC will be used
+        * when the object resides in local memory, WB otherwise.

I think Matt typed up a nice overview of the TTM mmap/coherency rules. Please sync with map and just put a link to his stuff here.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 893

Quoted 10 lines
include/uapi/drm/i915_drm.h +1 -6
         */
        __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC  1
-#define I915_MMAP_OFFSET_WB  2
-#define I915_MMAP_OFFSET_UC  3
 
-       /*
-        * Zero-terminated chain of extensions.
+/** Use an mmap for the object by binding to GTT. */

This /** I expect will confuse kerneldoc? Imo just remove these comments, you have the list above.

Quoted 18 lines
include/uapi/drm/i915_drm.h +12 -1
+#define I915_MMAP_OFFSET_GTT   0
+/** Use Write-Combined caching. */
+#define I915_MMAP_OFFSET_WC    1
+/** Use Write-Back caching. */
+#define I915_MMAP_OFFSET_WB    2
+/** Do not use caching when binding this mmap. */
+#define I915_MMAP_OFFSET_UC    3
+/** Use the TTM binding, which determines the appropriate caching mode. */
+#define I915_MMAP_OFFSET_TTM   4
+
+       /**
+        * @extensions: Zero-terminated chain of extensions.
         *
         * No current extensions defined; mbz.
         */
--

2.31.0

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

With the nits&issues addressed:

Also pls make sure Jason or Ken ack this too.

Finally ... igt impact?
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915: Add TTM offset argument to mmap. (rev2)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm/i915: Add TTM offset argument to mmap. (rev2)
URL : https://patchwork.freedesktop.org/series/92103/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10324_full -> Patchwork_20562_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_20562_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_20562_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_20562_full:

### CI changes ###

#### Possible regressions ####

* boot:
- shard-tglb: ([PASS][1], [PASS][2], [PASS][3], [PASS][4], [PASS][5], [PASS][6], [PASS][7], [PASS][8], [PASS][9], [PASS][10], [PASS][11], [PASS][12], [PASS][13], [PASS][14], [PASS][15], [PASS][16], [PASS][17], [PASS][18], [PASS][19], [PASS][20], [PASS][21], [PASS][22], [PASS][23], [PASS][24], [PASS][25]) -> ([PASS][26], [PASS][27], [PASS][28], [PASS][29], [PASS][30], [PASS][31], [FAIL][32], [PASS][33], [PASS][34], [PASS][35], [PASS][36], [PASS][37], [PASS][38], [PASS][39], [PASS][40], [PASS][41], [PASS][42], [PASS][43], [PASS][44], [PASS][45], [PASS][46], [PASS][47], [PASS][48], [PASS][49], [PASS][50])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb7/boot.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb7/boot.html
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb7/boot.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb7/boot.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/boot.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/boot.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/boot.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/boot.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/boot.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb5/boot.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb5/boot.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb5/boot.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb3/boot.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb3/boot.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb3/boot.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb3/boot.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb3/boot.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb2/boot.html
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb2/boot.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb2/boot.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb2/boot.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb1/boot.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb1/boot.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb1/boot.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb1/boot.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb6/boot.html
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb5/boot.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb5/boot.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb5/boot.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb5/boot.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/boot.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/boot.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/boot.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/boot.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb2/boot.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb2/boot.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb2/boot.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb2/boot.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb1/boot.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb1/boot.html
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb1/boot.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb1/boot.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb7/boot.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb7/boot.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb7/boot.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb7/boot.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb6/boot.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb6/boot.html
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb6/boot.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb6/boot.html

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_schedule@independent@vcs1:
- shard-kbl: [PASS][51] -> [FAIL][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-kbl1/igt@gem_exec_schedule@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl2/igt@gem_exec_schedule@[email protected]

* igt@i915_selftest@live@hugepages:
- shard-skl: [PASS][53] -> [INCOMPLETE][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl8/igt@i915_selftest@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl8/igt@i915_selftest@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-tglb: [PASS][55] -> [INCOMPLETE][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb6/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@kms_ccs@pipe-a-bad-aux-stride-yf_tiled_ccs:
- {shard-rkl}: [FAIL][57] ([i915#3678]) -> [SKIP][58] +4 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-2/igt@kms_ccs@pipe-a-bad-aux-stride-yf_tiled_ccs.html
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@kms_ccs@pipe-a-bad-aux-stride-yf_tiled_ccs.html

Known issues
------------

Here are the changes found in Patchwork_20562_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_persistence@legacy-engines-queued:
- shard-snb: NOTRUN -> [SKIP][59] ([fdo#109271] / [i915#1099]) +10 similar issues
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-snb5/igt@[email protected]

* igt@gem_eio@in-flight-contexts-immediate:
- shard-tglb: [PASS][60] -> [TIMEOUT][61] ([i915#3063])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb7/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb2/igt@[email protected]

* igt@gem_exec_fair@basic-none@vecs0:
- shard-kbl: [PASS][62] -> [FAIL][63] ([i915#2842])
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-kbl1/igt@gem_exec_fair@[email protected]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl2/igt@gem_exec_fair@[email protected]
- shard-apl: [PASS][64] -> [FAIL][65] ([i915#2842] / [i915#3468])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-apl3/igt@gem_exec_fair@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_suspend@basic-s3:
- shard-kbl: NOTRUN -> [DMESG-WARN][66] ([i915#180])
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl3/igt@[email protected]

* igt@gem_pwrite@basic-exhaustion:
- shard-apl: NOTRUN -> [WARN][67] ([i915#2658])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl3/igt@[email protected]

* igt@gem_softpin@noreloc-s3:
- shard-apl: [PASS][68] -> [DMESG-WARN][69] ([i915#180]) +1 similar issue
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-apl6/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl2/igt@[email protected]

* igt@gem_userptr_blits@input-checking:
- shard-kbl: NOTRUN -> [DMESG-WARN][70] ([i915#3002])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl3/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-kbl: [PASS][71] -> [DMESG-WARN][72] ([i915#180])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-kbl3/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl4/igt@[email protected]

* igt@gen7_exec_parse@basic-offset:
- shard-apl: NOTRUN -> [SKIP][73] ([fdo#109271]) +190 similar issues
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl8/igt@[email protected]

* igt@gen7_exec_parse@load-register-reg:
- shard-iclb: NOTRUN -> [SKIP][74] ([fdo#109289])
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@gen9_exec_parse@batch-invalid-length:
- shard-tglb: NOTRUN -> [SKIP][75] ([fdo#112306])
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/igt@[email protected]

* igt@gen9_exec_parse@bb-secure:
- shard-iclb: NOTRUN -> [SKIP][76] ([fdo#112306])
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [PASS][77] -> [FAIL][78] ([i915#454])
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-iclb7/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb4/igt@[email protected]

* igt@i915_pm_rpm@modeset-lpsp-stress:
- shard-tglb: [PASS][79] -> [DMESG-WARN][80] ([i915#2411] / [i915#2868])
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb2/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb5/igt@[email protected]

* igt@kms_addfb_basic@invalid-smem-bo-on-discrete:
- shard-apl: NOTRUN -> [FAIL][81] ([i915#3745])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl3/igt@[email protected]

* igt@kms_async_flips@alternate-sync-async-flip:
- shard-skl: [PASS][82] -> [FAIL][83] ([i915#2521])
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl4/igt@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl2/igt@[email protected]

* igt@kms_big_fb@yf-tiled-8bpp-rotate-0:
- shard-tglb: NOTRUN -> [SKIP][84] ([fdo#111615])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/igt@[email protected]

* igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs:
- shard-iclb: NOTRUN -> [SKIP][85] ([fdo#109278]) +3 similar issues
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs.html

* igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
- shard-tglb: NOTRUN -> [SKIP][86] ([i915#3689])
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb3/igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

* igt@kms_chamelium@dp-audio-edid:
- shard-skl: NOTRUN -> [SKIP][87] ([fdo#109271] / [fdo#111827]) +5 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl10/igt@[email protected]

* igt@kms_chamelium@dp-frame-dump:
- shard-iclb: NOTRUN -> [SKIP][88] ([fdo#109284] / [fdo#111827]) +2 similar issues
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@kms_color@pipe-d-ctm-0-5:
- shard-iclb: NOTRUN -> [SKIP][89] ([fdo#109278] / [i915#1149])
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-ctm-blue-to-red:
- shard-snb: NOTRUN -> [SKIP][90] ([fdo#109271] / [fdo#111827]) +23 similar issues
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-snb2/igt@[email protected]

* igt@kms_color_chamelium@pipe-b-ctm-0-25:
- shard-kbl: NOTRUN -> [SKIP][91] ([fdo#109271] / [fdo#111827]) +9 similar issues
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl2/igt@[email protected]

* igt@kms_color_chamelium@pipe-invalid-degamma-lut-sizes:
- shard-apl: NOTRUN -> [SKIP][92] ([fdo#109271] / [fdo#111827]) +12 similar issues
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl8/igt@[email protected]

* igt@kms_content_protection@atomic:
- shard-apl: NOTRUN -> [TIMEOUT][93] ([i915#1319])
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl8/igt@[email protected]

* igt@kms_content_protection@legacy:
- shard-kbl: NOTRUN -> [TIMEOUT][94] ([i915#1319])
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl3/igt@[email protected]

* igt@kms_content_protection@lic:
- shard-tglb: NOTRUN -> [SKIP][95] ([fdo#111828])
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb1/igt@[email protected]

* igt@kms_content_protection@uevent:
- shard-kbl: NOTRUN -> [FAIL][96] ([i915#2105])
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl3/igt@[email protected]

* igt@kms_cursor_edge_walk@pipe-d-128x128-right-edge:
- shard-snb: NOTRUN -> [SKIP][97] ([fdo#109271]) +503 similar issues
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-snb2/igt@[email protected]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-apl: [PASS][98] -> [INCOMPLETE][99] ([i915#180])
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-apl2/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl7/igt@[email protected]

* igt@kms_flip@2x-dpms-vs-vblank-race:
- shard-iclb: NOTRUN -> [SKIP][100] ([fdo#109274])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
- shard-skl: NOTRUN -> [SKIP][101] ([fdo#109271]) +78 similar issues
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl10/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@b-edp1:
- shard-skl: [PASS][102] -> [FAIL][103] ([i915#79])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl2/igt@kms_flip@[email protected]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl5/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@b-hdmi-a1:
- shard-glk: [PASS][104] -> [FAIL][105] ([i915#79])
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-glk8/igt@kms_flip@[email protected]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-glk2/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@c-edp1:
- shard-skl: [PASS][106] -> [FAIL][107] ([i915#2122]) +1 similar issue
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl5/igt@kms_flip@[email protected]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl3/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-kbl: NOTRUN -> [SKIP][108] ([fdo#109271]) +134 similar issues
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl2/igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-cpu.html

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-shrfb-plflip-blt:
- shard-iclb: NOTRUN -> [SKIP][109] ([fdo#109280]) +2 similar issues
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-kbl: [PASS][110] -> [DMESG-WARN][111] ([i915#180] / [i915#1982])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-kbl4/igt@[email protected]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: [PASS][112] -> [FAIL][113] ([fdo#108145] / [i915#265])
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl2/igt@[email protected]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl6/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-alpha-basic:
- shard-kbl: NOTRUN -> [FAIL][114] ([fdo#108145] / [i915#265])
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-transparent-fb:
- shard-apl: NOTRUN -> [FAIL][115] ([i915#265])
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl8/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
- shard-apl: NOTRUN -> [FAIL][116] ([fdo#108145] / [i915#265])
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl6/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-5:
- shard-kbl: NOTRUN -> [SKIP][117] ([fdo#109271] / [i915#658]) +2 similar issues
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl2/igt@[email protected]
- shard-apl: NOTRUN -> [SKIP][118] ([fdo#109271] / [i915#658]) +2 similar issues
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl8/igt@[email protected]

* igt@kms_psr2_su@frontbuffer:
- shard-skl: NOTRUN -> [SKIP][119] ([fdo#109271] / [i915#658]) +1 similar issue
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl10/igt@[email protected]
- shard-iclb: [PASS][120] -> [SKIP][121] ([fdo#109642] / [fdo#111068] / [i915#658])
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-iclb2/igt@[email protected]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb5/igt@[email protected]

* igt@kms_psr@psr2_basic:
- shard-iclb: [PASS][122] -> [SKIP][123] ([fdo#109441]) +1 similar issue
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-iclb2/igt@kms_psr@psr2_basic.html
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb4/igt@kms_psr@psr2_basic.html

* igt@kms_writeback@writeback-fb-id:
- shard-apl: NOTRUN -> [SKIP][124] ([fdo#109271] / [i915#2437]) +1 similar issue
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl6/igt@[email protected]

* igt@prime_nv_test@nv_write_i915_gtt_mmap_read:
- shard-iclb: NOTRUN -> [SKIP][125] ([fdo#109291])
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@prime_nv_test@nv_write_i915_gtt_mmap_read.html

* igt@sysfs_clients@busy:
- shard-iclb: NOTRUN -> [SKIP][126] ([i915#2994])
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@sysfs_clients@fair-1:
- shard-apl: NOTRUN -> [SKIP][127] ([fdo#109271] / [i915#2994]) +1 similar issue
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-apl3/igt@[email protected]

* igt@sysfs_clients@sema-50:
- shard-kbl: NOTRUN -> [SKIP][128] ([fdo#109271] / [i915#2994]) +1 similar issue
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl3/igt@[email protected]

* igt@vgem_basic@unload:
- shard-iclb: NOTRUN -> [INCOMPLETE][129] ([i915#3744])
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

#### Possible fixes ####

* igt@drm_mm@all@insert_range:
- shard-skl: [INCOMPLETE][130] ([i915#2485]) -> [PASS][131]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl6/igt@drm_mm@all@insert_range.html
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl1/igt@drm_mm@all@insert_range.html

* igt@fbdev@write:
- {shard-rkl}: [SKIP][132] ([i915#2582]) -> [PASS][133] +1 similar issue
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-2/igt@[email protected]
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@gem_create@create-clear:
- shard-glk: [FAIL][134] ([i915#1888] / [i915#3160]) -> [PASS][135]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-glk8/igt@[email protected]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-glk2/igt@[email protected]

* igt@gem_exec_fair@basic-none@vcs0:
- shard-kbl: [FAIL][136] ([i915#2842]) -> [PASS][137]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-kbl1/igt@gem_exec_fair@[email protected]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-kbl2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-tglb: [FAIL][138] ([i915#2842]) -> [PASS][139]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb3/igt@gem_exec_fair@[email protected]
[139]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-iclb: [FAIL][140] ([i915#2849]) -> [PASS][141]
[140]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-iclb6/igt@gem_exec_fair@[email protected]
[141]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_reloc@basic-scanout@vecs0:
- {shard-rkl}: [SKIP][142] ([i915#3639]) -> [PASS][143] +3 similar issues
[142]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-2/igt@gem_exec_reloc@[email protected]
[143]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@gem_exec_reloc@[email protected]

* igt@gem_huc_copy@huc-copy:
- shard-tglb: [SKIP][144] ([i915#2190]) -> [PASS][145]
[144]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-tglb6/igt@[email protected]
[145]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-tglb7/igt@[email protected]

* igt@gem_mmap_offset@clear:
- shard-iclb: [FAIL][146] ([i915#3160]) -> [PASS][147]
[146]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-iclb7/igt@[email protected]
[147]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-iclb2/igt@[email protected]

* igt@gen9_exec_parse@allowed-single:
- shard-skl: [DMESG-WARN][148] ([i915#1436] / [i915#716]) -> [PASS][149]
[148]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl1/igt@[email protected]
[149]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl3/igt@[email protected]

* igt@i915_pm_rpm@gem-execbuf:
- {shard-rkl}: [SKIP][150] ([fdo#109308]) -> [PASS][151] +1 similar issue
[150]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-1/igt@[email protected]
[151]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@i915_pm_rpm@modeset-lpsp-stress-no-wait:
- {shard-rkl}: [SKIP][152] ([i915#1397]) -> [PASS][153]
[152]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-2/igt@[email protected]
[153]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@kms_atomic@test-only:
- {shard-rkl}: [SKIP][154] ([i915#1845]) -> [PASS][155] +40 similar issues
[154]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-2/igt@[email protected]
[155]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@linear-max-hw-stride-64bpp-rotate-180:
- {shard-rkl}: [SKIP][156] ([i915#3721]) -> [PASS][157] +7 similar issues
[156]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-5/igt@[email protected]
[157]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@x-tiled-32bpp-rotate-0:
- shard-glk: [DMESG-WARN][158] ([i915#118] / [i915#95]) -> [PASS][159] +1 similar issue
[158]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-glk4/igt@[email protected]
[159]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-glk6/igt@[email protected]

* igt@kms_big_fb@y-tiled-16bpp-rotate-180:
- {shard-rkl}: [SKIP][160] ([i915#3638]) -> [PASS][161] +3 similar issues
[160]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-5/igt@[email protected]
[161]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_rc_ccs:
- {shard-rkl}: [FAIL][162] ([i915#3678]) -> [PASS][163] +10 similar issues
[162]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-1/igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_rc_ccs.html
[163]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_rc_ccs.html

* igt@kms_color@pipe-a-ctm-red-to-blue:
- shard-skl: [DMESG-WARN][164] ([i915#1982]) -> [PASS][165] +1 similar issue
[164]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-skl3/igt@[email protected]
[165]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-skl2/igt@[email protected]

* igt@kms_color@pipe-c-ctm-red-to-blue:
- {shard-rkl}: [SKIP][166] ([i915#1149] / [i915#1849]) -> [PASS][167] +7 similar issues
[166]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-5/igt@[email protected]
[167]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-64x64-random:
- {shard-rkl}: [SKIP][168] ([fdo#112022]) -> [PASS][169] +17 similar issues
[168]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10324/shard-rkl-1/igt@[email protected]
[169]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/shard-rkl-6/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-skl: [INCOMPLETE][170] ([i915#300]) -> [PASS][171]
[170]: h

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20562/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Maarten Lankhorst
Quoted 239 lines · Maarten Lankhorst

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +16 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
                return -ENODEV;
 
        if (obj->ops->mmap_offset)  {
+               if (mmap_type != I915_MMAP_TYPE_TTM)
+                       return -ENODEV;
+
                *offset = obj->ops->mmap_offset(obj);
                return 0;
        }
 
+       if (mmap_type == I915_MMAP_TYPE_TTM)
+               return -ENODEV;
+
        if (mmap_type != I915_MMAP_TYPE_GTT &&
            !i915_gem_object_has_struct_page(obj) &&
            !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
        enum i915_mmap_type mmap_type;
 
-       if (boot_cpu_has(X86_FEATURE_PAT))
+       if (HAS_LMEM(to_i915(dev)))
+               mmap_type = I915_MMAP_TYPE_TTM;
+       else if (boot_cpu_has(X86_FEATURE_PAT))
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                type = I915_MMAP_TYPE_UC;
                break;
 
+       case I915_MMAP_OFFSET_TTM:
+               type = I915_MMAP_TYPE_TTM;
+               break;
+
        default:
                return -EINVAL;
        }
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &vm_ops_cpu;
                break;
 
+       case I915_MMAP_TYPE_TTM:
+               GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);
+               /* fall-through */
        case I915_MMAP_TYPE_WB:
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
                vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
        I915_MMAP_TYPE_WC,
        I915_MMAP_TYPE_WB,
        I915_MMAP_TYPE_UC,
+       I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +25 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
        return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+       if (HAS_LMEM(i915))
+               return I915_MMAP_TYPE_TTM;
+
+       return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
                               unsigned long size,
                               int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return expected && expected == PTR_ERR(obj);
 
-       ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        i915_gem_object_put(obj);
 
        return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
                goto out;
        }
 
-       err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        if (err) {
                pr_err("Unable to insert object into reclaimed hole\n");
                goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        bool no_map;
 
+       if (HAS_LMEM(i915))
+               return type == I915_MMAP_TYPE_TTM;
+       else if (type == I915_MMAP_TYPE_TTM)
+               return false;
+
        if (type == I915_MMAP_TYPE_GTT &&
            !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
                return false;
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
                        err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
                        if (err == 0)
                                err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+                       if (err == 0)
+                               err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);
 
                        i915_gem_object_put(obj);
                        if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
        case I915_MMAP_TYPE_WB: return "wb";
        case I915_MMAP_TYPE_WC: return "wc";
        case I915_MMAP_TYPE_UC: return "uc";
+       case I915_MMAP_TYPE_TTM: return "ttm";
        default: return "unknown";
        }
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
                if (err == 0)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+               if (err == 0)
+                       err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
                err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
                err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
include/uapi/drm/i915_drm.h +27 -11
index e334a8b14ef2..1610ed40b4b5 100644
@@ -849,31 +849,60 @@ struct drm_i915_gem_mmap_gtt {
        __u64 offset;
 };
 
+/**
+ * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
+ *
+ * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
+ * and is used to retrieve the fake offset to mmap an object specified by &handle.
+ *
+ * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
+ * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
+ * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
+ */
 struct drm_i915_gem_mmap_offset {
-       /** Handle for the object being mapped. */
+       /** @handle: Handle for the object being mapped. */
        __u32 handle;
+       /** @pad: Must be zero */
        __u32 pad;
        /**
-        * Fake offset to use for subsequent mmap call
+        * @offset: The fake offset to use for subsequent mmap call
         *
         * This is a fixed-size type for 32/64 compatibility.
         */
        __u64 offset;
 
        /**
-        * Flags for extended behaviour.
+        * @flags: Flags for extended behaviour.
+        *
+        * It is mandatory that one of the `MMAP_OFFSET` types
+        * should be included:
+        * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT.
+        * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
+        * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
+        * - `I915_MMAP_OFFSET_TTM`: Use TTM to determine caching based on object placement.
+        *
+        * Only on devices with local memory is `I915_MMAP_OFFSET_TTM` valid. On
+        * devices without local memory, this caching mode is invalid.
         *
-        * It is mandatory that one of the MMAP_OFFSET types
-        * (GTT, WC, WB, UC, etc) should be included.
+        * As caching mode when specifying `I915_MMAP_OFFSET_TTM`, WC or WB will
+        * be used, depending on the object placement. WC will be used
+        * when the object resides in local memory, WB otherwise.
         */
        __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC  1
-#define I915_MMAP_OFFSET_WB  2
-#define I915_MMAP_OFFSET_UC  3
 
-       /*
-        * Zero-terminated chain of extensions.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 902

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+/** Use an mmap for the object by binding to GTT. */
+#define I915_MMAP_OFFSET_GTT   0
+/** Use Write-Combined caching. */
+#define I915_MMAP_OFFSET_WC    1
+/** Use Write-Back caching. */
+#define I915_MMAP_OFFSET_WB    2
+/** Do not use caching when binding this mmap. */
+#define I915_MMAP_OFFSET_UC    3
+/** Use the TTM binding, which determines the appropriate caching mode. */
+#define I915_MMAP_OFFSET_TTM   4

I'm not sure I like the name here. TTM is an implementation detail, not a kind of map. I think we want something more like I915_MMAP_OFFSET_IMPLICIT or something like that. The semantics here, as far as I can tell, are "the mmap type is based on the object; you can't change it." On DG1, the mmap type is fixed for all objects. On integrated, we could have a BO create option for the mmap type but we don't yet.

--Jason

Quoted 9 lines
include/uapi/drm/i915_drm.h +3 -1
+
+       /**
+        * @extensions: Zero-terminated chain of extensions.
         *
         * No current extensions defined; mbz.
         */
--

2.31.0

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 252 lines · Jason Ekstrand
Quoted 239 lines · Maarten Lankhorst

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +16 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
                return -ENODEV;
 
        if (obj->ops->mmap_offset)  {
+               if (mmap_type != I915_MMAP_TYPE_TTM)
+                       return -ENODEV;
+
                *offset = obj->ops->mmap_offset(obj);
                return 0;
        }
 
+       if (mmap_type == I915_MMAP_TYPE_TTM)
+               return -ENODEV;
+
        if (mmap_type != I915_MMAP_TYPE_GTT &&
            !i915_gem_object_has_struct_page(obj) &&
            !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
        enum i915_mmap_type mmap_type;
 
-       if (boot_cpu_has(X86_FEATURE_PAT))
+       if (HAS_LMEM(to_i915(dev)))
+               mmap_type = I915_MMAP_TYPE_TTM;
+       else if (boot_cpu_has(X86_FEATURE_PAT))
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                type = I915_MMAP_TYPE_UC;
                break;
 
+       case I915_MMAP_OFFSET_TTM:
+               type = I915_MMAP_TYPE_TTM;
+               break;
+
        default:
                return -EINVAL;
        }
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &vm_ops_cpu;
                break;
 
+       case I915_MMAP_TYPE_TTM:
+               GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);
+               /* fall-through */
        case I915_MMAP_TYPE_WB:
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
                vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
        I915_MMAP_TYPE_WC,
        I915_MMAP_TYPE_WB,
        I915_MMAP_TYPE_UC,
+       I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +25 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
        return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+       if (HAS_LMEM(i915))
+               return I915_MMAP_TYPE_TTM;
+
+       return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
                               unsigned long size,
                               int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return expected && expected == PTR_ERR(obj);
 
-       ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        i915_gem_object_put(obj);
 
        return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
                goto out;
        }
 
-       err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        if (err) {
                pr_err("Unable to insert object into reclaimed hole\n");
                goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        bool no_map;
 
+       if (HAS_LMEM(i915))
+               return type == I915_MMAP_TYPE_TTM;
+       else if (type == I915_MMAP_TYPE_TTM)
+               return false;
+
        if (type == I915_MMAP_TYPE_GTT &&
            !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
                return false;
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
                        err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
                        if (err == 0)
                                err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+                       if (err == 0)
+                               err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);
 
                        i915_gem_object_put(obj);
                        if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
        case I915_MMAP_TYPE_WB: return "wb";
        case I915_MMAP_TYPE_WC: return "wc";
        case I915_MMAP_TYPE_UC: return "uc";
+       case I915_MMAP_TYPE_TTM: return "ttm";
        default: return "unknown";
        }
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
                if (err == 0)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+               if (err == 0)
+                       err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
                err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
                err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
include/uapi/drm/i915_drm.h +27 -11
index e334a8b14ef2..1610ed40b4b5 100644
@@ -849,31 +849,60 @@ struct drm_i915_gem_mmap_gtt {
        __u64 offset;
 };
 
+/**
+ * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
+ *
+ * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
+ * and is used to retrieve the fake offset to mmap an object specified by &handle.
+ *
+ * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
+ * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
+ * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
+ */
 struct drm_i915_gem_mmap_offset {
-       /** Handle for the object being mapped. */
+       /** @handle: Handle for the object being mapped. */
        __u32 handle;
+       /** @pad: Must be zero */
        __u32 pad;
        /**
-        * Fake offset to use for subsequent mmap call
+        * @offset: The fake offset to use for subsequent mmap call
         *
         * This is a fixed-size type for 32/64 compatibility.
         */
        __u64 offset;
 
        /**
-        * Flags for extended behaviour.
+        * @flags: Flags for extended behaviour.
+        *
+        * It is mandatory that one of the `MMAP_OFFSET` types
+        * should be included:
+        * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT.
+        * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
+        * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
+        * - `I915_MMAP_OFFSET_TTM`: Use TTM to determine caching based on object placement.
+        *
+        * Only on devices with local memory is `I915_MMAP_OFFSET_TTM` valid. On
+        * devices without local memory, this caching mode is invalid.
         *
-        * It is mandatory that one of the MMAP_OFFSET types
-        * (GTT, WC, WB, UC, etc) should be included.
+        * As caching mode when specifying `I915_MMAP_OFFSET_TTM`, WC or WB will
+        * be used, depending on the object placement. WC will be used
+        * when the object resides in local memory, WB otherwise.
         */
        __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC  1
-#define I915_MMAP_OFFSET_WB  2
-#define I915_MMAP_OFFSET_UC  3
 
-       /*
-        * Zero-terminated chain of extensions.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 902

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+/** Use an mmap for the object by binding to GTT. */
+#define I915_MMAP_OFFSET_GTT   0
+/** Use Write-Combined caching. */
+#define I915_MMAP_OFFSET_WC    1
+/** Use Write-Back caching. */
+#define I915_MMAP_OFFSET_WB    2
+/** Do not use caching when binding this mmap. */
+#define I915_MMAP_OFFSET_UC    3
+/** Use the TTM binding, which determines the appropriate caching mode. */
+#define I915_MMAP_OFFSET_TTM   4
Quoted 7 lines

I'm not sure I like the name here. TTM is an implementation detail, not a kind of map. I think we want something more like I915_MMAP_OFFSET_IMPLICIT or something like that. The semantics here, as far as I can tell, are "the mmap type is based on the object; you can't change it." On DG1, the mmap type is fixed for all objects. On integrated, we could have a BO create option for the mmap type but we don't yet.

Yeah it's not a great name, but also we didn't come up with anything substantially better on irc. More ideas:
- PREDEFINED
- PRESELECTED

Note that we want to pick a value here which also makes sense for when we extend GEM_CREATE_EXT to allow you to select the single mmap mode you get at creation time (for igfx cleanup of the uapi). So IMPLICIT isn't the greatest name either, when we'll allow userspace to explicit chose it - just not here anymore.

Anyway, pick a name and we'll paint this bikeshed, I don't care much really. As long as there's kerneldoc :-)
-Daniel

Quoted 20 lines

--Jason

Quoted 9 lines
include/uapi/drm/i915_drm.h +3 -1
+
+       /**
+        * @extensions: Zero-terminated chain of extensions.
         *
         * No current extensions defined; mbz.
         */
--

2.31.0

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#7 lore raw
Quoted 267 lines · Daniel Vetter
Quoted 252 lines · Jason Ekstrand
Quoted 239 lines · Maarten Lankhorst

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +16 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
                return -ENODEV;
 
        if (obj->ops->mmap_offset)  {
+               if (mmap_type != I915_MMAP_TYPE_TTM)
+                       return -ENODEV;
+
                *offset = obj->ops->mmap_offset(obj);
                return 0;
        }
 
+       if (mmap_type == I915_MMAP_TYPE_TTM)
+               return -ENODEV;
+
        if (mmap_type != I915_MMAP_TYPE_GTT &&
            !i915_gem_object_has_struct_page(obj) &&
            !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
        enum i915_mmap_type mmap_type;
 
-       if (boot_cpu_has(X86_FEATURE_PAT))
+       if (HAS_LMEM(to_i915(dev)))
+               mmap_type = I915_MMAP_TYPE_TTM;
+       else if (boot_cpu_has(X86_FEATURE_PAT))
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                type = I915_MMAP_TYPE_UC;
                break;
 
+       case I915_MMAP_OFFSET_TTM:
+               type = I915_MMAP_TYPE_TTM;
+               break;
+
        default:
                return -EINVAL;
        }
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &vm_ops_cpu;
                break;
 
+       case I915_MMAP_TYPE_TTM:
+               GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);
+               /* fall-through */
        case I915_MMAP_TYPE_WB:
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
                vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
        I915_MMAP_TYPE_WC,
        I915_MMAP_TYPE_WB,
        I915_MMAP_TYPE_UC,
+       I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +25 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
        return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+       if (HAS_LMEM(i915))
+               return I915_MMAP_TYPE_TTM;
+
+       return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
                               unsigned long size,
                               int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return expected && expected == PTR_ERR(obj);
 
-       ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        i915_gem_object_put(obj);
 
        return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
                goto out;
        }
 
-       err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        if (err) {
                pr_err("Unable to insert object into reclaimed hole\n");
                goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        bool no_map;
 
+       if (HAS_LMEM(i915))
+               return type == I915_MMAP_TYPE_TTM;
+       else if (type == I915_MMAP_TYPE_TTM)
+               return false;
+
        if (type == I915_MMAP_TYPE_GTT &&
            !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
                return false;
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
                        err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
                        if (err == 0)
                                err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+                       if (err == 0)
+                               err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);
 
                        i915_gem_object_put(obj);
                        if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
        case I915_MMAP_TYPE_WB: return "wb";
        case I915_MMAP_TYPE_WC: return "wc";
        case I915_MMAP_TYPE_UC: return "uc";
+       case I915_MMAP_TYPE_TTM: return "ttm";
        default: return "unknown";
        }
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
                if (err == 0)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+               if (err == 0)
+                       err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
                err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
                err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
include/uapi/drm/i915_drm.h +27 -11
index e334a8b14ef2..1610ed40b4b5 100644
@@ -849,31 +849,60 @@ struct drm_i915_gem_mmap_gtt {
        __u64 offset;
 };
 
+/**
+ * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
+ *
+ * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
+ * and is used to retrieve the fake offset to mmap an object specified by &handle.
+ *
+ * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
+ * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
+ * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
+ */
 struct drm_i915_gem_mmap_offset {
-       /** Handle for the object being mapped. */
+       /** @handle: Handle for the object being mapped. */
        __u32 handle;
+       /** @pad: Must be zero */
        __u32 pad;
        /**
-        * Fake offset to use for subsequent mmap call
+        * @offset: The fake offset to use for subsequent mmap call
         *
         * This is a fixed-size type for 32/64 compatibility.
         */
        __u64 offset;
 
        /**
-        * Flags for extended behaviour.
+        * @flags: Flags for extended behaviour.
+        *
+        * It is mandatory that one of the `MMAP_OFFSET` types
+        * should be included:
+        * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT.
+        * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
+        * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
+        * - `I915_MMAP_OFFSET_TTM`: Use TTM to determine caching based on object placement.
+        *
+        * Only on devices with local memory is `I915_MMAP_OFFSET_TTM` valid. On
+        * devices without local memory, this caching mode is invalid.
         *
-        * It is mandatory that one of the MMAP_OFFSET types
-        * (GTT, WC, WB, UC, etc) should be included.
+        * As caching mode when specifying `I915_MMAP_OFFSET_TTM`, WC or WB will
+        * be used, depending on the object placement. WC will be used
+        * when the object resides in local memory, WB otherwise.
         */
        __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC  1
-#define I915_MMAP_OFFSET_WB  2
-#define I915_MMAP_OFFSET_UC  3
 
-       /*
-        * Zero-terminated chain of extensions.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 902

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+/** Use an mmap for the object by binding to GTT. */
+#define I915_MMAP_OFFSET_GTT   0
+/** Use Write-Combined caching. */
+#define I915_MMAP_OFFSET_WC    1
+/** Use Write-Back caching. */
+#define I915_MMAP_OFFSET_WB    2
+/** Do not use caching when binding this mmap. */
+#define I915_MMAP_OFFSET_UC    3
+/** Use the TTM binding, which determines the appropriate caching mode. */
+#define I915_MMAP_OFFSET_TTM   4
Quoted 7 lines

I'm not sure I like the name here. TTM is an implementation detail, not a kind of map. I think we want something more like I915_MMAP_OFFSET_IMPLICIT or something like that. The semantics here, as far as I can tell, are "the mmap type is based on the object; you can't change it." On DG1, the mmap type is fixed for all objects. On integrated, we could have a BO create option for the mmap type but we don't yet.

Yeah it's not a great name, but also we didn't come up with anything substantially better on irc. More ideas:
- PREDEFINED
- PRESELECTED

Quoted 5 lines

Note that we want to pick a value here which also makes sense for when we extend GEM_CREATE_EXT to allow you to select the single mmap mode you get at creation time (for igfx cleanup of the uapi). So IMPLICIT isn't the greatest name either, when we'll allow userspace to explicit chose it - just not here anymore.

Yeah, none of them are great. Maybe FIXED? Or PER_BO? Or BO_CREATE?
Or just BO? I think the semantics we want are "whatever was on the
BO at create time".

--Jason

Quoted 26 lines

Anyway, pick a name and we'll paint this bikeshed, I don't care much really. As long as there's kerneldoc :-)
-Daniel

Quoted 12 lines

--Jason

Quoted 9 lines
include/uapi/drm/i915_drm.h +3 -1
+
+       /**
+        * @extensions: Zero-terminated chain of extensions.
         *
         * No current extensions defined; mbz.
         */
--

2.31.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 4 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
Quoted 274 lines · Jason Ekstrand
Quoted 267 lines · Daniel Vetter
Quoted 252 lines · Jason Ekstrand
Quoted 239 lines · Maarten Lankhorst

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +16 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
                return -ENODEV;
 
        if (obj->ops->mmap_offset)  {
+               if (mmap_type != I915_MMAP_TYPE_TTM)
+                       return -ENODEV;
+
                *offset = obj->ops->mmap_offset(obj);
                return 0;
        }
 
+       if (mmap_type == I915_MMAP_TYPE_TTM)
+               return -ENODEV;
+
        if (mmap_type != I915_MMAP_TYPE_GTT &&
            !i915_gem_object_has_struct_page(obj) &&
            !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
        enum i915_mmap_type mmap_type;
 
-       if (boot_cpu_has(X86_FEATURE_PAT))
+       if (HAS_LMEM(to_i915(dev)))
+               mmap_type = I915_MMAP_TYPE_TTM;
+       else if (boot_cpu_has(X86_FEATURE_PAT))
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                type = I915_MMAP_TYPE_UC;
                break;
 
+       case I915_MMAP_OFFSET_TTM:
+               type = I915_MMAP_TYPE_TTM;
+               break;
+
        default:
                return -EINVAL;
        }
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &vm_ops_cpu;
                break;
 
+       case I915_MMAP_TYPE_TTM:
+               GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);
+               /* fall-through */
        case I915_MMAP_TYPE_WB:
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
                vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
        I915_MMAP_TYPE_WC,
        I915_MMAP_TYPE_WB,
        I915_MMAP_TYPE_UC,
+       I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +25 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
        return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+       if (HAS_LMEM(i915))
+               return I915_MMAP_TYPE_TTM;
+
+       return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
                               unsigned long size,
                               int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return expected && expected == PTR_ERR(obj);
 
-       ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        i915_gem_object_put(obj);
 
        return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
                goto out;
        }
 
-       err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        if (err) {
                pr_err("Unable to insert object into reclaimed hole\n");
                goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        bool no_map;
 
+       if (HAS_LMEM(i915))
+               return type == I915_MMAP_TYPE_TTM;
+       else if (type == I915_MMAP_TYPE_TTM)
+               return false;
+
        if (type == I915_MMAP_TYPE_GTT &&
            !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
                return false;
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
                        err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
                        if (err == 0)
                                err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+                       if (err == 0)
+                               err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);
 
                        i915_gem_object_put(obj);
                        if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
        case I915_MMAP_TYPE_WB: return "wb";
        case I915_MMAP_TYPE_WC: return "wc";
        case I915_MMAP_TYPE_UC: return "uc";
+       case I915_MMAP_TYPE_TTM: return "ttm";
        default: return "unknown";
        }
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
                if (err == 0)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+               if (err == 0)
+                       err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
                err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
                err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
include/uapi/drm/i915_drm.h +27 -11
index e334a8b14ef2..1610ed40b4b5 100644
@@ -849,31 +849,60 @@ struct drm_i915_gem_mmap_gtt {
        __u64 offset;
 };
 
+/**
+ * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
+ *
+ * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
+ * and is used to retrieve the fake offset to mmap an object specified by &handle.
+ *
+ * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
+ * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
+ * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
+ */
 struct drm_i915_gem_mmap_offset {
-       /** Handle for the object being mapped. */
+       /** @handle: Handle for the object being mapped. */
        __u32 handle;
+       /** @pad: Must be zero */
        __u32 pad;
        /**
-        * Fake offset to use for subsequent mmap call
+        * @offset: The fake offset to use for subsequent mmap call
         *
         * This is a fixed-size type for 32/64 compatibility.
         */
        __u64 offset;
 
        /**
-        * Flags for extended behaviour.
+        * @flags: Flags for extended behaviour.
+        *
+        * It is mandatory that one of the `MMAP_OFFSET` types
+        * should be included:
+        * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT.
+        * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
+        * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
+        * - `I915_MMAP_OFFSET_TTM`: Use TTM to determine caching based on object placement.
+        *
+        * Only on devices with local memory is `I915_MMAP_OFFSET_TTM` valid. On
+        * devices without local memory, this caching mode is invalid.
         *
-        * It is mandatory that one of the MMAP_OFFSET types
-        * (GTT, WC, WB, UC, etc) should be included.
+        * As caching mode when specifying `I915_MMAP_OFFSET_TTM`, WC or WB will
+        * be used, depending on the object placement. WC will be used
+        * when the object resides in local memory, WB otherwise.
         */
        __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC  1
-#define I915_MMAP_OFFSET_WB  2
-#define I915_MMAP_OFFSET_UC  3
 
-       /*
-        * Zero-terminated chain of extensions.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 902

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+/** Use an mmap for the object by binding to GTT. */
+#define I915_MMAP_OFFSET_GTT   0
+/** Use Write-Combined caching. */
+#define I915_MMAP_OFFSET_WC    1
+/** Use Write-Back caching. */
+#define I915_MMAP_OFFSET_WB    2
+/** Do not use caching when binding this mmap. */
+#define I915_MMAP_OFFSET_UC    3
+/** Use the TTM binding, which determines the appropriate caching mode. */
+#define I915_MMAP_OFFSET_TTM   4
Quoted 7 lines

I'm not sure I like the name here. TTM is an implementation detail, not a kind of map. I think we want something more like I915_MMAP_OFFSET_IMPLICIT or something like that. The semantics here, as far as I can tell, are "the mmap type is based on the object; you can't change it." On DG1, the mmap type is fixed for all objects. On integrated, we could have a BO create option for the mmap type but we don't yet.

Yeah it's not a great name, but also we didn't come up with anything substantially better on irc. More ideas:
- PREDEFINED
- PRESELECTED

Quoted 5 lines

Note that we want to pick a value here which also makes sense for when we extend GEM_CREATE_EXT to allow you to select the single mmap mode you get at creation time (for igfx cleanup of the uapi). So IMPLICIT isn't the greatest name either, when we'll allow userspace to explicit chose it - just not here anymore.

Quoted 3 lines

Yeah, none of them are great. Maybe FIXED? Or PER_BO? Or BO_CREATE?
Or just BO? I think the semantics we want are "whatever was on the
BO at create time".

_FIXED sounds like the least horrible one to me.
-Daniel

Quoted 33 lines

--Jason

Quoted 30 lines

Anyway, pick a name and we'll paint this bikeshed, I don't care much really. As long as there's kerneldoc :-)
-Daniel

Quoted 12 lines

--Jason

Quoted 9 lines
include/uapi/drm/i915_drm.h +3 -1
+
+       /**
+        * @extensions: Zero-terminated chain of extensions.
         *
         * No current extensions defined; mbz.
         */
--

2.31.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#9 lore raw
Quoted 276 lines · Daniel Vetter
Quoted 274 lines · Jason Ekstrand
Quoted 272 lines · Daniel Vetter
Quoted 252 lines · Jason Ekstrand
Quoted 239 lines · Maarten Lankhorst

This is only used for ttm, and tells userspace that the mapping type is ignored. This disables the other type of mmap offsets when discrete memory is used, so fix the selftests as well.

Document the struct as well, so it shows up in docbook correctly.

Changes since v1:
- Add docbook entries.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 ++++++-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++-
 include/uapi/drm/i915_drm.h                   | 51 +++++++++++++++----
 4 files changed, 82 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +16 -1
index a90f796e85c0..b34be9e5d094 100644
@@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
                return -ENODEV;
 
        if (obj->ops->mmap_offset)  {
+               if (mmap_type != I915_MMAP_TYPE_TTM)
+                       return -ENODEV;
+
                *offset = obj->ops->mmap_offset(obj);
                return 0;
        }
 
+       if (mmap_type == I915_MMAP_TYPE_TTM)
+               return -ENODEV;
+
        if (mmap_type != I915_MMAP_TYPE_GTT &&
            !i915_gem_object_has_struct_page(obj) &&
            !i915_gem_object_has_iomem(obj))
@@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
 {
        enum i915_mmap_type mmap_type;
 
-       if (boot_cpu_has(X86_FEATURE_PAT))
+       if (HAS_LMEM(to_i915(dev)))
+               mmap_type = I915_MMAP_TYPE_TTM;
+       else if (boot_cpu_has(X86_FEATURE_PAT))
                mmap_type = I915_MMAP_TYPE_WC;
        else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
                return -ENODEV;
@@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
                type = I915_MMAP_TYPE_UC;
                break;
 
+       case I915_MMAP_OFFSET_TTM:
+               type = I915_MMAP_TYPE_TTM;
+               break;
+
        default:
                return -EINVAL;
        }
@@ -968,6 +980,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &vm_ops_cpu;
                break;
 
+       case I915_MMAP_TYPE_TTM:
+               GEM_WARN_ON(mmo->mmap_type == I915_MMAP_TYPE_TTM);
+               /* fall-through */
        case I915_MMAP_TYPE_WB:
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
                vma->vm_ops = &vm_ops_cpu;
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
index ef3de2ae9723..d4c42bcdfeb6 100644
@@ -105,6 +105,7 @@ enum i915_mmap_type {
        I915_MMAP_TYPE_WC,
        I915_MMAP_TYPE_WB,
        I915_MMAP_TYPE_UC,
+       I915_MMAP_TYPE_TTM,
 };
 
 struct i915_mmap_offset {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +25 -2
index 1da8bd675e54..27a35d88e5f5 100644
@@ -573,6 +573,14 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
        return 0;
 }
 
+static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
+{
+       if (HAS_LMEM(i915))
+               return I915_MMAP_TYPE_TTM;
+
+       return I915_MMAP_TYPE_GTT;
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
                               unsigned long size,
                               int expected)
@@ -585,7 +593,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return expected && expected == PTR_ERR(obj);
 
-       ret = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       ret = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        i915_gem_object_put(obj);
 
        return ret == expected;
@@ -689,7 +697,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
                goto out;
        }
 
-       err = __assign_mmap_offset(obj, I915_MMAP_TYPE_GTT, &offset, NULL);
+       err = __assign_mmap_offset(obj, default_mapping(i915), &offset, NULL);
        if (err) {
                pr_err("Unable to insert object into reclaimed hole\n");
                goto err_obj;
@@ -831,8 +839,14 @@ static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        bool no_map;
 
+       if (HAS_LMEM(i915))
+               return type == I915_MMAP_TYPE_TTM;
+       else if (type == I915_MMAP_TYPE_TTM)
+               return false;
+
        if (type == I915_MMAP_TYPE_GTT &&
            !i915_ggtt_has_aperture(&to_i915(obj->base.dev)->ggtt))
                return false;
@@ -970,6 +984,8 @@ static int igt_mmap(void *arg)
                        err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
                        if (err == 0)
                                err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
+                       if (err == 0)
+                               err = __igt_mmap(i915, obj, I915_MMAP_TYPE_TTM);
 
                        i915_gem_object_put(obj);
                        if (err)
@@ -987,6 +1003,7 @@ static const char *repr_mmap_type(enum i915_mmap_type type)
        case I915_MMAP_TYPE_WB: return "wb";
        case I915_MMAP_TYPE_WC: return "wc";
        case I915_MMAP_TYPE_UC: return "uc";
+       case I915_MMAP_TYPE_TTM: return "ttm";
        default: return "unknown";
        }
 }
@@ -1100,6 +1117,8 @@ static int igt_mmap_access(void *arg)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WC);
                if (err == 0)
                        err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_UC);
+               if (err == 0)
+                       err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1241,6 +1260,8 @@ static int igt_mmap_gpu(void *arg)
                err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
@@ -1396,6 +1417,8 @@ static int igt_mmap_revoke(void *arg)
                err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
                if (err == 0)
                        err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
+               if (err == 0)
+                       err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_TTM);
 
                i915_gem_object_put(obj);
                if (err)
include/uapi/drm/i915_drm.h +27 -11
index e334a8b14ef2..1610ed40b4b5 100644
@@ -849,31 +849,60 @@ struct drm_i915_gem_mmap_gtt {
        __u64 offset;
 };
 
+/**
+ * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object.
+ *
+ * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl,
+ * and is used to retrieve the fake offset to mmap an object specified by &handle.
+ *
+ * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+.
+ * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave
+ * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`.
+ */
 struct drm_i915_gem_mmap_offset {
-       /** Handle for the object being mapped. */
+       /** @handle: Handle for the object being mapped. */
        __u32 handle;
+       /** @pad: Must be zero */
        __u32 pad;
        /**
-        * Fake offset to use for subsequent mmap call
+        * @offset: The fake offset to use for subsequent mmap call
         *
         * This is a fixed-size type for 32/64 compatibility.
         */
        __u64 offset;
 
        /**
-        * Flags for extended behaviour.
+        * @flags: Flags for extended behaviour.
+        *
+        * It is mandatory that one of the `MMAP_OFFSET` types
+        * should be included:
+        * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT.
+        * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching.
+        * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching.
+        * - `I915_MMAP_OFFSET_TTM`: Use TTM to determine caching based on object placement.
+        *
+        * Only on devices with local memory is `I915_MMAP_OFFSET_TTM` valid. On
+        * devices without local memory, this caching mode is invalid.
         *
-        * It is mandatory that one of the MMAP_OFFSET types
-        * (GTT, WC, WB, UC, etc) should be included.
+        * As caching mode when specifying `I915_MMAP_OFFSET_TTM`, WC or WB will
+        * be used, depending on the object placement. WC will be used
+        * when the object resides in local memory, WB otherwise.
         */
        __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC  1
-#define I915_MMAP_OFFSET_WB  2
-#define I915_MMAP_OFFSET_UC  3
 
-       /*
-        * Zero-terminated chain of extensions.

include/uapi/drm/i915_drm.h struct drm_i915_gem_mmap_gtt { · line 902

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+/** Use an mmap for the object by binding to GTT. */
+#define I915_MMAP_OFFSET_GTT   0
+/** Use Write-Combined caching. */
+#define I915_MMAP_OFFSET_WC    1
+/** Use Write-Back caching. */
+#define I915_MMAP_OFFSET_WB    2
+/** Do not use caching when binding this mmap. */
+#define I915_MMAP_OFFSET_UC    3
+/** Use the TTM binding, which determines the appropriate caching mode. */
+#define I915_MMAP_OFFSET_TTM   4
Quoted 7 lines

I'm not sure I like the name here. TTM is an implementation detail, not a kind of map. I think we want something more like I915_MMAP_OFFSET_IMPLICIT or something like that. The semantics here, as far as I can tell, are "the mmap type is based on the object; you can't change it." On DG1, the mmap type is fixed for all objects. On integrated, we could have a BO create option for the mmap type but we don't yet.

Yeah it's not a great name, but also we didn't come up with anything substantially better on irc. More ideas:
- PREDEFINED
- PRESELECTED

Note that we want to pick a value here which also makes sense for when we extend GEM_CREATE_EXT to allow you to select the single mmap mode you get at creation time (for igfx cleanup of the uapi). So IMPLICIT isn't the greatest name either, when we'll allow userspace to explicit chose it - just not here anymore.

Quoted 5 lines
Quoted 3 lines

Yeah, none of them are great. Maybe FIXED? Or PER_BO? Or BO_CREATE?
Or just BO? I think the semantics we want are "whatever was on the
BO at create time".

_FIXED sounds like the least horrible one to me.

Fine with me.

Quoted 40 lines

-Daniel

Quoted 33 lines

--Jason

Quoted 30 lines

Anyway, pick a name and we'll paint this bikeshed, I don't care much really. As long as there's kerneldoc :-)
-Daniel

Quoted 12 lines

--Jason

Quoted 9 lines
include/uapi/drm/i915_drm.h +3 -1
+
+       /**
+        * @extensions: Zero-terminated chain of extensions.
         *
         * No current extensions defined; mbz.
         */
--

2.31.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch