diff options
2 files changed, 82 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb index 268759c2..cd3ba3d1 100644 --- a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb | |||
@@ -34,6 +34,7 @@ SRC_URI = " \ | |||
34 | file://0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch \ | 34 | file://0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch \ |
35 | file://0026-Fix-gpu-driver-probe-failure.patch \ | 35 | file://0026-Fix-gpu-driver-probe-failure.patch \ |
36 | file://0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch \ | 36 | file://0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch \ |
37 | file://0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch \ | ||
37 | " | 38 | " |
38 | SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" | 39 | SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" |
39 | SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" | 40 | SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" |
diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch new file mode 100644 index 00000000..72275a4c --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0028-Replace-vma-vm_flags-direct-modifications-with-modif.patch | |||
@@ -0,0 +1,81 @@ | |||
1 | From e3e0f5e3fa0ddb396393d444bce6e575f7a16189 Mon Sep 17 00:00:00 2001 | ||
2 | From: Parth Gajjar <parth.gajjar@amd.com> | ||
3 | Date: Thu, 21 Dec 2023 22:41:32 -0800 | ||
4 | Subject: [PATCH] Replace vma->vm_flags direct modifications with modifier | ||
5 | calls | ||
6 | |||
7 | Replace direct modifications to vma->vm_flags with calls to modifier | ||
8 | functions to be able to track flag changes and to keep vma locking | ||
9 | correctness. (Kernel 6.3) | ||
10 | |||
11 | Signed-off-by: Parth Gajjar <parth.gajjar@amd.com> | ||
12 | --- | ||
13 | linux/mali_memory.c | 10 ++++++++++ | ||
14 | linux/mali_memory_cow.c | 13 ++++++++++--- | ||
15 | 2 files changed, 20 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/linux/mali_memory.c b/linux/mali_memory.c | ||
18 | index 2b2b209..c21d0b7 100644 | ||
19 | --- a/linux/mali_memory.c | ||
20 | +++ b/linux/mali_memory.c | ||
21 | @@ -266,11 +266,17 @@ int mali_mmap(struct file *filp, struct vm_area_struct *vma) | ||
22 | * that it's present and can never be paged out (see also previous | ||
23 | * entry) | ||
24 | */ | ||
25 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) | ||
26 | + vm_flags_set(vma, VM_IO | VM_DONTCOPY | VM_PFNMAP); | ||
27 | +#else | ||
28 | vma->vm_flags |= VM_IO; | ||
29 | vma->vm_flags |= VM_DONTCOPY; | ||
30 | vma->vm_flags |= VM_PFNMAP; | ||
31 | +#endif | ||
32 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0) | ||
33 | vma->vm_flags |= VM_RESERVED; | ||
34 | +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) | ||
35 | + vm_flags_set(vma, VM_DONTDUMP | VM_DONTEXPAND); | ||
36 | #else | ||
37 | vma->vm_flags |= VM_DONTDUMP; | ||
38 | vma->vm_flags |= VM_DONTEXPAND; | ||
39 | @@ -288,7 +294,11 @@ int mali_mmap(struct file *filp, struct vm_area_struct *vma) | ||
40 | if (!(vma->vm_flags & VM_WRITE)) { | ||
41 | MALI_DEBUG_PRINT(4, ("mmap allocation with read only !\n")); | ||
42 | /* add VM_WRITE for do_page_fault will check this when a write fault */ | ||
43 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) | ||
44 | + vm_flags_set(vma, VM_WRITE | VM_READ); | ||
45 | +#else | ||
46 | vma->vm_flags |= VM_WRITE | VM_READ; | ||
47 | +#endif | ||
48 | vma->vm_page_prot = PAGE_READONLY; | ||
49 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); | ||
50 | mem_bkend->flags |= MALI_MEM_BACKEND_FLAG_COW_CPU_NO_WRITE; | ||
51 | diff --git a/linux/mali_memory_cow.c b/linux/mali_memory_cow.c | ||
52 | index 6fadd42..e631431 100644 | ||
53 | --- a/linux/mali_memory_cow.c | ||
54 | +++ b/linux/mali_memory_cow.c | ||
55 | @@ -391,13 +391,20 @@ _mali_osk_errcode_t mali_memory_cow_modify_range(mali_mem_backend *backend, | ||
56 | } | ||
57 | } else { | ||
58 | /* used to trigger page fault for swappable cowed memory. */ | ||
59 | - alloc->cpu_mapping.vma->vm_flags |= VM_PFNMAP; | ||
60 | - alloc->cpu_mapping.vma->vm_flags |= VM_MIXEDMAP; | ||
61 | - | ||
62 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) | ||
63 | + vm_flags_set(alloc->cpu_mapping.vma, VM_PFNMAP | VM_MIXEDMAP); | ||
64 | +#else | ||
65 | + alloc->cpu_mapping.vma->vm_flags |= VM_PFNMAP; | ||
66 | + alloc->cpu_mapping.vma->vm_flags |= VM_MIXEDMAP; | ||
67 | +#endif | ||
68 | zap_vma_ptes(alloc->cpu_mapping.vma, alloc->cpu_mapping.vma->vm_start + range_start, range_size); | ||
69 | /* delete this flag to let swappble is ummapped regard to stauct page not page frame. */ | ||
70 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) | ||
71 | + vm_flags_clear(alloc->cpu_mapping.vma, VM_PFNMAP | VM_MIXEDMAP); | ||
72 | +#else | ||
73 | alloc->cpu_mapping.vma->vm_flags &= ~VM_PFNMAP; | ||
74 | alloc->cpu_mapping.vma->vm_flags &= ~VM_MIXEDMAP; | ||
75 | +#endif | ||
76 | } | ||
77 | } | ||
78 | |||
79 | -- | ||
80 | 2.25.1 | ||
81 | |||