diff options
Diffstat (limited to 'meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali')
10 files changed, 291 insertions, 222 deletions
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb index fe2fbdcf5..747ec724c 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb @@ -3,10 +3,10 @@ SECTION = "kernel/modules" LICENSE = "GPLv2" LIC_FILES_CHKSUM = " \ - file://linux/license/gpl/mali_kernel_license.h;md5=436192a2c5cfd47df0ad1987dffc4ae6 \ + file://linux/license/gpl/mali_kernel_license.h;md5=f5af2d61f4c1eb262cb6a557aaa1070a \ " -PV = "r8p0-01rel0" +PV = "r9p0-01rel0" SRC_URI = " \ https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-${PV}.tgz \ @@ -16,21 +16,23 @@ SRC_URI = " \ file://0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch \ file://0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch \ file://0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch \ - file://0007-Replace-__GFP_REPEAT-by-__GFP_RETRY_MAYFAIL.patch \ - file://0008-mali_internal_sync-Rename-wait_queue_t-with-wait_que.patch \ - file://0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch \ file://0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch \ file://0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch\ file://0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch\ file://0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch\ file://0014-linux-mali_-timer-Get-rid-of-init_timer.patch\ + file://0015-fix-driver-failed-to-check-map-error.patch \ + file://0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch \ + file://0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch \ + file://0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch \ + file://0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch \ " -SRC_URI[md5sum] = "8f04ae86957fd56197ad5a9d017b84ff" -SRC_URI[sha256sum] = "bfd14fa3f75a71d4ba313534e651ca1c58dc354e882c0b39867e335882a06350" +SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" +SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" inherit module -do_make_scripts[depends] += "virtual/kernel:do_unpack" +PARALLEL_MAKE = "-j 1" S = "${WORKDIR}/DX910-SW-99002-${PV}/driver/src/devicedrv/mali" @@ -38,7 +40,7 @@ COMPATIBLE_MACHINE = "^$" COMPATIBLE_MACHINE_zynqmpeg = "zynqmpeg" COMPATIBLE_MACHINE_zynqmpev = "zynqmpev" -PACKAGE_ARCH = "${SOC_FAMILY}${SOC_VARIANT}" +PACKAGE_ARCH = "${SOC_VARIANT_ARCH}" EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \ ARCH="${ARCH}" \ @@ -47,6 +49,5 @@ EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \ USING_DT=1 \ MALI_SHARED_INTERRUPTS=1 \ CROSS_COMPILE="${TARGET_PREFIX}" \ - O=${STAGING_KERNEL_BUILDDIR} \ MALI_QUIET=1 \ ' diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch index e5eeb19fd..3c82f602a 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch @@ -21,9 +21,9 @@ index 5a259fe..a6dd94c 100644 -include $(KDIR)/.config +ifeq ($(O),) -+ include $(KDIR)/.config ++ -include $(KDIR)/.config +else -+ include $(O)/.config ++ -include $(O)/.config +endif ifeq ($(ARCH), arm) diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-Replace-__GFP_REPEAT-by-__GFP_RETRY_MAYFAIL.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-Replace-__GFP_REPEAT-by-__GFP_RETRY_MAYFAIL.patch deleted file mode 100644 index 6e5f54479..000000000 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-Replace-__GFP_REPEAT-by-__GFP_RETRY_MAYFAIL.patch +++ /dev/null @@ -1,54 +0,0 @@ -From a8190cd3b346633016d1c0096ef73e0e1ceef438 Mon Sep 17 00:00:00 2001 -From: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Date: Tue, 5 Dec 2017 09:25:15 -0800 -Subject: [PATCH 7/9] Replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL - -Refer kernel patch dcda9b04713c3f6ff0875652924844fae28286ea -which replaces with a useful semantic - -Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Upstream-Status: Pending ---- - driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | 4 ++++ - driver/src/devicedrv/mali/linux/mali_osk_notification.c | 7 ++++++- - 2 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c -index 5fe1270..1602371 100644 ---- linux/mali_memory_os_alloc.c -+++ b/linux/mali_memory_os_alloc.c -@@ -202,7 +202,11 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) - /* Allocate new pages, if needed. */ - for (i = 0; i < remaining; i++) { - dma_addr_t dma_addr; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) -+ gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN | __GFP_COLD; -+#else - gfp_t flags = __GFP_ZERO | __GFP_REPEAT | __GFP_NOWARN | __GFP_COLD; -+#endif - int err; - - #if defined(CONFIG_ARM) && !defined(CONFIG_ARM_LPAE) -diff --git a/driver/src/devicedrv/mali/linux/mali_osk_notification.c b/driver/src/devicedrv/mali/linux/mali_osk_notification.c -index b22fe68..d0c302a 100644 ---- linux/mali_osk_notification.c -+++ b/linux/mali_osk_notification.c -@@ -55,9 +55,14 @@ _mali_osk_notification_t *_mali_osk_notification_create(u32 type, u32 size) - { - /* OPT Recycling of notification objects */ - _mali_osk_notification_wrapper_t *notification; -- -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) -+ notification = (_mali_osk_notification_wrapper_t *)kmalloc(sizeof(_mali_osk_notification_wrapper_t) + size, -+ GFP_KERNEL | __GFP_HIGH | __GFP_RETRY_MAYFAIL); -+#else - notification = (_mali_osk_notification_wrapper_t *)kmalloc(sizeof(_mali_osk_notification_wrapper_t) + size, - GFP_KERNEL | __GFP_HIGH | __GFP_REPEAT); -+#endif -+ - if (NULL == notification) { - MALI_DEBUG_PRINT(1, ("Failed to create a notification object\n")); - return NULL; --- -2.7.4 - diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0008-mali_internal_sync-Rename-wait_queue_t-with-wait_que.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0008-mali_internal_sync-Rename-wait_queue_t-with-wait_que.patch deleted file mode 100644 index 592fea04e..000000000 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0008-mali_internal_sync-Rename-wait_queue_t-with-wait_que.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 717d7899f6d8048c6b88b3c52e8a9c8afbddbb65 Mon Sep 17 00:00:00 2001 -From: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Date: Tue, 5 Dec 2017 09:48:42 -0800 -Subject: [PATCH 8/9] mali_internal_sync: Rename wait_queue_t with - wait_queue_entry_t - -Refer kernel patch ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f -and 2055da which replaces the struct name - -Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Upstream-Status: Pending ---- - .../src/devicedrv/mali/linux/mali_internal_sync.c | 27 ++++++++++++++++++++-- - .../src/devicedrv/mali/linux/mali_internal_sync.h | 4 ++++ - 2 files changed, 29 insertions(+), 2 deletions(-) - -diff --git a/driver/src/devicedrv/mali/linux/mali_internal_sync.c b/driver/src/devicedrv/mali/linux/mali_internal_sync.c -index 1f2574e..957a056 100644 ---- linux/mali_internal_sync.c -+++ b/linux/mali_internal_sync.c -@@ -121,8 +121,13 @@ static void mali_internal_sync_fence_add_fence(struct mali_internal_sync_fence * - } - #endif - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -+static int mali_internal_sync_fence_wake_up_wq(wait_queue_entry_t *curr, unsigned mode, -+ int wake_flags, void *key) -+#else - static int mali_internal_sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, - int wake_flags, void *key) -+#endif - { - struct mali_internal_sync_fence_waiter *wait; - MALI_IGNORE(mode); -@@ -130,8 +135,12 @@ static int mali_internal_sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode - MALI_IGNORE(key); - - wait = container_of(curr, struct mali_internal_sync_fence_waiter, work); -- list_del_init(&wait->work.task_list); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -+ list_del_init(&wait->work.entry); -+#else -+ list_del_init(&wait->work.task_list); -+#endif - wait->callback(wait->work.private, wait); - return 1; - } -@@ -498,7 +507,11 @@ void mali_internal_sync_fence_waiter_init(struct mali_internal_sync_fence_waiter - MALI_DEBUG_ASSERT_POINTER(waiter); - MALI_DEBUG_ASSERT_POINTER(callback); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -+ INIT_LIST_HEAD(&waiter->work.entry); -+#else - INIT_LIST_HEAD(&waiter->work.task_list); -+#endif - waiter->callback = callback; - } - -@@ -560,8 +573,13 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe - spin_lock_irqsave(&sync_fence->wq.lock, flags); - err = sync_fence->fence->ops->signaled(sync_fence->fence); - -- if (0 == err) -+ if (0 == err){ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -+ __add_wait_queue_entry_tail(&sync_fence->wq, &waiter->work); -+#else - __add_wait_queue_tail(&sync_fence->wq, &waiter->work); -+#endif -+ } - spin_unlock_irqrestore(&sync_fence->wq.lock, flags); - - return err; -@@ -578,8 +596,13 @@ int mali_internal_sync_fence_cancel_async(struct mali_internal_sync_fence *sync_ - MALI_DEBUG_ASSERT_POINTER(waiter); - - spin_lock_irqsave(&sync_fence->wq.lock, flags); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -+ if (!list_empty(&waiter->work.entry)) -+ list_del_init(&waiter->work.entry); -+#else - if (!list_empty(&waiter->work.task_list)) - list_del_init(&waiter->work.task_list); -+#endif - else - ret = -ENOENT; - spin_unlock_irqrestore(&sync_fence->wq.lock, flags); -diff --git a/driver/src/devicedrv/mali/linux/mali_internal_sync.h b/driver/src/devicedrv/mali/linux/mali_internal_sync.h -index a5655c7..70f29f9 100644 ---- linux/mali_internal_sync.h -+++ b/linux/mali_internal_sync.h -@@ -112,7 +112,11 @@ typedef void (*mali_internal_sync_callback_t)(struct mali_internal_sync_fence *s - struct mali_internal_sync_fence_waiter *waiter); - - struct mali_internal_sync_fence_waiter { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -+ wait_queue_entry_t work; -+#else - wait_queue_t work; -+#endif - mali_internal_sync_callback_t callback; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) - #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) --- -2.7.4 - diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch deleted file mode 100644 index 3445512c7..000000000 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 478de18bf513ecad419d25981e7b66c78126752c Mon Sep 17 00:00:00 2001 -From: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Date: Tue, 5 Dec 2017 09:58:36 -0800 -Subject: [PATCH 9/9] mali_memory_swap_alloc.c: Rename global_page_state with - global_zone_page_state - -Refer Kernel commit c41f012ade0b95b0a6e25c7150673e0554736165 -Which simply renames without any functional changes - -Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Upstream-Status: Pending ---- - driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c -index a54faca..e122b4c 100644 ---- linux/mali_memory_swap_alloc.c -+++ b/linux/mali_memory_swap_alloc.c -@@ -248,7 +248,11 @@ static void mali_mem_swap_swapped_bkend_pool_shrink(_mali_mem_swap_pool_shrink_t - } - - /* Get system free pages number. */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) -+ system_free_size = global_zone_page_state(NR_FREE_PAGES) * PAGE_SIZE; -+#else - system_free_size = global_page_state(NR_FREE_PAGES) * PAGE_SIZE; -+#endif - last_gpu_utilization = _mali_ukk_utilization_gp_pp(); - - if ((last_gpu_utilization < gpu_utilization_threshold_value) -@@ -575,8 +579,12 @@ int mali_mem_swap_alloc_pages(mali_mem_swap *swap_mem, u32 size, u32 *bkend_idx) - - list_add_tail(&m_page->list, &swap_mem->pages); - } -- -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) -+ system_free_size = global_zone_page_state(NR_FREE_PAGES) * PAGE_SIZE; -+#else - system_free_size = global_page_state(NR_FREE_PAGES) * PAGE_SIZE; -+#endif -+ - - if ((system_free_size < mali_mem_swap_out_threshold_value) - && (mem_backend_swapped_pool_size > (mali_mem_swap_out_threshold_value >> 2)) --- -2.7.4 - diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch new file mode 100644 index 000000000..5363c37e8 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch @@ -0,0 +1,17 @@ +Index: mali/linux/mali_memory_os_alloc.c +=================================================================== +--- mali.orig/linux/mali_memory_os_alloc.c ++++ mali/linux/mali_memory_os_alloc.c +@@ -239,8 +239,10 @@ int mali_mem_os_alloc_pages(mali_mem_os_ + /* Ensure page is flushed from CPU caches. */ + dma_addr = dma_map_page(&mali_platform_device->dev, new_page, + 0, _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); +- dma_unmap_page(&mali_platform_device->dev, dma_addr, +- _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); ++ err = dma_mapping_error(&mali_platform_device->dev, dma_addr); ++ if (likely(!err)) ++ dma_unmap_page(&mali_platform_device->dev, dma_addr, ++ _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); + dma_addr = dma_map_page(&mali_platform_device->dev, new_page, + 0, _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch b/meta-xilinx/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 000000000..dc8bbebf4 --- /dev/null +++ b/meta-xilinx/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 @@ +From 8cf1dd43f3f25cb4afb84dfc3b0e7c02bc8f7f0c Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Mon, 24 Feb 2020 18:19:37 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1 1/3] mali_memory_secure: Kernel 5.0 + onwards 'access_ok' API does not take 'type' as input parameter + +'access_ok' no longer needs 'type' as input paramter from kernel 5.0 +onwards. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + driver/src/devicedrv/mali/linux/mali_ukk_mem.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/driver/src/devicedrv/mali/linux/mali_ukk_mem.c b/driver/src/devicedrv/mali/linux/mali_ukk_mem.c +index 4ec57dc..270bb6d 100644 +--- linux/mali_ukk_mem.c ++++ b/linux/mali_ukk_mem.c +@@ -207,8 +207,13 @@ int mem_write_safe_wrapper(struct mali_session_data *session_data, _mali_uk_mem_ + kargs.ctx = (uintptr_t)session_data; + + /* Check if we can access the buffers */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) ++ if (!access_ok((const void __user *)kargs.dest, kargs.size) ++ || !access_ok((const void __user *)kargs.src, kargs.size)) { ++#else + if (!access_ok(VERIFY_WRITE, kargs.dest, kargs.size) + || !access_ok(VERIFY_READ, kargs.src, kargs.size)) { ++#endif + return -EINVAL; + } + +@@ -266,7 +271,11 @@ int mem_dump_mmu_page_table_wrapper(struct mali_session_data *session_data, _mal + goto err_exit; + + user_buffer = (void __user *)(uintptr_t)kargs.buffer; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) ++ if (!access_ok(user_buffer, kargs.size)) ++#else + if (!access_ok(VERIFY_WRITE, user_buffer, kargs.size)) ++#endif + goto err_exit; + + /* allocate temporary buffer (kernel side) to store mmu page table info */ +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch b/meta-xilinx/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 000000000..9c4bbee9f --- /dev/null +++ b/meta-xilinx/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 @@ +From 953cab73b8bc487da330aa454abd7f8c7466737e Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Mon, 24 Feb 2020 18:32:16 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1 2/3] Support for vm_insert_pfn + deprecated from kernel 4.20 + +From kernel 4.20 onwards, support for vm_insert_pfn is deprecated. +Hence, replace the same with vmf_insert_pfn. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + .../devicedrv/mali/linux/mali_memory_block_alloc.c | 6 +++++- + driver/src/devicedrv/mali/linux/mali_memory_cow.c | 14 ++++++++++++-- + .../src/devicedrv/mali/linux/mali_memory_os_alloc.c | 20 +++++++++++++++++--- + driver/src/devicedrv/mali/linux/mali_memory_secure.c | 7 ++++++- + 4 files changed, 40 insertions(+), 7 deletions(-) + +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c +index 0c5b6c3..e528699 100644 +--- linux/mali_memory_block_alloc.c ++++ b/linux/mali_memory_block_alloc.c +@@ -309,9 +309,13 @@ int mali_mem_block_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *v + + list_for_each_entry(m_page, &block_mem->pfns, list) { + MALI_DEBUG_ASSERT(m_page->type == MALI_PAGE_NODE_BLOCK); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); +- + if (unlikely(0 != ret)) { ++#endif + return -EFAULT; + } + addr += _MALI_OSK_MALI_PAGE_SIZE; +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_cow.c b/driver/src/devicedrv/mali/linux/mali_memory_cow.c +index f1d44fe..1dae1d6 100644 +--- linux/mali_memory_cow.c ++++ b/linux/mali_memory_cow.c +@@ -532,9 +532,14 @@ int mali_mem_cow_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma + * flush which makes it way slower than remap_pfn_range or vm_insert_pfn.
+ ret = vm_insert_page(vma, addr, page);
+ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
+-
+ if (unlikely(0 != ret)) {
++#endif ++
+ return ret;
+ }
+ addr += _MALI_OSK_MALI_PAGE_SIZE;
+@@ -569,9 +574,14 @@ _mali_osk_errcode_t mali_mem_cow_cpu_map_pages_locked(mali_mem_backend *mem_bken +
+ list_for_each_entry(m_page, &cow->pages, list) {
+ if ((count >= offset) && (count < offset + num)) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
+-
+ if (unlikely(0 != ret)) {
++#endif ++
+ if (count == offset) {
+ return _MALI_OSK_ERR_FAULT;
+ } else {
+diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c +index 3fb6f05..7de3920 100644 +--- linux/mali_memory_os_alloc.c ++++ b/linux/mali_memory_os_alloc.c +@@ -378,9 +378,14 @@ int mali_mem_os_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma) + ret = vm_insert_page(vma, addr, page); + */ + page = m_page->page; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, page_to_pfn(page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, page_to_pfn(page)); +- + if (unlikely(0 != ret)) { ++#endif ++ + return -EFAULT; + } + addr += _MALI_OSK_MALI_PAGE_SIZE; +@@ -416,9 +421,13 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken + + vm_end -= _MALI_OSK_MALI_PAGE_SIZE; + if (mapping_page_num > 0) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, vm_end, page_to_pfn(m_page->page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, vm_end, page_to_pfn(m_page->page)); +- + if (unlikely(0 != ret)) { ++#endif + /*will return -EBUSY If the page has already been mapped into table, but it's OK*/ + if (-EBUSY == ret) { + break; +@@ -439,9 +448,14 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken + list_for_each_entry(m_page, &os_mem->pages, list) { + if (count >= offset) { + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, vstart, page_to_pfn(m_page->page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, vstart, page_to_pfn(m_page->page)); +- + if (unlikely(0 != ret)) { ++#endif ++ + /*will return -EBUSY If the page has already been mapped into table, but it's OK*/ + if (-EBUSY == ret) { + break; +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c +index 5546304..cebd1c8 100644 +--- linux/mali_memory_secure.c ++++ b/linux/mali_memory_secure.c +@@ -132,9 +132,14 @@ int mali_mem_secure_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct * + MALI_DEBUG_ASSERT(0 == size % _MALI_OSK_MALI_PAGE_SIZE); + + for (j = 0; j < size / _MALI_OSK_MALI_PAGE_SIZE; j++) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, PFN_DOWN(phys)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, PFN_DOWN(phys)); +- + if (unlikely(0 != ret)) { ++#endif ++ + return -EFAULT; + } + addr += _MALI_OSK_MALI_PAGE_SIZE; +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch b/meta-xilinx/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 000000000..9797db629 --- /dev/null +++ b/meta-xilinx/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 @@ +From ad5c569f0cc40698699fc2f2c1db3ceb9f8b8f35 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 25 Feb 2020 11:36:01 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1 3/3] Change return type to vm_fault_t + for fault handler + +From kernel 4.17 onwards the return type of fault handler for +vm_operations is of type 'vm_fault_t'. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + driver/src/devicedrv/mali/linux/mali_memory.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/driver/src/devicedrv/mali/linux/mali_memory.c b/driver/src/devicedrv/mali/linux/mali_memory.c +index c0f0982..2b2b209 100644 +--- linux/mali_memory.c ++++ b/linux/mali_memory.c +@@ -70,7 +70,9 @@ static void mali_mem_vma_close(struct vm_area_struct *vma) + } + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) ++static vm_fault_t mali_mem_vma_fault(struct vm_fault *vmf) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + static int mali_mem_vma_fault(struct vm_fault *vmf) + #else + static int mali_mem_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch b/meta-xilinx/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 000000000..154bb673e --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch @@ -0,0 +1,36 @@ +From c6a6b39cea3fdfd91cae7f2a4ef6f36d2c55fdd6 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 25 Feb 2020 15:17:17 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1] "get_monotonic_boottime(&ts)" + deprecated from kernel 4.20 onwards + +As "get_monotonic_boottime(&ts)" is deprecated, replace the same with +"ktime_get_boottime_ts64(&ts)". Refer kernel commit ID +976516404ff3fab2a8caa8bd6f5efc1437fed0b8 + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + driver/src/devicedrv/mali/linux/mali_osk_time.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/driver/src/devicedrv/mali/linux/mali_osk_time.c b/driver/src/devicedrv/mali/linux/mali_osk_time.c +index 03046a5..bfcbf7f 100644 +--- linux/mali_osk_time.c ++++ b/linux/mali_osk_time.c +@@ -53,7 +53,13 @@ u64 _mali_osk_time_get_ns(void) + + u64 _mali_osk_boot_time_get_ns(void) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ struct timespec64 tsval; ++ ktime_get_boottime_ts64(&tsval); ++ return (u64)timespec64_to_ns(&tsval); ++#else + struct timespec tsval; + get_monotonic_boottime(&tsval); + return (u64)timespec_to_ns(&tsval); ++#endif + } +-- +2.7.4 + |