1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the GNU General Public License version 2. Note that NO WARRANTY is provided. 8 * See "LICENSE_GPLv2.txt" for details. 9 * 10 * @TAG(DATA61_GPL) 11 */ 12 13#ifndef __ARCH_MACHINE_TLB_H 14#define __ARCH_MACHINE_TLB_H 15 16#include <mode/machine.h> 17#include <arch/smp/ipi_inline.h> 18#if defined(CONFIG_ARM_HYPERVISOR_SUPPORT) && defined(CONFIG_ARCH_AARCH64) 19#include <armv/tlb.h> 20#endif 21 22static inline void invalidateTranslationSingleLocal(vptr_t vptr) 23{ 24#if defined(CONFIG_ARM_HYPERVISOR_SUPPORT) && defined(CONFIG_ARCH_AARCH64) 25 invalidateLocalTLB_IPA_VMID(vptr); 26#else 27 invalidateLocalTLB_VAASID(vptr); 28#endif 29} 30 31static inline void invalidateTranslationASIDLocal(hw_asid_t hw_asid) 32{ 33#if defined(CONFIG_ARM_HYPERVISOR_SUPPORT) && defined(CONFIG_ARCH_AARCH64) 34 invalidateLocalTLB_VMID(hw_asid); 35#else 36 invalidateLocalTLB_ASID(hw_asid); 37#endif 38} 39 40static inline void invalidateTranslationAllLocal(void) 41{ 42 invalidateLocalTLB(); 43} 44 45static inline void invalidateTranslationSingle(vptr_t vptr) 46{ 47 invalidateTranslationSingleLocal(vptr); 48 SMP_COND_STATEMENT(doRemoteInvalidateTranslationSingle(vptr, MASK(CONFIG_MAX_NUM_NODES))); 49} 50 51static inline void invalidateTranslationASID(hw_asid_t hw_asid) 52{ 53 invalidateTranslationASIDLocal(hw_asid); 54 SMP_COND_STATEMENT(doRemoteInvalidateTranslationASID(hw_asid, MASK(CONFIG_MAX_NUM_NODES))); 55} 56 57static inline void invalidateTranslationAll(void) 58{ 59 invalidateTranslationAllLocal(); 60 SMP_COND_STATEMENT(doRemoteInvalidateTranslationAll(MASK(CONFIG_MAX_NUM_NODES))); 61} 62 63#endif /* __ARCH_MACHINE_TLB_H */ 64