[meta-xilinx] [PATCH] kernel-module-mali.bb: Update MALI kernel module to r7p0

Manjukumar Matha manjukumar.harthikote-matha at xilinx.com
Tue May 9 11:35:15 PDT 2017


Update kernel-module-mali to r7p0 version

Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha at xilinx.com>
---
 recipes-graphics/mali/kernel-module-mali.bb        | 22 ++++--
 ...ange-Makefile-to-be-compatible-with-Yocto.patch | 49 ++++++++++++
 ...li-r5p1-01rel0-Remove-unused-trace-macros.patch | 38 ---------
 ...i-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch | 52 ++++++++++++
 ...li-r7p0-00rel0-Remove-unused-trace-macros.patch | 33 ++++++++
 ...i-r7p0-00rel0-Don-t-include-mali_read_phy.patch | 47 +++++++++++
 ...-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch | 29 +++++++
 ...-mali-r7p0-page_cache_release-to-put_page.patch | 30 +++++++
 ..._os_alloc.c-Align-with-dma_attrs-changes-.patch | 92 ++++++++++++++++++++++
 ...ps-will-be-modified-by-the-driver-only-ti.patch | 34 ++++++++
 ...kernel_linux.c-Handle-clock-when-probed-a.patch | 90 +++++++++++++++++++++
 .../mali/kernel-module-mali/Makefile.patch         | 36 ---------
 12 files changed, 471 insertions(+), 81 deletions(-)
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch
 delete mode 100644 recipes-graphics/mali/kernel-module-mali/0001-mali-r5p1-01rel0-Remove-unused-trace-macros.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch
 create mode 100644 recipes-graphics/mali/kernel-module-mali/0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch
 delete mode 100644 recipes-graphics/mali/kernel-module-mali/Makefile.patch

diff --git a/recipes-graphics/mali/kernel-module-mali.bb b/recipes-graphics/mali/kernel-module-mali.bb
index 4efece3..0ad1a49 100644
--- a/recipes-graphics/mali/kernel-module-mali.bb
+++ b/recipes-graphics/mali/kernel-module-mali.bb
@@ -3,24 +3,31 @@ SECTION = "kernel/modules"
 
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = " \
-	file://linux/license/gpl/mali_kernel_license.h;md5=68c66513a9dacef77a52c3d6c5e6afd5 \
+	file://linux/license/gpl/mali_kernel_license.h;md5=1436c0d104589824163a3eb50fbb5050 \
 	"
 
-PV = "r5p1-01rel0"
+PV = "r7p0-00rel0"
 
 SRC_URI = " \
 	http://malideveloper.arm.com/downloads/drivers/DX910/${PV}/DX910-SW-99002-${PV}.tgz \
-	file://Makefile.patch \
-	file://0001-mali-r5p1-01rel0-Remove-unused-trace-macros.patch \
+	file://0001-Change-Makefile-to-be-compatible-with-Yocto.patch \
+	file://0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch \
+	file://0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch \
+	file://0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch \
+	file://0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch \
+	file://0006-staging-mali-r7p0-page_cache_release-to-put_page.patch \
+	file://0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch \
+	file://0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch \
+	file://0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch \
 	"
-SRC_URI[md5sum] = "9c85c113e4d41ae992e45ba27287d1ab"
-SRC_URI[sha256sum] = "86209c99c36a7622402b016b6f764c212b738ccdec9cdc6d6f16758c013957a0"
+SRC_URI[md5sum] = "db3ef3258eb55700484ecadfdce1fee1"
+SRC_URI[sha256sum] = "496ba80684aa4236806891a8445978849f7dd07299f5e58b14d52cd5e7ba0536"
 
 inherit module
 
 do_make_scripts[depends] += "virtual/kernel:do_unpack"
 
-S = "${WORKDIR}/driver/src/devicedrv/mali"
+S = "${WORKDIR}/DX910-SW-99002-${PV}/driver/src/devicedrv/mali"
 
 COMPATIBLE_MACHINE = "^$"
 COMPATIBLE_MACHINE_zynqmp = "zynqmp"
@@ -33,4 +40,5 @@ EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \
 		MALI_SHARED_INTERRUPTS=1 \
 		CROSS_COMPILE="${TARGET_PREFIX}" \
 		O=${STAGING_KERNEL_BUILDDIR} \
+		MALI_QUIET=1 \
 		'
diff --git a/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch b/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch
new file mode 100644
index 0000000..0314734
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch
@@ -0,0 +1,49 @@
+From d9a4441c31faef60b7f39692df6913d58ec69d1b Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon at xilinx.com>
+Date: Thu, 8 Sep 2016 09:56:40 -0700
+Subject: [PATCH 1/6] Change Makefile to be compatible with Yocto
+
+Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha at xilinx.com>
+Signed-off-by: Hyun Kwon <hyun.kwon at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/Makefile | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/driver/src/devicedrv/mali/Makefile b/driver/src/devicedrv/mali/Makefile
+index f39ae4d..9ef9713 100755
+--- Makefile
++++ b/Makefile
+@@ -88,7 +88,11 @@ endif
+ # Define host system directory
+ KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
+ 
+-include $(KDIR)/.config
++ifeq ($(O),)
++	include $(KDIR)/.config
++else
++	include $(O)/.config
++endif
+ 
+ ifeq ($(ARCH), arm)
+ # when compiling for ARM we're cross compiling
+@@ -193,10 +197,15 @@ ifeq ($(MALI_MEM_SWAP_TRACKING),1)
+ EXTRA_DEFINES += -DMALI_MEM_SWAP_TRACKING=1
+ endif
+ 
++EXTRA_DEFINES += -Wno-error=date-time
++
+ all: $(UMP_SYMVERS_FILE)
+-	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules
++	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) O=$(O) modules
+ 	@rm $(FILES_PREFIX)__malidrv_build_info.c $(FILES_PREFIX)__malidrv_build_info.o
+ 
++modules_install:
++	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules_install
++
+ clean:
+ 	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
+ 
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0001-mali-r5p1-01rel0-Remove-unused-trace-macros.patch b/recipes-graphics/mali/kernel-module-mali/0001-mali-r5p1-01rel0-Remove-unused-trace-macros.patch
deleted file mode 100644
index b7758be..0000000
--- a/recipes-graphics/mali/kernel-module-mali/0001-mali-r5p1-01rel0-Remove-unused-trace-macros.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 79e49b32d8d52ac765e6ee30ff7d25b8660bd704 Mon Sep 17 00:00:00 2001
-From: Yasir-Khan <yasir_khan at mentor.com>
-Date: Fri, 4 Nov 2016 18:43:43 +0500
-Subject: [PATCH] mali: r5p1-01rel0: Remove unused trace macros
-
-TRACE_SYSTEM_STRING is not needed in each trace file anymore.
-
-Based on:
-https://patchwork.kernel.org/patch/6150651/
-https://github.com/Xilinx/linux-xlnx/commit/dadb5e41f28f9619debc9aae4ae543aa1dcd5be8
-
-Upstream-status: Pending
-
-Signed-off-by: Yasir-Khan <yasir_khan at mentor.com>
----
- src/devicedrv/mali/linux/mali_linux_trace.h | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/driver/src/devicedrv/mali/linux/mali_linux_trace.h b/driver/src/devicedrv/mali/linux/mali_linux_trace.h
-index c6cd2bf..195e3cf 100644
---- a/linux/mali_linux_trace.h
-+++ b/linux/mali_linux_trace.h
-@@ -13,12 +13,10 @@
- 
- #include <linux/types.h>
- 
--#include <linux/stringify.h>
- #include <linux/tracepoint.h>
- 
- #undef  TRACE_SYSTEM
- #define TRACE_SYSTEM mali
--#define TRACE_SYSTEM_STRING __stringfy(TRACE_SYSTEM)
- 
- #define TRACE_INCLUDE_PATH .
- #define TRACE_INCLUDE_FILE mali_linux_trace
--- 
-2.8.1
-
diff --git a/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch b/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch
new file mode 100644
index 0000000..363153e
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch
@@ -0,0 +1,52 @@
+From 65a8f9eb32322538396607805dcbc28aa0aadcb7 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon at xilinx.com>
+Date: Thu, 25 Jun 2015 17:14:42 -0700
+Subject: [PATCH 2/6] staging: mali: r7p0-00rel0: Add the ZYNQ/ZYNQMP platform
+
+Add the number of PP cores that is required for Zynq/ZynqMP configuration.
+
+Signed-off-by: Hyun Kwon <hyun.kwon at xilinx.com>
+Signed-off-by: Michal Simek <michal.simek at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/platform/arm/arm.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c
+index a7ff1b2..0682842 100755
+--- platform/arm/arm.c
++++ b/platform/arm/arm.c
+@@ -261,6 +261,10 @@ static struct mali_gpu_device_data mali_gpu_data = {
+ 	.dedicated_mem_start = 0x80000000, /* Physical start address (use 0xD0000000 for old indirect setup) */
+ 	.dedicated_mem_size = 0x10000000, /* 256MB */
+ #endif
++#if defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP)
++	.fb_start = 0x00000000,
++	.fb_size = 0xfffff000,
++#else
+ #if defined(CONFIG_ARM64)
+ 	/* Some framebuffer drivers get the framebuffer dynamically, such as through GEM,
+ 	* in which the memory resource can't be predicted in advance.
+@@ -271,6 +275,7 @@ static struct mali_gpu_device_data mali_gpu_data = {
+ 	.fb_start = 0xe0000000,
+ 	.fb_size = 0x01000000,
+ #endif
++#endif /* !defined(CONFIG_ARCH_ZYNQ) && !defined(CONFIG_ARCH_ZYNQMP) */
+ 	.control_interval = 1000, /* 1000ms */
+ 	.utilization_callback = mali_gpu_utilization_callback,
+ 	.get_clock_info = NULL,
+@@ -505,6 +510,11 @@ int mali_platform_device_init(struct platform_device *device)
+ 			mali_write_phys(0xC0010020, 0xA); /* Enable direct memory mapping for FPGA */
+ 		}
+ 	}
++#elif defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP)
++
++	MALI_DEBUG_PRINT(4, ("Registering Zynq/ZynqMP Mali-400 device\n"));
++	num_pp_cores = 2;
++
+ #endif
+ 
+ 	/* After kernel 3.15 device tree will default set dev
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch b/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch
new file mode 100644
index 0000000..fc0dc6e
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch
@@ -0,0 +1,33 @@
+From c86d22f1133647518a68f9f1cbe73e1797e68fa8 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon at xilinx.com>
+Date: Tue, 3 May 2016 08:11:38 -0700
+Subject: [PATCH 3/6] staging: mali: r7p0-00rel0: Remove unused trace macros
+
+TRACE_SYSTEM_STRING is not need in each trace file anymore.
+
+Signed-off-by: Hyun Kwon <hyun.kwon at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/linux/mali_linux_trace.h | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/driver/src/devicedrv/mali/linux/mali_linux_trace.h b/driver/src/devicedrv/mali/linux/mali_linux_trace.h
+index 2c91ddc..d4e45ab 100755
+--- linux/mali_linux_trace.h
++++ b/linux/mali_linux_trace.h
+@@ -13,12 +13,10 @@
+ 
+ #include <linux/types.h>
+ 
+-#include <linux/stringify.h>
+ #include <linux/tracepoint.h>
+ 
+ #undef  TRACE_SYSTEM
+ #define TRACE_SYSTEM mali
+-#define TRACE_SYSTEM_STRING __stringfy(TRACE_SYSTEM)
+ 
+ #define TRACE_INCLUDE_PATH .
+ #define TRACE_INCLUDE_FILE mali_linux_trace
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch b/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch
new file mode 100644
index 0000000..ce3bea0
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch
@@ -0,0 +1,47 @@
+From 3e6fb4697bddc4cfbb82e6a0b2f9f28d5c1d0a04 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon at xilinx.com>
+Date: Wed, 29 Jun 2016 09:14:37 -0700
+Subject: [PATCH 4/6] staging: mali: r7p0-00rel0: Don't include
+ mali_read_phys() for zynq/zynqmp
+
+mali_read_phys() is not used with CONFIG_ARCH_ZYNQ and CONFIG_ARCH_ZYNQMP.
+
+Signed-off-by: Hyun Kwon <hyun.kwon at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/platform/arm/arm.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c
+index 0682842..c6f58d8 100755
+--- platform/arm/arm.c
++++ b/platform/arm/arm.c
+@@ -38,7 +38,9 @@
+ static int mali_core_scaling_enable = 0;
+ 
+ void mali_gpu_utilization_callback(struct mali_gpu_utilization_data *data);
++#if !(defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP))
+ static u32 mali_read_phys(u32 phys_addr);
++#endif
+ #if defined(CONFIG_ARCH_REALVIEW)
+ static void mali_write_phys(u32 phys_addr, u32 value);
+ #endif
+@@ -578,6 +580,7 @@ int mali_platform_device_deinit(struct platform_device *device)
+ 
+ #endif /* CONFIG_MALI_DT */
+ 
++#if !(defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP))
+ static u32 mali_read_phys(u32 phys_addr)
+ {
+ 	u32 phys_addr_page = phys_addr & 0xFFFFE000;
+@@ -592,6 +595,7 @@ static u32 mali_read_phys(u32 phys_addr)
+ 
+ 	return ret;
+ }
++#endif
+ 
+ #if defined(CONFIG_ARCH_REALVIEW)
+ static void mali_write_phys(u32 phys_addr, u32 value)
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch b/recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch
new file mode 100644
index 0000000..32dd9d4
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch
@@ -0,0 +1,29 @@
+From ac3baaacbaa564e768529dcb2353a84eb47ae847 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon at xilinx.com>
+Date: Mon, 12 Sep 2016 13:12:46 -0700
+Subject: [PATCH 5/6] mali: r7p0: PAGE_CACHE_SHIFT to PAGE_CACHE
+
+09cbfea removed PAGE_CACHE_*.
+
+Signed-off-by: Hyun Kwon <hyun.kwon at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c | 2 +-
+ 1 file changed, 1 insertion(+), 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 4793328..1aea47b 100755
+--- linux/mali_memory_swap_alloc.c
++++ b/linux/mali_memory_swap_alloc.c
+@@ -52,7 +52,7 @@ extern struct mali_mem_os_allocator mali_mem_os_allocator;
+ #define MALI_SWAP_LOW_MEM_DEFAULT_VALUE (60*1024*1024)
+ #define MALI_SWAP_INVALIDATE_MALI_ADDRESS (0)               /* Used to mark the given memory cookie is invalidate. */
+ #define MALI_SWAP_GLOBAL_SWAP_FILE_SIZE (0xFFFFFFFF)
+-#define MALI_SWAP_GLOBAL_SWAP_FILE_INDEX ((MALI_SWAP_GLOBAL_SWAP_FILE_SIZE) >> PAGE_CACHE_SHIFT)
++#define MALI_SWAP_GLOBAL_SWAP_FILE_INDEX ((MALI_SWAP_GLOBAL_SWAP_FILE_SIZE) >> PAGE_SHIFT)
+ #define MALI_SWAP_GLOBAL_SWAP_FILE_INDEX_RESERVE (1 << 15) /* Reserved for CoW nonlinear swap backend memory, the space size is 128MB. */
+ 
+ unsigned int mali_mem_swap_out_threshold_value = MALI_SWAP_LOW_MEM_DEFAULT_VALUE;
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch b/recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch
new file mode 100644
index 0000000..5582bfa
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch
@@ -0,0 +1,30 @@
+From 9dd708ba609b826c07fa91d8a5ee56b368ae8183 Mon Sep 17 00:00:00 2001
+From: "madhurki at xilinx.com" <madhurki at xilinx.com>
+Date: Mon, 12 Sep 2016 17:14:34 -0700
+Subject: [PATCH 6/6] staging: mali: r7p0: page_cache_release() to put_page()
+
+09cbfea replaced page_cache_release() to put_page().
+
+Signed-off-by: Hyun Kwon <hyun.kwon at xilinx.com>
+Signed-off-by: madhurki at xilinx.com <madhurki at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c | 2 +-
+ 1 file changed, 1 insertion(+), 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 1aea47b..068e4d0 100755
+--- linux/mali_memory_swap_alloc.c
++++ b/linux/mali_memory_swap_alloc.c
+@@ -183,7 +183,7 @@ static void mali_mem_swap_out_page_node(mali_page_node *page_node)
+ 	dma_unmap_page(&mali_platform_device->dev, page_node->swap_it->dma_addr,
+ 		       _MALI_OSK_MALI_PAGE_SIZE, DMA_TO_DEVICE);
+ 	set_page_dirty(page_node->swap_it->page);
+-	page_cache_release(page_node->swap_it->page);
++	put_page(page_node->swap_it->page);
+ }
+ 
+ void mali_mem_swap_unlock_single_mem_backend(mali_mem_backend *mem_bkend)
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch b/recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch
new file mode 100644
index 0000000..79c507d
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch
@@ -0,0 +1,92 @@
+From f0a49bccbdd910c48aab59e07aed98093f4a0fea Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki at xilinx.com>
+Date: Wed, 25 Jan 2017 02:59:40 -0800
+Subject: [PATCH 1/2] mali_memory_os_alloc.c: Align with dma_attrs changes from
+ 4.8 Kernel
+
+From 4.8 Kernel the DMA attributes is no longer a pointer but an unsigned long.
+
+Signed-off-by: Madhurkiran Harikrishnan <madhurki at xilinx.com>
+Upstream Status: Pending
+---
+ .../devicedrv/mali/linux/mali_memory_os_alloc.c    | 25 +++++++++++++++++-----
+ 1 file changed, 20 insertions(+), 5 deletions(-)
+
+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 7f229eb..08fa2fb 100755
+--- linux/mali_memory_os_alloc.c
++++ b/linux/mali_memory_os_alloc.c
+@@ -26,9 +26,11 @@
+ #define MALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_PAGES (MALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB * 256)
+ #define MALI_OS_MEMORY_POOL_TRIM_JIFFIES (10 * CONFIG_HZ) /* Default to 10s */
+ 
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
+ /* Write combine dma_attrs */
+ static DEFINE_DMA_ATTRS(dma_attrs_wc);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++static unsigned long dma_attrs_wc;
+ #endif
+ 
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
+@@ -511,10 +513,14 @@ _mali_osk_errcode_t mali_mem_os_get_table_page(mali_dma_addr *phys, mali_io_addr
+ 	spin_unlock(&mali_mem_page_table_page_pool.lock);
+ 
+ 	if (_MALI_OSK_ERR_OK != ret) {
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
+ 		*mapping = dma_alloc_attrs(&mali_platform_device->dev,
+ 					   _MALI_OSK_MALI_PAGE_SIZE, &tmp_phys,
+ 					   GFP_KERNEL, &dma_attrs_wc);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++		*mapping = dma_alloc_attrs(&mali_platform_device->dev,
++					   _MALI_OSK_MALI_PAGE_SIZE, &tmp_phys,
++					   GFP_KERNEL, dma_attrs_wc);
+ #else
+ 		*mapping = dma_alloc_writecombine(&mali_platform_device->dev,
+ 						  _MALI_OSK_MALI_PAGE_SIZE, &tmp_phys, GFP_KERNEL);
+@@ -550,10 +556,14 @@ void mali_mem_os_release_table_page(mali_dma_addr phys, void *virt)
+ 	} else {
+ 		spin_unlock(&mali_mem_page_table_page_pool.lock);
+ 
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
+ 		dma_free_attrs(&mali_platform_device->dev,
+ 			       _MALI_OSK_MALI_PAGE_SIZE, virt, phys,
+ 			       &dma_attrs_wc);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++		dma_free_attrs(&mali_platform_device->dev,
++				_MALI_OSK_MALI_PAGE_SIZE, virt, phys,
++				dma_attrs_wc);
+ #else
+ 		dma_free_writecombine(&mali_platform_device->dev,
+ 				      _MALI_OSK_MALI_PAGE_SIZE, virt, phys);
+@@ -606,9 +616,12 @@ static void mali_mem_os_page_table_pool_free(size_t nr_to_free)
+ 
+ 	/* After releasing the spinlock: free the pages we removed from the pool. */
+ 	for (i = 0; i < nr_to_free; i++) {
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
+ 		dma_free_attrs(&mali_platform_device->dev, _MALI_OSK_MALI_PAGE_SIZE,
+ 			       virt_arr[i], (dma_addr_t)phys_arr[i], &dma_attrs_wc);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++		dma_free_attrs(&mali_platform_device->dev, _MALI_OSK_MALI_PAGE_SIZE,
++				virt_arr[i], (dma_addr_t)phys_arr[i], dma_attrs_wc);
+ #else
+ 		dma_free_writecombine(&mali_platform_device->dev,
+ 				      _MALI_OSK_MALI_PAGE_SIZE,
+@@ -757,8 +770,10 @@ _mali_osk_errcode_t mali_mem_os_init(void)
+ 		return _MALI_OSK_ERR_NOMEM;
+ 	}
+ 
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
+ 	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &dma_attrs_wc);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++	dma_attrs_wc |= DMA_ATTR_WRITE_COMBINE;
+ #endif
+ 
+ 	register_shrinker(&mali_mem_os_allocator.shrinker);
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch b/recipes-graphics/mali/kernel-module-mali/0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch
new file mode 100644
index 0000000..c11b60a
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch
@@ -0,0 +1,34 @@
+From 4bb78550d818b9e6491fa2d3b9706bb217a1597b Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki at xilinx.com>
+Date: Wed, 25 Jan 2017 10:00:33 -0800
+Subject: [PATCH 2/2] arm.c: dma_ops will be modified by the driver only till
+ Kernel v4.7
+
+From v4.8(Platform specific) Kernel the arch_setup_dma_ops will
+not give a dummy_dma_ops if acpi is disabled rather pass a valid
+dma_ops.
+
+Signed-off-by: Madhurkiran Harikrishnan <madhurki at xilinx.com>
+Upstream Status: Pending
+---
+ driver/src/devicedrv/mali/platform/arm/arm.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c
+index c6f58d8..36965fe 100755
+--- platform/arm/arm.c
++++ b/platform/arm/arm.c
+@@ -529,8 +529,9 @@ int mali_platform_device_init(struct platform_device *device)
+ 	 */
+ 	if (!device->dev.dma_mask)
+ 		device->dev.dma_mask = &device->dev.coherent_dma_mask;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
+ 	device->dev.archdata.dma_ops = dma_ops;
+-
++#endif
+ 	err = platform_device_add_data(device, &mali_gpu_data, sizeof(mali_gpu_data));
+ 
+ 	if (0 == err) {
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch b/recipes-graphics/mali/kernel-module-mali/0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch
new file mode 100644
index 0000000..34cbccf
--- /dev/null
+++ b/recipes-graphics/mali/kernel-module-mali/0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch
@@ -0,0 +1,90 @@
+From ba8c94302a1c606315109a9d1cee342213fdbf98 Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki at xilinx.com>
+Date: Thu, 16 Feb 2017 12:15:58 -0800
+Subject: [PATCH] linux/mali_kernel_linux.c: Handle clock when probed and
+ removed
+
+This patch will handle the clock through clock
+specifier for GPU PP0 and PP1.
+
+Signed-off-by: Madhurkiran Harikrishnan <madhurki at xilinx.com>
+Upstream-Status: Inappropriate  [Specific to Xilinx ZynqMP]
+---
+ .../src/devicedrv/mali/linux/mali_kernel_linux.c   | 40 +++++++++++++++++++++-
+ 1 file changed, 39 insertions(+), 1 deletion(-)
+
+diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c
+index 9bfa2bd..cfde20f 100755
+--- linux/mali_kernel_linux.c
++++ b/linux/mali_kernel_linux.c
+@@ -45,6 +45,14 @@
+ #if defined(CONFIG_MALI400_INTERNAL_PROFILING)
+ #include "mali_profiling_internal.h"
+ #endif
++
++#if defined(CONFIG_ARCH_ZYNQMP)
++/* Initialize variables for clocks */
++struct clk *clk_gpu;
++struct clk *clk_gpu_pp0;
++struct clk *clk_gpu_pp1;
++#endif
++
+ #if defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_MALI_DVFS)
+ #include "mali_osk_profiling.h"
+ #include "mali_dvfs_policy.h"
+@@ -580,7 +588,23 @@ static int mali_probe(struct platform_device *pdev)
+ 	}
+ #endif
+ 
+-
++#if defined(CONFIG_ARCH_ZYNQMP)
++	/* Initialize clocks for GPU and PP */
++	clk_gpu = devm_clk_get(&pdev->dev, "gpu");
++	if (IS_ERR(clk_gpu))
++		return PTR_ERR(clk_gpu);
++	clk_prepare_enable(clk_gpu);
++
++	clk_gpu_pp0 = devm_clk_get(&pdev->dev, "gpu_pp0");
++	if (IS_ERR(clk_gpu_pp0))
++		return PTR_ERR(clk_gpu_pp0);
++	clk_prepare_enable(clk_gpu_pp0);
++
++	clk_gpu_pp1 = devm_clk_get(&pdev->dev, "gpu_pp1");
++	if (IS_ERR(clk_gpu_pp1))
++		return PTR_ERR(clk_gpu_pp1);
++	clk_prepare_enable(clk_gpu_pp1);
++#endif
+ 	if (_MALI_OSK_ERR_OK == _mali_osk_wq_init()) {
+ 		/* Initialize the Mali GPU HW specified by pdev */
+ 		if (_MALI_OSK_ERR_OK == mali_initialize_subsystems()) {
+@@ -608,6 +632,12 @@ static int mali_probe(struct platform_device *pdev)
+ 		_mali_osk_wq_term();
+ 	}
+ 
++#if defined(CONFIG_ARCH_ZYNQMP)
++	clk_disable_unprepare(clk_gpu);
++	clk_disable_unprepare(clk_gpu_pp0);
++	clk_disable_unprepare(clk_gpu_pp1);
++#endif
++
+ #ifdef CONFIG_MALI_DEVFREQ
+ 	mali_devfreq_term(mdev);
+ devfreq_init_failed:
+@@ -673,6 +703,14 @@ static int mali_remove(struct platform_device *pdev)
+ 	mali_platform_device_deinit(mali_platform_device);
+ #endif
+ 	mali_platform_device = NULL;
++
++#if defined(CONFIG_ARCH_ZYNQMP)
++	/* Remove clock */
++	clk_disable_unprepare(clk_gpu);
++	clk_disable_unprepare(clk_gpu_pp0);
++	clk_disable_unprepare(clk_gpu_pp1);
++#endif
++
+ 	return 0;
+ }
+ 
+-- 
+2.7.4
+
diff --git a/recipes-graphics/mali/kernel-module-mali/Makefile.patch b/recipes-graphics/mali/kernel-module-mali/Makefile.patch
deleted file mode 100644
index 0f05687..0000000
--- a/recipes-graphics/mali/kernel-module-mali/Makefile.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Change Makefile to be compatible with Yocto
-
-Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha at xilinx.com>
-Upstream Status: Pending
---- driver/src/devicedrv/mali/Makefile	2015-03-29 20:38:45.000000000 -0700
-+++ b/Makefile	2016-01-26 20:13:56.053436042 -0800
-@@ -85,7 +85,11 @@
- # Define host system directory
- KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
- 
--include $(KDIR)/.config
-+ifeq ($(O),)
-+	include $(KDIR)/.config
-+else
-+	include $(O)/.config
-+endif
- 
- ifeq ($(ARCH), arm)
- # when compiling for ARM we're cross compiling
-@@ -170,10 +174,15 @@
- EXTRA_DEFINES += -DPROFILING_SKIP_PP_JOBS=1 -DPROFILING_SKIP_GP_JOBS=1
- endif
- 
-+EXTRA_DEFINES += -Wno-error=date-time
-+
- all: $(UMP_SYMVERS_FILE)
--	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules
-+	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) O=$(O) modules
- 	@rm $(FILES_PREFIX)__malidrv_build_info.c $(FILES_PREFIX)__malidrv_build_info.o
- 
-+modules_install:
-+	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules_install
-+
- clean:
- 	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
- 
-- 
2.7.4




More information about the meta-xilinx mailing list