diff mbox series

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

Message ID 20191105145931.14612-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t] i915/gem_mmap_gtt: Skip if we have no aperture and no mmap_gtt | expand

Commit Message

Chris Wilson Nov. 5, 2019, 2:59 p.m. UTC
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@chris-wilson.co.uk>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 tests/i915/gem_mmap_gtt.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Joonas Lahtinen Nov. 6, 2019, 12:39 p.m. UTC | #1
Quoting Chris Wilson (2019-11-05 16:59:31)
> 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@chris-wilson.co.uk>
> Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
diff mbox series

Patch

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];