1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef __ASM_CSKY_CKMMUV2_H
4 #define __ASM_CSKY_CKMMUV2_H
6 #include <abi/reg_ops.h>
7 #include <asm/barrier.h>
9 static inline int read_mmu_index(void)
11 return mfcr("cr<0, 15>");
14 static inline void write_mmu_index(int value
)
16 mtcr("cr<0, 15>", value
);
19 static inline int read_mmu_entrylo0(void)
21 return mfcr("cr<2, 15>");
24 static inline int read_mmu_entrylo1(void)
26 return mfcr("cr<3, 15>");
29 static inline void write_mmu_pagemask(int value
)
31 mtcr("cr<6, 15>", value
);
34 static inline int read_mmu_entryhi(void)
36 return mfcr("cr<4, 15>");
39 static inline void write_mmu_entryhi(int value
)
41 mtcr("cr<4, 15>", value
);
44 static inline unsigned long read_mmu_msa0(void)
46 return mfcr("cr<30, 15>");
49 static inline void write_mmu_msa0(unsigned long value
)
51 mtcr("cr<30, 15>", value
);
54 static inline unsigned long read_mmu_msa1(void)
56 return mfcr("cr<31, 15>");
59 static inline void write_mmu_msa1(unsigned long value
)
61 mtcr("cr<31, 15>", value
);
67 static inline void tlb_probe(void)
69 mtcr("cr<8, 15>", 0x80000000);
72 static inline void tlb_read(void)
74 mtcr("cr<8, 15>", 0x40000000);
77 static inline void tlb_invalid_all(void)
79 #ifdef CONFIG_CPU_HAS_TLBI
88 mtcr("cr<8, 15>", 0x04000000);
92 static inline void local_tlb_invalid_all(void)
94 #ifdef CONFIG_CPU_HAS_TLBI
107 static inline void tlb_invalid_indexed(void)
109 mtcr("cr<8, 15>", 0x02000000);
112 #define NOP32 ".long 0x4820c400\n"
114 static inline void setup_pgd(pgd_t
*pgd
, int asid
)
116 #ifdef CONFIG_CPU_HAS_TLBI
122 #ifdef CONFIG_CPU_HAS_TLBI
123 "mtcr %1, cr<28, 15> \n"
125 "mtcr %1, cr<29, 15> \n"
126 "mtcr %0, cr< 4, 15> \n"
131 :"r"(asid
), "r"(__pa(pgd
) | BIT(0))
135 static inline pgd_t
*get_pgd(void)
137 return __va(mfcr("cr<29, 15>") & ~BIT(0));
139 #endif /* __ASM_CSKY_CKMMUV2_H */