]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/arm64/kernel/bpi.S
arm64: Implement branch predictor hardening for affected Cortex-A CPUs
[mirror_ubuntu-artful-kernel.git] / arch / arm64 / kernel / bpi.S
CommitLineData
ec52ee18
WD
1/*
2 * Contains CPU specific branch predictor invalidation sequences
3 *
4 * Copyright (C) 2018 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/linkage.h>
20
21.macro ventry target
22 .rept 31
23 nop
24 .endr
25 b \target
26.endm
27
28.macro vectors target
29 ventry \target + 0x000
30 ventry \target + 0x080
31 ventry \target + 0x100
32 ventry \target + 0x180
33
34 ventry \target + 0x200
35 ventry \target + 0x280
36 ventry \target + 0x300
37 ventry \target + 0x380
38
39 ventry \target + 0x400
40 ventry \target + 0x480
41 ventry \target + 0x500
42 ventry \target + 0x580
43
44 ventry \target + 0x600
45 ventry \target + 0x680
46 ventry \target + 0x700
47 ventry \target + 0x780
48.endm
49
50 .align 11
51ENTRY(__bp_harden_hyp_vecs_start)
52 .rept 4
53 vectors __kvm_hyp_vector
54 .endr
55ENTRY(__bp_harden_hyp_vecs_end)
f2f427ad
WD
56ENTRY(__psci_hyp_bp_inval_start)
57 sub sp, sp, #(8 * 18)
58 stp x16, x17, [sp, #(16 * 0)]
59 stp x14, x15, [sp, #(16 * 1)]
60 stp x12, x13, [sp, #(16 * 2)]
61 stp x10, x11, [sp, #(16 * 3)]
62 stp x8, x9, [sp, #(16 * 4)]
63 stp x6, x7, [sp, #(16 * 5)]
64 stp x4, x5, [sp, #(16 * 6)]
65 stp x2, x3, [sp, #(16 * 7)]
66 stp x0, x1, [sp, #(16 * 8)]
67 mov x0, #0x84000000
68 smc #0
69 ldp x16, x17, [sp, #(16 * 0)]
70 ldp x14, x15, [sp, #(16 * 1)]
71 ldp x12, x13, [sp, #(16 * 2)]
72 ldp x10, x11, [sp, #(16 * 3)]
73 ldp x8, x9, [sp, #(16 * 4)]
74 ldp x6, x7, [sp, #(16 * 5)]
75 ldp x4, x5, [sp, #(16 * 6)]
76 ldp x2, x3, [sp, #(16 * 7)]
77 ldp x0, x1, [sp, #(16 * 8)]
78 add sp, sp, #(8 * 18)
79ENTRY(__psci_hyp_bp_inval_end)