summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-bsp/recipes-graphics/mali
diff options
context:
space:
mode:
authorDylan Yip <dylan.yip@xilinx.com>2021-02-10 10:06:59 -0800
committerSai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>2021-07-14 14:22:32 -0700
commit4952cc30ca5f63a7a06e2c10d8e760430dfb08f1 (patch)
tree379ad725fcf108ec968bc7aad1a73b001a869bd3 /meta-xilinx-bsp/recipes-graphics/mali
parentf78c0fb72693da1d4d8109445778a10e1ec3e423 (diff)
downloadmeta-xilinx-4952cc30ca5f63a7a06e2c10d8e760430dfb08f1.tar.gz
kernel-module-mali: Update to compile with kernel v5.10
Update patches to compile mali drivers with kernel v5.10 Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Diffstat (limited to 'meta-xilinx-bsp/recipes-graphics/mali')
-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/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch92
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch37
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch38
-rw-r--r--meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch33
5 files changed, 204 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 f16758e8..cfb03dcb 100644
--- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
@@ -26,6 +26,10 @@ SRC_URI = " \
26 file://0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.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 \ 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 \ 28 file://0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch \
29 file://0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch \
30 file://0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch \
31 file://0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch \
32 file://0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch \
29 " 33 "
30SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" 34SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c"
31SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" 35SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b"
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch
new file mode 100644
index 00000000..9a72b9b2
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch
@@ -0,0 +1,92 @@
1From cbc2351e8acf7ed38f6d965e5ea21620e45eda30 Mon Sep 17 00:00:00 2001
2From: Dylan Yip <dylan.yip@xilinx.com>
3Date: Tue, 9 Feb 2021 10:05:41 -0800
4Subject: [PATCH 20/23] Fix ioremap_nocache() deprecation in kernel 5.6
5
6As of commit 4bdc0d676a643140 ("remove ioremap_nocache and
7devm_ioremap_nocache") from kernel 5.6, ioremap_nocache has been
8removed because ioremap is already non-cached by default. So replace all
9calls with ioremap.
10
11Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
12---
13 linux/mali_memory_cow.c | 4 ++++
14 linux/mali_osk_low_level_mem.c | 4 ++++
15 platform/arm/arm.c | 12 ++++++++++++
16 3 files changed, 20 insertions(+)
17
18diff --git a/linux/mali_memory_cow.c b/linux/mali_memory_cow.c
19index 1dae1d6..6fadd42 100644
20--- a/linux/mali_memory_cow.c
21+++ b/linux/mali_memory_cow.c
22@@ -693,7 +693,11 @@ void _mali_mem_cow_copy_page(mali_page_node *src_node, mali_page_node *dst_node)
23 /*
24 * use ioremap to map src for BLOCK memory
25 */
26+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
27+ src = ioremap(_mali_page_node_get_dma_addr(src_node), _MALI_OSK_MALI_PAGE_SIZE);
28+#else
29 src = ioremap_nocache(_mali_page_node_get_dma_addr(src_node), _MALI_OSK_MALI_PAGE_SIZE);
30+#endif
31 memcpy(dst, src , _MALI_OSK_MALI_PAGE_SIZE);
32 iounmap(src);
33 }
34diff --git a/linux/mali_osk_low_level_mem.c b/linux/mali_osk_low_level_mem.c
35index 84f93d9..5a0a725 100644
36--- a/linux/mali_osk_low_level_mem.c
37+++ b/linux/mali_osk_low_level_mem.c
38@@ -33,7 +33,11 @@ void _mali_osk_write_mem_barrier(void)
39
40 mali_io_address _mali_osk_mem_mapioregion(uintptr_t phys, u32 size, const char *description)
41 {
42+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
43+ return (mali_io_address)ioremap(phys, size);
44+#else
45 return (mali_io_address)ioremap_nocache(phys, size);
46+#endif
47 }
48
49 void _mali_osk_mem_unmapioregion(uintptr_t phys, u32 size, mali_io_address virt)
50diff --git a/platform/arm/arm.c b/platform/arm/arm.c
51index b2fb746..e468263 100644
52--- a/platform/arm/arm.c
53+++ b/platform/arm/arm.c
54@@ -98,7 +98,11 @@ static int mali_secure_mode_init_juno(void)
55
56 MALI_DEBUG_ASSERT(NULL == secure_mode_mapped_addr);
57
58+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
59+ secure_mode_mapped_addr = ioremap(phys_addr_page, map_size);
60+#else
61 secure_mode_mapped_addr = ioremap_nocache(phys_addr_page, map_size);
62+#endif
63 if (NULL != secure_mode_mapped_addr) {
64 return mali_gpu_reset_and_secure_mode_disable_juno();
65 }
66@@ -588,7 +592,11 @@ static u32 mali_read_phys(u32 phys_addr)
67 u32 phys_offset = phys_addr & 0x00001FFF;
68 u32 map_size = phys_offset + sizeof(u32);
69 u32 ret = 0xDEADBEEF;
70+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
71+ void *mem_mapped = ioremap(phys_addr_page, map_size);
72+#else
73 void *mem_mapped = ioremap_nocache(phys_addr_page, map_size);
74+#endif
75 if (NULL != mem_mapped) {
76 ret = (u32)ioread32(((u8 *)mem_mapped) + phys_offset);
77 iounmap(mem_mapped);
78@@ -604,7 +612,11 @@ static void mali_write_phys(u32 phys_addr, u32 value)
79 u32 phys_addr_page = phys_addr & 0xFFFFE000;
80 u32 phys_offset = phys_addr & 0x00001FFF;
81 u32 map_size = phys_offset + sizeof(u32);
82+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
83+ void *mem_mapped = ioremap(phys_addr_page, map_size);
84+#else
85 void *mem_mapped = ioremap_nocache(phys_addr_page, map_size);
86+#endif
87 if (NULL != mem_mapped) {
88 iowrite32(value, ((u8 *)mem_mapped) + phys_offset);
89 iounmap(mem_mapped);
90--
912.17.1
92
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch
new file mode 100644
index 00000000..adef8e18
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch
@@ -0,0 +1,37 @@
1From bc0f85271681532c7e394229f0155366d1de8779 Mon Sep 17 00:00:00 2001
2From: Dylan Yip <dylan.yip@xilinx.com>
3Date: Mon, 8 Feb 2021 23:47:01 -0800
4Subject: [PATCH 21/23] Use updated timekeeping functions in kernel 5.6
5
6As of commit 412c53a680a9 ("y2038: remove unused time32 interfaces"), 32
7bit timekeeping functions like getnstimeofday() have been removed. So
8use the 64 bit replacements.
9
10Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
11---
12 linux/mali_osk_time.c | 6 ++++++
13 1 file changed, 6 insertions(+)
14
15diff --git a/linux/mali_osk_time.c b/linux/mali_osk_time.c
16index bfcbf7f..583d82b 100644
17--- a/linux/mali_osk_time.c
18+++ b/linux/mali_osk_time.c
19@@ -46,9 +46,15 @@ void _mali_osk_time_ubusydelay(u32 usecs)
20
21 u64 _mali_osk_time_get_ns(void)
22 {
23+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
24+ struct timespec64 tsval;
25+ ktime_get_real_ts64(&tsval);
26+ return (u64)timespec64_to_ns(&tsval);
27+#else
28 struct timespec tsval;
29 getnstimeofday(&tsval);
30 return (u64)timespec_to_ns(&tsval);
31+#endif
32 }
33
34 u64 _mali_osk_boot_time_get_ns(void)
35--
362.17.1
37
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch
new file mode 100644
index 00000000..181df7b7
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch
@@ -0,0 +1,38 @@
1From d17933b6909cc29103befc2ef4e6cf413d9e8fb6 Mon Sep 17 00:00:00 2001
2From: Dylan Yip <dylan.yip@xilinx.com>
3Date: Tue, 9 Feb 2021 08:58:44 -0800
4Subject: [PATCH 22/23] Set HAVE_UNLOCKED_IOCTL default to true
5
6As of commit b19dd42faf41 ("bkl: Remove locked .ioctl file operation")
7of kernel 2.6, the ioctl operation has been replaced with
8unlocked_ioctl. Since this change has been around for almost 10 years,
9go ahead and set the default HAVE_UNLOCKED_IOCTL to be true.
10
11Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
12---
13 Kbuild | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/Kbuild b/Kbuild
17index 02c3f3d..8c6e6e0 100644
18--- a/Kbuild
19+++ b/Kbuild
20@@ -21,6 +21,7 @@ MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0
21 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0
22 MALI_UPPER_HALF_SCHEDULING ?= 1
23 MALI_ENABLE_CPU_CYCLES ?= 0
24+HAVE_UNLOCKED_IOCTL ?= 1
25
26 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
27 # The ARM proprietary product will only include the license/proprietary directory
28@@ -179,6 +180,7 @@ ccflags-y += -DMALI_STATE_TRACKING=1
29 ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
30 ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
31 ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)
32+ccflags-y += -DHAVE_UNLOCKED_IOCTL=$(HAVE_UNLOCKED_IOCTL)
33
34 ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
35 ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
36--
372.17.1
38
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch
new file mode 100644
index 00000000..bab2bd37
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch
@@ -0,0 +1,33 @@
1From e2b52e358e0e030d3881ef80ef09de3662b41210 Mon Sep 17 00:00:00 2001
2From: Dylan Yip <dylan.yip@xilinx.com>
3Date: Tue, 9 Feb 2021 09:48:01 -0800
4Subject: [PATCH 23/23] Use PTR_ERR_OR_ZERO instead of PTR_RET
5
6As of commit fad7c9020948 ("err.h: remove deprecated PTR_RET for good")
7in kernel 5.7, PTR_RET has been removed and replaced with
8PTR_ERR_OR_ZERO. So use this API instead.
9
10Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
11---
12 linux/mali_memory_dma_buf.c | 4 ++++
13 1 file changed, 4 insertions(+)
14
15diff --git a/linux/mali_memory_dma_buf.c b/linux/mali_memory_dma_buf.c
16index 905cd8b..fcdcaac 100644
17--- a/linux/mali_memory_dma_buf.c
18+++ b/linux/mali_memory_dma_buf.c
19@@ -281,7 +281,11 @@ int mali_dma_buf_get_size(struct mali_session_data *session, _mali_uk_dma_buf_ge
20 buf = dma_buf_get(fd);
21 if (IS_ERR_OR_NULL(buf)) {
22 MALI_DEBUG_PRINT_ERROR(("Failed to get dma-buf from fd: %d\n", fd));
23+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)
24+ return PTR_ERR_OR_ZERO(buf);
25+#else
26 return PTR_RET(buf);
27+#endif
28 }
29
30 if (0 != put_user(buf->size, &user_arg->size)) {
31--
322.17.1
33