Skip to contentSkip to conversation

Drop relocations for new gens

PATCH Superseded Zbigniew Kempczyński 1 participant 2 messages Mar 17, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Drop relocations for new gens

Patch likely is temporary - until Jason will figure out where to put his code and avoid unnecessary walk over the objects array. I need this to find out what tests will fail when we disallow passing relocations data in execbuf.

Current patch
https://patchwork.freedesktop.org/patch/424069/?series=87980&rev=2
still allows passing relocation data. So we got no -EINVAL for new hardware what is not we want.

When pread/pwrite drop + allocator series will be merge we want to rerun of that series and see what's failing on CI.

Cc Jason Ekstrand <[email protected]>
Cc Daniel Vetter <[email protected]>

Zbigniew Kempczyński (1):
drm/i915/gem: Drop relocation support on all new hardware

 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
Signature · 6 lines
2.26.0

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

PATCH 1/1 drm/i915/gem: Drop relocation support on all new hardware

Ensure we don't pass any relocation data in execbuf for any new hardware.

Patch likely is not optimal but is doing hard cut before entering execbuf.

Cc Jason Ekstrand <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +22 -0
index fe170186dd42..a3b603412448 100644
@@ -3394,6 +3394,22 @@ static bool check_buffer_count(size_t count)
 	return !(count < 1 || count > INT_MAX || count > SIZE_MAX / sz - 1);
 }
 
+static bool check_objects_correctness(const struct drm_i915_private *i915,
+				      const struct drm_i915_gem_exec_object2 *objs,
+				      uint32_t buffer_count)
+{
+	uint32_t i;
+
+	if (INTEL_GEN(i915) < 9 || IS_TIGERLAKE(i915))
+		return true;
+
+	for (i = 0; i < buffer_count; i++)
+		if (objs[i].relocation_count)
+			return false;
+
+	return true;
+}
+
 /*
  * Legacy execbuffer just creates an exec2 list from the original exec object
  * list array and passes it to the real function.
@@ -3529,6 +3545,12 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
 		return -EFAULT;
 	}
 
+	if (!check_objects_correctness(i915, exec2_list, count)) {
+		drm_dbg(&i915->drm, "Relocations are not supported\n");
+		kvfree(exec2_list);
+		return -EINVAL;
+	}
+
 	err = i915_gem_do_execbuffer(dev, file, args, exec2_list);
 
 	/*
Signature · 6 lines
2.26.0

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