hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/riscv/include/asm/cacheflush.h
....@@ -1,24 +1,12 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2015 Regents of the University of California
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation, version 2.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #ifndef _ASM_RISCV_CACHEFLUSH_H
157 #define _ASM_RISCV_CACHEFLUSH_H
168
17
-#include <asm-generic/cacheflush.h>
18
-
19
-#undef flush_icache_range
20
-#undef flush_icache_user_range
21
-#undef flush_dcache_page
9
+#include <linux/mm.h>
2210
2311 static inline void local_flush_icache_all(void)
2412 {
....@@ -32,13 +20,15 @@
3220 if (test_bit(PG_dcache_clean, &page->flags))
3321 clear_bit(PG_dcache_clean, &page->flags);
3422 }
23
+#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
3524
3625 /*
3726 * RISC-V doesn't have an instruction to flush parts of the instruction cache,
3827 * so instead we just flush the whole thing.
3928 */
4029 #define flush_icache_range(start, end) flush_icache_all()
41
-#define flush_icache_user_range(vma, pg, addr, len) flush_icache_all()
30
+#define flush_icache_user_page(vma, pg, addr, len) \
31
+ flush_icache_mm(vma->vm_mm, 0)
4232
4333 #ifndef CONFIG_SMP
4434
....@@ -47,7 +37,7 @@
4737
4838 #else /* CONFIG_SMP */
4939
50
-#define flush_icache_all() sbi_remote_fence_i(NULL)
40
+void flush_icache_all(void);
5141 void flush_icache_mm(struct mm_struct *mm, bool local);
5242
5343 #endif /* CONFIG_SMP */
....@@ -58,4 +48,6 @@
5848 #define SYS_RISCV_FLUSH_ICACHE_LOCAL 1UL
5949 #define SYS_RISCV_FLUSH_ICACHE_ALL (SYS_RISCV_FLUSH_ICACHE_LOCAL)
6050
51
+#include <asm-generic/cacheflush.h>
52
+
6153 #endif /* _ASM_RISCV_CACHEFLUSH_H */