[Intel-gfx] [PATCH i-g-t] i915/gem_mmap_gtt: Skip if we have no aperture and no mmap_gtt

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 5 14:59:31 UTC 2019


If the device does not expose an aperture for indirect access with
detiling functionality, the kernel rejects an attempt to create such a
mapping with -ENODEV. If the ioctl is not supported, we can skip all of
our mmap_gtt specific tests.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
Cc: Matthew Auld <matthew.auld at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 tests/i915/gem_mmap_gtt.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index 91da5a37b..7738c47cb 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -1019,9 +1019,18 @@ igt_main
 	if (igt_run_in_simulation())
 		OBJECT_SIZE = 1 * 1024 * 1024;
 
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 
+		/*
+		 * If the HW lacks or does not expose an aperture for indirect
+		 * detiling access from untrusted userspace to the objects,
+		 * the kernel does an early rejection of the mmap_gtt ioctl.
+		 */
+		igt_require_f(mmap_ioctl(fd, &arg) != -ENODEV,
+			      "HW & kernel support for indirect detiling aperture\n");
+	}
+
 	igt_subtest("bad-object") {
 		uint32_t real_handle = gem_create(fd, 4096);
 		uint32_t handles[20];
-- 
2.24.0



More information about the Intel-gfx mailing list