From: Jean-Francois Dagenais <[email protected]>

This fixes an error when using the module in a kernel configured with
the CONFIG_DMA_API_DEBUG flag.

utgard fd4b0000.gpu: DMA-API: device driver failed to check map
error[device address=0x00000000325b0000] [size=4096 bytes] [mapped as
page]
...
 [<ffffff80082f72bc>] check_unmap+0x44c/0x7e8
 [<ffffff80082f76b8>] debug_dma_unmap_page+0x60/0x68
 [<ffffff8000622e60>] mali_mem_os_alloc_pages+0x230/0x498 [mali]
...

Acked-by: Hyun Kwon <[email protected]>
Signed-off-by: Jean-Francois Dagenais <[email protected]>
Signed-off-by: Sai Hari Chandana Kalluri <[email protected]>
Signed-off-by: Manjukumar Matha <[email protected]>
---
 .../recipes-graphics/mali/kernel-module-mali.bb         |  1 +
 .../0015-fix-driver-failed-to-check-map-error.patch     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 
meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch

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 fe2fbdc..be9e719 100644
--- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
+++ b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
@@ -24,6 +24,7 @@ SRC_URI = " \
        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 \
        "
 SRC_URI[md5sum] = "8f04ae86957fd56197ad5a9d017b84ff"
 SRC_URI[sha256sum] = 
"bfd14fa3f75a71d4ba313534e651ca1c58dc354e882c0b39867e335882a06350"
diff --git 
a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch
 
b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch
new file mode 100644
index 0000000..5363c37
--- /dev/null
+++ 
b/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);
+ 
-- 
2.7.4

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#4593): 
https://lists.yoctoproject.org/g/meta-xilinx/message/4593
Mute This Topic: https://lists.yoctoproject.org/mt/68553769/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-xilinx/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to