]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jan 2020 18:34:14 +0000 (19:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jan 2020 18:34:14 +0000 (19:34 +0100)
added patches:
kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch

queue-4.19/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch b/queue-4.19/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch
new file mode 100644 (file)
index 0000000..4ef7c0e
--- /dev/null
@@ -0,0 +1,57 @@
+From 4942dc6638b07b5326b6d2faa142635c559e7cd5 Mon Sep 17 00:00:00 2001
+From: Andrew Murray <andrew.murray@arm.com>
+Date: Fri, 17 Jan 2020 13:43:24 +0000
+Subject: KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE
+
+From: Andrew Murray <andrew.murray@arm.com>
+
+commit 4942dc6638b07b5326b6d2faa142635c559e7cd5 upstream.
+
+On VHE systems arch.mdcr_el2 is written to mdcr_el2 at vcpu_load time to
+set options for self-hosted debug and the performance monitors
+extension.
+
+Unfortunately the value of arch.mdcr_el2 is not calculated until
+kvm_arm_setup_debug() in the run loop after the vcpu has been loaded.
+This means that the initial brief iterations of the run loop use a zero
+value of mdcr_el2 - until the vcpu is preempted. This also results in a
+delay between changes to vcpu->guest_debug taking effect.
+
+Fix this by writing to mdcr_el2 in kvm_arm_setup_debug() on VHE systems
+when a change to arch.mdcr_el2 has been detected.
+
+Fixes: d5a21bcc2995 ("KVM: arm64: Move common VHE/non-VHE trap config in separate functions")
+Cc: <stable@vger.kernel.org> # 4.17.x-
+Suggested-by: James Morse <james.morse@arm.com>
+Acked-by: Will Deacon <will@kernel.org>
+Reviewed-by: Marc Zyngier <maz@kernel.org>
+Signed-off-by: Andrew Murray <andrew.murray@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kvm/debug.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/arch/arm64/kvm/debug.c
++++ b/arch/arm64/kvm/debug.c
+@@ -112,7 +112,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_
+ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
+ {
+       bool trap_debug = !(vcpu->arch.flags & KVM_ARM64_DEBUG_DIRTY);
+-      unsigned long mdscr;
++      unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2;
+       trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug);
+@@ -208,6 +208,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu
+       if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE))
+               vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY;
++      /* Write mdcr_el2 changes since vcpu_load on VHE systems */
++      if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2)
++              write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
++
+       trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2);
+       trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1));
+ }
index c79ae06b1d1f6c3a981c8f9eec5e0bffe321667a..e353ff8c28cd324fc1ce283b8117e500c29a8a58 100644 (file)
@@ -52,3 +52,4 @@ crypto-af_alg-use-bh_lock_sock-in-sk_destruct.patch
 random-try-to-actively-add-entropy-rather-than-passively-wait-for-it.patch
 block-cleanup-__blkdev_issue_discard.patch
 block-fix-32-bit-overflow-in-__blkdev_issue_discard.patch
+kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch