diff options
author | Yash Ladani <yash.ladani@amd.com> | 2024-12-13 03:41:25 -0800 |
---|---|---|
committer | Mark Hatle <mark.hatle@amd.com> | 2025-03-30 14:16:06 -0600 |
commit | d95e1f722c130341900918f3952b1167d2861665 (patch) | |
tree | a8cca094800d72cb41c7a3d308aee2074c703ee4 | |
parent | 1cc51d3ff4286397fc7dfe37957cfb2d96092c78 (diff) | |
download | meta-xilinx-d95e1f722c130341900918f3952b1167d2861665.tar.gz |
mali400: Added patch for compatibility with 6.12 kernel
Added 0030-Update-driver-to-make-it-compatible-with-6.12-kernel.patch
Which has shrinker, strscpy and .remove handler related changes
to make driver compatible with 6.12 kernel.
Signed-off-by: Yash Ladani <yash.ladani@amd.com>
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
2 files changed, 135 insertions, 0 deletions
diff --git a/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali/0030-Update-driver-to-make-it-compatible-with-6.12-kernel.patch b/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali/0030-Update-driver-to-make-it-compatible-with-6.12-kernel.patch new file mode 100644 index 00000000..b00bc062 --- /dev/null +++ b/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali/0030-Update-driver-to-make-it-compatible-with-6.12-kernel.patch | |||
@@ -0,0 +1,134 @@ | |||
1 | From 46736b39c03646a124531ddd5b6a2bcf8be65242 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yash Ladani <yash.ladani@amd.com> | ||
3 | Date: Wed, 11 Dec 2024 01:04:50 -0800 | ||
4 | Subject: [PATCH] Update driver to make it compatible with 6.12 kernel | ||
5 | |||
6 | - Updated shrinker functions | ||
7 | - Use strscpy instead of strlcpy | ||
8 | - .remove handler now returns void instead of int | ||
9 | |||
10 | Signed-off-by: Yash Ladani <yash.ladani@amd.com> | ||
11 | --- | ||
12 | linux/mali_internal_sync.c | 4 ++++ | ||
13 | linux/mali_kernel_linux.c | 12 ++++++++++++ | ||
14 | linux/mali_memory_os_alloc.c | 9 ++++++++- | ||
15 | linux/mali_osk_mali.c | 12 +++++++++--- | ||
16 | 4 files changed, 33 insertions(+), 4 deletions(-) | ||
17 | |||
18 | diff --git a/linux/mali_internal_sync.c b/linux/mali_internal_sync.c | ||
19 | index 981b5b1..c5fb701 100644 | ||
20 | --- a/linux/mali_internal_sync.c | ||
21 | +++ b/linux/mali_internal_sync.c | ||
22 | @@ -167,7 +167,11 @@ struct mali_internal_sync_timeline *mali_internal_sync_timeline_create(const str | ||
23 | #else | ||
24 | sync_timeline->fence_context = fence_context_alloc(1); | ||
25 | #endif | ||
26 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0) | ||
27 | + strscpy(sync_timeline->name, name, sizeof(sync_timeline->name)); | ||
28 | +#else | ||
29 | strlcpy(sync_timeline->name, name, sizeof(sync_timeline->name)); | ||
30 | +#endif | ||
31 | |||
32 | INIT_LIST_HEAD(&sync_timeline->sync_pt_list_head); | ||
33 | spin_lock_init(&sync_timeline->sync_pt_list_lock); | ||
34 | diff --git a/linux/mali_kernel_linux.c b/linux/mali_kernel_linux.c | ||
35 | index 050af67..d312ea7 100644 | ||
36 | --- a/linux/mali_kernel_linux.c | ||
37 | +++ b/linux/mali_kernel_linux.c | ||
38 | @@ -187,7 +187,11 @@ static int mali_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | ||
39 | #endif | ||
40 | |||
41 | static int mali_probe(struct platform_device *pdev); | ||
42 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) | ||
43 | +static void mali_remove(struct platform_device *pdev); | ||
44 | +#else | ||
45 | static int mali_remove(struct platform_device *pdev); | ||
46 | +#endif | ||
47 | |||
48 | static int mali_driver_suspend_scheduler(struct device *dev); | ||
49 | static int mali_driver_resume_scheduler(struct device *dev); | ||
50 | @@ -692,7 +696,11 @@ clock_prepare_failed: | ||
51 | return -EFAULT; | ||
52 | } | ||
53 | |||
54 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) | ||
55 | +static void mali_remove(struct platform_device *pdev) | ||
56 | +#else | ||
57 | static int mali_remove(struct platform_device *pdev) | ||
58 | +#endif | ||
59 | { | ||
60 | #ifdef CONFIG_MALI_DEVFREQ | ||
61 | struct mali_device *mdev = dev_get_drvdata(&pdev->dev); | ||
62 | @@ -736,7 +744,11 @@ static int mali_remove(struct platform_device *pdev) | ||
63 | mali_disable_clk(); | ||
64 | #endif | ||
65 | |||
66 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) | ||
67 | + return; | ||
68 | +#else | ||
69 | return 0; | ||
70 | +#endif | ||
71 | } | ||
72 | |||
73 | static int mali_miscdevice_register(struct platform_device *pdev) | ||
74 | diff --git a/linux/mali_memory_os_alloc.c b/linux/mali_memory_os_alloc.c | ||
75 | index a17210e..2e79277 100644 | ||
76 | --- a/linux/mali_memory_os_alloc.c | ||
77 | +++ b/linux/mali_memory_os_alloc.c | ||
78 | @@ -799,7 +799,10 @@ _mali_osk_errcode_t mali_mem_os_init(void) | ||
79 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &dma_attrs_wc); | ||
80 | #endif | ||
81 | |||
82 | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) | ||
83 | + | ||
84 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) | ||
85 | + shrinker_register(&mali_mem_os_allocator.shrinker); | ||
86 | +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) | ||
87 | register_shrinker(&mali_mem_os_allocator.shrinker, "mali"); | ||
88 | #else | ||
89 | register_shrinker(&mali_mem_os_allocator.shrinker); | ||
90 | @@ -810,7 +813,11 @@ _mali_osk_errcode_t mali_mem_os_init(void) | ||
91 | void mali_mem_os_term(void) | ||
92 | { | ||
93 | struct mali_page_node *m_page, *m_tmp; | ||
94 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) | ||
95 | + shrinker_free(&mali_mem_os_allocator.shrinker); | ||
96 | +#else | ||
97 | unregister_shrinker(&mali_mem_os_allocator.shrinker); | ||
98 | +#endif | ||
99 | cancel_delayed_work_sync(&mali_mem_os_allocator.timed_shrinker); | ||
100 | |||
101 | if (NULL != mali_mem_os_allocator.wq) { | ||
102 | diff --git a/linux/mali_osk_mali.c b/linux/mali_osk_mali.c | ||
103 | index 3f66132..1218d2f 100644 | ||
104 | --- a/linux/mali_osk_mali.c | ||
105 | +++ b/linux/mali_osk_mali.c | ||
106 | @@ -220,8 +220,10 @@ uintptr_t _mali_osk_resource_base_address(void) | ||
107 | void _mali_osk_device_data_pmu_config_get(u16 *domain_config_array, int array_size) | ||
108 | { | ||
109 | struct device_node *node = mali_platform_device->dev.of_node; | ||
110 | - struct property *prop; | ||
111 | - const __be32 *p; | ||
112 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0) | ||
113 | + struct property *prop; | ||
114 | + const __be32 *p; | ||
115 | +#endif | ||
116 | int length = 0, i = 0; | ||
117 | u32 u; | ||
118 | |||
119 | @@ -238,7 +240,11 @@ void _mali_osk_device_data_pmu_config_get(u16 *domain_config_array, int array_si | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | - of_property_for_each_u32(node, "pmu_domain_config", prop, p, u) { | ||
124 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,11,0) | ||
125 | + of_property_for_each_u32(node, "pmu_domain_config", u) { | ||
126 | +#else | ||
127 | + of_property_for_each_u32(node, "pmu_domain_config", prop, p, u) { | ||
128 | +#endif | ||
129 | domain_config_array[i] = (u16)u; | ||
130 | i++; | ||
131 | } | ||
132 | -- | ||
133 | 2.34.1 | ||
134 | |||
diff --git a/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali_r9p0-01rel0.bb b/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali_r9p0-01rel0.bb index c25970e7..6596e9bd 100644 --- a/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali_r9p0-01rel0.bb +++ b/meta-xilinx-mali400/recipes-graphics/mali/kernel-module-mali_r9p0-01rel0.bb | |||
@@ -34,6 +34,7 @@ SRC_URI = " \ | |||
34 | file://0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch \ | 34 | file://0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch \ |
35 | file://0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch \ | 35 | file://0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch \ |
36 | file://0029-Fixed-buildpath-QA-warning.patch \ | 36 | file://0029-Fixed-buildpath-QA-warning.patch \ |
37 | file://0030-Update-driver-to-make-it-compatible-with-6.12-kernel.patch \ | ||
37 | " | 38 | " |
38 | SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" | 39 | SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" |
39 | SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" | 40 | SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" |