From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2 1/1] drm/i915/gem: Drop relocation support on all new hardware
Date: Wed, 17 Mar 2021 12:17:44 +0100 [thread overview]
Message-ID: <20210317111744.97872-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20210317111744.97872-1-zbigniew.kempczynski@intel.com>
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.
v2: fixing version (< 12 instead of incidentally tested < 9)
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
.../gpu/drm/i915/gem/i915_gem_execbuffer.c | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index fe170186dd42..7d42ec5b8eb5 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -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) < 12 || 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);
/*
--
2.26.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-03-17 11:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 11:17 [Intel-gfx] [PATCH v2 0/1] Drop relocations for new gens Zbigniew Kempczyński
2021-03-17 11:17 ` Zbigniew Kempczyński [this message]
2021-03-17 12:01 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Drop relocations for new gens (rev2) Patchwork
2021-03-17 12:31 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-03-17 14:09 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-03-17 16:46 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-03-17 17:47 ` Patchwork
2021-03-17 19:57 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210317111744.97872-2-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox