From: Russell King Date: Wed, 16 May 2018 10:29:30 +0000 (+0100) Subject: ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 X-Git-Tag: v4.18-rc1~123^2^3~3 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=add5609877c6785cc002c6ed7e008b1d61064439;p=uclinux-h8%2Flinux.git ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 Report support for SMCCC_ARCH_WORKAROUND_1 to KVM guests for affected CPUs. Signed-off-by: Russell King Boot-tested-by: Tony Lindgren Reviewed-by: Tony Lindgren Reviewed-by: Marc Zyngier --- diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 248b930563e5..11f91744ffb0 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -311,8 +312,17 @@ static inline void kvm_arm_vhe_guest_exit(void) {} static inline bool kvm_arm_harden_branch_predictor(void) { - /* No way to detect it yet, pretend it is not there. */ - return false; + switch(read_cpuid_part()) { +#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR + case ARM_CPU_PART_BRAHMA_B15: + case ARM_CPU_PART_CORTEX_A12: + case ARM_CPU_PART_CORTEX_A15: + case ARM_CPU_PART_CORTEX_A17: + return true; +#endif + default: + return false; + } } #endif /* __ARM_KVM_HOST_H__ */