18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2015-2018 - ARM Ltd 48c2ecf20Sopenharmony_ci * Author: Marc Zyngier <marc.zyngier@arm.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/arm-smccc.h> 88c2ecf20Sopenharmony_ci#include <linux/linkage.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <asm/kvm_asm.h> 118c2ecf20Sopenharmony_ci#include <asm/kvm_mmu.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci /* 148c2ecf20Sopenharmony_ci * This is not executed directly and is instead copied into the vectors 158c2ecf20Sopenharmony_ci * by install_bp_hardening_cb(). 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci .data 188c2ecf20Sopenharmony_ci .pushsection .rodata 198c2ecf20Sopenharmony_ci .global __smccc_workaround_1_smc 208c2ecf20Sopenharmony_ciSYM_DATA_START(__smccc_workaround_1_smc) 218c2ecf20Sopenharmony_ci esb 228c2ecf20Sopenharmony_ci sub sp, sp, #(8 * 4) 238c2ecf20Sopenharmony_ci stp x2, x3, [sp, #(8 * 0)] 248c2ecf20Sopenharmony_ci stp x0, x1, [sp, #(8 * 2)] 258c2ecf20Sopenharmony_ci mov w0, #ARM_SMCCC_ARCH_WORKAROUND_1 268c2ecf20Sopenharmony_ci smc #0 278c2ecf20Sopenharmony_ci ldp x2, x3, [sp, #(8 * 0)] 288c2ecf20Sopenharmony_ci ldp x0, x1, [sp, #(8 * 2)] 298c2ecf20Sopenharmony_ci add sp, sp, #(8 * 4) 308c2ecf20Sopenharmony_ci1: .org __smccc_workaround_1_smc + __SMCCC_WORKAROUND_1_SMC_SZ 318c2ecf20Sopenharmony_ci .org 1b 328c2ecf20Sopenharmony_ciSYM_DATA_END(__smccc_workaround_1_smc) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci .global __smccc_workaround_3_smc 358c2ecf20Sopenharmony_ciSYM_DATA_START(__smccc_workaround_3_smc) 368c2ecf20Sopenharmony_ci esb 378c2ecf20Sopenharmony_ci sub sp, sp, #(8 * 4) 388c2ecf20Sopenharmony_ci stp x2, x3, [sp, #(8 * 0)] 398c2ecf20Sopenharmony_ci stp x0, x1, [sp, #(8 * 2)] 408c2ecf20Sopenharmony_ci mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 418c2ecf20Sopenharmony_ci smc #0 428c2ecf20Sopenharmony_ci ldp x2, x3, [sp, #(8 * 0)] 438c2ecf20Sopenharmony_ci ldp x0, x1, [sp, #(8 * 2)] 448c2ecf20Sopenharmony_ci add sp, sp, #(8 * 4) 458c2ecf20Sopenharmony_ci1: .org __smccc_workaround_3_smc + __SMCCC_WORKAROUND_3_SMC_SZ 468c2ecf20Sopenharmony_ci .org 1b 478c2ecf20Sopenharmony_ciSYM_DATA_END(__smccc_workaround_3_smc) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci .global __spectre_bhb_loop_k8 508c2ecf20Sopenharmony_ciSYM_DATA_START(__spectre_bhb_loop_k8) 518c2ecf20Sopenharmony_ci esb 528c2ecf20Sopenharmony_ci sub sp, sp, #(8 * 2) 538c2ecf20Sopenharmony_ci stp x0, x1, [sp, #(8 * 0)] 548c2ecf20Sopenharmony_ci mov x0, #8 558c2ecf20Sopenharmony_ci2: b . + 4 568c2ecf20Sopenharmony_ci subs x0, x0, #1 578c2ecf20Sopenharmony_ci b.ne 2b 588c2ecf20Sopenharmony_ci dsb nsh 598c2ecf20Sopenharmony_ci isb 608c2ecf20Sopenharmony_ci ldp x0, x1, [sp, #(8 * 0)] 618c2ecf20Sopenharmony_ci add sp, sp, #(8 * 2) 628c2ecf20Sopenharmony_ci1: .org __spectre_bhb_loop_k8 + __SPECTRE_BHB_LOOP_SZ 638c2ecf20Sopenharmony_ci .org 1b 648c2ecf20Sopenharmony_ciSYM_DATA_END(__spectre_bhb_loop_k8) 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci .global __spectre_bhb_loop_k24 678c2ecf20Sopenharmony_ciSYM_DATA_START(__spectre_bhb_loop_k24) 688c2ecf20Sopenharmony_ci esb 698c2ecf20Sopenharmony_ci sub sp, sp, #(8 * 2) 708c2ecf20Sopenharmony_ci stp x0, x1, [sp, #(8 * 0)] 718c2ecf20Sopenharmony_ci mov x0, #24 728c2ecf20Sopenharmony_ci2: b . + 4 738c2ecf20Sopenharmony_ci subs x0, x0, #1 748c2ecf20Sopenharmony_ci b.ne 2b 758c2ecf20Sopenharmony_ci dsb nsh 768c2ecf20Sopenharmony_ci isb 778c2ecf20Sopenharmony_ci ldp x0, x1, [sp, #(8 * 0)] 788c2ecf20Sopenharmony_ci add sp, sp, #(8 * 2) 798c2ecf20Sopenharmony_ci1: .org __spectre_bhb_loop_k24 + __SPECTRE_BHB_LOOP_SZ 808c2ecf20Sopenharmony_ci .org 1b 818c2ecf20Sopenharmony_ciSYM_DATA_END(__spectre_bhb_loop_k24) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci .global __spectre_bhb_loop_k32 848c2ecf20Sopenharmony_ciSYM_DATA_START(__spectre_bhb_loop_k32) 858c2ecf20Sopenharmony_ci esb 868c2ecf20Sopenharmony_ci sub sp, sp, #(8 * 2) 878c2ecf20Sopenharmony_ci stp x0, x1, [sp, #(8 * 0)] 888c2ecf20Sopenharmony_ci mov x0, #32 898c2ecf20Sopenharmony_ci2: b . + 4 908c2ecf20Sopenharmony_ci subs x0, x0, #1 918c2ecf20Sopenharmony_ci b.ne 2b 928c2ecf20Sopenharmony_ci dsb nsh 938c2ecf20Sopenharmony_ci isb 948c2ecf20Sopenharmony_ci ldp x0, x1, [sp, #(8 * 0)] 958c2ecf20Sopenharmony_ci add sp, sp, #(8 * 2) 968c2ecf20Sopenharmony_ci1: .org __spectre_bhb_loop_k32 + __SPECTRE_BHB_LOOP_SZ 978c2ecf20Sopenharmony_ci .org 1b 988c2ecf20Sopenharmony_ciSYM_DATA_END(__spectre_bhb_loop_k32) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci .global __spectre_bhb_clearbhb 1018c2ecf20Sopenharmony_ciSYM_DATA_START(__spectre_bhb_clearbhb) 1028c2ecf20Sopenharmony_ci esb 1038c2ecf20Sopenharmony_ci clearbhb 1048c2ecf20Sopenharmony_ci isb 1058c2ecf20Sopenharmony_ci1: .org __spectre_bhb_clearbhb + __SPECTRE_BHB_CLEARBHB_SZ 1068c2ecf20Sopenharmony_ci .org 1b 1078c2ecf20Sopenharmony_ciSYM_DATA_END(__spectre_bhb_clearbhb) 108