]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - arch/riscv/include/asm/tlbflush.h
UBUNTU: Ubuntu-5.11.0-22.23
[mirror_ubuntu-hirsute-kernel.git] / arch / riscv / include / asm / tlbflush.h
CommitLineData
50acfb2b 1/* SPDX-License-Identifier: GPL-2.0-only */
fab957c1
PD
2/*
3 * Copyright (C) 2009 Chen Liqin <liqin.chen@sunplusct.com>
4 * Copyright (C) 2012 Regents of the University of California
fab957c1
PD
5 */
6
7#ifndef _ASM_RISCV_TLBFLUSH_H
8#define _ASM_RISCV_TLBFLUSH_H
9
08f051ed 10#include <linux/mm_types.h>
f99fb607 11#include <asm/smp.h>
08f051ed 12
6bd33e1e 13#ifdef CONFIG_MMU
fab957c1
PD
14static inline void local_flush_tlb_all(void)
15{
16 __asm__ __volatile__ ("sfence.vma" : : : "memory");
17}
18
19/* Flush one page from local TLB */
20static inline void local_flush_tlb_page(unsigned long addr)
21{
22 __asm__ __volatile__ ("sfence.vma %0" : : "r" (addr) : "memory");
23}
6bd33e1e
CH
24#else /* CONFIG_MMU */
25#define local_flush_tlb_all() do { } while (0)
26#define local_flush_tlb_page(addr) do { } while (0)
27#endif /* CONFIG_MMU */
fab957c1 28
6bd33e1e 29#if defined(CONFIG_SMP) && defined(CONFIG_MMU)
95594cb4
CH
30void flush_tlb_all(void);
31void flush_tlb_mm(struct mm_struct *mm);
32void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
33void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
34 unsigned long end);
6bd33e1e
CH
35#else /* CONFIG_SMP && CONFIG_MMU */
36
fab957c1
PD
37#define flush_tlb_all() local_flush_tlb_all()
38#define flush_tlb_page(vma, addr) local_flush_tlb_page(addr)
f1b65f20
AW
39
40static inline void flush_tlb_range(struct vm_area_struct *vma,
41 unsigned long start, unsigned long end)
42{
43 local_flush_tlb_all();
44}
45
46#define flush_tlb_mm(mm) flush_tlb_all()
6bd33e1e 47#endif /* !CONFIG_SMP || !CONFIG_MMU */
fab957c1 48
fab957c1
PD
49/* Flush a range of kernel pages */
50static inline void flush_tlb_kernel_range(unsigned long start,
51 unsigned long end)
52{
53 flush_tlb_all();
54}
55
fab957c1 56#endif /* _ASM_RISCV_TLBFLUSH_H */