msm: idle-v7.S: Add NOPs to avoid ungraceful exit of GDFS on 8x25
When the core enter into a low power mode (eg: PC/StandalonePC)
it executes the 'wfi' instrcution, which triggers the SPM state
machine and SPM start put the core into low power mode
(PC/StandalonePC). When this is happening there could be a race
between SPM & CPU core (this is because difference of execution
of clock frequencies for SPM and core, as SPM operate at TCXO and
core operate at the order of GHZ), where SPM trying to put the core
into low power mode & same time core sees the 'wfi' instruction as
failure due to an interrupt and fall through after 'wfi' instrcution.
When the above scenario happens system becomes unstable and seeing
kernel panics. To avoid the race between SPM & core, add the 'nop's
in the 'wfi' failure path. These nop's make sure that core doen't
execute memory related instructions (ldr,str etc) until SPM complete
its state transition and stays in a known state.
N nops = 4 clock cycles * (Tcpu/Ttcxo) = 4 * (1.2gig/19.2mhz) = 250
Ttcxo = 1/19.2mhz (52ns)
Tcpu = time period of CPU clock
CRs-Fixed: 359102
Change-Id: I341bdabf011195db5ad08499f229c330ddb900bc
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
diff --git a/arch/arm/mach-msm/idle-v7.S b/arch/arm/mach-msm/idle-v7.S
index 0028286..b73ddc8 100644
--- a/arch/arm/mach-msm/idle-v7.S
+++ b/arch/arm/mach-msm/idle-v7.S
@@ -44,6 +44,15 @@
skip\@:
.endm
+/* Add NOPs for 8x25 target */
+.macro DELAY_8x25, rept
+#ifdef CONFIG_ARCH_MSM8625
+ .rept \rept
+ nop
+ .endr
+#endif
+.endm
+
ENTRY(msm_arch_idle)
wfi
#ifdef CONFIG_ARCH_MSM8X60
@@ -130,6 +139,7 @@
SET_SMP_COHERENCY OFF
wfi
+ DELAY_8x25 300
mcr p15, 0, r4, c1, c0, 0 /* restore d/i cache */
isb