All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] i915/gem_userptr_blits: Check set-domain on userptr for validation
@ 2021-01-15 17:42 Chris Wilson
  2021-01-15 18:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2021-01-16  1:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2021-01-15 17:42 UTC (permalink / raw
  To: intel-gfx; +Cc: igt-dev, Chris Wilson

We use set-domain on userptr to validate that get-user-pages is
applicable to the address range. Let's perform a very basic test to
exercise this combination.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_userptr_blits.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 8765123e0..1add307a2 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -2185,6 +2185,29 @@ static void test_invalidate_close_race(int fd, bool overlap, int timeout)
 	free(t_data.ptr);
 }
 
+static void test_sd_probe(int i915)
+{
+	uint32_t handle;
+	void *page;
+
+	page = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
+		   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+
+	gem_userptr(i915, page, 4096, 0, 0, &handle);
+	igt_assert_eq(__gem_set_domain(i915, handle,
+				       I915_GEM_DOMAIN_GTT, 0),
+		      0);
+	gem_close(i915, handle);
+
+	munmap(page, 4096);
+
+	gem_userptr(i915, page, 4096, 0, 0, &handle);
+	igt_assert_eq(__gem_set_domain(i915, handle,
+				       I915_GEM_DOMAIN_GTT, 0),
+		      -EFAULT);
+	gem_close(i915, handle);
+}
+
 struct ufd_thread {
 	uint32_t *page;
 	int i915;
@@ -2379,6 +2402,9 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)
 		igt_subtest("forbidden-operations")
 			test_forbidden_ops(fd);
 
+		igt_subtest("sd-probe")
+			test_sd_probe(fd);
+
 		igt_subtest("userfault")
 			test_userfault(fd);
 
-- 
2.30.0

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-16  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-15 17:42 [Intel-gfx] [PATCH i-g-t] i915/gem_userptr_blits: Check set-domain on userptr for validation Chris Wilson
2021-01-15 18:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-01-16  1:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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.