Skip to content

Commit 06a71a2

Browse files
sudeep-hollachazy
authored andcommitted
arm64: KVM: unregister notifiers in hyp mode teardown path
Commit 1e947ba ("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: 1e947ba ("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>
1 parent 6141570 commit 06a71a2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

arch/arm/kvm/arm.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,10 +1112,17 @@ static void __init hyp_cpu_pm_init(void)
11121112
{
11131113
cpu_pm_register_notifier(&hyp_init_cpu_pm_nb);
11141114
}
1115+
static void __init hyp_cpu_pm_exit(void)
1116+
{
1117+
cpu_pm_unregister_notifier(&hyp_init_cpu_pm_nb);
1118+
}
11151119
#else
11161120
static inline void hyp_cpu_pm_init(void)
11171121
{
11181122
}
1123+
static inline void hyp_cpu_pm_exit(void)
1124+
{
1125+
}
11191126
#endif
11201127

11211128
static void teardown_common_resources(void)
@@ -1141,9 +1148,7 @@ static int init_subsystems(void)
11411148
/*
11421149
* Register CPU Hotplug notifier
11431150
*/
1144-
cpu_notifier_register_begin();
1145-
err = __register_cpu_notifier(&hyp_init_cpu_nb);
1146-
cpu_notifier_register_done();
1151+
err = register_cpu_notifier(&hyp_init_cpu_nb);
11471152
if (err) {
11481153
kvm_err("Cannot register KVM init CPU notifier (%d)\n", err);
11491154
return err;
@@ -1193,6 +1198,8 @@ static void teardown_hyp_mode(void)
11931198
free_hyp_pgds();
11941199
for_each_possible_cpu(cpu)
11951200
free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
1201+
unregister_cpu_notifier(&hyp_init_cpu_nb);
1202+
hyp_cpu_pm_exit();
11961203
}
11971204

11981205
static int init_vhe_mode(void)

0 commit comments

Comments
 (0)