diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2013-08-05 10:04:46 -0400 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2013-12-16 12:17:33 -0500 |
commit | 1fcf7ce0c60213994269fb59569ec161eb6e08d6 (patch) | |
tree | 20727b0aab3e343de361adbc7030d99a3319cb1e /arch/arm/kvm/arm.c | |
parent | fb1ab1ab3889fc23ed90e452502662311ebdf229 (diff) |
arm: kvm: implement CPU PM notifier
Upon CPU shutdown and consequent warm-reboot, the hypervisor CPU state
must be re-initialized. This patch implements a CPU PM notifier that
upon warm-boot calls a KVM hook to reinitialize properly the hypervisor
state so that the CPU can be safely resumed.
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'arch/arm/kvm/arm.c')
-rw-r--r-- | arch/arm/kvm/arm.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 2a700e00528d..b18165ca1d38 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/cpu.h> | 19 | #include <linux/cpu.h> |
20 | #include <linux/cpu_pm.h> | ||
20 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
21 | #include <linux/err.h> | 22 | #include <linux/err.h> |
22 | #include <linux/kvm_host.h> | 23 | #include <linux/kvm_host.h> |
@@ -853,6 +854,33 @@ static struct notifier_block hyp_init_cpu_nb = { | |||
853 | .notifier_call = hyp_init_cpu_notify, | 854 | .notifier_call = hyp_init_cpu_notify, |
854 | }; | 855 | }; |
855 | 856 | ||
857 | #ifdef CONFIG_CPU_PM | ||
858 | static int hyp_init_cpu_pm_notifier(struct notifier_block *self, | ||
859 | unsigned long cmd, | ||
860 | void *v) | ||
861 | { | ||
862 | if (cmd == CPU_PM_EXIT) { | ||
863 | cpu_init_hyp_mode(NULL); | ||
864 | return NOTIFY_OK; | ||
865 | } | ||
866 | |||
867 | return NOTIFY_DONE; | ||
868 | } | ||
869 | |||
870 | static struct notifier_block hyp_init_cpu_pm_nb = { | ||
871 | .notifier_call = hyp_init_cpu_pm_notifier, | ||
872 | }; | ||
873 | |||
874 | static void __init hyp_cpu_pm_init(void) | ||
875 | { | ||
876 | cpu_pm_register_notifier(&hyp_init_cpu_pm_nb); | ||
877 | } | ||
878 | #else | ||
879 | static inline void hyp_cpu_pm_init(void) | ||
880 | { | ||
881 | } | ||
882 | #endif | ||
883 | |||
856 | /** | 884 | /** |
857 | * Inits Hyp-mode on all online CPUs | 885 | * Inits Hyp-mode on all online CPUs |
858 | */ | 886 | */ |
@@ -1013,6 +1041,8 @@ int kvm_arch_init(void *opaque) | |||
1013 | goto out_err; | 1041 | goto out_err; |
1014 | } | 1042 | } |
1015 | 1043 | ||
1044 | hyp_cpu_pm_init(); | ||
1045 | |||
1016 | kvm_coproc_table_init(); | 1046 | kvm_coproc_table_init(); |
1017 | return 0; | 1047 | return 0; |
1018 | out_err: | 1048 | out_err: |