1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (c) 2015-2017, Linaro Limited
4 */
5
6#include <arm64.h>
7#include <asm.S>
8#include <util.h>
9
10/* void tlbi_all(void); */
11FUNC tlbi_all , :
12	dsb	ishst		/* Sync with table update */
13	tlbi	vmalle1is	/* All tlb in inner shareable */
14	dsb	ish		/* Sync with tlb invalidation completion */
15	isb			/* Sync execution on tlb update */
16	ret
17END_FUNC tlbi_all
18
19/* void tlbi_mva_allasid(vaddr_t mva); */
20FUNC tlbi_mva_allasid , :
21	lsr	x0, x0, #TLBI_MVA_SHIFT
22	dsb	ishst		/* Sync with table update */
23	tlbi	vaae1is, x0	/* Invalidate tlb by mva in inner shareable */
24	dsb	ish		/* Sync with tlb invalidation completion */
25	isb			/* Sync execution on tlb update */
26	ret
27END_FUNC tlbi_mva_allasid
28
29/* void tlbi_asid(unsigned int asid); */
30FUNC tlbi_asid , :
31	lsl	x0, x0, #TLBI_ASID_SHIFT
32	dsb	ishst		/* Sync with table update */
33	tlbi	aside1is, x0	/* Invalidate tlb by asid in inner shareable */
34	orr	x0, x0, #BIT(TLBI_ASID_SHIFT) /* Select the kernel ASID */
35	tlbi	aside1is, x0	/* Invalidate tlb by asid in inner shareable */
36	dsb	ish		/* Sync with tlb invalidation completion */
37	isb			/* Sync execution on tlb update */
38	ret
39END_FUNC tlbi_asid
40
41BTI(emit_aarch64_feature_1_and     GNU_PROPERTY_AARCH64_FEATURE_1_BTI)
42