From patchwork Tue Nov 12 15:47:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11239699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49B8D159A for ; Tue, 12 Nov 2019 15:48:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3186A214E0 for ; Tue, 12 Nov 2019 15:48:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3186A214E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A51B06EB63; Tue, 12 Nov 2019 15:48:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id B0B7F6E4A5; Tue, 12 Nov 2019 15:48:12 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 19175614-1500050 for multiple; Tue, 12 Nov 2019 15:47:59 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 12 Nov 2019 15:47:57 +0000 Message-Id: <20191112154757.7304-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] i915: Mark up a few more tests that only target GGTT X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If a test is only targeting the GGTT API and its corner cases, it can only run if we have a mappable aperture. Signed-off-by: Chris Wilson Cc: Antonio Argenziano Acked-by: Antonio Argenziano --- lib/i915/gem_mman.c | 19 +++++++++++++++++++ lib/i915/gem_mman.h | 3 +++ tests/i915/gem_gtt_cpu_tlb.c | 1 + tests/i915/gem_gtt_hog.c | 1 + tests/i915/gem_gtt_speed.c | 2 ++ tests/i915/gem_mmap_gtt.c | 5 +---- tests/i915/gem_tiled_swapping.c | 1 + 7 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index 3cf9a6bbd..76d0be82e 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -252,3 +252,22 @@ void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, uns igt_assert(ptr); return ptr; } + +bool gem_has_ggtt(int i915) +{ + struct drm_i915_gem_mmap_gtt arg = {}; + int err; + + err = 0; + if (ioctl(i915, DRM_IOCTL_I915_GEM_MMAP_GTT, &arg)) + err = errno; + errno = 0; + + return errno != ENODEV; +} + +void gem_require_ggtt(int i915) +{ + igt_require_f(gem_has_ggtt(i915), + "HW & kernel support for indirect detiling aperture\n"); +} diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h index f7242ed77..67891c8de 100644 --- a/lib/i915/gem_mman.h +++ b/lib/i915/gem_mman.h @@ -35,6 +35,9 @@ void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsi #define I915_GEM_DOMAIN_WC 0x80 #endif +bool gem_has_ggtt(int i915); +void gem_require_ggtt(int i915); + void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot); void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); diff --git a/tests/i915/gem_gtt_cpu_tlb.c b/tests/i915/gem_gtt_cpu_tlb.c index cf3c543df..a4cbb1034 100644 --- a/tests/i915/gem_gtt_cpu_tlb.c +++ b/tests/i915/gem_gtt_cpu_tlb.c @@ -79,6 +79,7 @@ igt_simple_main igt_skip_on_simulation(); fd = drm_open_driver(DRIVER_INTEL); + gem_require_ggtt(fd); handle = gem_create(fd, OBJ_SIZE); diff --git a/tests/i915/gem_gtt_hog.c b/tests/i915/gem_gtt_hog.c index ca730649c..7a6273936 100644 --- a/tests/i915/gem_gtt_hog.c +++ b/tests/i915/gem_gtt_hog.c @@ -161,6 +161,7 @@ igt_simple_main /* check for an intel gpu before goint nuts. */ int fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_ggtt(fd); close(fd); igt_skip_on_simulation(); diff --git a/tests/i915/gem_gtt_speed.c b/tests/i915/gem_gtt_speed.c index dfa7216cc..0cdd51dc3 100644 --- a/tests/i915/gem_gtt_speed.c +++ b/tests/i915/gem_gtt_speed.c @@ -124,7 +124,9 @@ igt_simple_main_args("s:", NULL, help_str, opt_handler, NULL) buf = malloc(size); memset(buf, 0, size); + fd = drm_open_driver(DRIVER_INTEL); + gem_require_ggtt(fd); handle = gem_create(fd, size); igt_assert(handle); diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c index ac25f13e2..d31c73ed4 100644 --- a/tests/i915/gem_mmap_gtt.c +++ b/tests/i915/gem_mmap_gtt.c @@ -1020,8 +1020,6 @@ igt_main OBJECT_SIZE = 1 * 1024 * 1024; igt_fixture { - struct drm_i915_gem_mmap_gtt arg = {}; - fd = drm_open_driver(DRIVER_INTEL); /* @@ -1029,8 +1027,7 @@ igt_main * 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"); + gem_require_ggtt(fd); } igt_subtest("bad-object") { diff --git a/tests/i915/gem_tiled_swapping.c b/tests/i915/gem_tiled_swapping.c index 1b70c1e51..3a95c9469 100644 --- a/tests/i915/gem_tiled_swapping.c +++ b/tests/i915/gem_tiled_swapping.c @@ -175,6 +175,7 @@ igt_main current_tiling_mode = I915_TILING_X; fd = drm_open_driver(DRIVER_INTEL); + gem_require_ggtt(fd); intel_purge_vm_caches(fd); check_memory_layout(fd);