summaryrefslogtreecommitdiff
path: root/mali_kbase/mali_kbase_mem_linux.h
diff options
context:
space:
mode:
authorSidath Senanayake <sidaths@google.com>2020-10-27 11:38:49 +0000
committerSidath Senanayake <sidaths@google.com>2020-10-27 11:38:49 +0000
commit72f2457ff7355ff0389efe5bc9cec3365362d8c4 (patch)
tree8f5fb993bd2a8eb181c880b180b6401b46f76620 /mali_kbase/mali_kbase_mem_linux.h
parentd4ca6eb7268ee2db9deabd1745b505c6e1c162f9 (diff)
downloadgpu-72f2457ff7355ff0389efe5bc9cec3365362d8c4.tar.gz
Mali Valhall DDK r27p0 KMD
Provenance: 7e6f74ec1 (collaborate/EAC/v_r27p0) VX504X08X-BU-00000-r27p0-01eac0 - Android DDK VX504X08X-SW-99006-r27p0-01eac0 - Android Renderscript AOSP parts VX504X08X-BU-60000-r27p0-01eac0 - Android Document Bundle VX504X08X-DC-11001-r27p0-01eac0 - Valhall Android DDK Software Errata Signed-off-by: Sidath Senanayake <sidaths@google.com> Change-Id: Ib59de731b034cc7e2631e35f1b0063b8f6894ecc
Diffstat (limited to 'mali_kbase/mali_kbase_mem_linux.h')
-rw-r--r--mali_kbase/mali_kbase_mem_linux.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/mali_kbase/mali_kbase_mem_linux.h b/mali_kbase/mali_kbase_mem_linux.h
index cd094b3..85e030a 100644
--- a/mali_kbase/mali_kbase_mem_linux.h
+++ b/mali_kbase/mali_kbase_mem_linux.h
@@ -194,8 +194,8 @@ int kbase_mem_grow_gpu_mapping(struct kbase_context *kctx,
* Take the provided region and make all the physical pages within it
* reclaimable by the kernel, updating the per-process VM stats as well.
* Remove any CPU mappings (as these can't be removed in the shrinker callback
- * as mmap_sem might already be taken) but leave the GPU mapping intact as
- * and until the shrinker reclaims the allocation.
+ * as mmap_sem/mmap_lock might already be taken) but leave the GPU mapping
+ * intact as and until the shrinker reclaims the allocation.
*
* Note: Must be called with the region lock of the containing context.
*/
@@ -461,4 +461,18 @@ static inline vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma,
}
#endif
+/**
+ * kbase_mem_get_process_mmap_lock - Return the mmap lock for the current process
+ *
+ * Return: the mmap lock for the current process
+ */
+static inline struct rw_semaphore *kbase_mem_get_process_mmap_lock(void)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
+ return &current->mm->mmap_sem;
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) */
+ return &current->mm->mmap_lock;
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0) */
+}
+
#endif /* _KBASE_MEM_LINUX_H_ */