ARM: kvm: prevent freeing boot_hyp_pgd when CPU_PM is selected
PATCH 1/1 ARM: kvm: prevent freeing boot_hyp_pgd when CPU_PM is selected
The boot_hyp_pgd is required to install HYP context through cpu_init_hyp_mode, on cold-boot for primary and secondary cpus, but also on the warm-boot path for secondaries (ie when a CPU is hotplugged in). On platforms with power management capabilities (eg suspend to RAM or idle-states that allow the core to enter deep idle where core is shutdown on power down entry), the boot_hyp_pgd is required to restore HYP context too upon CPU_PM notification, so the boot_hyp_pgd must not be freed to guarantee a proper HYP context restore, which in turn ensures proper core resume from low-power.
This patch adds an additional guard to free_boot_hyp_pgd() to remove its call from the kernel if CPU_PM is enabled, so that on platforms where HOTPLUG_CPU is disabled (eg UP), CPU_PM operations (suspend and CPUidle) are still guaranteed to function.
--- arch/arm/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kvm/arm.c +1 -1
@@ -1068,7 +1068,7 @@ static int init_hyp_mode(void)if (err) goto out_free_mappings; -#ifndef CONFIG_HOTPLUG_CPU +#if !defined(CONFIG_HOTPLUG_CPU ) && !defined(CONFIG_CPU_PM )free_boot_hyp_pgd ();#endif
Signature · 1 line
2.2.1
PATCH 1/1 ARM: kvm: prevent freeing boot_hyp_pgd when CPU_PM is selected
Quoted 39 lines · Lorenzo Pieralisi
The
boot_hyp_pgdis required to install HYP context throughcpu_init_hyp_mode, on cold-boot for primary and secondary cpus, but also on the warm-boot path for secondaries (ie when a CPU is hotplugged in). On platforms with power management capabilities (eg suspend to RAM or idle-states that allow the core to enter deep idle where core is shutdown on power down entry), theboot_hyp_pgdis required to restore HYP context too uponCPU_PMnotification, so theboot_hyp_pgdmust not be freed to guarantee a proper HYP context restore, which in turn ensures proper core resume from low-power.This patch adds an additional guard to
free_boot_hyp_pgd()to remove its call from the kernel ifCPU_PMis enabled, so that on platforms whereHOTPLUG_CPUis disabled (eg UP),CPU_PMoperations (suspend and CPUidle) are still guaranteed to function.Signed-off-by Lorenzo Pieralisi <[email protected]>Cc Christoffer Dall <[email protected]>Cc Marc Zyngier <[email protected]>Cc Sudeep Holla <[email protected]>--- arch/arm/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/kvm/arm.c +1
-1@@ -1068,7 +1068,7 @@ static int init_hyp_mode(void)if (err) goto out_free_mappings; -#ifndef CONFIG_HOTPLUG_CPU +#if !defined(CONFIG_HOTPLUG_CPU ) && !defined(CONFIG_CPU_PM )free_boot_hyp_pgd ();#endif Signature · 1 line
2.2.1
Without knowing a lot about power management in Linux and exactly what these defines mean, I'm fine with this: