]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
arm/arm64: KVM: detect CPU reset on CPU_PM_EXIT
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 26 Feb 2014 18:47:36 +0000 (18:47 +0000)
committerJiri Slaby <jslaby@suse.cz>
Thu, 30 Apr 2015 09:15:01 +0000 (11:15 +0200)
commit449b62f6603d57cb80519176406a1adc2936a144
tree6b903f306b8c0a2b90f04537a62ad5d4deeac91e
parented663694cef3b169679335ab49b84e695729f027
arm/arm64: KVM: detect CPU reset on CPU_PM_EXIT

commit b20c9f29c5c25921c6ad18b50d4b61e6d181c3cc upstream.

Commit 1fcf7ce0c602 (arm: kvm: implement CPU PM notifier) added
support for CPU power-management, using a cpu_notifier to re-init
KVM on a CPU that entered CPU idle.

The code assumed that a CPU entering idle would actually be powered
off, loosing its state entierely, and would then need to be
reinitialized. It turns out that this is not always the case, and
some HW performs CPU PM without actually killing the core. In this
case, we try to reinitialize KVM while it is still live. It ends up
badly, as reported by Andre Przywara (using a Calxeda Midway):

[    3.663897] Kernel panic - not syncing: unexpected prefetch abort in Hyp mode at: 0x685760
[    3.663897] unexpected data abort in Hyp mode at: 0xc067d150
[    3.663897] unexpected HVC/SVC trap in Hyp mode at: 0xc0901dd0

The trick here is to detect if we've been through a full re-init or
not by looking at HVBAR (VBAR_EL2 on arm64). This involves
implementing the backend for __hyp_get_vectors in the main KVM HYP
code (rather small), and checking the return value against the
default one when the CPU notifier is called on CPU_PM_EXIT.

Reported-by: Andre Przywara <osp@andrep.de>
Tested-by: Andre Przywara <osp@andrep.de>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Rob Herring <rob.herring@linaro.org>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/arm/kvm/arm.c
arch/arm/kvm/interrupts.S
arch/arm64/kvm/hyp.S