ion: export a few handle-related APIs

There are a few APIs (ion_handle_put and ion_handle_get_by_id) that are
useful for implementing Ion extensions (e.g. custom ioctl
handlers). Remove the `static' to make these APIs available to other Ion
code.

Change-Id: Ice8767853f628d8178e96a36db3da02fa97f3235
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: msm: update custom caching ioctls for new handle format

The userspace API for Ion handles has changed slightly. Update the MSM
caching ioctls to work with the new format.

Change-Id: I6dee3190f5cad117a4d7059f1c7f0f01e05692c0
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: msm: fix bug with handle id handling

0 is not a valid handle id value. If we get a 0 we should try to do the
dma_buf import.

Change-Id: I2b9355a5ad65c91247c0369047f921cf02908b1c
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: kgsl: Fix mem leak when page allocation fails

Page allocation may fail during OOM condition. Update
sglen and size to correct value (allocated) so that
they get freed in kgsl_sharedmem_free().

Change-Id: I1aa0ca77bb767523dfcf0f6cc3a21eac2b6b80e4
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: when unmapping from the mmu flush the entire tlb

Flushes the entire tlb when calling mmu_unmap to make sure there
is no race condition between unmapping and freeing the pages.

Change-Id: I911f8479a3aef2006f9df40a3419284423937542
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>