aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2016-04-04 09:46:51 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2016-04-06 07:47:52 -0400
commit06a71a24bae57a07afee9cda6b00495347d8a448 (patch)
tree46a9cdb33645181f15fe915af1d76eb90c221020
parent6141570c36f0c937d5deff20d9cf08cbd8d8ed48 (diff)
arm64: KVM: unregister notifiers in hyp mode teardown path
Commit 1e947bad0b63 ("arm64: KVM: Skip HYP setup when already running in HYP") re-organized the hyp init code and ended up leaving the CPU hotplug and PM notifier even if hyp mode initialization fails. Since KVM is not yet supported with ACPI, the above mentioned commit breaks CPU hotplug in ACPI boot. This patch fixes teardown_hyp_mode to properly unregister both CPU hotplug and PM notifiers in the teardown path. Fixes: 1e947bad0b63 ("arm64: KVM: Skip HYP setup when already running in HYP") Cc: Christoffer Dall <christoffer.dall@linaro.org> Cc: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r--arch/arm/kvm/arm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index b5384311dec4..dded1b763c16 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -1112,10 +1112,17 @@ static void __init hyp_cpu_pm_init(void)
1112{ 1112{
1113 cpu_pm_register_notifier(&hyp_init_cpu_pm_nb); 1113 cpu_pm_register_notifier(&hyp_init_cpu_pm_nb);
1114} 1114}
1115static void __init hyp_cpu_pm_exit(void)
1116{
1117 cpu_pm_unregister_notifier(&hyp_init_cpu_pm_nb);
1118}
1115#else 1119#else
1116static inline void hyp_cpu_pm_init(void) 1120static inline void hyp_cpu_pm_init(void)
1117{ 1121{
1118} 1122}
1123static inline void hyp_cpu_pm_exit(void)
1124{
1125}
1119#endif 1126#endif
1120 1127
1121static void teardown_common_resources(void) 1128static void teardown_common_resources(void)
@@ -1141,9 +1148,7 @@ static int init_subsystems(void)
1141 /* 1148 /*
1142 * Register CPU Hotplug notifier 1149 * Register CPU Hotplug notifier
1143 */ 1150 */
1144 cpu_notifier_register_begin(); 1151 err = register_cpu_notifier(&hyp_init_cpu_nb);
1145 err = __register_cpu_notifier(&hyp_init_cpu_nb);
1146 cpu_notifier_register_done();
1147 if (err) { 1152 if (err) {
1148 kvm_err("Cannot register KVM init CPU notifier (%d)\n", err); 1153 kvm_err("Cannot register KVM init CPU notifier (%d)\n", err);
1149 return err; 1154 return err;
@@ -1193,6 +1198,8 @@ static void teardown_hyp_mode(void)
1193 free_hyp_pgds(); 1198 free_hyp_pgds();
1194 for_each_possible_cpu(cpu) 1199 for_each_possible_cpu(cpu)
1195 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu)); 1200 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
1201 unregister_cpu_notifier(&hyp_init_cpu_nb);
1202 hyp_cpu_pm_exit();
1196} 1203}
1197 1204
1198static int init_vhe_mode(void) 1205static int init_vhe_mode(void)