msm: hotplug: Wait for power collapse completion in platform_cpu_kill()
Call msm_pm_wait_cpu_shutdown() to wait for the CPU to be fully
power-collapsed before returning from platform_cpu_kill(). This is
necessary to prevent CPU_DEAD and CPU_DEAD_FROZEN notifiers from
executing until the CPU is fully collapsed. Otherwise, some drivers
may turn off hardware resources before it is safe to do so. For
example, acpuclock-8960's hotplug handler turns off CPU clocks as
part of CPU_DEAD. If this happens before the collapse is complete,
it may result in a hang.
The call to msm_pm_wait_cpu_shutdown() will return immediately for
hotplugs that do not involve power-collapse and therefore has no
impact for those scenarios.
Change-Id: I88bf28f01fb02ad7dfcb8234c745570e5085585a
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index 2e615eb..26adec6 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2002 ARM Ltd.
* All Rights Reserved
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -67,8 +68,13 @@
{
struct completion *killed =
&per_cpu(msm_hotplug_devices, cpu).cpu_killed;
+ int ret;
- return wait_for_completion_timeout(killed, HZ * 5);
+ ret = wait_for_completion_timeout(killed, HZ * 5);
+ if (ret)
+ return ret;
+
+ return msm_pm_wait_cpu_shutdown(cpu);
}
/*