Ensure that the signals are properly destroyed in enta_free()

etna_create() allocates six signals, one for the context and one per
allocated command buffer.  etna_free() cleans up the command buffers,
but fails to clean up the signals which etna_create() allocated.  Fix
this oversight.

Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Add viv_ioctl() interface

Add a viv_ioctl() interface to provide an etnaviv version of
gcoOS_DeviceControl().  This allows us to temporarily extend galcore
with features that it otherwise would not have (such as my DMA buf
import, and support for user memory mapping of regions marked
read-only.)

Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Properly handle ioctl() returning EINTR

Jon Nettleton's kernel galcore driver can return EINTR while waiting
for user signals.  With this galcore version, if we are waiting on a
command buffer galcore signal (to indicate that the buffer is now
available for re-use), and we are sent a user signal (eg, SIGALRM),
then ioctl() may return EINTR.

This causes etnaviv to believe that the galcore signal was received,
and it is safe to proceed with the next command buffer.  In reality,
this can cause the GPU to scribble over memory which it should not,
and can cause the entire platform to lock up.

Signed-off-by: Russell King <rmk@arm.linux.org.uk>
GCABI for 4.6.9 iMX galcore

Add header files and etnaviv configuration for the 4.6.9 iMX galcore
version, found in (at least) Jon Nettleton's 3.14.14 kernel.

Signed-off-by: Jon Nettleton <jon.nettleton@gmail.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Fix viv_map_user_memory() for 4.6.9 iMX GCABI

The 4.6.9 iMX GCABI has a .physical member added to the MapUserMemory
structure, which must be initialised to ~0 to map by virtual address.

Introduce a new conditional "GCABI_MAPUSERMEMORY_HAS_PHYSICAL" to
indicate the presence of this member and arrange to initialise it
appropriately in viv_map_user_memory().

Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Add support to import dmabuf fds into etnaviv

dmabufs are DMA buffers which can be passed between kernel drivers
under the control of userspace by means of a file descriptor.  Add
support to import dmabufs into etnaviv, creating an etna_bo for
them which can be released using the normal methods.

Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Add support to permit mapping memory with protection info

The standard galcore user memory mapping function fails when asked to
map read-only memory, such as X shmem buffers.  The reason these fail
is because get_user_pages() is always attempted with "write" mode
enabled, which is not permissible with read-only mappings.

To allow this to work (so that Xv can be implemented efficiently) we
must be able to map read-only buffers.  This adds an extension to
etnaviv, found in my Dove galcore driver and Jon Nettleton's iMX6
kernels which permit this without changing the existing galcore APIs.

Signed-off-by: Russell King <rmk@arm.linux.org.uk>