All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms
@ 2013-06-04  2:34 Barry Song
  2013-06-04  2:34 ` [PATCH 1/2] ARM:prima2: move sirfsoc_of_rstc_init to .init_machine Barry Song
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Barry Song @ 2013-06-04  2:34 UTC (permalink / raw)
  To: linux-arm-kernel

These two patches fix the kernel panic for multiple-platform kernel to run on non-SiRF
platforms.

It depends on patches I sent in the pull-request mail
[GIT PULL] SiRF fixes for the v3.10 series
at:
http://www.spinics.net/lists/arm-kernel/msg247521.html

And thanks for the original patchset from Srinivas Kandagatla <srinivas.kandagatla@st.com>

Barry Song (2):
  ARM:prima2: move sirfsoc_of_rstc_init to .init_machine
  ARM:prima2:drop postcore_initcalls in pm module

 arch/arm/mach-prima2/common.c | 10 ++++++++++
 arch/arm/mach-prima2/common.h |  1 +
 arch/arm/mach-prima2/pm.c     | 35 +++++++++++++++++++----------------
 arch/arm/mach-prima2/rstc.c   |  5 +----
 4 files changed, 31 insertions(+), 20 deletions(-)

-- 
1.8.2.3



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ARM:prima2: move sirfsoc_of_rstc_init to .init_machine
  2013-06-04  2:34 [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Barry Song
@ 2013-06-04  2:34 ` Barry Song
  2013-06-04  2:34 ` [PATCH 2/2] ARM:prima2:drop postcore_initcalls in pm module Barry Song
  2013-06-10  0:13 ` [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Olof Johansson
  2 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2013-06-04  2:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch moves sirfsoc_of_rstc_init from early_initcall to .init_machine
in machine descriptor, doing this way a multi_v7 kernel will not crash
on non-prima2 SOCs.

Without this patch the multi_v7 kernel panics if we boot it on any non
prima2 parts with below log:

Kernel panic - not syncing: unable to find compatible rstc node in dtb

CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc3-00535-gc3cc4ac #62
[<c001387c>] (unwind_backtrace+0x0/0xf8) from [<c00111cc>]
(show_stack+0x10/0x14)
[<c00111cc>] (show_stack+0x10/0x14) from [<c03417f4>] (panic+0x90/0x1e4)
[<c03417f4>] (panic+0x90/0x1e4) from [<c04256d0>]
(sirfsoc_of_rstc_init+0x24/0x5c)
[<c04256d0>] (sirfsoc_of_rstc_init+0x24/0x5c) from [<c041f854>]
(do_one_initcall+0x90/0x150)
[<c041f854>] (do_one_initcall+0x90/0x150) from [<c041f978>]
(kernel_init_freeable+0x64/0x1c4)
[<c041f978>] (kernel_init_freeable+0x64/0x1c4) from [<c033d344>]
(kernel_init+0x8/0xe4)
[<c033d344>] (kernel_init+0x8/0xe4) from [<c000ded8>]
(ret_from_fork+0x14/0x3c)

Initially detected when booting Stih415 SOC with multi_v7_defconfig.

Cc: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 arch/arm/mach-prima2/common.c | 10 ++++++++++
 arch/arm/mach-prima2/common.h |  1 +
 arch/arm/mach-prima2/rstc.c   |  5 +----
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index e588c21..383aa41 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -17,6 +17,13 @@
 #include <linux/of_platform.h>
 #include "common.h"
 
+void __init sirfsoc_init_mach(void)
+{
+	sirfsoc_of_rstc_init();
+	of_platform_populate(NULL, of_default_bus_match_table,
+		NULL, NULL);
+}
+
 void __init sirfsoc_init_late(void)
 {
 	sirfsoc_pm_init();
@@ -47,6 +54,7 @@ DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
 	.map_io         = sirfsoc_map_io,
 	.init_irq	= irqchip_init,
 	.init_time	= sirfsoc_init_time,
+	.init_machine	= sirfsoc_init_mach,
 	.init_late	= sirfsoc_init_late,
 	.dt_compat      = atlas6_dt_match,
 	.restart	= sirfsoc_restart,
@@ -65,6 +73,7 @@ DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
 	.map_io         = sirfsoc_map_io,
 	.init_irq	= irqchip_init,
 	.init_time	= sirfsoc_init_time,
+	.init_machine   = sirfsoc_init_mach,
 	.dma_zone_size	= SZ_256M,
 	.init_late	= sirfsoc_init_late,
 	.dt_compat      = prima2_dt_match,
@@ -84,6 +93,7 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
 	.map_io         = sirfsoc_map_io,
 	.init_irq	= irqchip_init,
 	.init_time	= sirfsoc_init_time,
+	.init_machine   = sirfsoc_init_mach,
 	.init_late	= sirfsoc_init_late,
 	.dt_compat      = marco_dt_match,
 	.restart	= sirfsoc_restart,
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index 81135cd..095a16f 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -20,6 +20,7 @@ extern struct smp_operations   sirfsoc_smp_ops;
 extern void sirfsoc_secondary_startup(void);
 extern void sirfsoc_cpu_die(unsigned int cpu);
 
+extern void __init sirfsoc_of_rstc_init(void);
 extern void __init sirfsoc_of_irq_init(void);
 extern void __init sirfsoc_of_clk_init(void);
 extern void sirfsoc_restart(char, const char *);
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index 435019c..60fae92 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -23,7 +23,7 @@ static struct of_device_id rstc_ids[]  = {
 	{},
 };
 
-static int __init sirfsoc_of_rstc_init(void)
+void __init sirfsoc_of_rstc_init(void)
 {
 	struct device_node *np;
 
@@ -36,10 +36,7 @@ static int __init sirfsoc_of_rstc_init(void)
 		panic("unable to map rstc cpu registers\n");
 
 	of_node_put(np);
-
-	return 0;
 }
-early_initcall(sirfsoc_of_rstc_init);
 
 int sirfsoc_reset_device(struct device *dev)
 {
-- 
1.8.2.3



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM:prima2:drop postcore_initcalls in pm module
  2013-06-04  2:34 [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Barry Song
  2013-06-04  2:34 ` [PATCH 1/2] ARM:prima2: move sirfsoc_of_rstc_init to .init_machine Barry Song
@ 2013-06-04  2:34 ` Barry Song
  2013-06-10  0:13 ` [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Olof Johansson
  2 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2013-06-04  2:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch drops all postcore_initcalls in pm module and move these
functions to sirfsoc_pm_init which is init_late of machine desc.
Without this patch a multi_v7 kernel panics if we boot it on any
non prima2 parts with below log:

Kernel panic - not syncing: unable to find compatible pwrc node in dtb

CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc3-00536-ge2f1bc1 #63
[<c001387c>] (unwind_backtrace+0x0/0xf8) from [<c00111cc>]
(show_stack+0x10/0x14)
[<c00111cc>] (show_stack+0x10/0x14) from [<c0341834>] (panic+0x90/0x1e4)
[<c0341834>] (panic+0x90/0x1e4) from [<c0425784>]
(sirfsoc_of_pwrc_init+0x24/0x58)
[<c0425784>] (sirfsoc_of_pwrc_init+0x24/0x58) from [<c041f854>]
(do_one_initcall+0x90/0x150)
[<c041f854>] (do_one_initcall+0x90/0x150) from [<c041fa10>]
(kernel_init_freeable+0xfc/0x1c4)
[<c041fa10>] (kernel_init_freeable+0xfc/0x1c4) from [<c033d384>]
(kernel_init+0x8/0xe4)
[<c033d384>] (kernel_init+0x8/0xe4) from [<c000ded8>]
(ret_from_fork+0x14/0x3c)
CPU1: stopping
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.10.0-rc3-00536-ge2f1bc1 #63
[<c001387c>] (unwind_backtrace+0x0/0xf8) from [<c00111cc>]
(show_stack+0x10/0x14)
[<c00111cc>] (show_stack+0x10/0x14) from [<c0012030>]
(handle_IPI+0xf8/0x12c)
[<c0012030>] (handle_IPI+0xf8/0x12c) from [<c0008600>]
(gic_handle_irq+0x54/0x5c)
[<c0008600>] (gic_handle_irq+0x54/0x5c) from [<c000da80>]
(__irq_svc+0x40/0x50)
Exception stack(0xef079fa0 to 0xef079fe8)
9fa0: c0ddd6d8 00000000 000002d2 00000000 ef078000 c04888f5 00000001
c04888f5
9fc0: c045c490 c045c42c c0348f38 00000000 01000000 ef079fe8 c000f018
c000f01c
9fe0: 60000113 ffffffff
[<c000da80>] (__irq_svc+0x40/0x50) from [<c000f01c>]
(arch_cpu_idle+0x28/0x30)
[<c000f01c>] (arch_cpu_idle+0x28/0x30) from [<c0051080>]
(cpu_startup_entry+0x60/0x130)
[<c0051080>] (cpu_startup_entry+0x60/0x130) from [<6033dfc4>]
(0x6033dfc4)

Initially detected when booting Stih415 SOC with multi_v7_defconfig.

Cc: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 arch/arm/mach-prima2/pm.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
index f7e347e..d57a97f 100644
--- a/arch/arm/mach-prima2/pm.c
+++ b/arch/arm/mach-prima2/pm.c
@@ -80,23 +80,12 @@ static int sirfsoc_pm_enter(suspend_state_t state)
 	return 0;
 }
 
-static const struct platform_suspend_ops sirfsoc_pm_ops = {
-	.enter = sirfsoc_pm_enter,
-	.valid = suspend_valid_only_mem,
-};
-
-int __init sirfsoc_pm_init(void)
-{
-	suspend_set_ops(&sirfsoc_pm_ops);
-	return 0;
-}
-
 static const struct of_device_id pwrc_ids[] = {
 	{ .compatible = "sirf,prima2-pwrc" },
 	{}
 };
 
-static int __init sirfsoc_of_pwrc_init(void)
+static void __init sirfsoc_of_pwrc_init(void)
 {
 	struct device_node *np;
 
@@ -113,10 +102,7 @@ static int __init sirfsoc_of_pwrc_init(void)
 		panic("unable to find base address of pwrc node in dtb\n");
 
 	of_node_put(np);
-
-	return 0;
 }
-postcore_initcall(sirfsoc_of_pwrc_init);
 
 static const struct of_device_id memc_ids[] = {
 	{ .compatible = "sirf,prima2-memc" },
@@ -147,4 +133,22 @@ static int __init sirfsoc_memc_init(void)
 {
 	return platform_driver_register(&sirfsoc_memc_driver);
 }
-postcore_initcall(sirfsoc_memc_init);
+
+static const struct platform_suspend_ops sirfsoc_pm_ops = {
+	.enter = sirfsoc_pm_enter,
+	.valid = suspend_valid_only_mem,
+};
+
+int __init sirfsoc_pm_init(void)
+{
+	int ret;
+
+	sirfsoc_of_pwrc_init();
+
+	ret = sirfsoc_memc_init();
+	if (ret)
+		return ret;
+
+	suspend_set_ops(&sirfsoc_pm_ops);
+	return 0;
+}
-- 
1.8.2.3



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms
  2013-06-04  2:34 [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Barry Song
  2013-06-04  2:34 ` [PATCH 1/2] ARM:prima2: move sirfsoc_of_rstc_init to .init_machine Barry Song
  2013-06-04  2:34 ` [PATCH 2/2] ARM:prima2:drop postcore_initcalls in pm module Barry Song
@ 2013-06-10  0:13 ` Olof Johansson
  2013-06-10  3:40   ` Barry Song
  2 siblings, 1 reply; 5+ messages in thread
From: Olof Johansson @ 2013-06-10  0:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 04, 2013 at 10:34:13AM +0800, Barry Song wrote:
> These two patches fix the kernel panic for multiple-platform kernel to run on non-SiRF
> platforms.
> 
> It depends on patches I sent in the pull-request mail
> [GIT PULL] SiRF fixes for the v3.10 series
> at:
> http://www.spinics.net/lists/arm-kernel/msg247521.html
> 
> And thanks for the original patchset from Srinivas Kandagatla <srinivas.kandagatla@st.com>

Hi,

A better and more narrow fix for 3.10 would be to gracefully abort the
initcalls if the device nodes are not found, which is what I had as original
feedback on these patches in the first place. Print an error but continue
booting.


-Olof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms
  2013-06-10  0:13 ` [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Olof Johansson
@ 2013-06-10  3:40   ` Barry Song
  0 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2013-06-10  3:40 UTC (permalink / raw)
  To: linux-arm-kernel

2013/6/10 Olof Johansson <olof@lixom.net>:
> On Tue, Jun 04, 2013 at 10:34:13AM +0800, Barry Song wrote:
>> These two patches fix the kernel panic for multiple-platform kernel to run on non-SiRF
>> platforms.
>>
>> It depends on patches I sent in the pull-request mail
>> [GIT PULL] SiRF fixes for the v3.10 series
>> at:
>> http://www.spinics.net/lists/arm-kernel/msg247521.html
>>
>> And thanks for the original patchset from Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> Hi,
>
> A better and more narrow fix for 3.10 would be to gracefully abort the
> initcalls if the device nodes are not found, which is what I had as original
> feedback on these patches in the first place. Print an error but continue
> booting.
ok, for 3.10, let's do a quick fix, then i will ack haojian zhuang's:
[PATCH v2] ARM: prima2: fix incorrect panic usage

i had some discussion with Srinivas, and agreed with Srinivas about
moving these functions to callback of prima2 mach_desc. that will
avoid some redundant function calls for non-csr platforms. i'll make
it as cleanup in 3.11 then.

>
>
> -Olof
>

-barry

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-10  3:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04  2:34 [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Barry Song
2013-06-04  2:34 ` [PATCH 1/2] ARM:prima2: move sirfsoc_of_rstc_init to .init_machine Barry Song
2013-06-04  2:34 ` [PATCH 2/2] ARM:prima2:drop postcore_initcalls in pm module Barry Song
2013-06-10  0:13 ` [PATCH 0/2] ARM: multiple-platforms: fix the kernel panic on non-SiRF platforms Olof Johansson
2013-06-10  3:40   ` Barry Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.