drm/i915/gem: Fix the mman selftest
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Tue, 31 Aug 2021 12:29:31 +0000 (14:29 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 2 Sep 2021 12:43:14 +0000 (14:43 +0200)
commit450cede7f3804ca7f8b3da210ebefa61c0958f22
tree3a4d1db632cb6d4df1c1b71192109cd72d83e590
parent5db1856781e45c9610f7652a19cc656b984235e7
drm/i915/gem: Fix the mman selftest

Using the I915_MMAP_TYPE_FIXED mmap type requires the TTM backend, so
for that mmap type, use __i915_gem_object_create_user() instead of
i915_gem_object_create_internal(), as we really want to tests objects
mmap-able by user-space.

This also means that the out-of-space error happens at object creation
and returns -ENXIO rather than -ENOSPC, so fix the code up to expect
that on out-of-offset-space errors.

Finally only use I915_MMAP_TYPE_FIXED for LMEM and SMEM for now if
testing on LMEM-capable devices. For stolen LMEM, we still take the
same path as for integrated, as that haven't been moved over to TTM yet,
and user-space should not be able to create out of stolen LMEM anyway.

v2:
 - Check the presence of the obj->ops->mmap_offset callback rather than
   hardcoding the supported mmap regions in can_mmap() (Maarten Lankhorst)

Fixes: 7961c5b60f23 ("drm/i915: Add TTM offset argument to mmap.")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210831122931.157536-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c