All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_softpin: Check the last 32b page is excluded
Date: Wed, 16 Dec 2020 20:52:32 +0000	[thread overview]
Message-ID: <20201216205232.1365213-1-chris@chris-wilson.co.uk> (raw)

In order to prevent issues with 32b stateless address, the last page
under 4G is excluded for non-48b objects.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: CQ Tang <cq.tang@intel.com>
---
 tests/i915/gem_softpin.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index a3e6dcac3..703beb77d 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -156,6 +156,39 @@ static void test_zero(int i915)
 	gem_close(i915, object.handle);
 }
 
+static void test_32b_last_page(int i915)
+{
+	uint64_t sz, gtt = gem_aperture_size(i915);
+	struct drm_i915_gem_exec_object2 object = {
+		.flags = EXEC_OBJECT_PINNED,
+	};
+	struct drm_i915_gem_execbuffer2 execbuf = {
+		.buffers_ptr = to_user_pointer(&object),
+		.buffer_count = 1,
+	};
+
+	/*
+	 * The last page under 32b is excluded for !48b objects in order to
+	 * prevent issues with stateless addressing.
+	 */
+
+	igt_require(gtt >= 1ull << 32);
+	object.handle = batch_create(i915, &sz),
+
+	object.offset = 1ull << 32;
+	object.offset -= sz;
+	igt_assert_f(__gem_execbuf(i915, &execbuf) == -EINVAL,
+		     "execbuf succeeded with object.offset=%llx + %"PRIx64"\n",
+		     object.offset, sz);
+
+	object.offset -= 4096;
+	igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
+		     "execbuf failed with object.offset=%llx + %"PRIx64"\n",
+		     object.offset, sz);
+
+	gem_close(i915, object.handle);
+}
+
 static void test_softpin(int fd)
 {
 	const uint32_t size = 1024 * 1024;
@@ -622,6 +655,10 @@ igt_main
 		igt_require(gem_uses_full_ppgtt(fd));
 		test_zero(fd);
 	}
+	igt_subtest("32b-excludes-last-page") {
+		igt_require(gem_uses_full_ppgtt(fd));
+		test_32b_last_page(fd);
+	}
 	igt_subtest("softpin")
 		test_softpin(fd);
 	igt_subtest("overlap")
-- 
2.29.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2020-12-16 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 20:52 Chris Wilson [this message]
2020-12-16 21:23 ` [Intel-gfx] [PATCH i-g-t] i915/gem_softpin: Check the last 32b page is excluded Tang, CQ
2020-12-16 21:35   ` Chris Wilson

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=20201216205232.1365213-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.