1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 * Copyright (c) 2017, Linaro Limited 5 */ 6 7 #ifndef TLB_HELPERS_H 8 #define TLB_HELPERS_H 9 10 #include <arm.h> 11 12 #ifndef __ASSEMBLER__ 13 #include <types_ext.h> 14 15 void tlbi_all(void); 16 void tlbi_asid(unsigned long asid); 17 void tlbi_mva_allasid(unsigned long addr); 18 tlbi_mva_allasid_nosync(vaddr_t va)19static inline void tlbi_mva_allasid_nosync(vaddr_t va) 20 { 21 #ifdef ARM64 22 tlbi_vaae1is(va >> TLBI_MVA_SHIFT); 23 #else 24 write_tlbimvaais(va); 25 #endif 26 } 27 tlbi_mva_asid_nosync(vaddr_t va,uint32_t asid)28static inline void tlbi_mva_asid_nosync(vaddr_t va, uint32_t asid) 29 { 30 uint32_t a = asid & TLBI_ASID_MASK; 31 32 #ifdef ARM64 33 tlbi_vale1is((va >> TLBI_MVA_SHIFT) | SHIFT_U64(a, TLBI_ASID_SHIFT)); 34 tlbi_vale1is((va >> TLBI_MVA_SHIFT) | 35 SHIFT_U64(a | 1, TLBI_ASID_SHIFT)); 36 #else 37 write_tlbimvais((va & ~(BIT32(TLBI_MVA_SHIFT) - 1)) | a); 38 write_tlbimvais((va & ~(BIT32(TLBI_MVA_SHIFT) - 1)) | a | 1); 39 #endif 40 } 41 tlbi_mva_asid(vaddr_t va,uint32_t asid)42static inline void tlbi_mva_asid(vaddr_t va, uint32_t asid) 43 { 44 dsb_ishst(); 45 tlbi_mva_asid_nosync(va, asid); 46 dsb_ish(); 47 isb(); 48 } 49 #endif /*!__ASSEMBLER__*/ 50 51 #endif /* TLB_HELPERS_H */ 52