freebsd-dev/sys/dev/drm2
John Baldwin 7077c42623 Add a new file operations hook for mmap operations. File type-specific
logic is now placed in the mmap hook implementation rather than requiring
it to be placed in sys/vm/vm_mmap.c.  This hook allows new file types to
support mmap() as well as potentially allowing mmap() for existing file
types that do not currently support any mapping.

The vm_mmap() function is now split up into two functions.  A new
vm_mmap_object() function handles the "back half" of vm_mmap() and accepts
a referenced VM object to map rather than a (handle, handle_type) tuple.
vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a
a VM object and then calling vm_mmap_object() to handle the actual mapping.
The vm_mmap() function remains for use by other parts of the kernel
(e.g. device drivers and exec) but now only supports mapping vnodes,
character devices, and anonymous memory.

The mmap() system call invokes vm_mmap_object() directly with a NULL object
for anonymous mappings.  For mappings using a file descriptor, the
descriptors fo_mmap() hook is invoked instead.  The fo_mmap() hook is
responsible for performing type-specific checks and adjustments to
arguments as well as possibly modifying mapping parameters such as flags
or the object offset.  The fo_mmap() hook routines then call
vm_mmap_object() to handle the actual mapping.

The fo_mmap() hook is optional.  If it is not set, then fo_mmap() will
fail with ENODEV.  A fo_mmap() hook is implemented for regular files,
character devices, and shared memory objects (created via shm_open()).

While here, consistently use the VM_PROT_* constants for the vm_prot_t
type for the 'prot' variable passed to vm_mmap() and vm_mmap_object()
as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines.
Previously some places were using the mmap()-specific PROT_* constants
instead.  While this happens to work because PROT_xx == VM_PROT_xx,
using VM_PROT_* is more correct.

Differential Revision:	https://reviews.freebsd.org/D2658
Reviewed by:	alc (glanced over), kib
MFC after:	1 month
Sponsored by:	Chelsio
2015-06-04 19:41:15 +00:00
..
i915 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
radeon drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
ttm drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
ati_pcigart.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_agpsupport.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_atomic.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_auth.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_buffer.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_buffer.h drm: Import drm_buffer.[ch] from Linux 3.8-rc3 2013-08-24 16:14:20 +00:00
drm_bufs.c Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
drm_context.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_core.h drm: Call drm_global_init() & drm_global_release() at module load/unload 2013-08-24 15:47:15 +00:00
drm_crtc_helper.c drm: Import Linux commit 9bc3cd5673d84d29272fa7181a4dfca83cbb48c1 2015-03-29 18:45:51 +00:00
drm_crtc_helper.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_crtc.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_crtc.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_dma.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_dp_helper.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_dp_helper.h drm: Import drm_dp_helper.c from Linux 3.8-rc3 2013-08-24 23:38:57 +00:00
drm_dp_iic_helper.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_drv.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_edid_modes.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_edid.c Fix build. 2015-03-17 19:13:11 +00:00
drm_edid.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_fb_helper.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_fb_helper.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_fixed.h drm: Import drm_fixed.h from Linux 3.8 2013-08-25 12:27:15 +00:00
drm_fops.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_fourcc.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_gem_names.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_gem_names.h drm/i915: Add HW context support 2014-09-17 08:28:50 +00:00
drm_gem.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_global.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_global.h
drm_hashtab.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_hashtab.h
drm_ioc32.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_ioctl.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_irq.c CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
drm_linux_list_sort.c drm: Fix build with gcc, broken with r258549 2013-11-25 15:01:59 +00:00
drm_linux_list.h drm: Import list_for_each_entry_safe_from() macro 2013-08-25 10:28:02 +00:00
drm_lock.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_memory.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_mm.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_mm.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_mode.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_modes.c drm: Import Linux commit 9bc3cd5673d84d29272fa7181a4dfca83cbb48c1 2015-03-29 18:45:51 +00:00
drm_os_freebsd.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_os_freebsd.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_pci.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_pciids.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_sarea.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_scatter.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_stub.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_sysctl.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm_vm.c drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drm.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00
drmP.h drm: Update the device-independent code to match Linux 3.8.13 2015-03-17 18:50:33 +00:00