diff --git a/src/aarch64-linux-flush-dcache/my_shmem.c b/src/aarch64-linux-flush-dcache/my_shmem.c index 7aa5285..325ef6d 100644 --- a/src/aarch64-linux-flush-dcache/my_shmem.c +++ b/src/aarch64-linux-flush-dcache/my_shmem.c @@ -1,6 +1,5 @@ // [TODO] Clean up headers... // #include -#include #include "linux/atomic/atomic-long.h" #include #include "linux/gfp.h" @@ -20,6 +19,8 @@ #include #include +#include + MODULE_AUTHOR("Zk."); MODULE_DESCRIPTION("4.2.W1: mmap for point of coherency"); MODULE_LICENSE("GPL"); @@ -59,7 +60,7 @@ static void my_shmem_vmops_close(struct vm_area_struct *vma) __func__, page_address(pg), *(ulong *)(page_address(pg)), sizeof(ulong)); // [!!] `dcache_clean_poc` seems not exported. - dcache_clean_poc(vaddr_start, vaddr_start + PAGE_SIZE); + __dcache_clean_poc(vaddr_start, vaddr_start + PAGE_SIZE); pr_info("[%s] After flush: 0x%px has 0x%lx [+%ld].\n", __func__, page_address(pg), *(ulong *)(page_address(pg)), sizeof(ulong)); @@ -282,4 +283,4 @@ static void __exit my_shmem_exit(void) } module_init(my_shmem_init); -module_exit(my_shmem_exit); \ No newline at end of file +module_exit(my_shmem_exit); diff --git a/src/patch/0000-export-dcache-clean-poc.patch b/src/patch/0000-export-dcache-clean-poc.patch new file mode 100644 index 0000000..0d65f3b --- /dev/null +++ b/src/patch/0000-export-dcache-clean-poc.patch @@ -0,0 +1,44 @@ +diff --git a/arch/arm64/include/asm/cacheflush_extra.h b/arch/arm64/include/asm/cacheflush_extra.h +new file mode 100644 +index 000000000000..d989e93ff01a +--- /dev/null ++++ b/arch/arm64/include/asm/cacheflush_extra.h +@@ -0,0 +1,11 @@ ++/* ++ * Get dcache_clean|inval_poc out to driverland! ++ */ ++ ++#ifndef __ASM_CACHEFLUSH_EX_H ++#define __ASM_CACHEFLUSH_EX_H ++ ++/* Ref. cacheflush.h */ ++extern void __dcache_clean_poc(unsigned long start, unsigned long end); ++ ++#endif /* __ASM_CACHEFLUSH_EX_H */ +\ No newline at end of file +diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c +index 013eead9b695..d9bb343d4b5e 100644 +--- a/arch/arm64/mm/flush.c ++++ b/arch/arm64/mm/flush.c +@@ -15,6 +15,8 @@ + #include + #include + ++#include ++ + void sync_icache_aliases(unsigned long start, unsigned long end) + { + if (icache_is_aliasing()) { +@@ -62,6 +64,12 @@ void __sync_icache_dcache(pte_t pte) + } + EXPORT_SYMBOL_GPL(__sync_icache_dcache); + ++void __dcache_clean_poc(ulong start, ulong end) ++{ ++ dcache_clean_poc(start, end); ++} ++EXPORT_SYMBOL(__dcache_clean_poc); ++ + /* + * This function is called when a page has been modified by the kernel. Mark + * it as dirty for later flushing when mapped in user space (if executable,