summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-bsp/recipes-graphics
diff options
context:
space:
mode:
authorMadhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>2020-02-25 16:54:22 -0800
committerSai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>2020-02-25 22:32:13 -0800
commit3abc67c6f1ae7bd51a3780e0a3af2535d543d47f (patch)
treece437b595f206a21d514c969f4946ff86e999eb0 /meta-xilinx-bsp/recipes-graphics
parentd3c421e4fe7289ed806618fdb97cffb23c89442e (diff)
downloadmeta-xilinx-3abc67c6f1ae7bd51a3780e0a3af2535d543d47f.tar.gz
kernel-module-mali: Make the driver compatible with kernel 5.4
The patch series makes the Mali400 kernel driver compatible with linux kernel 5.4 Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Diffstat (limited to 'meta-xilinx-bsp/recipes-graphics')
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb4
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch47
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch146
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch32
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch36
5 files changed, 265 insertions, 0 deletions
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
index c86fb2ec..a836de15 100644
--- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
@@ -22,6 +22,10 @@ SRC_URI = " \
22 file://0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch\ 22 file://0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch\
23 file://0014-linux-mali_-timer-Get-rid-of-init_timer.patch\ 23 file://0014-linux-mali_-timer-Get-rid-of-init_timer.patch\
24 file://0015-fix-driver-failed-to-check-map-error.patch \ 24 file://0015-fix-driver-failed-to-check-map-error.patch \
25 file://0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch \
26 file://0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch \
27 file://0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch \
28 file://0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch \
25 " 29 "
26SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" 30SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c"
27SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" 31SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b"
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch
new file mode 100644
index 00000000..dc8bbebf
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch
@@ -0,0 +1,47 @@
1From 8cf1dd43f3f25cb4afb84dfc3b0e7c02bc8f7f0c Mon Sep 17 00:00:00 2001
2From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
3Date: Mon, 24 Feb 2020 18:19:37 -0800
4Subject: [LINUX][rel-v2020.1][PATCH v1 1/3] mali_memory_secure: Kernel 5.0
5 onwards 'access_ok' API does not take 'type' as input parameter
6
7'access_ok' no longer needs 'type' as input paramter from kernel 5.0
8onwards.
9
10Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
11---
12 driver/src/devicedrv/mali/linux/mali_ukk_mem.c | 9 +++++++++
13 1 file changed, 9 insertions(+)
14
15diff --git a/driver/src/devicedrv/mali/linux/mali_ukk_mem.c b/driver/src/devicedrv/mali/linux/mali_ukk_mem.c
16index 4ec57dc..270bb6d 100644
17--- linux/mali_ukk_mem.c
18+++ b/linux/mali_ukk_mem.c
19@@ -207,8 +207,13 @@ int mem_write_safe_wrapper(struct mali_session_data *session_data, _mali_uk_mem_
20 kargs.ctx = (uintptr_t)session_data;
21
22 /* Check if we can access the buffers */
23+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
24+ if (!access_ok((const void __user *)kargs.dest, kargs.size)
25+ || !access_ok((const void __user *)kargs.src, kargs.size)) {
26+#else
27 if (!access_ok(VERIFY_WRITE, kargs.dest, kargs.size)
28 || !access_ok(VERIFY_READ, kargs.src, kargs.size)) {
29+#endif
30 return -EINVAL;
31 }
32
33@@ -266,7 +271,11 @@ int mem_dump_mmu_page_table_wrapper(struct mali_session_data *session_data, _mal
34 goto err_exit;
35
36 user_buffer = (void __user *)(uintptr_t)kargs.buffer;
37+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
38+ if (!access_ok(user_buffer, kargs.size))
39+#else
40 if (!access_ok(VERIFY_WRITE, user_buffer, kargs.size))
41+#endif
42 goto err_exit;
43
44 /* allocate temporary buffer (kernel side) to store mmu page table info */
45--
462.7.4
47
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch
new file mode 100644
index 00000000..9c4bbee9
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch
@@ -0,0 +1,146 @@
1From 953cab73b8bc487da330aa454abd7f8c7466737e Mon Sep 17 00:00:00 2001
2From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
3Date: Mon, 24 Feb 2020 18:32:16 -0800
4Subject: [LINUX][rel-v2020.1][PATCH v1 2/3] Support for vm_insert_pfn
5 deprecated from kernel 4.20
6
7From kernel 4.20 onwards, support for vm_insert_pfn is deprecated.
8Hence, replace the same with vmf_insert_pfn.
9
10Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
11---
12 .../devicedrv/mali/linux/mali_memory_block_alloc.c | 6 +++++-
13 driver/src/devicedrv/mali/linux/mali_memory_cow.c | 14 ++++++++++++--
14 .../src/devicedrv/mali/linux/mali_memory_os_alloc.c | 20 +++++++++++++++++---
15 driver/src/devicedrv/mali/linux/mali_memory_secure.c | 7 ++++++-
16 4 files changed, 40 insertions(+), 7 deletions(-)
17
18diff --git a/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c
19index 0c5b6c3..e528699 100644
20--- linux/mali_memory_block_alloc.c
21+++ b/linux/mali_memory_block_alloc.c
22@@ -309,9 +309,13 @@ int mali_mem_block_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *v
23
24 list_for_each_entry(m_page, &block_mem->pfns, list) {
25 MALI_DEBUG_ASSERT(m_page->type == MALI_PAGE_NODE_BLOCK);
26+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
27+ ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
28+ if (unlikely(VM_FAULT_ERROR & ret)) {
29+#else
30 ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
31-
32 if (unlikely(0 != ret)) {
33+#endif
34 return -EFAULT;
35 }
36 addr += _MALI_OSK_MALI_PAGE_SIZE;
37diff --git a/driver/src/devicedrv/mali/linux/mali_memory_cow.c b/driver/src/devicedrv/mali/linux/mali_memory_cow.c
38index f1d44fe..1dae1d6 100644
39--- linux/mali_memory_cow.c
40+++ b/linux/mali_memory_cow.c
41@@ -532,9 +532,14 @@ int mali_mem_cow_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma
42 * flush which makes it way slower than remap_pfn_range or vm_insert_pfn.
43 ret = vm_insert_page(vma, addr, page);
44 */
45+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
46+ ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
47+ if (unlikely(VM_FAULT_ERROR & ret)) {
48+#else
49 ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
50-
51 if (unlikely(0 != ret)) {
52+#endif
53+
54 return ret;
55 }
56 addr += _MALI_OSK_MALI_PAGE_SIZE;
57@@ -569,9 +574,14 @@ _mali_osk_errcode_t mali_mem_cow_cpu_map_pages_locked(mali_mem_backend *mem_bken
58
59 list_for_each_entry(m_page, &cow->pages, list) {
60 if ((count >= offset) && (count < offset + num)) {
61+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
62+ ret = vmf_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
63+ if (unlikely(VM_FAULT_ERROR & ret)) {
64+#else
65 ret = vm_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
66-
67 if (unlikely(0 != ret)) {
68+#endif
69+
70 if (count == offset) {
71 return _MALI_OSK_ERR_FAULT;
72 } else {
73diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c
74index 3fb6f05..7de3920 100644
75--- linux/mali_memory_os_alloc.c
76+++ b/linux/mali_memory_os_alloc.c
77@@ -378,9 +378,14 @@ int mali_mem_os_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma)
78 ret = vm_insert_page(vma, addr, page);
79 */
80 page = m_page->page;
81+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
82+ ret = vmf_insert_pfn(vma, addr, page_to_pfn(page));
83+ if (unlikely(VM_FAULT_ERROR & ret)) {
84+#else
85 ret = vm_insert_pfn(vma, addr, page_to_pfn(page));
86-
87 if (unlikely(0 != ret)) {
88+#endif
89+
90 return -EFAULT;
91 }
92 addr += _MALI_OSK_MALI_PAGE_SIZE;
93@@ -416,9 +421,13 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken
94
95 vm_end -= _MALI_OSK_MALI_PAGE_SIZE;
96 if (mapping_page_num > 0) {
97+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
98+ ret = vmf_insert_pfn(vma, vm_end, page_to_pfn(m_page->page));
99+ if (unlikely(VM_FAULT_ERROR & ret)) {
100+#else
101 ret = vm_insert_pfn(vma, vm_end, page_to_pfn(m_page->page));
102-
103 if (unlikely(0 != ret)) {
104+#endif
105 /*will return -EBUSY If the page has already been mapped into table, but it's OK*/
106 if (-EBUSY == ret) {
107 break;
108@@ -439,9 +448,14 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken
109 list_for_each_entry(m_page, &os_mem->pages, list) {
110 if (count >= offset) {
111
112+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
113+ ret = vmf_insert_pfn(vma, vstart, page_to_pfn(m_page->page));
114+ if (unlikely(VM_FAULT_ERROR & ret)) {
115+#else
116 ret = vm_insert_pfn(vma, vstart, page_to_pfn(m_page->page));
117-
118 if (unlikely(0 != ret)) {
119+#endif
120+
121 /*will return -EBUSY If the page has already been mapped into table, but it's OK*/
122 if (-EBUSY == ret) {
123 break;
124diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c
125index 5546304..cebd1c8 100644
126--- linux/mali_memory_secure.c
127+++ b/linux/mali_memory_secure.c
128@@ -132,9 +132,14 @@ int mali_mem_secure_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *
129 MALI_DEBUG_ASSERT(0 == size % _MALI_OSK_MALI_PAGE_SIZE);
130
131 for (j = 0; j < size / _MALI_OSK_MALI_PAGE_SIZE; j++) {
132+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
133+ ret = vmf_insert_pfn(vma, addr, PFN_DOWN(phys));
134+ if (unlikely(VM_FAULT_ERROR & ret)) {
135+#else
136 ret = vm_insert_pfn(vma, addr, PFN_DOWN(phys));
137-
138 if (unlikely(0 != ret)) {
139+#endif
140+
141 return -EFAULT;
142 }
143 addr += _MALI_OSK_MALI_PAGE_SIZE;
144--
1452.7.4
146
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch
new file mode 100644
index 00000000..9797db62
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch
@@ -0,0 +1,32 @@
1From ad5c569f0cc40698699fc2f2c1db3ceb9f8b8f35 Mon Sep 17 00:00:00 2001
2From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
3Date: Tue, 25 Feb 2020 11:36:01 -0800
4Subject: [LINUX][rel-v2020.1][PATCH v1 3/3] Change return type to vm_fault_t
5 for fault handler
6
7From kernel 4.17 onwards the return type of fault handler for
8vm_operations is of type 'vm_fault_t'.
9
10Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
11---
12 driver/src/devicedrv/mali/linux/mali_memory.c | 4 +++-
13 1 file changed, 3 insertions(+), 1 deletion(-)
14
15diff --git a/driver/src/devicedrv/mali/linux/mali_memory.c b/driver/src/devicedrv/mali/linux/mali_memory.c
16index c0f0982..2b2b209 100644
17--- linux/mali_memory.c
18+++ b/linux/mali_memory.c
19@@ -70,7 +70,9 @@ static void mali_mem_vma_close(struct vm_area_struct *vma)
20 }
21 }
22
23-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
24+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
25+static vm_fault_t mali_mem_vma_fault(struct vm_fault *vmf)
26+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
27 static int mali_mem_vma_fault(struct vm_fault *vmf)
28 #else
29 static int mali_mem_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
30--
312.7.4
32
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch
new file mode 100644
index 00000000..154bb673
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch
@@ -0,0 +1,36 @@
1From c6a6b39cea3fdfd91cae7f2a4ef6f36d2c55fdd6 Mon Sep 17 00:00:00 2001
2From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
3Date: Tue, 25 Feb 2020 15:17:17 -0800
4Subject: [LINUX][rel-v2020.1][PATCH v1] "get_monotonic_boottime(&ts)"
5 deprecated from kernel 4.20 onwards
6
7As "get_monotonic_boottime(&ts)" is deprecated, replace the same with
8"ktime_get_boottime_ts64(&ts)". Refer kernel commit ID
9976516404ff3fab2a8caa8bd6f5efc1437fed0b8
10
11Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
12---
13 driver/src/devicedrv/mali/linux/mali_osk_time.c | 6 ++++++
14 1 file changed, 6 insertions(+)
15
16diff --git a/driver/src/devicedrv/mali/linux/mali_osk_time.c b/driver/src/devicedrv/mali/linux/mali_osk_time.c
17index 03046a5..bfcbf7f 100644
18--- linux/mali_osk_time.c
19+++ b/linux/mali_osk_time.c
20@@ -53,7 +53,13 @@ u64 _mali_osk_time_get_ns(void)
21
22 u64 _mali_osk_boot_time_get_ns(void)
23 {
24+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
25+ struct timespec64 tsval;
26+ ktime_get_boottime_ts64(&tsval);
27+ return (u64)timespec64_to_ns(&tsval);
28+#else
29 struct timespec tsval;
30 get_monotonic_boottime(&tsval);
31 return (u64)timespec_to_ns(&tsval);
32+#endif
33 }
34--
352.7.4
36