Add meta-xilinx subtree

Import git://git.yoctoproject.org/meta-xilinx from 5fccc46503 as
meta-xilinx subtree.

Change-Id: I3d59bcf3a57cee588aab7f5cdd0287af66450c8a
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc
new file mode 100644
index 0000000..f9935f2
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=/usr/lib
+includedir=/usr/include
+
+Name: egl
+Description: MALI EGL library
+Requires.private:
+Version: r8p0
+Libs: -L${libdir} -lEGL
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc
new file mode 100644
index 0000000..4895400
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=/usr/lib
+includedir=/usr/include
+
+Name: glesv1
+Description: MALI OpenGL ES 1.1 library
+Requires.private:
+Version: r8p0
+Libs: -L${libdir} -lGLESv1_CM
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc
new file mode 100644
index 0000000..888af87
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=/usr/lib
+includedir=/usr/include
+
+Name: gles_cm
+Description: Mali OpenGL ES 1.1 CM library
+Requires.private:
+Version: r8p0
+Libs: -L${libdir} -lGLESv1_CM
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc
new file mode 100644
index 0000000..5047c39
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=/usr/lib
+includedir=/usr/include
+
+Name: glesv2
+Description: MALI OpenGL ES 2.0 library
+Requires.private:
+Version: r8p0
+Libs: -L${libdir} -lGLESv2
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb
new file mode 100644
index 0000000..3e675d9
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb
@@ -0,0 +1,108 @@
+DESCRIPTION = "libGLES for ZynqMP with Mali 400"
+
+LICENSE = "Proprietary"
+LICENSE_FLAGS = "xilinx"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Proprietary;md5=0557f9d92cf58f2ccdd50f62f8ac0b28"
+
+inherit distro_features_check
+inherit xilinx-fetch-restricted
+
+ANY_OF_DISTRO_FEATURES = "fbdev x11"
+
+PROVIDES += "virtual/libgles1 virtual/libgles2 virtual/egl"
+
+FILESEXTRAPATHS_append := " \
+                ${THISDIR}/files: \
+                ${THISDIR}/r8p0-00rel0: "
+
+
+# Fetch the MALI 400 binaries from here
+# https://www.xilinx.com/member/forms/download/mali-driver-license.html?filename=mali-400-userspace.tar
+
+PV = "r8p0-01rel0"
+SRC_URI = " \
+    https://www.xilinx.com/member/forms/download/mali-driver-license.html?filename=mali-400-userspace.tar;downloadfilename=mali-400-userspace.tar \
+    file://egl.pc \
+    file://glesv1_cm.pc \
+    file://glesv1.pc \
+    file://glesv2.pc \
+    "
+
+SRC_URI[md5sum] = "e75b147c8b4ee96616e24572cdc9c21f"
+SRC_URI[sha256sum] = "7b179ec2df54ee05a886cca1535c0bdc6cba77a646e22742adedc79bfc2b3017"
+
+COMPATIBLE_MACHINE = "^$"
+COMPATIBLE_MACHINE_zynqmpeg = "zynqmpeg"
+COMPATIBLE_MACHINE_zynqmpev = "zynqmpev"
+
+PACKAGE_ARCH = "${SOC_FAMILY}${SOC_VARIANT}"
+
+
+S = "${WORKDIR}/mali-400"
+
+X11RDEPENDS = "libxdamage libxext libx11 libdrm libxfixes"
+X11DEPENDS = "libxdamage libxext virtual/libx11 libdrm libxfixes"
+
+RDEPENDS_${PN} = " \
+	kernel-module-mali \
+	${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11RDEPENDS}', '', d)} \
+	"
+
+DEPENDS = "\
+	${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)} \
+	"
+
+EGL_TYPE = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11',  \
+               bb.utils.contains('DISTRO_FEATURES', 'fbdev',  'fbdev', '', d), d)}"
+
+do_compile() {
+	# Extract the MALI binaries into workdir
+	tar -xf ${WORKDIR}/mali/rel-v2018.1/r8p0-01rel0.tar -C ${S}
+}
+
+do_install() {
+    #Identify the ARCH type
+    ${TARGET_PREFIX}gcc --version > ARCH_PLATFORM
+    if grep -q aarch64 "ARCH_PLATFORM"; then
+	ARCH_PLATFORM_DIR=aarch64-linux-gnu
+    else
+	ARCH_PLATFORM_DIR=arm-linux-gnueabihf
+    fi
+
+    # install headers
+    install -d -m 0655 ${D}${includedir}/EGL
+    install -m 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/${EGL_TYPE}/usr/include/EGL/*.h ${D}${includedir}/EGL/
+    install -d -m 0655 ${D}${includedir}/GLES
+    install -m 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/${EGL_TYPE}/usr/include/GLES/*.h ${D}${includedir}/GLES/
+    install -d -m 0655 ${D}${includedir}/GLES2
+    install -m 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/${EGL_TYPE}/usr/include/GLES2/*.h ${D}${includedir}/GLES2/
+    install -d -m 0655 ${D}${includedir}/KHR
+    install -m 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/${EGL_TYPE}/usr/include/KHR/*.h ${D}${includedir}/KHR/
+
+    install -d ${D}${libdir}/pkgconfig
+    install -m 0644 ${WORKDIR}/egl.pc ${D}${libdir}/pkgconfig/egl.pc
+    install -m 0644 ${WORKDIR}/glesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc
+    install -m 0644 ${WORKDIR}/glesv1.pc ${D}${libdir}/pkgconfig/glesv1.pc
+    install -m 0644 ${WORKDIR}/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc
+
+    install -d ${D}${libdir}
+    cp -a --no-preserve=ownership ${S}/${PV}/${ARCH_PLATFORM_DIR}/${EGL_TYPE}/usr/lib/*.so* ${D}${libdir}
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
+        sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if (1)/' ${D}${includedir}/EGL/eglplatform.h
+    fi
+}
+
+
+# Inhibit warnings about files being stripped
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_SYSROOT_STRIP = "1"
+
+RREPLACES_${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2"
+RPROVIDES_${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2"
+RCONFLICTS_${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2"
+
+# These libraries shouldn't get installed in world builds unless something
+# explicitly depends upon them.
+EXCLUDE_FROM_WORLD = "1"
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
new file mode 100644
index 0000000..327f8f0
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb
@@ -0,0 +1,49 @@
+SUMMARY = "A Mali 400 Linux Kernel module"
+SECTION = "kernel/modules"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = " \
+	file://linux/license/gpl/mali_kernel_license.h;md5=436192a2c5cfd47df0ad1987dffc4ae6 \
+	"
+
+PV = "r8p0-01rel0"
+
+SRC_URI = " \
+	https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-${PV}.tgz \
+	file://0001-Change-Makefile-to-be-compatible-with-Yocto.patch \
+	file://0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch \
+	file://0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch \
+	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\
+	"
+SRC_URI[md5sum] = "8f04ae86957fd56197ad5a9d017b84ff"
+SRC_URI[sha256sum] = "bfd14fa3f75a71d4ba313534e651ca1c58dc354e882c0b39867e335882a06350"
+
+inherit module
+
+do_make_scripts[depends] += "virtual/kernel:do_unpack"
+
+S = "${WORKDIR}/DX910-SW-99002-${PV}/driver/src/devicedrv/mali"
+
+COMPATIBLE_MACHINE = "^$"
+COMPATIBLE_MACHINE_zynqmpeg = "zynqmpeg"
+COMPATIBLE_MACHINE_zynqmpev = "zynqmpev"
+
+PACKAGE_ARCH = "${SOC_FAMILY}${SOC_VARIANT}"
+
+EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \
+		ARCH="${ARCH}" \
+		BUILD=release \
+		MALI_PLATFORM="arm" \
+		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
new file mode 100644
index 0000000..e5eeb19
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch
@@ -0,0 +1,47 @@
+From 6d283b9aa3f7fb761da4cb076b47a62275fc4caa Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Date: Tue, 21 Nov 2017 03:57:25 -0800
+Subject: [PATCH 1/9] Change Makefile to be compatible with Yocto
+
+Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
+Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
+Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Upstream Status: Inappropriate [Xilinx specific]
+---
+ driver/src/devicedrv/mali/Makefile | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/driver/src/devicedrv/mali/Makefile b/driver/src/devicedrv/mali/Makefile
+index 5a259fe..a6dd94c 100644
+--- Makefile
++++ b/Makefile
+@@ -89,7 +89,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
+@@ -204,9 +208,12 @@ EXTRA_DEFINES += -DMALI_MEM_SWAP_TRACKING=1
+ endif
+ 
+ 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/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch
new file mode 100644
index 0000000..0a7b673
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch
@@ -0,0 +1,52 @@
+From f27aab2b0e4d5dea9b5a0e4648c142257940c428 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon@xilinx.com>
+Date: Thu, 25 Jun 2015 17:14:42 -0700
+Subject: [PATCH 2/9] staging: mali: r8p0-01rel0: 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@xilinx.com>
+Signed-off-by: Michal Simek <michal.simek@xilinx.com>
+Upstream Status: Inappropriate [Xilinx specific]
+---
+ 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 4e09aca..fac99bc 100644
+--- 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/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch
new file mode 100644
index 0000000..98aa6ac
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch
@@ -0,0 +1,35 @@
+From d6e44bbf8d1377f78481f611dec237e8d24baf74 Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Date: Tue, 21 Nov 2017 04:00:27 -0800
+Subject: [PATCH 3/9] staging: mali: r8p0-01rel0: Remove unused trace macros
+
+TRACE_SYSTEM_STRING is not need in each trace file anymore.
+
+Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
+Signed-off-by: Madhurkiran Harikrishnan <madhurki@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 7f0b19d..33cb1ca 100644
+--- linux/mali_linux_trace.h
++++ b/linux/mali_linux_trace.h
+@@ -13,13 +13,11 @@
+ 
+ #include <linux/types.h>
+ 
+-#include <linux/stringify.h>
+ #include <linux/tracepoint.h>
+ 
+ #undef  TRACE_SYSTEM
+ #define TRACE_SYSTEM mali
+ #ifndef TRACEPOINTS_ENABLED
+-#define TRACE_SYSTEM_STRING __stringfy(TRACE_SYSTEM)
+ #endif
+ #define TRACE_INCLUDE_PATH .
+ #define TRACE_INCLUDE_FILE mali_linux_trace
+-- 
+2.7.4
+
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch
new file mode 100644
index 0000000..c5c4967
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch
@@ -0,0 +1,47 @@
+From 2f5e8944357f43fbde4cb642c6ee4a699c88efb5 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon@xilinx.com>
+Date: Wed, 29 Jun 2016 09:14:37 -0700
+Subject: [PATCH 4/9] staging: mali: r8p0-01rel0: 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@xilinx.com>
+Upstream Status: Inappropriate [Xilinx specific]
+---
+ 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 fac99bc..62f9be6 100644
+--- 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/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch
new file mode 100644
index 0000000..3d78460
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch
@@ -0,0 +1,90 @@
+From e67e20ec6ff0c9720d87844270421453c738066a Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Date: Thu, 16 Feb 2017 12:15:58 -0800
+Subject: [PATCH 5/9] 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@xilinx.com>
+Upstream Status: Inappropriate [Xilinx specific]
+---
+ .../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 d7893a3..f15fb56 100644
+--- 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/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch
new file mode 100644
index 0000000..3e1745f
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch
@@ -0,0 +1,35 @@
+From ed7242238151c12029c566d1974058c579d8ae3d Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Date: Wed, 25 Jan 2017 10:00:33 -0800
+Subject: [PATCH 6/9] arm.c: global variable dma_ops is removed from the kernel
+ 4.7
+
+Refer kernel commit 1dccb598df549d892b6450c261da54cdd7af44b4, the global
+dma_ops variable and the special-casing for ACPI is removed , and just
+returns the dma ops that got set for the device, or the dummy_dma_ops
+if none were present.
+
+Signed-off-by: Madhurkiran Harikrishnan <madhurki@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 62f9be6..57ca989 100644
+--- 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/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
new file mode 100644
index 0000000..6e5f544
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-Replace-__GFP_REPEAT-by-__GFP_RETRY_MAYFAIL.patch
@@ -0,0 +1,54 @@
+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
new file mode 100644
index 0000000..592fea0
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0008-mali_internal_sync-Rename-wait_queue_t-with-wait_que.patch
@@ -0,0 +1,108 @@
+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
new file mode 100644
index 0000000..3445512
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0009-mali_memory_swap_alloc.c-Rename-global_page_state-wi.patch
@@ -0,0 +1,48 @@
+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/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch
new file mode 100644
index 0000000..98a86c8
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch
@@ -0,0 +1,31 @@
+From 58e2c55176f1a146781430b2a570c8ce5f80d426 Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Date: Mon, 28 Aug 2017 09:40:37 -0700
+Subject: [PATCH] common/mali_pm.c: Add PM runtime barrier after removing
+ suspend
+
+Runtime PM suspend "put" results in addition of PM suspend
+API in work queue. This barrier API will remove it from
+the work queue.
+
+Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Upstream-Status: Pending
+---
+ driver/src/devicedrv/mali/common/mali_pm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/driver/src/devicedrv/mali/common/mali_pm.c b/driver/src/devicedrv/mali/common/mali_pm.c
+index 858c689..62a1e5f 100644
+--- common/mali_pm.c
++++ b/common/mali_pm.c
+@@ -301,6 +301,7 @@ void mali_pm_init_end(void)
+ 	}
+ 
+ 	_mali_osk_pm_dev_ref_put();
++	_mali_osk_pm_dev_barrier();
+ }
+ 
+ void mali_pm_update_sync(void)
+-- 
+2.7.4
+
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch
new file mode 100644
index 0000000..38ab404
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch
@@ -0,0 +1,153 @@
+From aeff13ad9e9ef73172a9325f669aefd3c0403dbb Mon Sep 17 00:00:00 2001
+From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Date: Wed, 21 Feb 2018 16:52:15 -0800
+Subject: [PATCH] linux/mali_kernel_linux.c: Enable/disable clock for runtime
+ resume/suspend
+
+Enable/Disable the clock for GP,PP0 and PP1 during runtime
+resume/suspend.
+
+Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com>
+Reviewed-by: Hyun Kwon <hyunk@xilinx.com>
+Upstream Status: Inappropriate [Xilinx specific]
+---
+ .../src/devicedrv/mali/linux/mali_kernel_linux.c   | 65 ++++++++++++++++++----
+ 1 file changed, 54 insertions(+), 11 deletions(-)
+
+diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c
+index f15fb56..e61f33b 100644
+--- linux/mali_kernel_linux.c
++++ b/linux/mali_kernel_linux.c
+@@ -51,6 +51,7 @@
+ struct clk *clk_gpu;
+ struct clk *clk_gpu_pp0;
+ struct clk *clk_gpu_pp1;
++mali_bool clk_enabled;
+ #endif
+ 
+ #if defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_MALI_DVFS)
+@@ -281,6 +282,46 @@ struct file_operations mali_fops = {
+ 	.mmap = mali_mmap
+ };
+ 
++static int mali_enable_clk(void)
++{
++#if defined(CONFIG_ARCH_ZYNQMP)
++	int err = 0;
++
++	if (clk_enabled)
++		return 0;
++
++	clk_enabled = MALI_TRUE;
++	err = clk_prepare_enable(clk_gpu);
++	if (err) {
++		MALI_PRINT_ERROR(("Could not enable clock for GP\n\r"));
++		return err;
++	}
++	err = clk_prepare_enable(clk_gpu_pp0);
++	if (err) {
++		MALI_PRINT_ERROR(("Could not enable clock for PP0\n\r"));
++		return err;
++	}
++	err = clk_prepare_enable(clk_gpu_pp1);
++	if (err) {
++		MALI_PRINT_ERROR(("Could not enable clock for PP1\n\r"));
++		return err;
++	}
++#endif
++	return 0;
++}
++
++static void mali_disable_clk(void)
++{
++#if defined(CONFIG_ARCH_ZYNQMP)
++	if (clk_enabled) {
++		clk_enabled = MALI_FALSE;
++		clk_disable_unprepare(clk_gpu);
++		clk_disable_unprepare(clk_gpu_pp0);
++		clk_disable_unprepare(clk_gpu_pp1);
++	}
++#endif
++}
++
+ #if MALI_ENABLE_CPU_CYCLES
+ void mali_init_cpu_time_counters(int reset, int enable_divide_by_64)
+ {
+@@ -593,18 +634,19 @@ static int mali_probe(struct platform_device *pdev)
+ 	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
++
++	err = mali_enable_clk();
++	if (err)
++		return err;
+ 	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()) {
+@@ -632,11 +674,6 @@ 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);
+@@ -644,6 +681,7 @@ devfreq_init_failed:
+ 	mali_pm_metrics_term(mdev);
+ pm_metrics_init_failed:
+ 	clk_disable_unprepare(mdev->clock);
++	mali_disable_clk();
+ clock_prepare_failed:
+ 	clk_put(mdev->clock);
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && defined(CONFIG_OF) \
+@@ -706,9 +744,7 @@ static int mali_remove(struct platform_device *pdev)
+ 
+ #if defined(CONFIG_ARCH_ZYNQMP)
+ 	/* Remove clock */
+-	clk_disable_unprepare(clk_gpu);
+-	clk_disable_unprepare(clk_gpu_pp0);
+-	clk_disable_unprepare(clk_gpu_pp1);
++	mali_disable_clk();
+ #endif
+ 
+ 	return 0;
+@@ -816,6 +852,8 @@ static int mali_driver_runtime_suspend(struct device *dev)
+ 		devfreq_suspend_device(mdev->devfreq);
+ #endif
+ 
++	mali_disable_clk();
++
+ 		return 0;
+ 	} else {
+ 		return -EBUSY;
+@@ -824,6 +862,11 @@ static int mali_driver_runtime_suspend(struct device *dev)
+ 
+ static int mali_driver_runtime_resume(struct device *dev)
+ {
++	int err ;
++
++	err = mali_enable_clk();
++	if (err)
++		return err;
+ #ifdef CONFIG_MALI_DEVFREQ
+ 	struct mali_device *mdev = dev_get_drvdata(dev);
+ 	if (!mdev)
+-- 
+2.7.4
+
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch
new file mode 100644
index 0000000..bf2169e
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch
@@ -0,0 +1,141 @@
+From 630a8ea035fe2f075f6ea7f4bad0928f5b541c80 Mon Sep 17 00:00:00 2001
+From: Hyun Kwon <hyun.kwon@xilinx.com>
+Date: Wed, 21 Jan 2015 11:53:19 -0800
+Subject: [PATCH] src: drmmode_xilinx: Add the dumb gem support for Xilinx
+
+Add the dumb gem support for Xilinx
+
+Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
+Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
+Upstream-Status: Pending
+---
+ src/Makefile.am                     |  3 +-
+ src/armsoc_driver.c                 |  1 +
+ src/drmmode_driver.h                |  1 +
+ src/drmmode_xilinx/drmmode_xilinx.c | 76 +++++++++++++++++++++++++++++++++++++
+ 4 files changed, 80 insertions(+), 1 deletion(-)
+ create mode 100644 src/drmmode_xilinx/drmmode_xilinx.c
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 3b2601927c..db5f110fb2 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -43,7 +43,8 @@ armsoc_drv_ladir = @moduledir@/drivers
+ DRMMODE_SRCS = drmmode_exynos/drmmode_exynos.c \
+ 	drmmode_pl111/drmmode_pl111.c \
+ 	drmmode_kirin/drmmode_kirin.c \
+-	drmmode_sti/drmmode_sti.c
++	drmmode_sti/drmmode_sti.c \
++	drmmode_xilinx/drmmode_xilinx.c
+ 
+ 
+ armsoc_drv_la_SOURCES = \
+diff --git a/src/armsoc_driver.c b/src/armsoc_driver.c
+index 83e74a7ed1..3ace3c7be5 100644
+--- a/src/armsoc_driver.c
++++ b/src/armsoc_driver.c
+@@ -737,6 +737,7 @@ static struct drmmode_interface *get_drmmode_implementation(int drm_fd)
+ 		&pl111_interface,
+ 		&kirin_interface,
+ 		&sti_interface,
++		&xilinx_interface,
+ 	};
+ 	int i;
+ 
+diff --git a/src/drmmode_driver.h b/src/drmmode_driver.h
+index 879fc60ddc..18245d591a 100644
+--- a/src/drmmode_driver.h
++++ b/src/drmmode_driver.h
+@@ -106,6 +106,7 @@ extern struct drmmode_interface exynos_interface;
+ extern struct drmmode_interface pl111_interface;
+ extern struct drmmode_interface kirin_interface;
+ extern struct drmmode_interface sti_interface;
++extern struct drmmode_interface xilinx_interface;
+ 
+ 
+ #endif
+diff --git a/src/drmmode_xilinx/drmmode_xilinx.c b/src/drmmode_xilinx/drmmode_xilinx.c
+new file mode 100644
+index 0000000000..f4faceb0b4
+--- /dev/null
++++ b/src/drmmode_xilinx/drmmode_xilinx.c
+@@ -0,0 +1,76 @@
++/*
++ * Xilinx X11 ARMSOC driver
++ *
++ * Author: Hyun Woo Kwon <hyun.kwon@xilinx.com>
++ *
++ * Copyright (C) 2014 Xilinx, Inc.
++ *
++ * Based on drmmode_exynos.c
++ *
++ * Copyright © 2013 ARM Limited.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ *
++ */
++
++#include <stdlib.h>
++
++#include <drm.h>
++#include <xf86drm.h>
++
++#include "../drmmode_driver.h"
++
++static int create_custom_gem(int fd, struct armsoc_create_gem *create_gem)
++{
++	struct drm_mode_create_dumb arg;
++	int ret;
++
++	memset(&arg, 0, sizeof(arg));
++	arg.height = create_gem->height;
++	arg.width = create_gem->width;
++	arg.bpp = create_gem->bpp;
++
++	ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
++	if (ret)
++		return ret;
++
++	create_gem->height = arg.height;
++	create_gem->width = arg.width;
++	create_gem->bpp = arg.bpp;
++	create_gem->handle = arg.handle;
++	create_gem->pitch = arg.pitch;
++	create_gem->size = arg.size;
++
++	return 0;
++}
++
++struct drmmode_interface xilinx_interface = {
++	"xlnx"                /* name of drm driver */,
++	1                     /* use_page_flip_events */,
++	1                     /* use_early_display */,
++	0                     /* cursor width */,
++	0                     /* cursor_height */,
++	0                     /* cursor padding */,
++	HWCURSOR_API_NONE     /* cursor_api */,
++	NULL                  /* init_plane_for_cursor */,
++	0                     /* vblank_query_supported */,
++	create_custom_gem     /* create_custom_gem */,
++};
++
+-- 
+2.11.0
+
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc_git.bb b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc_git.bb
new file mode 100644
index 0000000..7a671fe
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc_git.bb
@@ -0,0 +1,23 @@
+require recipes-graphics/xorg-driver/xorg-driver-video.inc
+
+SUMMARY = "X.Org X server -- Xilinx ARM SOC display driver"
+DESCRIPTION = "Xilinx ARM SOC display driver "
+
+LICENSE = "MIT-X & GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=10ce5de3b111315ea652a5f74ec0c602"
+
+DEPENDS += "virtual/libx11 libdrm xf86driproto"
+RDEPENDS_${PN} += "xserver-xorg-module-exa"
+
+PV = "1.4.1+git${SRCPV}"
+
+SRCREV = "8bbdb2ae3bb8ef649999a8da33ddbe11a04763b8"
+SRC_URI = " \
+	git://anongit.freedesktop.org/xorg/driver/xf86-video-armsoc \
+	file://0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch \
+	"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = " --enable-maintainer-mode"
+CFLAGS += " -I${STAGING_INCDIR}/xorg "
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf
new file mode 100644
index 0000000..9ef3946
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf
@@ -0,0 +1,27 @@
+Section "InputDevice"
+	Identifier	"System Mouse"
+	Driver		"mouse"
+	Option		"Device" "/dev/input/mouse0"
+EndSection
+
+Section "InputDevice"
+	Identifier	"System Keyboard"
+	Driver		"kbd"
+	Option		"Device" "/dev/input/event0"
+EndSection
+
+Section "Device"
+        Identifier      "ZynqMP"
+        Driver          "armsoc"
+        Option          "DRI2"                  "true"
+        Option          "DRI2_PAGE_FLIP"        "false"
+        Option          "DRI2_WAIT_VSYNC"       "true"
+        Option          "SWcursorLCD"           "false"
+        Option          "DEBUG"                 "false"
+EndSection
+
+Section "Screen"
+        Identifier      "DefaultScreen"
+        Device          "ZynqMP"
+        DefaultDepth    16
+EndSection
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend
new file mode 100644
index 0000000..72d991c
--- /dev/null
+++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"