linux/arch/arm64/kvm
Marc Zyngier b20c9f29c5 arm/arm64: KVM: detect CPU reset on CPU_PM_EXIT
Commit 1fcf7ce0c6 (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>
2014-02-27 19:27:10 +01:00
..
Kconfig arm64: KVM: Add Kconfig option for max VCPUs per-Guest 2013-12-28 10:28:50 +00:00
Makefile arm64: KVM: 32bit conditional execution emulation 2013-06-12 16:42:15 +01:00
emulate.c arm64: KVM: 32bit conditional execution emulation 2013-06-12 16:42:15 +01:00
guest.c arm64: KVM: Support X-Gene guest VCPU on APM X-Gene host 2013-12-28 10:28:50 +00:00
handle_exit.c First round of KVM updates for 3.14; PPC parts will come next week. 2014-01-22 21:40:43 -08:00
hyp-init.S arm64: KVM: initialize HYP mode following the kernel endianness 2013-11-06 10:10:01 +00:00
hyp.S arm/arm64: KVM: detect CPU reset on CPU_PM_EXIT 2014-02-27 19:27:10 +01:00
inject_fault.c arm64: KVM: 32bit guest fault injection 2013-06-12 16:42:18 +01:00
regmap.c arm64: KVM: 32bit GP register access 2013-06-12 16:42:14 +01:00
reset.c arm64: KVM: enable initialization of a 32bit vcpu 2013-06-12 16:42:18 +01:00
sys_regs.c arm64: KVM: perform save/restore of PAR_EL1 2013-08-09 13:19:28 +01:00
sys_regs.h arm64: KVM: system register handling 2013-06-07 14:03:36 +01:00
sys_regs_generic_v8.c arm64: KVM: Support X-Gene guest VCPU on APM X-Gene host 2013-12-28 10:28:50 +00:00