Skip to contentSkip to conversation

Patch "KVM: arm: Restore banked registers and physical timer access on hyp_panic()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Apr 9, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

KVM: arm: Restore banked registers and physical timer access on hyp_panic()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
kvm-arm-restore-banked-registers-and-physical-timer-access-on-hyp_panic.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Apr 9 17:09:24 CEST 2018

From: James Morse <[email protected]>
Date: Tue, 25 Apr 2017 18:02:44 +0100
Subject: KVM: arm: Restore banked registers and physical timer access on hyp_panic()

From: James Morse <[email protected]>

[ Upstream commit d2e19368848ce6065daa785efca26faed54732b6 ]

When KVM panics, it hurridly restores the host context and parachutes into the host's panic() code. This looks like it was copied from arm64, the 32bit KVM panic code needs to restore the host's banked registers too.

At some point panic() touches the physical timer/counter, this will trap back to HYP. If we're lucky, we panic again.

Add a __timer_save_state() call to KVMs hyp_panic() path, this saves the guest registers and disables the traps for the host.

---
 arch/arm/kvm/hyp/switch.c |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/kvm/hyp/switch.c +2 -0
@@ -237,8 +237,10 @@ void __hyp_text __noreturn __hyp_panic(i
 
 		vcpu = (struct kvm_vcpu *)read_sysreg(HTPIDR);
 		host_ctxt = kern_hyp_va(vcpu->arch.host_cpu_context);
+		__timer_save_state(vcpu);
 		__deactivate_traps(vcpu);
 		__deactivate_vm(vcpu);
+		__banked_restore_state(host_ctxt);
 		__sysreg_restore_state(host_ctxt);
 	}
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/kvm-arm-restore-banked-registers-and-physical-timer-access-on-hyp_panic.patch queue-4.9/kvm-arm64-restore-host-physical-timer-access-on-hyp_panic.patch