drm/i915: Use ttm mmap handling for ttm bo's.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thu, 10 Jun 2021 07:01:52 +0000 (09:01 +0200)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fri, 11 Jun 2021 08:53:25 +0000 (10:53 +0200)
commitcf3e3e86d77970211e0983130e896ae242601003
tree328ad5fa59ab5807c27b2562ca26a94162cc99d4
parentf425821b946847282708121600fffc20344183a0
drm/i915: Use ttm mmap handling for ttm bo's.

Use the ttm handlers for servicing page faults, and vm_access.

We do our own validation of read-only access, otherwise use the
ttm handlers as much as possible.

Because the ttm handlers expect the vma_node at vma->base, we slightly
need to massage the mmap handlers to look at vma_node->driver_private
to fetch the bo, if it's NULL, we assume i915's normal mmap_offset uapi
is used.

This is the easiest way to achieve compatibility without changing ttm's
semantics.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210610070152.572423-5-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/i915/gem/i915_gem_mman.c
drivers/gpu/drm/i915/gem/i915_gem_object.h
drivers/gpu/drm/i915/gem/i915_gem_object_types.h
drivers/gpu/drm/i915/gem/i915_gem_pages.c
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
drivers/gpu/drm/i915/selftests/igt_mmap.c
drivers/gpu/drm/i915/selftests/igt_mmap.h