From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id F09FF6E9A6 for ; Thu, 24 Jun 2021 01:30:16 +0000 (UTC) Date: Wed, 23 Jun 2021 18:30:16 -0700 Message-ID: <87r1gsjbh3.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20210511090000.1521342-1-maarten.lankhorst@linux.intel.com> References: <20210511090000.1521342-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [igt-dev] [PATCH i-g-t] i915: Handle the case where legacy mmap is not available List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Maarten Lankhorst Cc: igt-dev@lists.freedesktop.org List-ID: On Tue, 11 May 2021 02:00:00 -0700, Maarten Lankhorst wrote: > > @@ -84,10 +93,14 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot) > { > struct drm_i915_gem_mmap_gtt mmap_arg; > void *ptr; > + int ret; > > memset(&mmap_arg, 0, sizeof(mmap_arg)); > mmap_arg.handle = handle; > - if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg)) > + ret = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg); > + if (ret == -1 && errno == EOPNOTSUPP) What is the handler for DRM_IOCTL_I915_GEM_MMAP_GTT ioctl in i915 (in the kernel)? I am unable to find it so for now I am just assuming that it will just get routed to the handler for DRM_IOCTL_I915_GEM_MMAP and return EOPNOTSUPP for Gen12+ which is what the code above seems to be assuming. > diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c > index 7c36571c9bad..fdddd306acb5 100644 > --- a/tests/i915/gem_mmap.c > +++ b/tests/i915/gem_mmap.c > @@ -154,8 +154,10 @@ igt_main > uint8_t buf[OBJECT_SIZE]; > uint8_t *addr; > > - igt_fixture > + igt_fixture { > fd = drm_open_driver(DRIVER_INTEL); > + igt_require(gem_has_legacy_mmap(fd)); > + } > > igt_subtest("bad-object") { > uint32_t real_handle = gem_create(fd, 4096); > diff --git a/tests/i915/gem_mmap_wc.c b/tests/i915/gem_mmap_wc.c > index 4a2192b30689..ad2d510fcf09 100644 > --- a/tests/i915/gem_mmap_wc.c > +++ b/tests/i915/gem_mmap_wc.c > @@ -504,6 +504,7 @@ igt_main > > igt_fixture { > fd = drm_open_driver(DRIVER_INTEL); > + igt_require(gem_has_legacy_mmap(fd)); I believe we also need to add this igt_require in other places where DRM_IOCTL_I915_GEM_MMAP and DRM_IOCTL_I915_GEM_MMAP_GTT ioctls are being calld directly without calling the functions in gem_mman.*. Looks like we should at least add this igt_require to: * tests/i915/gem_tiled_wc.c, and * test/i915/gem_mmap_gtt.c The remaining references are in overlay/ and tools/ so maybe we can figure out what to do for these later? With the above igt_require added to the two files above, this is: Reviewed-by: Ashutosh Dixit _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev