Skip to contentSkip to conversation

ARM: imx6q: remove imx_src_prepare_restart() call

PATCH New Shawn Guo 3 participants 4 messages Aug 17, 2012 – Oct 15, 2012

Subsystems (3)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/1 ARM: imx6q: remove imx_src_prepare_restart() call

Currently, imx_src_prepare_restart which is called by imx6q_restart assumes that cpu0 must be the running cpu, so it disables all secondary cpus. However this is not the case, the restart routine could possibly running on cpu1 or any other secondary cores. In that case, disabling the cpu that runs restart routine will hang up system.

Also it turns out that everything that is done by imx_src_prepare_restart is not really necessary, because the watchdog reset will have those registers reset properly. So let's remove the imx_src_prepare_restart call completely.

---
 arch/arm/mach-imx/mach-imx6q.c          |    2 --
 arch/arm/mach-imx/src.c                 |   13 -------------
 arch/arm/plat-mxc/include/mach/common.h |    1 -
 3 files changed, 0 insertions(+), 16 deletions(-)
arch/arm/mach-imx/mach-imx6q.c +0 -2
index 5ec0608..d9b0614 100644
@@ -48,8 +48,6 @@ void imx6q_restart(char mode, const char *cmd)
 	if (!wdog_base)
 		goto soft;
 
-	imx_src_prepare_restart();
-
 	/* enable wdog */
 	writew_relaxed(1 << 2, wdog_base);
 	/* write twice to ensure the request will not get ignored */
arch/arm/mach-imx/src.c +0 -13
index e15f155..900b3c1 100644
@@ -43,19 +43,6 @@ void imx_set_cpu_jump(int cpu, void *jump_addr)
 		       src_base + SRC_GPR1 + cpu * 8);
 }
 
-void imx_src_prepare_restart(void)
-{
-	u32 val;
-
-	/* clear enable bits of secondary cores */
-	val = readl_relaxed(src_base + SRC_SCR);
-	val &= ~(0x7 << BP_SRC_SCR_CORE1_ENABLE);
-	writel_relaxed(val, src_base + SRC_SCR);
-
-	/* clear persistent entry register of primary core */
-	writel_relaxed(0, src_base + SRC_GPR1);
-}
-
 void __init imx_src_init(void)
 {
 	struct device_node *np;
arch/arm/plat-mxc/include/mach/common.h +0 -1
index 7128e97..e94073f 100644
@@ -133,7 +133,6 @@ static inline void imx_smp_prepare(void) {}
 extern void imx_enable_cpu(int cpu, bool enable);
 extern void imx_set_cpu_jump(int cpu, void *jump_addr);
 extern void imx_src_init(void);
-extern void imx_src_prepare_restart(void);
 extern void imx_gpc_init(void);
 extern void imx_gpc_pre_suspend(void);
 extern void imx_gpc_post_resume(void);
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 ARM: imx6q: remove imx_src_prepare_restart() call

Quoted 6 lines · Shawn Guo

Currently, imx_src_prepare_restart which is called by imx6q_restart assumes that cpu0 must be the running cpu, so it disables all secondary cpus. However this is not the case, the restart routine could possibly running on cpu1 or any other secondary cores. In that case, disabling the cpu that runs restart routine will hang up system.

Quoted 7 lines

Also it turns out that everything that is done by imx_src_prepare_restart is not really necessary, because the watchdog reset will have those registers reset properly. So let's remove the imx_src_prepare_restart call completely.

Tested on a i.MX6 SabreLite board together with the patch 'ARM: fix cpu_relax() in case of doing dmb':

Thanks

Dirk

Quoted 55 lines
---
 arch/arm/mach-imx/mach-imx6q.c          |    2 --
 arch/arm/mach-imx/src.c                 |   13 -------------
 arch/arm/plat-mxc/include/mach/common.h |    1 -
 3 files changed, 0 insertions(+), 16 deletions(-)
arch/arm/mach-imx/mach-imx6q.c +0 -2
index 5ec0608..d9b0614 100644
@@ -48,8 +48,6 @@ void imx6q_restart(char mode, const char *cmd)
 	if (!wdog_base)
 		goto soft;
 
-	imx_src_prepare_restart();
-
 	/* enable wdog */
 	writew_relaxed(1 << 2, wdog_base);
 	/* write twice to ensure the request will not get ignored */
arch/arm/mach-imx/src.c +0 -13
index e15f155..900b3c1 100644
@@ -43,19 +43,6 @@ void imx_set_cpu_jump(int cpu, void *jump_addr)
 		       src_base + SRC_GPR1 + cpu * 8);
 }
 
-void imx_src_prepare_restart(void)
-{
-	u32 val;
-
-	/* clear enable bits of secondary cores */
-	val = readl_relaxed(src_base + SRC_SCR);
-	val &= ~(0x7 << BP_SRC_SCR_CORE1_ENABLE);
-	writel_relaxed(val, src_base + SRC_SCR);
-
-	/* clear persistent entry register of primary core */
-	writel_relaxed(0, src_base + SRC_GPR1);
-}
-
 void __init imx_src_init(void)
 {
 	struct device_node *np;
arch/arm/plat-mxc/include/mach/common.h +0 -1
index 7128e97..e94073f 100644
@@ -133,7 +133,6 @@ static inline void imx_smp_prepare(void) {}
 extern void imx_enable_cpu(int cpu, bool enable);
 extern void imx_set_cpu_jump(int cpu, void *jump_addr);
 extern void imx_src_init(void);
-extern void imx_src_prepare_restart(void);
 extern void imx_gpc_init(void);
 extern void imx_gpc_pre_suspend(void);
 extern void imx_gpc_post_resume(void);
#2 lore raw

PATCH 1/1 ARM: imx6q: remove imx_src_prepare_restart() call

In reply to Shawn Guo

Hi Shawn,

Quoted 10 lines · On Fri, 17 Aug 2012 13:11:56 +0800 Shawn Guo <[email protected]> wrote:

Currently, imx_src_prepare_restart which is called by imx6q_restart assumes that cpu0 must be the running cpu, so it disables all secondary cpus. However this is not the case, the restart routine could possibly running on cpu1 or any other secondary cores. In that case, disabling the cpu that runs restart routine will hang up system.

Also it turns out that everything that is done by imx_src_prepare_restart is not really necessary, because the watchdog reset will have those registers reset properly. So let's remove the imx_src_prepare_restart call completely.

What is the fate of this patch?

Thanks,
Anatolij

author
#3 lore raw

PATCH 1/1 ARM: imx6q: remove imx_src_prepare_restart() call

Quoted 11 lines · Anatolij Gustschin

Hi Shawn,

Quoted 6 lines · On Fri, 17 Aug 2012 13:11:56 +0800 Shawn Guo <[email protected]> wrote:

Currently, imx_src_prepare_restart which is called by imx6q_restart assumes that cpu0 must be the running cpu, so it disables all secondary cpus. However this is not the case, the restart routine could possibly running on cpu1 or any other secondary cores. In that case, disabling the cpu that runs restart routine will hang up system.

Quoted 7 lines
Quoted 4 lines

Also it turns out that everything that is done by imx_src_prepare_restart is not really necessary, because the watchdog reset will have those registers reset properly. So let's remove the imx_src_prepare_restart call completely.

What is the fate of this patch?

Discarded.

Further testing suggests that imx_src_prepare_restart call is needed, otherwise secondary cores will fail to come online, though system reboot works with core0.

The issue has been solved at kernel core level by the following patch.

a985941 kernel/sys.c: call disable_nonboot_cpus() in kernel_restart()

Shawn