Signed-off-by: Chris Wilson <[email protected]>
---
 tests/i915/gem_userptr_blits.c | 40 ++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 01498edad..6f2e89269 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -586,6 +586,40 @@ static int test_access_control(int fd)
        return 0;
 }
 
+static void test_exec_isolation(int fd)
+{
+       igt_fork(child, 1) {
+               igt_spin_t *spin = igt_spin_new(fd, .flags = IGT_SPIN_USERPTR);
+               gem_execbuf(fd, &spin->execbuf);
+               igt_spin_free(fd, spin);
+       }
+
+       igt_set_timeout(10, "blocked!");
+       igt_until_timeout(2)
+               igt_spin_free(fd, igt_spin_new(fd, .flags = IGT_SPIN_USERPTR));
+       igt_reset_timeout();
+
+       igt_waitchildren();
+}
+
+static void test_unmap_isolation(int fd)
+{
+       igt_spin_t *spin = igt_spin_new(fd, .flags = IGT_SPIN_USERPTR);
+
+       igt_fork(child, 1) {
+               gem_execbuf(fd, &spin->execbuf);
+               munmap(spin->batch, 4096);
+       }
+       igt_waitchildren();
+
+       igt_spin_end(spin);
+       mprotect(spin->batch, 4096, PROT_READ);
+       igt_assert_eq(__gem_execbuf(fd, &spin->execbuf), -EFAULT);
+       mprotect(spin->batch, 4096, PROT_WRITE);
+
+       igt_spin_free(fd, spin);
+}
+
 static int test_invalid_null_pointer(int fd)
 {
        uint32_t handle;
@@ -2388,6 +2422,12 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)
        igt_subtest("access-control")
                test_access_control(fd);
 
+       igt_subtest("exec-isolation")
+               test_exec_isolation(fd);
+
+       igt_subtest("unmap-isolation")
+               test_unmap_isolation(fd);
+
        igt_fixture
                free(can_mmap);
 }
-- 
2.28.0

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

Reply via email to