summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2018-08-24 17:18:41 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2018-08-24 17:18:41 -0400
commit123a2cb80707cceade3f68313dbb06f0e66532ee (patch)
tree307f5ad74c8a74fe1b6bea1ac6b0a884c85656ab
parent8430fe66152202e67ec17446908b702f8ecc8383 (diff)
downloadlongterm-queue-4.12-123a2cb80707cceade3f68313dbb06f0e66532ee.tar.gz
kvm: borrow 4.14-stable backport
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/arm64-KVM-Add-ARCH_WORKAROUND_2-support-for-guests.patch87
1 files changed, 36 insertions, 51 deletions
diff --git a/queue/arm64-KVM-Add-ARCH_WORKAROUND_2-support-for-guests.patch b/queue/arm64-KVM-Add-ARCH_WORKAROUND_2-support-for-guests.patch
index 310e4a9..55aae19 100644
--- a/queue/arm64-KVM-Add-ARCH_WORKAROUND_2-support-for-guests.patch
+++ b/queue/arm64-KVM-Add-ARCH_WORKAROUND_2-support-for-guests.patch
@@ -1,6 +1,6 @@
-From 55e3748e8902ff641e334226bdcb432f9a5d78d3 Mon Sep 17 00:00:00 2001
+From 07184939ffb0b216f28ff8098a36ae886d35fb8e Mon Sep 17 00:00:00 2001
From: Marc Zyngier <marc.zyngier@arm.com>
-Date: Tue, 29 May 2018 13:11:16 +0100
+Date: Fri, 20 Jul 2018 10:53:10 +0100
Subject: [PATCH] arm64: KVM: Add ARCH_WORKAROUND_2 support for guests
commit 55e3748e8902ff641e334226bdcb432f9a5d78d3 upstream.
@@ -17,12 +17,16 @@ Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[PG: borrow 4.14-stable version for the 4.12 baseline here.]
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
-index 707a1f06dc5d..b0c17d88ed40 100644
+index 26d3b8ed2166..1061897597f5 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
-@@ -319,6 +319,11 @@ static inline int kvm_map_vectors(void)
+@@ -238,6 +238,11 @@ static inline int kvm_map_vectors(void)
return 0;
}
@@ -31,11 +35,11 @@ index 707a1f06dc5d..b0c17d88ed40 100644
+ return 0;
+}
+
- #define kvm_phys_to_vttbr(addr) (addr)
-
#endif /* !__ASSEMBLY__ */
+
+ #endif /* __ARM_KVM_MMU_H__ */
diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
-index fefd8cf42c35..d4fbb1356c4c 100644
+index b956418f73bd..1a6d02350fc6 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -33,6 +33,9 @@
@@ -49,10 +53,10 @@ index fefd8cf42c35..d4fbb1356c4c 100644
#define kvm_ksym_ref(sym) \
({ \
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
-index 469de8acd06f..9bef3f69bdcd 100644
+index f075a567c6af..4b3b78fd48ce 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
-@@ -216,6 +216,9 @@ struct kvm_vcpu_arch {
+@@ -205,6 +205,9 @@ struct kvm_vcpu_arch {
/* Exception Information */
struct kvm_vcpu_fault_info fault;
@@ -63,10 +67,10 @@ index 469de8acd06f..9bef3f69bdcd 100644
u64 debug_flags;
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
-index f74987b76d91..fbe4ddd9da09 100644
+index 034240bde5b7..8b0b32fb9d52 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
-@@ -456,6 +456,30 @@ static inline int kvm_map_vectors(void)
+@@ -370,5 +370,29 @@ static inline int kvm_map_vectors(void)
}
#endif
@@ -94,11 +98,10 @@ index f74987b76d91..fbe4ddd9da09 100644
+}
+#endif
+
- #define kvm_phys_to_vttbr(addr) phys_to_ttbr(addr)
-
#endif /* __ASSEMBLY__ */
+ #endif /* __ARM64_KVM_MMU_H__ */
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
-index d9645236e474..c50cedc447f1 100644
+index 625678c5fe04..569bcdb13a70 100644
--- a/arch/arm64/kvm/hyp/switch.c
+++ b/arch/arm64/kvm/hyp/switch.c
@@ -15,6 +15,7 @@
@@ -109,8 +112,8 @@ index d9645236e474..c50cedc447f1 100644
#include <linux/types.h>
#include <linux/jump_label.h>
#include <uapi/linux/psci.h>
-@@ -389,6 +390,39 @@ static bool __hyp_text fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
- return false;
+@@ -281,6 +282,39 @@ static void __hyp_text __skip_instr(struct kvm_vcpu *vcpu)
+ write_sysreg_el2(*vcpu_pc(vcpu), elr);
}
+static inline bool __hyp_text __needs_ssbd_off(struct kvm_vcpu *vcpu)
@@ -146,52 +149,34 @@ index d9645236e474..c50cedc447f1 100644
+#endif
+}
+
- /* Switch to the guest for VHE systems running in EL2 */
- int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)
+ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
{
-@@ -409,6 +443,8 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)
- sysreg_restore_guest_state_vhe(guest_ctxt);
- __debug_switch_to_guest(vcpu);
-
-+ __set_guest_arch_workaround_state(vcpu);
-+
- do {
- /* Jump in the fire! */
- exit_code = __guest_enter(vcpu, host_ctxt);
-@@ -416,6 +452,8 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)
- /* And we're baaack! */
- } while (fixup_guest_exit(vcpu, &exit_code));
-
-+ __set_host_arch_workaround_state(vcpu);
-+
- fp_enabled = fpsimd_enabled_vhe();
-
- sysreg_save_guest_state_vhe(guest_ctxt);
-@@ -465,6 +503,8 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
- __sysreg_restore_state_nvhe(guest_ctxt);
- __debug_switch_to_guest(vcpu);
+ struct kvm_cpu_context *host_ctxt;
+@@ -311,6 +345,8 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
+ __sysreg_restore_guest_state(guest_ctxt);
+ __debug_restore_state(vcpu, kern_hyp_va(vcpu->arch.debug_ptr), guest_ctxt);
+ __set_guest_arch_workaround_state(vcpu);
+
- do {
- /* Jump in the fire! */
- exit_code = __guest_enter(vcpu, host_ctxt);
-@@ -472,6 +512,8 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
- /* And we're baaack! */
- } while (fixup_guest_exit(vcpu, &exit_code));
+ /* Jump in the fire! */
+ again:
+ exit_code = __guest_enter(vcpu, host_ctxt);
+@@ -353,6 +389,8 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
+ }
+ }
+ __set_host_arch_workaround_state(vcpu);
+
- fp_enabled = __fpsimd_enabled_nvhe();
+ if (cpus_have_const_cap(ARM64_HARDEN_BP_POST_GUEST_EXIT)) {
+ u32 midr = read_cpuid_id();
- __sysreg_save_state_nvhe(guest_ctxt);
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
-index a4c1b76240df..2d9b4795edb2 100644
+index 57892d5cc97d..4677c459e231 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
-@@ -1490,6 +1490,10 @@ static int init_hyp_mode(void)
- }
- }
+@@ -1387,6 +1387,10 @@ static int init_hyp_mode(void)
+
+ kvm_info("Hyp mode initialized successfully\n");
+ err = hyp_map_aux_data();
+ if (err)