CHROMIUM: MALI: Fix 32-bit kernels to work

The userspace/kernel ABI for mali_kbase requires being able to pass
64-bit offsets to mmap.  See mali_kbase_mem.h, which says:

 * On a 32bit platform, custom VA should be wired from 4GB
 * to the VA limit of the GPU. Unfortunately, the Linux mmap() interface
 * limits us to 2^32 pages (2^44 bytes, see mmap64 man page for reference).
 * So we put the default limit to the maximum possible on Linux and shrink
 * it down, if required by the GPU, during initialization.

Unfortunately for mali_kbase in commit be83bbf80682 ("mmap: introduce
sane default mmap limits") Linus broke this.  ...but a given driver
can make it work again by setting FMODE_UNSIGNED_OFFSET.  Let's do that.

BUG=chromium:941638
TEST=With series can use the GPU

Change-Id: I5a4f9aeb53808d20f2ec8ed093706ed353e837d8
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1538898
Reviewed-by: John Reitan <john.reitan@arm.corp-partner.google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
diff --git a/drivers/gpu/arm/midgard/mali_kbase_core_linux.c b/drivers/gpu/arm/midgard/mali_kbase_core_linux.c
index 5383c76..0a3535b 100644
--- a/drivers/gpu/arm/midgard/mali_kbase_core_linux.c
+++ b/drivers/gpu/arm/midgard/mali_kbase_core_linux.c
@@ -411,6 +411,12 @@
 	if (kbdev->infinite_cache_active_default)
 		kbase_ctx_flag_set(kctx, KCTX_INFINITE_CACHE);
 
+	/*
+	 * Allow large offsets as per commit be83bbf80682 ("mmap:
+	 * introduce sane default mmap limits")
+	 */
+	filp->f_mode |= FMODE_UNSIGNED_OFFSET;
+
 #ifdef CONFIG_DEBUG_FS
 	snprintf(kctx_name, 64, "%d_%d", kctx->tgid, kctx->id);