Merge branches 'fixes', 'misc' and 'spectre' into for-linus
[sfrench/cifs-2.6.git] / arch / arm / include / asm / kvm_host.h
index c6a749568dd6c413603ef3b7554561f356b33cc9..8467e05360d7a3395d1a50b9b97c12f021e4ffc9 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <linux/types.h>
 #include <linux/kvm_types.h>
+#include <asm/cputype.h>
 #include <asm/kvm.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
@@ -308,8 +309,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;
+       }
 }
 
 static inline void kvm_vcpu_load_sysregs(struct kvm_vcpu *vcpu) {}