File Index
Files and directories
Sign in
FILE

tlbflush.h

File preview with syntax highlighting.

linux-6.19.14/arch/riscv/include/asm/tlbflush.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2009 Chen Liqin <liqin.chen@sunplusct.com>
 4 * Copyright (C) 2012 Regents of the University of California
 5 */
 6
 7#ifndef _ASM_RISCV_TLBFLUSH_H
 8#define _ASM_RISCV_TLBFLUSH_H
 9
10#include <linux/mm_types.h>
11#include <asm/smp.h>
12#include <asm/errata_list.h>
13
14#define FLUSH_TLB_MAX_SIZE      ((unsigned long)-1)
15#define FLUSH_TLB_NO_ASID       ((unsigned long)-1)
16
17#ifdef CONFIG_MMU
18static inline void local_flush_tlb_all(void)
19{
20	__asm__ __volatile__ ("sfence.vma" : : : "memory");
21}
22
23static inline void local_flush_tlb_all_asid(unsigned long asid)
24{
25	if (asid != FLUSH_TLB_NO_ASID)
26		ALT_SFENCE_VMA_ASID(asid);
27	else
28		local_flush_tlb_all();
29}
30
31/* Flush one page from local TLB */
32static inline void local_flush_tlb_page(unsigned long addr)
33{
34	ALT_SFENCE_VMA_ADDR(addr);
35}
36
37static inline void local_flush_tlb_page_asid(unsigned long addr,
38					     unsigned long asid)
39{
40	if (asid != FLUSH_TLB_NO_ASID)
41		ALT_SFENCE_VMA_ADDR_ASID(addr, asid);
42	else
43		local_flush_tlb_page(addr);
44}
45
46void flush_tlb_all(void);
47void flush_tlb_mm(struct mm_struct *mm);
48void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
49			unsigned long end, unsigned int page_size);
50void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
51void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
52		     unsigned long end);
53void flush_tlb_kernel_range(unsigned long start, unsigned long end);
54void local_flush_tlb_kernel_range(unsigned long start, unsigned long end);
55#ifdef CONFIG_TRANSPARENT_HUGEPAGE
56#define __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
57void flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start,
58			unsigned long end);
59void flush_pud_tlb_range(struct vm_area_struct *vma, unsigned long start,
60			 unsigned long end);
61#endif
62
63bool arch_tlbbatch_should_defer(struct mm_struct *mm);
64void arch_tlbbatch_add_pending(struct arch_tlbflush_unmap_batch *batch,
65		struct mm_struct *mm, unsigned long start, unsigned long end);
66void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch);
67
68extern unsigned long tlb_flush_all_threshold;
69#else /* CONFIG_MMU */
70#define local_flush_tlb_all()			do { } while (0)
71#endif /* CONFIG_MMU */
72
73#endif /* _ASM_RISCV_TLBFLUSH_H */
~/ Read-only file preview.