diff options
Diffstat (limited to 'meta-xilinx-core/recipes-graphics/mali/kernel-module-mali')
20 files changed, 1191 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch new file mode 100644 index 00000000..3c82f602 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 6d283b9aa3f7fb761da4cb076b47a62275fc4caa Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
3 | Date: Tue, 21 Nov 2017 03:57:25 -0800 | ||
4 | Subject: [PATCH 1/9] Change Makefile to be compatible with Yocto | ||
5 | |||
6 | Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> | ||
7 | Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
8 | Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
9 | Upstream Status: Inappropriate [Xilinx specific] | ||
10 | --- | ||
11 | driver/src/devicedrv/mali/Makefile | 11 +++++++++-- | ||
12 | 1 file changed, 9 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/driver/src/devicedrv/mali/Makefile b/driver/src/devicedrv/mali/Makefile | ||
15 | index 5a259fe..a6dd94c 100644 | ||
16 | --- Makefile | ||
17 | +++ b/Makefile | ||
18 | @@ -89,7 +89,11 @@ endif | ||
19 | # Define host system directory | ||
20 | KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build | ||
21 | |||
22 | -include $(KDIR)/.config | ||
23 | +ifeq ($(O),) | ||
24 | + -include $(KDIR)/.config | ||
25 | +else | ||
26 | + -include $(O)/.config | ||
27 | +endif | ||
28 | |||
29 | ifeq ($(ARCH), arm) | ||
30 | # when compiling for ARM we're cross compiling | ||
31 | @@ -204,9 +208,12 @@ EXTRA_DEFINES += -DMALI_MEM_SWAP_TRACKING=1 | ||
32 | endif | ||
33 | |||
34 | all: $(UMP_SYMVERS_FILE) | ||
35 | - $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules | ||
36 | + $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) O=$(O) modules | ||
37 | @rm $(FILES_PREFIX)__malidrv_build_info.c $(FILES_PREFIX)__malidrv_build_info.o | ||
38 | |||
39 | +modules_install: | ||
40 | + $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules_install | ||
41 | + | ||
42 | clean: | ||
43 | $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean | ||
44 | |||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch new file mode 100644 index 00000000..0a7b6736 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From f27aab2b0e4d5dea9b5a0e4648c142257940c428 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hyun Kwon <hyun.kwon@xilinx.com> | ||
3 | Date: Thu, 25 Jun 2015 17:14:42 -0700 | ||
4 | Subject: [PATCH 2/9] staging: mali: r8p0-01rel0: Add the ZYNQ/ZYNQMP platform | ||
5 | |||
6 | Add the number of PP cores that is required for Zynq/ZynqMP configuration. | ||
7 | |||
8 | Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
9 | Signed-off-by: Michal Simek <michal.simek@xilinx.com> | ||
10 | Upstream Status: Inappropriate [Xilinx specific] | ||
11 | --- | ||
12 | driver/src/devicedrv/mali/platform/arm/arm.c | 10 ++++++++++ | ||
13 | 1 file changed, 10 insertions(+) | ||
14 | |||
15 | diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c | ||
16 | index 4e09aca..fac99bc 100644 | ||
17 | --- platform/arm/arm.c | ||
18 | +++ b/platform/arm/arm.c | ||
19 | @@ -261,6 +261,10 @@ static struct mali_gpu_device_data mali_gpu_data = { | ||
20 | .dedicated_mem_start = 0x80000000, /* Physical start address (use 0xD0000000 for old indirect setup) */ | ||
21 | .dedicated_mem_size = 0x10000000, /* 256MB */ | ||
22 | #endif | ||
23 | +#if defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP) | ||
24 | + .fb_start = 0x00000000, | ||
25 | + .fb_size = 0xfffff000, | ||
26 | +#else | ||
27 | #if defined(CONFIG_ARM64) | ||
28 | /* Some framebuffer drivers get the framebuffer dynamically, such as through GEM, | ||
29 | * in which the memory resource can't be predicted in advance. | ||
30 | @@ -271,6 +275,7 @@ static struct mali_gpu_device_data mali_gpu_data = { | ||
31 | .fb_start = 0xe0000000, | ||
32 | .fb_size = 0x01000000, | ||
33 | #endif | ||
34 | +#endif /* !defined(CONFIG_ARCH_ZYNQ) && !defined(CONFIG_ARCH_ZYNQMP) */ | ||
35 | .control_interval = 1000, /* 1000ms */ | ||
36 | .utilization_callback = mali_gpu_utilization_callback, | ||
37 | .get_clock_info = NULL, | ||
38 | @@ -505,6 +510,11 @@ int mali_platform_device_init(struct platform_device *device) | ||
39 | mali_write_phys(0xC0010020, 0xA); /* Enable direct memory mapping for FPGA */ | ||
40 | } | ||
41 | } | ||
42 | +#elif defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP) | ||
43 | + | ||
44 | + MALI_DEBUG_PRINT(4, ("Registering Zynq/ZynqMP Mali-400 device\n")); | ||
45 | + num_pp_cores = 2; | ||
46 | + | ||
47 | #endif | ||
48 | |||
49 | /* After kernel 3.15 device tree will default set dev | ||
50 | -- | ||
51 | 2.7.4 | ||
52 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch new file mode 100644 index 00000000..98aa6ac9 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From d6e44bbf8d1377f78481f611dec237e8d24baf74 Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
3 | Date: Tue, 21 Nov 2017 04:00:27 -0800 | ||
4 | Subject: [PATCH 3/9] staging: mali: r8p0-01rel0: Remove unused trace macros | ||
5 | |||
6 | TRACE_SYSTEM_STRING is not need in each trace file anymore. | ||
7 | |||
8 | Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
9 | Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
10 | Upstream Status: Pending | ||
11 | --- | ||
12 | driver/src/devicedrv/mali/linux/mali_linux_trace.h | 2 -- | ||
13 | 1 file changed, 2 deletions(-) | ||
14 | |||
15 | diff --git a/driver/src/devicedrv/mali/linux/mali_linux_trace.h b/driver/src/devicedrv/mali/linux/mali_linux_trace.h | ||
16 | index 7f0b19d..33cb1ca 100644 | ||
17 | --- linux/mali_linux_trace.h | ||
18 | +++ b/linux/mali_linux_trace.h | ||
19 | @@ -13,13 +13,11 @@ | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | -#include <linux/stringify.h> | ||
24 | #include <linux/tracepoint.h> | ||
25 | |||
26 | #undef TRACE_SYSTEM | ||
27 | #define TRACE_SYSTEM mali | ||
28 | #ifndef TRACEPOINTS_ENABLED | ||
29 | -#define TRACE_SYSTEM_STRING __stringfy(TRACE_SYSTEM) | ||
30 | #endif | ||
31 | #define TRACE_INCLUDE_PATH . | ||
32 | #define TRACE_INCLUDE_FILE mali_linux_trace | ||
33 | -- | ||
34 | 2.7.4 | ||
35 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch new file mode 100644 index 00000000..c5c49679 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 2f5e8944357f43fbde4cb642c6ee4a699c88efb5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hyun Kwon <hyun.kwon@xilinx.com> | ||
3 | Date: Wed, 29 Jun 2016 09:14:37 -0700 | ||
4 | Subject: [PATCH 4/9] staging: mali: r8p0-01rel0: Don't include | ||
5 | mali_read_phys() for zynq/zynqmp | ||
6 | |||
7 | mali_read_phys() is not used with CONFIG_ARCH_ZYNQ and CONFIG_ARCH_ZYNQMP. | ||
8 | |||
9 | Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
10 | Upstream Status: Inappropriate [Xilinx specific] | ||
11 | --- | ||
12 | driver/src/devicedrv/mali/platform/arm/arm.c | 4 ++++ | ||
13 | 1 file changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c | ||
16 | index fac99bc..62f9be6 100644 | ||
17 | --- platform/arm/arm.c | ||
18 | +++ b/platform/arm/arm.c | ||
19 | @@ -38,7 +38,9 @@ | ||
20 | static int mali_core_scaling_enable = 0; | ||
21 | |||
22 | void mali_gpu_utilization_callback(struct mali_gpu_utilization_data *data); | ||
23 | +#if !(defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP)) | ||
24 | static u32 mali_read_phys(u32 phys_addr); | ||
25 | +#endif | ||
26 | #if defined(CONFIG_ARCH_REALVIEW) | ||
27 | static void mali_write_phys(u32 phys_addr, u32 value); | ||
28 | #endif | ||
29 | @@ -578,6 +580,7 @@ int mali_platform_device_deinit(struct platform_device *device) | ||
30 | |||
31 | #endif /* CONFIG_MALI_DT */ | ||
32 | |||
33 | +#if !(defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP)) | ||
34 | static u32 mali_read_phys(u32 phys_addr) | ||
35 | { | ||
36 | u32 phys_addr_page = phys_addr & 0xFFFFE000; | ||
37 | @@ -592,6 +595,7 @@ static u32 mali_read_phys(u32 phys_addr) | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | +#endif | ||
42 | |||
43 | #if defined(CONFIG_ARCH_REALVIEW) | ||
44 | static void mali_write_phys(u32 phys_addr, u32 value) | ||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch new file mode 100644 index 00000000..3d784604 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch | |||
@@ -0,0 +1,90 @@ | |||
1 | From e67e20ec6ff0c9720d87844270421453c738066a Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
3 | Date: Thu, 16 Feb 2017 12:15:58 -0800 | ||
4 | Subject: [PATCH 5/9] linux/mali_kernel_linux.c: Handle clock when probed and | ||
5 | removed | ||
6 | |||
7 | This patch will handle the clock through clock | ||
8 | specifier for GPU PP0 and PP1. | ||
9 | |||
10 | Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
11 | Upstream Status: Inappropriate [Xilinx specific] | ||
12 | --- | ||
13 | .../src/devicedrv/mali/linux/mali_kernel_linux.c | 40 +++++++++++++++++++++- | ||
14 | 1 file changed, 39 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c | ||
17 | index d7893a3..f15fb56 100644 | ||
18 | --- linux/mali_kernel_linux.c | ||
19 | +++ b/linux/mali_kernel_linux.c | ||
20 | @@ -45,6 +45,14 @@ | ||
21 | #if defined(CONFIG_MALI400_INTERNAL_PROFILING) | ||
22 | #include "mali_profiling_internal.h" | ||
23 | #endif | ||
24 | + | ||
25 | +#if defined(CONFIG_ARCH_ZYNQMP) | ||
26 | +/* Initialize variables for clocks */ | ||
27 | +struct clk *clk_gpu; | ||
28 | +struct clk *clk_gpu_pp0; | ||
29 | +struct clk *clk_gpu_pp1; | ||
30 | +#endif | ||
31 | + | ||
32 | #if defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_MALI_DVFS) | ||
33 | #include "mali_osk_profiling.h" | ||
34 | #include "mali_dvfs_policy.h" | ||
35 | @@ -580,7 +588,23 @@ static int mali_probe(struct platform_device *pdev) | ||
36 | } | ||
37 | #endif | ||
38 | |||
39 | - | ||
40 | +#if defined(CONFIG_ARCH_ZYNQMP) | ||
41 | + /* Initialize clocks for GPU and PP */ | ||
42 | + clk_gpu = devm_clk_get(&pdev->dev, "gpu"); | ||
43 | + if (IS_ERR(clk_gpu)) | ||
44 | + return PTR_ERR(clk_gpu); | ||
45 | + clk_prepare_enable(clk_gpu); | ||
46 | + | ||
47 | + clk_gpu_pp0 = devm_clk_get(&pdev->dev, "gpu_pp0"); | ||
48 | + if (IS_ERR(clk_gpu_pp0)) | ||
49 | + return PTR_ERR(clk_gpu_pp0); | ||
50 | + clk_prepare_enable(clk_gpu_pp0); | ||
51 | + | ||
52 | + clk_gpu_pp1 = devm_clk_get(&pdev->dev, "gpu_pp1"); | ||
53 | + if (IS_ERR(clk_gpu_pp1)) | ||
54 | + return PTR_ERR(clk_gpu_pp1); | ||
55 | + clk_prepare_enable(clk_gpu_pp1); | ||
56 | +#endif | ||
57 | if (_MALI_OSK_ERR_OK == _mali_osk_wq_init()) { | ||
58 | /* Initialize the Mali GPU HW specified by pdev */ | ||
59 | if (_MALI_OSK_ERR_OK == mali_initialize_subsystems()) { | ||
60 | @@ -608,6 +632,12 @@ static int mali_probe(struct platform_device *pdev) | ||
61 | _mali_osk_wq_term(); | ||
62 | } | ||
63 | |||
64 | +#if defined(CONFIG_ARCH_ZYNQMP) | ||
65 | + clk_disable_unprepare(clk_gpu); | ||
66 | + clk_disable_unprepare(clk_gpu_pp0); | ||
67 | + clk_disable_unprepare(clk_gpu_pp1); | ||
68 | +#endif | ||
69 | + | ||
70 | #ifdef CONFIG_MALI_DEVFREQ | ||
71 | mali_devfreq_term(mdev); | ||
72 | devfreq_init_failed: | ||
73 | @@ -673,6 +703,14 @@ static int mali_remove(struct platform_device *pdev) | ||
74 | mali_platform_device_deinit(mali_platform_device); | ||
75 | #endif | ||
76 | mali_platform_device = NULL; | ||
77 | + | ||
78 | +#if defined(CONFIG_ARCH_ZYNQMP) | ||
79 | + /* Remove clock */ | ||
80 | + clk_disable_unprepare(clk_gpu); | ||
81 | + clk_disable_unprepare(clk_gpu_pp0); | ||
82 | + clk_disable_unprepare(clk_gpu_pp1); | ||
83 | +#endif | ||
84 | + | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | -- | ||
89 | 2.7.4 | ||
90 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch new file mode 100644 index 00000000..3e1745fd --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From ed7242238151c12029c566d1974058c579d8ae3d Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
3 | Date: Wed, 25 Jan 2017 10:00:33 -0800 | ||
4 | Subject: [PATCH 6/9] arm.c: global variable dma_ops is removed from the kernel | ||
5 | 4.7 | ||
6 | |||
7 | Refer kernel commit 1dccb598df549d892b6450c261da54cdd7af44b4, the global | ||
8 | dma_ops variable and the special-casing for ACPI is removed , and just | ||
9 | returns the dma ops that got set for the device, or the dummy_dma_ops | ||
10 | if none were present. | ||
11 | |||
12 | Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
13 | Upstream Status: Pending | ||
14 | --- | ||
15 | driver/src/devicedrv/mali/platform/arm/arm.c | 3 ++- | ||
16 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c | ||
19 | index 62f9be6..57ca989 100644 | ||
20 | --- platform/arm/arm.c | ||
21 | +++ b/platform/arm/arm.c | ||
22 | @@ -529,8 +529,9 @@ int mali_platform_device_init(struct platform_device *device) | ||
23 | */ | ||
24 | if (!device->dev.dma_mask) | ||
25 | device->dev.dma_mask = &device->dev.coherent_dma_mask; | ||
26 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) | ||
27 | device->dev.archdata.dma_ops = dma_ops; | ||
28 | - | ||
29 | +#endif | ||
30 | err = platform_device_add_data(device, &mali_gpu_data, sizeof(mali_gpu_data)); | ||
31 | |||
32 | if (0 == err) { | ||
33 | -- | ||
34 | 2.7.4 | ||
35 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch new file mode 100644 index 00000000..98a86c88 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 58e2c55176f1a146781430b2a570c8ce5f80d426 Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
3 | Date: Mon, 28 Aug 2017 09:40:37 -0700 | ||
4 | Subject: [PATCH] common/mali_pm.c: Add PM runtime barrier after removing | ||
5 | suspend | ||
6 | |||
7 | Runtime PM suspend "put" results in addition of PM suspend | ||
8 | API in work queue. This barrier API will remove it from | ||
9 | the work queue. | ||
10 | |||
11 | Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
12 | Upstream-Status: Pending | ||
13 | --- | ||
14 | driver/src/devicedrv/mali/common/mali_pm.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/driver/src/devicedrv/mali/common/mali_pm.c b/driver/src/devicedrv/mali/common/mali_pm.c | ||
18 | index 858c689..62a1e5f 100644 | ||
19 | --- common/mali_pm.c | ||
20 | +++ b/common/mali_pm.c | ||
21 | @@ -301,6 +301,7 @@ void mali_pm_init_end(void) | ||
22 | } | ||
23 | |||
24 | _mali_osk_pm_dev_ref_put(); | ||
25 | + _mali_osk_pm_dev_barrier(); | ||
26 | } | ||
27 | |||
28 | void mali_pm_update_sync(void) | ||
29 | -- | ||
30 | 2.7.4 | ||
31 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch new file mode 100644 index 00000000..38ab4042 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch | |||
@@ -0,0 +1,153 @@ | |||
1 | From aeff13ad9e9ef73172a9325f669aefd3c0403dbb Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
3 | Date: Wed, 21 Feb 2018 16:52:15 -0800 | ||
4 | Subject: [PATCH] linux/mali_kernel_linux.c: Enable/disable clock for runtime | ||
5 | resume/suspend | ||
6 | |||
7 | Enable/Disable the clock for GP,PP0 and PP1 during runtime | ||
8 | resume/suspend. | ||
9 | |||
10 | Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> | ||
11 | Reviewed-by: Hyun Kwon <hyunk@xilinx.com> | ||
12 | Upstream Status: Inappropriate [Xilinx specific] | ||
13 | --- | ||
14 | .../src/devicedrv/mali/linux/mali_kernel_linux.c | 65 ++++++++++++++++++---- | ||
15 | 1 file changed, 54 insertions(+), 11 deletions(-) | ||
16 | |||
17 | diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c | ||
18 | index f15fb56..e61f33b 100644 | ||
19 | --- linux/mali_kernel_linux.c | ||
20 | +++ b/linux/mali_kernel_linux.c | ||
21 | @@ -51,6 +51,7 @@ | ||
22 | struct clk *clk_gpu; | ||
23 | struct clk *clk_gpu_pp0; | ||
24 | struct clk *clk_gpu_pp1; | ||
25 | +mali_bool clk_enabled; | ||
26 | #endif | ||
27 | |||
28 | #if defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_MALI_DVFS) | ||
29 | @@ -281,6 +282,46 @@ struct file_operations mali_fops = { | ||
30 | .mmap = mali_mmap | ||
31 | }; | ||
32 | |||
33 | +static int mali_enable_clk(void) | ||
34 | +{ | ||
35 | +#if defined(CONFIG_ARCH_ZYNQMP) | ||
36 | + int err = 0; | ||
37 | + | ||
38 | + if (clk_enabled) | ||
39 | + return 0; | ||
40 | + | ||
41 | + clk_enabled = MALI_TRUE; | ||
42 | + err = clk_prepare_enable(clk_gpu); | ||
43 | + if (err) { | ||
44 | + MALI_PRINT_ERROR(("Could not enable clock for GP\n\r")); | ||
45 | + return err; | ||
46 | + } | ||
47 | + err = clk_prepare_enable(clk_gpu_pp0); | ||
48 | + if (err) { | ||
49 | + MALI_PRINT_ERROR(("Could not enable clock for PP0\n\r")); | ||
50 | + return err; | ||
51 | + } | ||
52 | + err = clk_prepare_enable(clk_gpu_pp1); | ||
53 | + if (err) { | ||
54 | + MALI_PRINT_ERROR(("Could not enable clock for PP1\n\r")); | ||
55 | + return err; | ||
56 | + } | ||
57 | +#endif | ||
58 | + return 0; | ||
59 | +} | ||
60 | + | ||
61 | +static void mali_disable_clk(void) | ||
62 | +{ | ||
63 | +#if defined(CONFIG_ARCH_ZYNQMP) | ||
64 | + if (clk_enabled) { | ||
65 | + clk_enabled = MALI_FALSE; | ||
66 | + clk_disable_unprepare(clk_gpu); | ||
67 | + clk_disable_unprepare(clk_gpu_pp0); | ||
68 | + clk_disable_unprepare(clk_gpu_pp1); | ||
69 | + } | ||
70 | +#endif | ||
71 | +} | ||
72 | + | ||
73 | #if MALI_ENABLE_CPU_CYCLES | ||
74 | void mali_init_cpu_time_counters(int reset, int enable_divide_by_64) | ||
75 | { | ||
76 | @@ -593,18 +634,19 @@ static int mali_probe(struct platform_device *pdev) | ||
77 | clk_gpu = devm_clk_get(&pdev->dev, "gpu"); | ||
78 | if (IS_ERR(clk_gpu)) | ||
79 | return PTR_ERR(clk_gpu); | ||
80 | - clk_prepare_enable(clk_gpu); | ||
81 | |||
82 | clk_gpu_pp0 = devm_clk_get(&pdev->dev, "gpu_pp0"); | ||
83 | if (IS_ERR(clk_gpu_pp0)) | ||
84 | return PTR_ERR(clk_gpu_pp0); | ||
85 | - clk_prepare_enable(clk_gpu_pp0); | ||
86 | |||
87 | clk_gpu_pp1 = devm_clk_get(&pdev->dev, "gpu_pp1"); | ||
88 | if (IS_ERR(clk_gpu_pp1)) | ||
89 | return PTR_ERR(clk_gpu_pp1); | ||
90 | - clk_prepare_enable(clk_gpu_pp1); | ||
91 | #endif | ||
92 | + | ||
93 | + err = mali_enable_clk(); | ||
94 | + if (err) | ||
95 | + return err; | ||
96 | if (_MALI_OSK_ERR_OK == _mali_osk_wq_init()) { | ||
97 | /* Initialize the Mali GPU HW specified by pdev */ | ||
98 | if (_MALI_OSK_ERR_OK == mali_initialize_subsystems()) { | ||
99 | @@ -632,11 +674,6 @@ static int mali_probe(struct platform_device *pdev) | ||
100 | _mali_osk_wq_term(); | ||
101 | } | ||
102 | |||
103 | -#if defined(CONFIG_ARCH_ZYNQMP) | ||
104 | - clk_disable_unprepare(clk_gpu); | ||
105 | - clk_disable_unprepare(clk_gpu_pp0); | ||
106 | - clk_disable_unprepare(clk_gpu_pp1); | ||
107 | -#endif | ||
108 | |||
109 | #ifdef CONFIG_MALI_DEVFREQ | ||
110 | mali_devfreq_term(mdev); | ||
111 | @@ -644,6 +681,7 @@ devfreq_init_failed: | ||
112 | mali_pm_metrics_term(mdev); | ||
113 | pm_metrics_init_failed: | ||
114 | clk_disable_unprepare(mdev->clock); | ||
115 | + mali_disable_clk(); | ||
116 | clock_prepare_failed: | ||
117 | clk_put(mdev->clock); | ||
118 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && defined(CONFIG_OF) \ | ||
119 | @@ -706,9 +744,7 @@ static int mali_remove(struct platform_device *pdev) | ||
120 | |||
121 | #if defined(CONFIG_ARCH_ZYNQMP) | ||
122 | /* Remove clock */ | ||
123 | - clk_disable_unprepare(clk_gpu); | ||
124 | - clk_disable_unprepare(clk_gpu_pp0); | ||
125 | - clk_disable_unprepare(clk_gpu_pp1); | ||
126 | + mali_disable_clk(); | ||
127 | #endif | ||
128 | |||
129 | return 0; | ||
130 | @@ -816,6 +852,8 @@ static int mali_driver_runtime_suspend(struct device *dev) | ||
131 | devfreq_suspend_device(mdev->devfreq); | ||
132 | #endif | ||
133 | |||
134 | + mali_disable_clk(); | ||
135 | + | ||
136 | return 0; | ||
137 | } else { | ||
138 | return -EBUSY; | ||
139 | @@ -824,6 +862,11 @@ static int mali_driver_runtime_suspend(struct device *dev) | ||
140 | |||
141 | static int mali_driver_runtime_resume(struct device *dev) | ||
142 | { | ||
143 | + int err ; | ||
144 | + | ||
145 | + err = mali_enable_clk(); | ||
146 | + if (err) | ||
147 | + return err; | ||
148 | #ifdef CONFIG_MALI_DEVFREQ | ||
149 | struct mali_device *mdev = dev_get_drvdata(dev); | ||
150 | if (!mdev) | ||
151 | -- | ||
152 | 2.7.4 | ||
153 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch new file mode 100644 index 00000000..24f0a22c --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 779b1883d56804ecd08fe7f57d6c01e3db4e893b Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Wed, 5 Dec 2018 18:07:29 -0800 | ||
4 | Subject: [PATCH 1/3] linux: mali_memory_os_alloc: Remove __GFP_COLD | ||
5 | |||
6 | The support for Cache hot and cold pages are removed from the kernel. | ||
7 | For more information refer kernel commit 453f85d43fa9ee243f0fc3ac4e1be45615301e3f | ||
8 | |||
9 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
10 | Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
11 | Upstream Status: Pending | ||
12 | --- | ||
13 | driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | 4 +++- | ||
14 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | ||
17 | index 1602371..830e8c6 100644 | ||
18 | --- linux/mali_memory_os_alloc.c | ||
19 | +++ b/linux/mali_memory_os_alloc.c | ||
20 | @@ -202,7 +202,9 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) | ||
21 | /* Allocate new pages, if needed. */ | ||
22 | for (i = 0; i < remaining; i++) { | ||
23 | dma_addr_t dma_addr; | ||
24 | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
25 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) | ||
26 | + gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN; | ||
27 | +#elif LINUX_VERSION_CODE == KERNEL_VERSION(4, 14, 0) | ||
28 | gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN | __GFP_COLD; | ||
29 | #else | ||
30 | gfp_t flags = __GFP_ZERO | __GFP_REPEAT | __GFP_NOWARN | __GFP_COLD; | ||
31 | -- | ||
32 | 2.7.4 | ||
33 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch new file mode 100644 index 00000000..c28a83f4 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From d20b6eb3e48e56558488dbdda98875b1aed0c29f Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Wed, 5 Dec 2018 18:13:28 -0800 | ||
4 | Subject: [PATCH 2/3] linux: mali_memory_secure: Add header file dma-direct.h | ||
5 | |||
6 | Add dma-direct.h header, as API dma_to_phys is defined here. | ||
7 | refer kernel commit ea8c64ace86647260ec4255f483e5844d62af2df | ||
8 | |||
9 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
10 | Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
11 | Upstream Status: Pending | ||
12 | --- | ||
13 | driver/src/devicedrv/mali/linux/mali_memory_secure.c | 4 ++++ | ||
14 | 1 file changed, 4 insertions(+) | ||
15 | |||
16 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c | ||
17 | index 2836b1b..4f55fa5 100644 | ||
18 | --- linux/mali_memory_secure.c | ||
19 | +++ b/linux/mali_memory_secure.c | ||
20 | @@ -13,7 +13,11 @@ | ||
21 | #include "mali_memory_secure.h" | ||
22 | #include "mali_osk.h" | ||
23 | #include <linux/mutex.h> | ||
24 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) | ||
25 | +#include <linux/dma-direct.h> | ||
26 | +#else | ||
27 | #include <linux/dma-mapping.h> | ||
28 | +#endif | ||
29 | #include <linux/dma-buf.h> | ||
30 | |||
31 | _mali_osk_errcode_t mali_mem_secure_attach_dma_buf(mali_mem_secure *secure_mem, u32 size, int mem_fd) | ||
32 | -- | ||
33 | 2.7.4 | ||
34 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch new file mode 100644 index 00000000..a7c1d5cc --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch | |||
@@ -0,0 +1,156 @@ | |||
1 | From b6936450484b5aa9dd2438367a907af020341d1d Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Thu, 6 Dec 2018 13:30:44 -0800 | ||
4 | Subject: [PATCH 3/3] linux: mali_*timer: Get rid of init_timer | ||
5 | |||
6 | kernel 4.19 got rid of ancient init_timer. Hence, replace it with | ||
7 | timer_setup API. For more information refer kernel commit | ||
8 | 7eeb6b893bd28c68b6d664de1d3120e49b855cdb | ||
9 | |||
10 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
11 | Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> | ||
12 | Upstream Status: Pending | ||
13 | --- | ||
14 | driver/src/devicedrv/mali/common/mali_control_timer.c | 6 ++++++ | ||
15 | driver/src/devicedrv/mali/common/mali_group.c | 6 ++++++ | ||
16 | driver/src/devicedrv/mali/common/mali_osk.h | 15 ++++++++++++++- | ||
17 | driver/src/devicedrv/mali/linux/mali_osk_timers.c | 15 ++++++++++++++- | ||
18 | 4 files changed, 40 insertions(+), 2 deletions(-) | ||
19 | |||
20 | diff --git a/driver/src/devicedrv/mali/common/mali_control_timer.c b/driver/src/devicedrv/mali/common/mali_control_timer.c | ||
21 | index 1296ffe..d24b934 100644 | ||
22 | --- common/mali_control_timer.c | ||
23 | +++ b/common/mali_control_timer.c | ||
24 | @@ -65,11 +65,17 @@ _mali_osk_errcode_t mali_control_timer_init(void) | ||
25 | } | ||
26 | } | ||
27 | |||
28 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
29 | + mali_control_timer = _mali_osk_timer_init(mali_control_timer_callback); | ||
30 | +#else | ||
31 | mali_control_timer = _mali_osk_timer_init(); | ||
32 | +#endif | ||
33 | if (NULL == mali_control_timer) { | ||
34 | return _MALI_OSK_ERR_FAULT; | ||
35 | } | ||
36 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
37 | _mali_osk_timer_setcallback(mali_control_timer, mali_control_timer_callback, NULL); | ||
38 | +#endif | ||
39 | |||
40 | return _MALI_OSK_ERR_OK; | ||
41 | } | ||
42 | diff --git a/driver/src/devicedrv/mali/common/mali_group.c b/driver/src/devicedrv/mali/common/mali_group.c | ||
43 | index 5c7b3f4..1702e9a 100644 | ||
44 | --- common/mali_group.c | ||
45 | +++ b/common/mali_group.c | ||
46 | @@ -65,9 +65,15 @@ struct mali_group *mali_group_create(struct mali_l2_cache_core *core, | ||
47 | |||
48 | group = _mali_osk_calloc(1, sizeof(struct mali_group)); | ||
49 | if (NULL != group) { | ||
50 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
51 | + group->timeout_timer = _mali_osk_timer_init(mali_group_timeout); | ||
52 | +#else | ||
53 | group->timeout_timer = _mali_osk_timer_init(); | ||
54 | +#endif | ||
55 | if (NULL != group->timeout_timer) { | ||
56 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
57 | _mali_osk_timer_setcallback(group->timeout_timer, mali_group_timeout, (void *)group); | ||
58 | +#endif | ||
59 | |||
60 | group->l2_cache_core[0] = core; | ||
61 | _mali_osk_list_init(&group->group_list); | ||
62 | diff --git a/driver/src/devicedrv/mali/common/mali_osk.h b/driver/src/devicedrv/mali/common/mali_osk.h | ||
63 | index a501778..fe93d79 100644 | ||
64 | --- common/mali_osk.h | ||
65 | +++ b/common/mali_osk.h | ||
66 | @@ -947,7 +947,17 @@ _mali_osk_errcode_t _mali_osk_notification_queue_dequeue(_mali_osk_notification_ | ||
67 | * asked for. | ||
68 | * | ||
69 | * @{ */ | ||
70 | - | ||
71 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
72 | +/** @brief Initialize a timer | ||
73 | + * | ||
74 | + * Allocates resources for a new timer, and initializes them. This does not | ||
75 | + * start the timer. | ||
76 | + * | ||
77 | + * @param callback Function to call when timer expires | ||
78 | + * @return a pointer to the allocated timer object, or NULL on failure. | ||
79 | + */ | ||
80 | +_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback); | ||
81 | +#else | ||
82 | /** @brief Initialize a timer | ||
83 | * | ||
84 | * Allocates resources for a new timer, and initializes them. This does not | ||
85 | @@ -956,6 +966,7 @@ _mali_osk_errcode_t _mali_osk_notification_queue_dequeue(_mali_osk_notification_ | ||
86 | * @return a pointer to the allocated timer object, or NULL on failure. | ||
87 | */ | ||
88 | _mali_osk_timer_t *_mali_osk_timer_init(void); | ||
89 | +#endif | ||
90 | |||
91 | /** @brief Start a timer | ||
92 | * | ||
93 | @@ -1034,6 +1045,7 @@ void _mali_osk_timer_del_async(_mali_osk_timer_t *tim); | ||
94 | */ | ||
95 | mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim); | ||
96 | |||
97 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
98 | /** @brief Set a timer's callback parameters. | ||
99 | * | ||
100 | * This must be called at least once before a timer is started/modified. | ||
101 | @@ -1047,6 +1059,7 @@ mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim); | ||
102 | * @param data Function-specific data to supply to the function on expiry. | ||
103 | */ | ||
104 | void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data); | ||
105 | +#endif | ||
106 | |||
107 | /** @brief Terminate a timer, and deallocate resources. | ||
108 | * | ||
109 | diff --git a/driver/src/devicedrv/mali/linux/mali_osk_timers.c b/driver/src/devicedrv/mali/linux/mali_osk_timers.c | ||
110 | index e5d7238..f9b5a86 100644 | ||
111 | --- linux/mali_osk_timers.c | ||
112 | +++ b/linux/mali_osk_timers.c | ||
113 | @@ -21,13 +21,24 @@ | ||
114 | struct _mali_osk_timer_t_struct { | ||
115 | struct timer_list timer; | ||
116 | }; | ||
117 | - | ||
118 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
119 | +typedef void (*timer_timeout_function_t)(struct timer_list *); | ||
120 | +#else | ||
121 | typedef void (*timer_timeout_function_t)(unsigned long); | ||
122 | +#endif | ||
123 | |||
124 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
125 | +_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback) | ||
126 | +#else | ||
127 | _mali_osk_timer_t *_mali_osk_timer_init(void) | ||
128 | +#endif | ||
129 | { | ||
130 | _mali_osk_timer_t *t = (_mali_osk_timer_t *)kmalloc(sizeof(_mali_osk_timer_t), GFP_KERNEL); | ||
131 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) | ||
132 | + if (NULL != t) timer_setup(&t->timer, (timer_timeout_function_t)callback, 0); | ||
133 | +#else | ||
134 | if (NULL != t) init_timer(&t->timer); | ||
135 | +#endif | ||
136 | return t; | ||
137 | } | ||
138 | |||
139 | @@ -62,12 +73,14 @@ mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim) | ||
140 | return 1 == timer_pending(&(tim->timer)); | ||
141 | } | ||
142 | |||
143 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) | ||
144 | void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data) | ||
145 | { | ||
146 | MALI_DEBUG_ASSERT_POINTER(tim); | ||
147 | tim->timer.data = (unsigned long)data; | ||
148 | tim->timer.function = (timer_timeout_function_t)callback; | ||
149 | } | ||
150 | +#endif | ||
151 | |||
152 | void _mali_osk_timer_term(_mali_osk_timer_t *tim) | ||
153 | { | ||
154 | -- | ||
155 | 2.7.4 | ||
156 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch new file mode 100644 index 00000000..5363c37e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | Index: mali/linux/mali_memory_os_alloc.c | ||
2 | =================================================================== | ||
3 | --- mali.orig/linux/mali_memory_os_alloc.c | ||
4 | +++ mali/linux/mali_memory_os_alloc.c | ||
5 | @@ -239,8 +239,10 @@ int mali_mem_os_alloc_pages(mali_mem_os_ | ||
6 | /* Ensure page is flushed from CPU caches. */ | ||
7 | dma_addr = dma_map_page(&mali_platform_device->dev, new_page, | ||
8 | 0, _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
9 | - dma_unmap_page(&mali_platform_device->dev, dma_addr, | ||
10 | - _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
11 | + err = dma_mapping_error(&mali_platform_device->dev, dma_addr); | ||
12 | + if (likely(!err)) | ||
13 | + dma_unmap_page(&mali_platform_device->dev, dma_addr, | ||
14 | + _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
15 | dma_addr = dma_map_page(&mali_platform_device->dev, new_page, | ||
16 | 0, _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
17 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch new file mode 100644 index 00000000..dc8bbebf --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 8cf1dd43f3f25cb4afb84dfc3b0e7c02bc8f7f0c Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Mon, 24 Feb 2020 18:19:37 -0800 | ||
4 | Subject: [LINUX][rel-v2020.1][PATCH v1 1/3] mali_memory_secure: Kernel 5.0 | ||
5 | onwards 'access_ok' API does not take 'type' as input parameter | ||
6 | |||
7 | 'access_ok' no longer needs 'type' as input paramter from kernel 5.0 | ||
8 | onwards. | ||
9 | |||
10 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
11 | --- | ||
12 | driver/src/devicedrv/mali/linux/mali_ukk_mem.c | 9 +++++++++ | ||
13 | 1 file changed, 9 insertions(+) | ||
14 | |||
15 | diff --git a/driver/src/devicedrv/mali/linux/mali_ukk_mem.c b/driver/src/devicedrv/mali/linux/mali_ukk_mem.c | ||
16 | index 4ec57dc..270bb6d 100644 | ||
17 | --- linux/mali_ukk_mem.c | ||
18 | +++ b/linux/mali_ukk_mem.c | ||
19 | @@ -207,8 +207,13 @@ int mem_write_safe_wrapper(struct mali_session_data *session_data, _mali_uk_mem_ | ||
20 | kargs.ctx = (uintptr_t)session_data; | ||
21 | |||
22 | /* Check if we can access the buffers */ | ||
23 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) | ||
24 | + if (!access_ok((const void __user *)kargs.dest, kargs.size) | ||
25 | + || !access_ok((const void __user *)kargs.src, kargs.size)) { | ||
26 | +#else | ||
27 | if (!access_ok(VERIFY_WRITE, kargs.dest, kargs.size) | ||
28 | || !access_ok(VERIFY_READ, kargs.src, kargs.size)) { | ||
29 | +#endif | ||
30 | return -EINVAL; | ||
31 | } | ||
32 | |||
33 | @@ -266,7 +271,11 @@ int mem_dump_mmu_page_table_wrapper(struct mali_session_data *session_data, _mal | ||
34 | goto err_exit; | ||
35 | |||
36 | user_buffer = (void __user *)(uintptr_t)kargs.buffer; | ||
37 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) | ||
38 | + if (!access_ok(user_buffer, kargs.size)) | ||
39 | +#else | ||
40 | if (!access_ok(VERIFY_WRITE, user_buffer, kargs.size)) | ||
41 | +#endif | ||
42 | goto err_exit; | ||
43 | |||
44 | /* allocate temporary buffer (kernel side) to store mmu page table info */ | ||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch new file mode 100644 index 00000000..9c4bbee9 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch | |||
@@ -0,0 +1,146 @@ | |||
1 | From 953cab73b8bc487da330aa454abd7f8c7466737e Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Mon, 24 Feb 2020 18:32:16 -0800 | ||
4 | Subject: [LINUX][rel-v2020.1][PATCH v1 2/3] Support for vm_insert_pfn | ||
5 | deprecated from kernel 4.20 | ||
6 | |||
7 | From kernel 4.20 onwards, support for vm_insert_pfn is deprecated. | ||
8 | Hence, replace the same with vmf_insert_pfn. | ||
9 | |||
10 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
11 | --- | ||
12 | .../devicedrv/mali/linux/mali_memory_block_alloc.c | 6 +++++- | ||
13 | driver/src/devicedrv/mali/linux/mali_memory_cow.c | 14 ++++++++++++-- | ||
14 | .../src/devicedrv/mali/linux/mali_memory_os_alloc.c | 20 +++++++++++++++++--- | ||
15 | driver/src/devicedrv/mali/linux/mali_memory_secure.c | 7 ++++++- | ||
16 | 4 files changed, 40 insertions(+), 7 deletions(-) | ||
17 | |||
18 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c | ||
19 | index 0c5b6c3..e528699 100644 | ||
20 | --- linux/mali_memory_block_alloc.c | ||
21 | +++ b/linux/mali_memory_block_alloc.c | ||
22 | @@ -309,9 +309,13 @@ int mali_mem_block_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *v | ||
23 | |||
24 | list_for_each_entry(m_page, &block_mem->pfns, list) { | ||
25 | MALI_DEBUG_ASSERT(m_page->type == MALI_PAGE_NODE_BLOCK); | ||
26 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
27 | + ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); | ||
28 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
29 | +#else | ||
30 | ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); | ||
31 | - | ||
32 | if (unlikely(0 != ret)) { | ||
33 | +#endif | ||
34 | return -EFAULT; | ||
35 | } | ||
36 | addr += _MALI_OSK_MALI_PAGE_SIZE; | ||
37 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_cow.c b/driver/src/devicedrv/mali/linux/mali_memory_cow.c | ||
38 | index f1d44fe..1dae1d6 100644 | ||
39 | --- linux/mali_memory_cow.c | ||
40 | +++ b/linux/mali_memory_cow.c | ||
41 | @@ -532,9 +532,14 @@ int mali_mem_cow_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma | ||
42 | * flush which makes it way slower than remap_pfn_range or vm_insert_pfn. | ||
43 | ret = vm_insert_page(vma, addr, page); | ||
44 | */ | ||
45 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
46 | + ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); | ||
47 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
48 | +#else | ||
49 | ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); | ||
50 | - | ||
51 | if (unlikely(0 != ret)) { | ||
52 | +#endif | ||
53 | + | ||
54 | return ret; | ||
55 | } | ||
56 | addr += _MALI_OSK_MALI_PAGE_SIZE; | ||
57 | @@ -569,9 +574,14 @@ _mali_osk_errcode_t mali_mem_cow_cpu_map_pages_locked(mali_mem_backend *mem_bken | ||
58 | |||
59 | list_for_each_entry(m_page, &cow->pages, list) { | ||
60 | if ((count >= offset) && (count < offset + num)) { | ||
61 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
62 | + ret = vmf_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page)); | ||
63 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
64 | +#else | ||
65 | ret = vm_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page)); | ||
66 | - | ||
67 | if (unlikely(0 != ret)) { | ||
68 | +#endif | ||
69 | + | ||
70 | if (count == offset) { | ||
71 | return _MALI_OSK_ERR_FAULT; | ||
72 | } else { | ||
73 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | ||
74 | index 3fb6f05..7de3920 100644 | ||
75 | --- linux/mali_memory_os_alloc.c | ||
76 | +++ b/linux/mali_memory_os_alloc.c | ||
77 | @@ -378,9 +378,14 @@ int mali_mem_os_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma) | ||
78 | ret = vm_insert_page(vma, addr, page); | ||
79 | */ | ||
80 | page = m_page->page; | ||
81 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
82 | + ret = vmf_insert_pfn(vma, addr, page_to_pfn(page)); | ||
83 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
84 | +#else | ||
85 | ret = vm_insert_pfn(vma, addr, page_to_pfn(page)); | ||
86 | - | ||
87 | if (unlikely(0 != ret)) { | ||
88 | +#endif | ||
89 | + | ||
90 | return -EFAULT; | ||
91 | } | ||
92 | addr += _MALI_OSK_MALI_PAGE_SIZE; | ||
93 | @@ -416,9 +421,13 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken | ||
94 | |||
95 | vm_end -= _MALI_OSK_MALI_PAGE_SIZE; | ||
96 | if (mapping_page_num > 0) { | ||
97 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
98 | + ret = vmf_insert_pfn(vma, vm_end, page_to_pfn(m_page->page)); | ||
99 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
100 | +#else | ||
101 | ret = vm_insert_pfn(vma, vm_end, page_to_pfn(m_page->page)); | ||
102 | - | ||
103 | if (unlikely(0 != ret)) { | ||
104 | +#endif | ||
105 | /*will return -EBUSY If the page has already been mapped into table, but it's OK*/ | ||
106 | if (-EBUSY == ret) { | ||
107 | break; | ||
108 | @@ -439,9 +448,14 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken | ||
109 | list_for_each_entry(m_page, &os_mem->pages, list) { | ||
110 | if (count >= offset) { | ||
111 | |||
112 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
113 | + ret = vmf_insert_pfn(vma, vstart, page_to_pfn(m_page->page)); | ||
114 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
115 | +#else | ||
116 | ret = vm_insert_pfn(vma, vstart, page_to_pfn(m_page->page)); | ||
117 | - | ||
118 | if (unlikely(0 != ret)) { | ||
119 | +#endif | ||
120 | + | ||
121 | /*will return -EBUSY If the page has already been mapped into table, but it's OK*/ | ||
122 | if (-EBUSY == ret) { | ||
123 | break; | ||
124 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c | ||
125 | index 5546304..cebd1c8 100644 | ||
126 | --- linux/mali_memory_secure.c | ||
127 | +++ b/linux/mali_memory_secure.c | ||
128 | @@ -132,9 +132,14 @@ int mali_mem_secure_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct * | ||
129 | MALI_DEBUG_ASSERT(0 == size % _MALI_OSK_MALI_PAGE_SIZE); | ||
130 | |||
131 | for (j = 0; j < size / _MALI_OSK_MALI_PAGE_SIZE; j++) { | ||
132 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
133 | + ret = vmf_insert_pfn(vma, addr, PFN_DOWN(phys)); | ||
134 | + if (unlikely(VM_FAULT_ERROR & ret)) { | ||
135 | +#else | ||
136 | ret = vm_insert_pfn(vma, addr, PFN_DOWN(phys)); | ||
137 | - | ||
138 | if (unlikely(0 != ret)) { | ||
139 | +#endif | ||
140 | + | ||
141 | return -EFAULT; | ||
142 | } | ||
143 | addr += _MALI_OSK_MALI_PAGE_SIZE; | ||
144 | -- | ||
145 | 2.7.4 | ||
146 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch new file mode 100644 index 00000000..9797db62 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From ad5c569f0cc40698699fc2f2c1db3ceb9f8b8f35 Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Tue, 25 Feb 2020 11:36:01 -0800 | ||
4 | Subject: [LINUX][rel-v2020.1][PATCH v1 3/3] Change return type to vm_fault_t | ||
5 | for fault handler | ||
6 | |||
7 | From kernel 4.17 onwards the return type of fault handler for | ||
8 | vm_operations is of type 'vm_fault_t'. | ||
9 | |||
10 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
11 | --- | ||
12 | driver/src/devicedrv/mali/linux/mali_memory.c | 4 +++- | ||
13 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/driver/src/devicedrv/mali/linux/mali_memory.c b/driver/src/devicedrv/mali/linux/mali_memory.c | ||
16 | index c0f0982..2b2b209 100644 | ||
17 | --- linux/mali_memory.c | ||
18 | +++ b/linux/mali_memory.c | ||
19 | @@ -70,7 +70,9 @@ static void mali_mem_vma_close(struct vm_area_struct *vma) | ||
20 | } | ||
21 | } | ||
22 | |||
23 | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) | ||
24 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) | ||
25 | +static vm_fault_t mali_mem_vma_fault(struct vm_fault *vmf) | ||
26 | +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) | ||
27 | static int mali_mem_vma_fault(struct vm_fault *vmf) | ||
28 | #else | ||
29 | static int mali_mem_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
30 | -- | ||
31 | 2.7.4 | ||
32 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch new file mode 100644 index 00000000..154bb673 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | From c6a6b39cea3fdfd91cae7f2a4ef6f36d2c55fdd6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
3 | Date: Tue, 25 Feb 2020 15:17:17 -0800 | ||
4 | Subject: [LINUX][rel-v2020.1][PATCH v1] "get_monotonic_boottime(&ts)" | ||
5 | deprecated from kernel 4.20 onwards | ||
6 | |||
7 | As "get_monotonic_boottime(&ts)" is deprecated, replace the same with | ||
8 | "ktime_get_boottime_ts64(&ts)". Refer kernel commit ID | ||
9 | 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 | ||
10 | |||
11 | Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> | ||
12 | --- | ||
13 | driver/src/devicedrv/mali/linux/mali_osk_time.c | 6 ++++++ | ||
14 | 1 file changed, 6 insertions(+) | ||
15 | |||
16 | diff --git a/driver/src/devicedrv/mali/linux/mali_osk_time.c b/driver/src/devicedrv/mali/linux/mali_osk_time.c | ||
17 | index 03046a5..bfcbf7f 100644 | ||
18 | --- linux/mali_osk_time.c | ||
19 | +++ b/linux/mali_osk_time.c | ||
20 | @@ -53,7 +53,13 @@ u64 _mali_osk_time_get_ns(void) | ||
21 | |||
22 | u64 _mali_osk_boot_time_get_ns(void) | ||
23 | { | ||
24 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) | ||
25 | + struct timespec64 tsval; | ||
26 | + ktime_get_boottime_ts64(&tsval); | ||
27 | + return (u64)timespec64_to_ns(&tsval); | ||
28 | +#else | ||
29 | struct timespec tsval; | ||
30 | get_monotonic_boottime(&tsval); | ||
31 | return (u64)timespec_to_ns(&tsval); | ||
32 | +#endif | ||
33 | } | ||
34 | -- | ||
35 | 2.7.4 | ||
36 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch new file mode 100644 index 00000000..ff86091f --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch | |||
@@ -0,0 +1,92 @@ | |||
1 | From cbc2351e8acf7ed38f6d965e5ea21620e45eda30 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dylan Yip <dylan.yip@xilinx.com> | ||
3 | Date: Tue, 9 Feb 2021 10:05:41 -0800 | ||
4 | Subject: [PATCH 20/23] Fix ioremap_nocache() deprecation in kernel 5.6 | ||
5 | |||
6 | As of commit 4bdc0d676a643140 ("remove ioremap_nocache and | ||
7 | devm_ioremap_nocache") from kernel 5.6, ioremap_nocache has been | ||
8 | removed because ioremap is already non-cached by default. So replace all | ||
9 | calls with ioremap. | ||
10 | |||
11 | Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> | ||
12 | --- | ||
13 | linux/mali_memory_cow.c | 4 ++++ | ||
14 | linux/mali_osk_low_level_mem.c | 4 ++++ | ||
15 | platform/arm/arm.c | 12 ++++++++++++ | ||
16 | 3 files changed, 20 insertions(+) | ||
17 | |||
18 | diff --git a/linux/mali_memory_cow.c b/linux/mali_memory_cow.c | ||
19 | index 1dae1d6..6fadd42 100644 | ||
20 | --- a/linux/mali_memory_cow.c | ||
21 | +++ b/linux/mali_memory_cow.c | ||
22 | @@ -693,7 +693,11 @@ void _mali_mem_cow_copy_page(mali_page_node *src_node, mali_page_node *dst_node) | ||
23 | /* | ||
24 | * use ioremap to map src for BLOCK memory | ||
25 | */ | ||
26 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
27 | + src = ioremap(_mali_page_node_get_dma_addr(src_node), _MALI_OSK_MALI_PAGE_SIZE); | ||
28 | +#else | ||
29 | src = ioremap_nocache(_mali_page_node_get_dma_addr(src_node), _MALI_OSK_MALI_PAGE_SIZE); | ||
30 | +#endif | ||
31 | memcpy(dst, src , _MALI_OSK_MALI_PAGE_SIZE); | ||
32 | iounmap(src); | ||
33 | } | ||
34 | diff --git a/linux/mali_osk_low_level_mem.c b/linux/mali_osk_low_level_mem.c | ||
35 | index 84f93d9..5a0a725 100644 | ||
36 | --- a/linux/mali_osk_low_level_mem.c | ||
37 | +++ b/linux/mali_osk_low_level_mem.c | ||
38 | @@ -33,7 +33,11 @@ void _mali_osk_write_mem_barrier(void) | ||
39 | |||
40 | mali_io_address _mali_osk_mem_mapioregion(uintptr_t phys, u32 size, const char *description) | ||
41 | { | ||
42 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
43 | + return (mali_io_address)ioremap(phys, size); | ||
44 | +#else | ||
45 | return (mali_io_address)ioremap_nocache(phys, size); | ||
46 | +#endif | ||
47 | } | ||
48 | |||
49 | void _mali_osk_mem_unmapioregion(uintptr_t phys, u32 size, mali_io_address virt) | ||
50 | diff --git a/platform/arm/arm.c b/platform/arm/arm.c | ||
51 | index b2fb746..e468263 100644 | ||
52 | --- a/platform/arm/arm.c | ||
53 | +++ b/platform/arm/arm.c | ||
54 | @@ -98,7 +98,11 @@ static int mali_secure_mode_init_juno(void) | ||
55 | |||
56 | MALI_DEBUG_ASSERT(NULL == secure_mode_mapped_addr); | ||
57 | |||
58 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
59 | + secure_mode_mapped_addr = ioremap(phys_addr_page, map_size); | ||
60 | +#else | ||
61 | secure_mode_mapped_addr = ioremap_nocache(phys_addr_page, map_size); | ||
62 | +#endif | ||
63 | if (NULL != secure_mode_mapped_addr) { | ||
64 | return mali_gpu_reset_and_secure_mode_disable_juno(); | ||
65 | } | ||
66 | @@ -588,7 +592,11 @@ static u32 mali_read_phys(u32 phys_addr) | ||
67 | u32 phys_offset = phys_addr & 0x00001FFF; | ||
68 | u32 map_size = phys_offset + sizeof(u32); | ||
69 | u32 ret = 0xDEADBEEF; | ||
70 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
71 | + void *mem_mapped = ioremap(phys_addr_page, map_size); | ||
72 | +#else | ||
73 | void *mem_mapped = ioremap_nocache(phys_addr_page, map_size); | ||
74 | +#endif | ||
75 | if (NULL != mem_mapped) { | ||
76 | ret = (u32)ioread32(((u8 *)mem_mapped) + phys_offset); | ||
77 | iounmap(mem_mapped); | ||
78 | @@ -604,7 +612,11 @@ static void mali_write_phys(u32 phys_addr, u32 value) | ||
79 | u32 phys_addr_page = phys_addr & 0xFFFFE000; | ||
80 | u32 phys_offset = phys_addr & 0x00001FFF; | ||
81 | u32 map_size = phys_offset + sizeof(u32); | ||
82 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
83 | + void *mem_mapped = ioremap(phys_addr_page, map_size); | ||
84 | +#else | ||
85 | void *mem_mapped = ioremap_nocache(phys_addr_page, map_size); | ||
86 | +#endif | ||
87 | if (NULL != mem_mapped) { | ||
88 | iowrite32(value, ((u8 *)mem_mapped) + phys_offset); | ||
89 | iounmap(mem_mapped); | ||
90 | -- | ||
91 | 2.17.1 | ||
92 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch new file mode 100644 index 00000000..adef8e18 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From bc0f85271681532c7e394229f0155366d1de8779 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dylan Yip <dylan.yip@xilinx.com> | ||
3 | Date: Mon, 8 Feb 2021 23:47:01 -0800 | ||
4 | Subject: [PATCH 21/23] Use updated timekeeping functions in kernel 5.6 | ||
5 | |||
6 | As of commit 412c53a680a9 ("y2038: remove unused time32 interfaces"), 32 | ||
7 | bit timekeeping functions like getnstimeofday() have been removed. So | ||
8 | use the 64 bit replacements. | ||
9 | |||
10 | Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> | ||
11 | --- | ||
12 | linux/mali_osk_time.c | 6 ++++++ | ||
13 | 1 file changed, 6 insertions(+) | ||
14 | |||
15 | diff --git a/linux/mali_osk_time.c b/linux/mali_osk_time.c | ||
16 | index bfcbf7f..583d82b 100644 | ||
17 | --- a/linux/mali_osk_time.c | ||
18 | +++ b/linux/mali_osk_time.c | ||
19 | @@ -46,9 +46,15 @@ void _mali_osk_time_ubusydelay(u32 usecs) | ||
20 | |||
21 | u64 _mali_osk_time_get_ns(void) | ||
22 | { | ||
23 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
24 | + struct timespec64 tsval; | ||
25 | + ktime_get_real_ts64(&tsval); | ||
26 | + return (u64)timespec64_to_ns(&tsval); | ||
27 | +#else | ||
28 | struct timespec tsval; | ||
29 | getnstimeofday(&tsval); | ||
30 | return (u64)timespec_to_ns(&tsval); | ||
31 | +#endif | ||
32 | } | ||
33 | |||
34 | u64 _mali_osk_boot_time_get_ns(void) | ||
35 | -- | ||
36 | 2.17.1 | ||
37 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch new file mode 100644 index 00000000..181df7b7 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From d17933b6909cc29103befc2ef4e6cf413d9e8fb6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dylan Yip <dylan.yip@xilinx.com> | ||
3 | Date: Tue, 9 Feb 2021 08:58:44 -0800 | ||
4 | Subject: [PATCH 22/23] Set HAVE_UNLOCKED_IOCTL default to true | ||
5 | |||
6 | As of commit b19dd42faf41 ("bkl: Remove locked .ioctl file operation") | ||
7 | of kernel 2.6, the ioctl operation has been replaced with | ||
8 | unlocked_ioctl. Since this change has been around for almost 10 years, | ||
9 | go ahead and set the default HAVE_UNLOCKED_IOCTL to be true. | ||
10 | |||
11 | Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> | ||
12 | --- | ||
13 | Kbuild | 2 ++ | ||
14 | 1 file changed, 2 insertions(+) | ||
15 | |||
16 | diff --git a/Kbuild b/Kbuild | ||
17 | index 02c3f3d..8c6e6e0 100644 | ||
18 | --- a/Kbuild | ||
19 | +++ b/Kbuild | ||
20 | @@ -21,6 +21,7 @@ MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0 | ||
21 | MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0 | ||
22 | MALI_UPPER_HALF_SCHEDULING ?= 1 | ||
23 | MALI_ENABLE_CPU_CYCLES ?= 0 | ||
24 | +HAVE_UNLOCKED_IOCTL ?= 1 | ||
25 | |||
26 | # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases: | ||
27 | # The ARM proprietary product will only include the license/proprietary directory | ||
28 | @@ -179,6 +180,7 @@ ccflags-y += -DMALI_STATE_TRACKING=1 | ||
29 | ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB) | ||
30 | ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION) | ||
31 | ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES) | ||
32 | +ccflags-y += -DHAVE_UNLOCKED_IOCTL=$(HAVE_UNLOCKED_IOCTL) | ||
33 | |||
34 | ifeq ($(MALI_UPPER_HALF_SCHEDULING),1) | ||
35 | ccflags-y += -DMALI_UPPER_HALF_SCHEDULING | ||
36 | -- | ||
37 | 2.17.1 | ||
38 | |||
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch new file mode 100644 index 00000000..bab2bd37 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From e2b52e358e0e030d3881ef80ef09de3662b41210 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dylan Yip <dylan.yip@xilinx.com> | ||
3 | Date: Tue, 9 Feb 2021 09:48:01 -0800 | ||
4 | Subject: [PATCH 23/23] Use PTR_ERR_OR_ZERO instead of PTR_RET | ||
5 | |||
6 | As of commit fad7c9020948 ("err.h: remove deprecated PTR_RET for good") | ||
7 | in kernel 5.7, PTR_RET has been removed and replaced with | ||
8 | PTR_ERR_OR_ZERO. So use this API instead. | ||
9 | |||
10 | Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> | ||
11 | --- | ||
12 | linux/mali_memory_dma_buf.c | 4 ++++ | ||
13 | 1 file changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/linux/mali_memory_dma_buf.c b/linux/mali_memory_dma_buf.c | ||
16 | index 905cd8b..fcdcaac 100644 | ||
17 | --- a/linux/mali_memory_dma_buf.c | ||
18 | +++ b/linux/mali_memory_dma_buf.c | ||
19 | @@ -281,7 +281,11 @@ int mali_dma_buf_get_size(struct mali_session_data *session, _mali_uk_dma_buf_ge | ||
20 | buf = dma_buf_get(fd); | ||
21 | if (IS_ERR_OR_NULL(buf)) { | ||
22 | MALI_DEBUG_PRINT_ERROR(("Failed to get dma-buf from fd: %d\n", fd)); | ||
23 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) | ||
24 | + return PTR_ERR_OR_ZERO(buf); | ||
25 | +#else | ||
26 | return PTR_RET(buf); | ||
27 | +#endif | ||
28 | } | ||
29 | |||
30 | if (0 != put_user(buf->size, &user_arg->size)) { | ||
31 | -- | ||
32 | 2.17.1 | ||
33 | |||