11 #ifndef _XTENSA_TLBFLUSH_H
12 #define _XTENSA_TLBFLUSH_H
17 #include <asm/processor.h>
19 #define DTLB_WAY_PGD 7
21 #define ITLB_ARF_WAYS 4
22 #define DTLB_ARF_WAYS 4
24 #define ITLB_HIT_BIT 3
25 #define DTLB_HIT_BIT 4
42 #define flush_tlb_kernel_range(start,end) flush_tlb_all()
46 static inline unsigned long itlb_probe(
unsigned long addr)
49 __asm__ __volatile__(
"pitlb %0, %1\n\t" :
"=a" (tmp) :
"a" (addr));
53 static inline unsigned long dtlb_probe(
unsigned long addr)
56 __asm__ __volatile__(
"pdtlb %0, %1\n\t" :
"=a" (tmp) :
"a" (addr));
60 static inline void invalidate_itlb_entry (
unsigned long probe)
62 __asm__ __volatile__(
"iitlb %0; isync\n\t" : :
"a" (probe));
65 static inline void invalidate_dtlb_entry (
unsigned long probe)
67 __asm__ __volatile__(
"idtlb %0; dsync\n\t" : :
"a" (probe));
75 static inline void invalidate_itlb_entry_no_isync (
unsigned entry)
78 __asm__ __volatile__ (
"iitlb %0\n" : :
"a" (entry) );
81 static inline void invalidate_dtlb_entry_no_isync (
unsigned entry)
84 __asm__ __volatile__ (
"idtlb %0\n" : :
"a" (entry) );
87 static inline void set_itlbcfg_register (
unsigned long val)
89 __asm__ __volatile__(
"wsr %0, itlbcfg\n\t" "isync\n\t"
93 static inline void set_dtlbcfg_register (
unsigned long val)
95 __asm__ __volatile__(
"wsr %0, dtlbcfg; dsync\n\t"
99 static inline void set_ptevaddr_register (
unsigned long val)
101 __asm__ __volatile__(
" wsr %0, ptevaddr; isync\n"
105 static inline unsigned long read_ptevaddr_register (
void)
108 __asm__ __volatile__(
"rsr %0, ptevaddr\n\t" :
"=a" (tmp));
112 static inline void write_dtlb_entry (
pte_t entry,
int way)
114 __asm__ __volatile__(
"wdtlb %1, %0; dsync\n\t"
115 : :
"r" (way),
"r" (entry) );
118 static inline void write_itlb_entry (
pte_t entry,
int way)
120 __asm__ __volatile__(
"witlb %1, %0; isync\n\t"
121 : :
"r" (way),
"r" (entry) );
124 static inline void invalidate_page_directory (
void)
126 invalidate_dtlb_entry (DTLB_WAY_PGD);
127 invalidate_dtlb_entry (DTLB_WAY_PGD+1);
128 invalidate_dtlb_entry (DTLB_WAY_PGD+2);
131 static inline void invalidate_itlb_mapping (
unsigned address)
133 unsigned long tlb_entry;
134 if (((tlb_entry = itlb_probe(address)) & (1 << ITLB_HIT_BIT)) != 0)
135 invalidate_itlb_entry(tlb_entry);
138 static inline void invalidate_dtlb_mapping (
unsigned address)
140 unsigned long tlb_entry;
141 if (((tlb_entry = dtlb_probe(address)) & (1 << DTLB_HIT_BIT)) != 0)
142 invalidate_dtlb_entry(tlb_entry);
145 #define check_pgt_cache() do { } while (0)
161 static inline unsigned long read_dtlb_virtual (
int way)
164 __asm__ __volatile__(
"rdtlb0 %0, %1\n\t" :
"=a" (tmp),
"+a" (way));
168 static inline unsigned long read_dtlb_translation (
int way)
171 __asm__ __volatile__(
"rdtlb1 %0, %1\n\t" :
"=a" (tmp),
"+a" (way));
175 static inline unsigned long read_itlb_virtual (
int way)
178 __asm__ __volatile__(
"ritlb0 %0, %1\n\t" :
"=a" (tmp),
"+a" (way));
182 static inline unsigned long read_itlb_translation (
int way)
185 __asm__ __volatile__(
"ritlb1 %0, %1\n\t" :
"=a" (tmp),
"+a" (way));