diff options
| author | Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | 2018-12-11 06:54:15 -0800 |
|---|---|---|
| committer | Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> | 2019-06-28 14:20:30 -0700 |
| commit | 22d9e2a8e00a029be125178ddddd1bbf653eb002 (patch) | |
| tree | 7ce9d891c2b47b1a23a23ba3f41ae15b36b21b4d | |
| parent | 092608220442b2ca86ef802cb9599c825f27216b (diff) | |
| download | meta-xilinx-22d9e2a8e00a029be125178ddddd1bbf653eb002.tar.gz | |
kernel-module-mali: Fix errors associated with kernel upgrade to 4.19
These patches fixes errors caused by removal of ancient init_timer API.
Also, addresses the removal of hot/cold cache pages in the kernel.
Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
4 files changed, 226 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 327f8f09..fe2fbdcf 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb +++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb | |||
| @@ -21,6 +21,9 @@ SRC_URI = " \ | |||
| 21 | file://0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch \ | 21 | file://0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch \ |
| 22 | file://0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch \ | 22 | file://0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch \ |
| 23 | file://0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch\ | 23 | file://0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch\ |
| 24 | file://0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch\ | ||
| 25 | file://0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch\ | ||
| 26 | file://0014-linux-mali_-timer-Get-rid-of-init_timer.patch\ | ||
| 24 | " | 27 | " |
| 25 | SRC_URI[md5sum] = "8f04ae86957fd56197ad5a9d017b84ff" | 28 | SRC_URI[md5sum] = "8f04ae86957fd56197ad5a9d017b84ff" |
| 26 | SRC_URI[sha256sum] = "bfd14fa3f75a71d4ba313534e651ca1c58dc354e882c0b39867e335882a06350" | 29 | SRC_URI[sha256sum] = "bfd14fa3f75a71d4ba313534e651ca1c58dc354e882c0b39867e335882a06350" |
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch new file mode 100644 index 00000000..24f0a22c --- /dev/null +++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 779b1883d56804ecd08fe7f57d6c01e3db4e893b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
| 3 | Date: Wed, 5 Dec 2018 18:07:29 -0800 | ||
| 4 | Subject: [PATCH 1/3] linux: mali_memory_os_alloc: Remove __GFP_COLD | ||
| 5 | |||
| 6 | The support for Cache hot and cold pages are removed from the kernel. | ||
| 7 | For more information refer kernel commit 453f85d43fa9ee243f0fc3ac4e1be45615301e3f | ||
| 8 | |||
| 9 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
| 10 | Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
| 11 | Upstream Status: Pending | ||
| 12 | --- | ||
| 13 | driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | 4 +++- | ||
| 14 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | ||
| 17 | index 1602371..830e8c6 100644 | ||
| 18 | --- linux/mali_memory_os_alloc.c | ||
| 19 | +++ b/linux/mali_memory_os_alloc.c | ||
| 20 | @@ -202,7 +202,9 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) | ||
| 21 | /* Allocate new pages, if needed. */ | ||
| 22 | for (i = 0; i < remaining; i++) { | ||
| 23 | dma_addr_t dma_addr; | ||
| 24 | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 25 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) | ||
| 26 | + gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN; | ||
| 27 | +#elif LINUX_VERSION_CODE == KERNEL_VERSION(4, 14, 0) | ||
| 28 | gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN | __GFP_COLD; | ||
| 29 | #else | ||
| 30 | gfp_t flags = __GFP_ZERO | __GFP_REPEAT | __GFP_NOWARN | __GFP_COLD; | ||
| 31 | -- | ||
| 32 | 2.7.4 | ||
| 33 | |||
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch new file mode 100644 index 00000000..c28a83f4 --- /dev/null +++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | From d20b6eb3e48e56558488dbdda98875b1aed0c29f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
| 3 | Date: Wed, 5 Dec 2018 18:13:28 -0800 | ||
| 4 | Subject: [PATCH 2/3] linux: mali_memory_secure: Add header file dma-direct.h | ||
| 5 | |||
| 6 | Add dma-direct.h header, as API dma_to_phys is defined here. | ||
| 7 | refer kernel commit ea8c64ace86647260ec4255f483e5844d62af2df | ||
| 8 | |||
| 9 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
| 10 | Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
| 11 | Upstream Status: Pending | ||
| 12 | --- | ||
| 13 | driver/src/devicedrv/mali/linux/mali_memory_secure.c | 4 ++++ | ||
| 14 | 1 file changed, 4 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c | ||
| 17 | index 2836b1b..4f55fa5 100644 | ||
| 18 | --- linux/mali_memory_secure.c | ||
| 19 | +++ b/linux/mali_memory_secure.c | ||
| 20 | @@ -13,7 +13,11 @@ | ||
| 21 | #include "mali_memory_secure.h" | ||
| 22 | #include "mali_osk.h" | ||
| 23 | #include <linux/mutex.h> | ||
| 24 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) | ||
| 25 | +#include <linux/dma-direct.h> | ||
| 26 | +#else | ||
| 27 | #include <linux/dma-mapping.h> | ||
| 28 | +#endif | ||
| 29 | #include <linux/dma-buf.h> | ||
| 30 | |||
| 31 | _mali_osk_errcode_t mali_mem_secure_attach_dma_buf(mali_mem_secure *secure_mem, u32 size, int mem_fd) | ||
| 32 | -- | ||
| 33 | 2.7.4 | ||
| 34 | |||
diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch new file mode 100644 index 00000000..a7c1d5cc --- /dev/null +++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | From b6936450484b5aa9dd2438367a907af020341d1d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
| 3 | Date: Thu, 6 Dec 2018 13:30:44 -0800 | ||
| 4 | Subject: [PATCH 3/3] linux: mali_*timer: Get rid of init_timer | ||
| 5 | |||
| 6 | kernel 4.19 got rid of ancient init_timer. Hence, replace it with | ||
| 7 | timer_setup API. For more information refer kernel commit | ||
| 8 | 7eeb6b893bd28c68b6d664de1d3120e49b855cdb | ||
| 9 | |||
| 10 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
| 11 | Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
| 12 | Upstream Status: Pending | ||
| 13 | --- | ||
| 14 | driver/src/devicedrv/mali/common/mali_control_timer.c | 6 ++++++ | ||
| 15 | driver/src/devicedrv/mali/common/mali_group.c | 6 ++++++ | ||
| 16 | driver/src/devicedrv/mali/common/mali_osk.h | 15 ++++++++++++++- | ||
| 17 | driver/src/devicedrv/mali/linux/mali_osk_timers.c | 15 ++++++++++++++- | ||
| 18 | 4 files changed, 40 insertions(+), 2 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/driver/src/devicedrv/mali/common/mali_control_timer.c b/driver/src/devicedrv/mali/common/mali_control_timer.c | ||
| 21 | index 1296ffe..d24b934 100644 | ||
| 22 | --- common/mali_control_timer.c | ||
| 23 | +++ b/common/mali_control_timer.c | ||
| 24 | @@ -65,11 +65,17 @@ _mali_osk_errcode_t mali_control_timer_init(void) | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 29 | + mali_control_timer = _mali_osk_timer_init(mali_control_timer_callback); | ||
| 30 | +#else | ||
| 31 | mali_control_timer = _mali_osk_timer_init(); | ||
| 32 | +#endif | ||
| 33 | if (NULL == mali_control_timer) { | ||
| 34 | return _MALI_OSK_ERR_FAULT; | ||
| 35 | } | ||
| 36 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
| 37 | _mali_osk_timer_setcallback(mali_control_timer, mali_control_timer_callback, NULL); | ||
| 38 | +#endif | ||
| 39 | |||
| 40 | return _MALI_OSK_ERR_OK; | ||
| 41 | } | ||
| 42 | diff --git a/driver/src/devicedrv/mali/common/mali_group.c b/driver/src/devicedrv/mali/common/mali_group.c | ||
| 43 | index 5c7b3f4..1702e9a 100644 | ||
| 44 | --- common/mali_group.c | ||
| 45 | +++ b/common/mali_group.c | ||
| 46 | @@ -65,9 +65,15 @@ struct mali_group *mali_group_create(struct mali_l2_cache_core *core, | ||
| 47 | |||
| 48 | group = _mali_osk_calloc(1, sizeof(struct mali_group)); | ||
| 49 | if (NULL != group) { | ||
| 50 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 51 | + group->timeout_timer = _mali_osk_timer_init(mali_group_timeout); | ||
| 52 | +#else | ||
| 53 | group->timeout_timer = _mali_osk_timer_init(); | ||
| 54 | +#endif | ||
| 55 | if (NULL != group->timeout_timer) { | ||
| 56 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
| 57 | _mali_osk_timer_setcallback(group->timeout_timer, mali_group_timeout, (void *)group); | ||
| 58 | +#endif | ||
| 59 | |||
| 60 | group->l2_cache_core[0] = core; | ||
| 61 | _mali_osk_list_init(&group->group_list); | ||
| 62 | diff --git a/driver/src/devicedrv/mali/common/mali_osk.h b/driver/src/devicedrv/mali/common/mali_osk.h | ||
| 63 | index a501778..fe93d79 100644 | ||
| 64 | --- common/mali_osk.h | ||
| 65 | +++ b/common/mali_osk.h | ||
| 66 | @@ -947,7 +947,17 @@ _mali_osk_errcode_t _mali_osk_notification_queue_dequeue(_mali_osk_notification_ | ||
| 67 | * asked for. | ||
| 68 | * | ||
| 69 | * @{ */ | ||
| 70 | - | ||
| 71 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 72 | +/** @brief Initialize a timer | ||
| 73 | + * | ||
| 74 | + * Allocates resources for a new timer, and initializes them. This does not | ||
| 75 | + * start the timer. | ||
| 76 | + * | ||
| 77 | + * @param callback Function to call when timer expires | ||
| 78 | + * @return a pointer to the allocated timer object, or NULL on failure. | ||
| 79 | + */ | ||
| 80 | +_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback); | ||
| 81 | +#else | ||
| 82 | /** @brief Initialize a timer | ||
| 83 | * | ||
| 84 | * Allocates resources for a new timer, and initializes them. This does not | ||
| 85 | @@ -956,6 +966,7 @@ _mali_osk_errcode_t _mali_osk_notification_queue_dequeue(_mali_osk_notification_ | ||
| 86 | * @return a pointer to the allocated timer object, or NULL on failure. | ||
| 87 | */ | ||
| 88 | _mali_osk_timer_t *_mali_osk_timer_init(void); | ||
| 89 | +#endif | ||
| 90 | |||
| 91 | /** @brief Start a timer | ||
| 92 | * | ||
| 93 | @@ -1034,6 +1045,7 @@ void _mali_osk_timer_del_async(_mali_osk_timer_t *tim); | ||
| 94 | */ | ||
| 95 | mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim); | ||
| 96 | |||
| 97 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
| 98 | /** @brief Set a timer's callback parameters. | ||
| 99 | * | ||
| 100 | * This must be called at least once before a timer is started/modified. | ||
| 101 | @@ -1047,6 +1059,7 @@ mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim); | ||
| 102 | * @param data Function-specific data to supply to the function on expiry. | ||
| 103 | */ | ||
| 104 | void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data); | ||
| 105 | +#endif | ||
| 106 | |||
| 107 | /** @brief Terminate a timer, and deallocate resources. | ||
| 108 | * | ||
| 109 | diff --git a/driver/src/devicedrv/mali/linux/mali_osk_timers.c b/driver/src/devicedrv/mali/linux/mali_osk_timers.c | ||
| 110 | index e5d7238..f9b5a86 100644 | ||
| 111 | --- linux/mali_osk_timers.c | ||
| 112 | +++ b/linux/mali_osk_timers.c | ||
| 113 | @@ -21,13 +21,24 @@ | ||
| 114 | struct _mali_osk_timer_t_struct { | ||
| 115 | struct timer_list timer; | ||
| 116 | }; | ||
| 117 | - | ||
| 118 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 119 | +typedef void (*timer_timeout_function_t)(struct timer_list *); | ||
| 120 | +#else | ||
| 121 | typedef void (*timer_timeout_function_t)(unsigned long); | ||
| 122 | +#endif | ||
| 123 | |||
| 124 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 125 | +_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback) | ||
| 126 | +#else | ||
| 127 | _mali_osk_timer_t *_mali_osk_timer_init(void) | ||
| 128 | +#endif | ||
| 129 | { | ||
| 130 | _mali_osk_timer_t *t = (_mali_osk_timer_t *)kmalloc(sizeof(_mali_osk_timer_t), GFP_KERNEL); | ||
| 131 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
| 132 | + if (NULL != t) timer_setup(&t->timer, (timer_timeout_function_t)callback, 0); | ||
| 133 | +#else | ||
| 134 | if (NULL != t) init_timer(&t->timer); | ||
| 135 | +#endif | ||
| 136 | return t; | ||
| 137 | } | ||
| 138 | |||
| 139 | @@ -62,12 +73,14 @@ mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim) | ||
| 140 | return 1 == timer_pending(&(tim->timer)); | ||
| 141 | } | ||
| 142 | |||
| 143 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
| 144 | void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data) | ||
| 145 | { | ||
| 146 | MALI_DEBUG_ASSERT_POINTER(tim); | ||
| 147 | tim->timer.data = (unsigned long)data; | ||
| 148 | tim->timer.function = (timer_timeout_function_t)callback; | ||
| 149 | } | ||
| 150 | +#endif | ||
| 151 | |||
| 152 | void _mali_osk_timer_term(_mali_osk_timer_t *tim) | ||
| 153 | { | ||
| 154 | -- | ||
| 155 | 2.7.4 | ||
| 156 | |||
