unnamed_ba_thesis/src/patch/0000-export-dcache-clean-poc-dbg.patch
2024-02-23 14:06:42 +00:00

58 lines
1.6 KiB
Diff

diff --git a/arch/arm64/include/asm/cacheflush_extra.h b/arch/arm64/include/asm/cacheflush_extra.h
new file mode 100644
index 000000000000..98eadccbcde4
--- /dev/null
+++ b/arch/arm64/include/asm/cacheflush_extra.h
@@ -0,0 +1,13 @@
+/*
+ * 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);
+extern void __dcache_clean_poc_dbg(
+ unsigned long start, unsigned long end, unsigned long long *runtime);
+
+#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..f8920b1187ef 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -15,6 +15,8 @@
#include <asm/cache.h>
#include <asm/tlbflush.h>
+#include <asm/cacheflush_extra.h>
+
void sync_icache_aliases(unsigned long start, unsigned long end)
{
if (icache_is_aliasing()) {
@@ -62,6 +64,24 @@ 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);
+
+void __dcache_clean_poc_dbg(ulong start, ulong end, u64 *runtime)
+{
+ u64 calltime, rettime;
+
+ calltime = ktime_get_ns();
+ dcache_clean_poc(start, end);
+ rettime = ktime_get_ns();
+
+ *runtime = rettime - calltime;
+}
+EXPORT_SYMBOL(__dcache_clean_poc_dbg);
+
/*
* 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,