freebsd-nq/sys/dev/drm
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
..
ati_pcigart.c Add missing calls to bus_dmamap_unload() when freeing static DMA 2014-06-13 18:20:44 +00:00
drm_agpsupport.c Do a sweep of the tree replacing calls to pci_find_extcap() with calls to 2011-03-23 13:10:15 +00:00
drm_atomic.h
drm_auth.c
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_dma.c
drm_drawable.c
drm_drv.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
drm_fops.c Streamline use of cdevpriv and correct some corner cases. 2012-08-15 16:19:39 +00:00
drm_hashtab.c
drm_hashtab.h
drm_internal.h
drm_ioctl.c
drm_irq.c
drm_linux_list.h
drm_lock.c
drm_memory.c
drm_mm.c
drm_mm.h
drm_pci.c Add missing calls to bus_dmamap_unload() when freeing static DMA 2014-06-13 18:20:44 +00:00
drm_pciids.h
drm_sarea.h Remove ia64. 2014-07-07 00:27:09 +00:00
drm_scatter.c Replace kernel virtual address space allocation with vmem. This provides 2013-08-07 06:21:20 +00:00
drm_sman.c
drm_sman.h
drm_sysctl.c Adjust printf format specifiers for dev_t and ino_t in kernel. 2014-12-17 07:27:19 +00:00
drm_vm.c
drm.h Remove ia64. 2014-07-07 00:27:09 +00:00
drmP.h Back out r261266 pending security buy-in. 2014-01-31 17:39:51 +00:00
i915_dma.c
i915_drm.h
i915_drv.c
i915_drv.h Do not define bool/true/false if the symbols already exist. 2011-12-12 18:43:24 +00:00
i915_irq.c
i915_mem.c
i915_reg.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
i915_suspend.c
mach64_dma.c In sys/dev/drm/mach64_dma.c, remove static function mach64_set_dma_eol(), 2013-12-26 00:11:19 +00:00
mach64_drm.h
mach64_drv.c
mach64_drv.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
mach64_irq.c
mach64_state.c
mga_dma.c
mga_drm.h
mga_drv.c
mga_drv.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
mga_irq.c
mga_state.c
mga_ucode.h
mga_warp.c
r128_cce.c
r128_drm.h
r128_drv.c
r128_drv.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
r128_irq.c
r128_state.c
r300_cmdbuf.c
r300_reg.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
r600_blit.c Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
r600_cp.c
r600_microcode.h
radeon_cp.c Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
radeon_cs.c
radeon_drm.h
radeon_drv.c
radeon_drv.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
radeon_irq.c
radeon_mem.c
radeon_microcode.h
radeon_state.c In sys/dev/drm/radeon_state.c, use the correct printf length modifiers 2011-12-30 02:07:50 +00:00
savage_bci.c
savage_drm.h
savage_drv.c
savage_drv.h
savage_state.c
sis_drm.h
sis_drv.c
sis_drv.h
sis_ds.c
sis_ds.h
sis_mm.c
tdfx_drv.c
tdfx_drv.h
via_3d_reg.h
via_dma.c Cast VIA_READ to (void) where the result is unused. 2012-11-09 14:46:23 +00:00
via_dmablit.c - Modify vm_page_unwire() and vm_page_enqueue() to directly accept 2014-06-16 18:15:27 +00:00
via_dmablit.h
via_drm.h
via_drv.c
via_drv.h
via_irq.c Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
via_map.c
via_mm.c
via_verifier.c
via_verifier.h
via_video.c