arm64: KVM: Propagate full Spectre v2 workaround state to KVM guests
[linux-2.6-microblaze.git] / arch / arm / include / asm / kvm_host.h
index 075e192..e74e8f4 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2012 - Virtual Open Systems and Columbia University
  * Author: Christoffer Dall <c.dall@virtualopensystems.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #ifndef __ARM_KVM_HOST_H__
@@ -374,7 +362,11 @@ static inline void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu) {}
 static inline void kvm_arm_vhe_guest_enter(void) {}
 static inline void kvm_arm_vhe_guest_exit(void) {}
 
-static inline bool kvm_arm_harden_branch_predictor(void)
+#define KVM_BP_HARDEN_UNKNOWN          -1
+#define KVM_BP_HARDEN_WA_NEEDED                0
+#define KVM_BP_HARDEN_NOT_REQUIRED     1
+
+static inline int kvm_arm_harden_branch_predictor(void)
 {
        switch(read_cpuid_part()) {
 #ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
@@ -382,10 +374,12 @@ static inline bool kvm_arm_harden_branch_predictor(void)
        case ARM_CPU_PART_CORTEX_A12:
        case ARM_CPU_PART_CORTEX_A15:
        case ARM_CPU_PART_CORTEX_A17:
-               return true;
+               return KVM_BP_HARDEN_WA_NEEDED;
 #endif
+       case ARM_CPU_PART_CORTEX_A7:
+               return KVM_BP_HARDEN_NOT_REQUIRED;
        default:
-               return false;
+               return KVM_BP_HARDEN_UNKNOWN;
        }
 }