| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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. |
|---|
| 12 | 4 | */ |
|---|
| 13 | 5 | |
|---|
| 14 | 6 | #ifndef _ASM_RISCV_CACHEFLUSH_H |
|---|
| 15 | 7 | #define _ASM_RISCV_CACHEFLUSH_H |
|---|
| 16 | 8 | |
|---|
| 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> |
|---|
| 22 | 10 | |
|---|
| 23 | 11 | static inline void local_flush_icache_all(void) |
|---|
| 24 | 12 | { |
|---|
| .. | .. |
|---|
| 32 | 20 | if (test_bit(PG_dcache_clean, &page->flags)) |
|---|
| 33 | 21 | clear_bit(PG_dcache_clean, &page->flags); |
|---|
| 34 | 22 | } |
|---|
| 23 | +#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
|---|
| 35 | 24 | |
|---|
| 36 | 25 | /* |
|---|
| 37 | 26 | * RISC-V doesn't have an instruction to flush parts of the instruction cache, |
|---|
| 38 | 27 | * so instead we just flush the whole thing. |
|---|
| 39 | 28 | */ |
|---|
| 40 | 29 | #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) |
|---|
| 42 | 32 | |
|---|
| 43 | 33 | #ifndef CONFIG_SMP |
|---|
| 44 | 34 | |
|---|
| .. | .. |
|---|
| 47 | 37 | |
|---|
| 48 | 38 | #else /* CONFIG_SMP */ |
|---|
| 49 | 39 | |
|---|
| 50 | | -#define flush_icache_all() sbi_remote_fence_i(NULL) |
|---|
| 40 | +void flush_icache_all(void); |
|---|
| 51 | 41 | void flush_icache_mm(struct mm_struct *mm, bool local); |
|---|
| 52 | 42 | |
|---|
| 53 | 43 | #endif /* CONFIG_SMP */ |
|---|
| .. | .. |
|---|
| 58 | 48 | #define SYS_RISCV_FLUSH_ICACHE_LOCAL 1UL |
|---|
| 59 | 49 | #define SYS_RISCV_FLUSH_ICACHE_ALL (SYS_RISCV_FLUSH_ICACHE_LOCAL) |
|---|
| 60 | 50 | |
|---|
| 51 | +#include <asm-generic/cacheflush.h> |
|---|
| 52 | + |
|---|
| 61 | 53 | #endif /* _ASM_RISCV_CACHEFLUSH_H */ |
|---|