linux/include/drm
David Herrmann 88d7ebe593 drm/vma: add access management helpers
The VMA offset manager uses a device-global address-space. Hence, any
user can currently map any offset-node they want. They only need to guess
the right offset. If we wanted per open-file offset spaces, we'd either
need VM_NONLINEAR mappings or multiple "struct address_space" trees. As
both doesn't really scale, we implement access management in the VMA
manager itself.

We use an rb-tree to store open-files for each VMA node. On each mmap
call, GEM, TTM or the drivers must check whether the current user is
allowed to map this file.

We add a separate lock for each node as there is no generic lock available
for the caller to protect the node easily.

As we currently don't know whether an object may be used for mmap(), we
have to do access management for all objects. If it turns out to slow down
handle creation/deletion significantly, we can optimize it in several
ways:
 - Most times only a single filp is added per bo so we could use a static
   "struct file *main_filp" which is checked/added/removed first before we
   fall back to the rbtree+drm_vma_offset_file.
   This could be even done lockless with rcu.
 - Let user-space pass a hint whether mmap() should be supported on the
   bo and avoid access-management if not.
 - .. there are probably more ideas once we have benchmarks ..

v2: add drm_vma_node_verify_access() helper

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-08-27 11:54:54 +10:00
..
i2c drm/i2c: tda998x: add video and audio input configuration 2013-08-19 09:10:32 +10:00
ttm drm/ttm: convert to unified vma offset manager 2013-07-25 20:47:07 +10:00
drm_agpsupport.h drm: provide agp dummies for CONFIG_AGP=n 2013-08-09 07:22:11 +10:00
drm_buffer.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
drm_cache.h drm/ttm: consolidate cache flushing code in one place. 2009-08-27 09:53:47 +10:00
drm_core.h drm: Fix support for PCI domains 2010-08-10 08:20:20 +10:00
drm_crtc_helper.h drm: extract drm_kms_helper_hotplug_event 2012-11-20 15:50:32 +10:00
drm_crtc.h drm: Remove 2 unused defines 2013-08-21 12:47:36 +10:00
drm_dp_helper.h drm: Added SDP and VSC structures for handling PSR for eDP 2013-07-18 09:59:21 +02:00
drm_edid.h drm: add drm_edid_to_eld helper extracting SADs from EDID (v2) 2013-04-23 18:03:58 -04:00
drm_encoder_slave.h drm: i2c encoder helper wrappers 2013-02-17 17:55:42 -05:00
drm_fb_cma_helper.h drm: Make drm_fb_cma_describe() static 2013-08-21 12:47:41 +10:00
drm_fb_helper.h drm: Remove pointless '-' characters from drm_fb_helper documentation 2013-05-10 14:46:11 +10:00
drm_fixed.h drm: add some additional fixed point helpers (v3) 2013-06-27 19:16:37 -04:00
drm_flip_work.h drm: add flip-work helper 2013-08-19 10:32:26 +10:00
drm_gem_cma_helper.h drm/gem: create drm_gem_dumb_destroy 2013-08-07 09:59:24 +10:00
drm_global.h drm: move ttm global code to core drm 2010-08-04 09:46:06 +10:00
drm_hashtab.h drm: Add a hash-tab rcu-safe API 2012-11-28 18:36:05 +10:00
drm_mem_util.h introduce SIZE_MAX 2012-05-31 17:49:26 -07:00
drm_memory.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
drm_mm.h drm/mm: remove unused API 2013-08-07 10:16:50 +10:00
drm_os_linux.h drm: Remove mtrr_add and mtrr_del fallback hack for non-MTRR systems 2013-05-31 13:37:37 +10:00
drm_pciids.h drm: Remove unused PCI ids 2013-08-21 12:47:45 +10:00
drm_rect.h drm: Fix drm_rect documentation 2013-05-23 12:51:32 +02:00
drm_sysfs.h drm: Enable drm drivers to add drm sysfs devices. 2009-08-19 16:08:51 +10:00
drm_usb.h drm: add usb framework 2011-02-07 13:09:42 +10:00
drm_vma_manager.h drm/vma: add access management helpers 2013-08-27 11:54:54 +10:00
drmP.h drm/prime: Always add exported buffers to the handle cache 2013-08-21 13:05:03 +10:00
exynos_drm.h drm/exynos: change file license to GPL 2013-01-04 15:54:32 +09:00
gma_drm.h gma500: fix ioctl confict 2012-03-10 13:06:04 +00:00
i915_drm.h UAPI: (Scripted) Disintegrate include/drm 2012-10-04 18:21:50 +01:00
i915_powerwell.h i915/drm: Add private api for power well usage 2013-06-06 17:32:16 +02:00
intel-gtt.h drm/i915: Fix gen2 mappable calculations 2013-02-15 10:30:38 +01:00