From 3392af0694cdb66677a2bb141084b8799e9cae84 Mon Sep 17 00:00:00 2001
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Thu, 7 Sep 2017 11:42:30 -0700
Subject: [PATCH] smp: Wake up all idle CPUs when suspending to idle

Regardless of CPU isolation or not, we need to wake up all the
CPUs during suspend to idle so that each CPU can disable their
local tick device, etc. If we don't wake every CPU up, then we
don't fully suspend the system and things like sched_clock and
timekeeping are never stopped properly.

Change-Id: Ic9141602acc5e6cddefca0727f9be075dad3e498
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 kernel/smp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 9e3ae23b85de..6e5cb7e541ce 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -19,6 +19,7 @@
 #include <linux/sched.h>
 #include <linux/sched/idle.h>
 #include <linux/hypervisor.h>
+#include <linux/suspend.h>
 
 #include "smpboot.h"
 
@@ -769,8 +770,8 @@ void wake_up_all_idle_cpus(void)
 	for_each_online_cpu(cpu) {
 		if (cpu == smp_processor_id())
 			continue;
-
-		if (!cpu_isolated(cpu))
+		if (s2idle_state == S2IDLE_STATE_ENTER ||
+		    !cpu_isolated(cpu))
 			wake_up_if_idle(cpu);
 	}
 	preempt_enable();