diff mbox

[v1,2/2] ARM:prima2:move postcore_initcalls to init_machine.

Message ID 1369993517-24735-1-git-send-email-srinivas.kandagatla@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Srinivas KANDAGATLA May 31, 2013, 9:45 a.m. UTC
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>

This patch moves all  postcore_initcalls to very first calls in
init_machine. This should achieve the same sequencing as done via
postcore_initcalls.
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.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
 arch/arm/mach-prima2/common.c |    3 +++
 arch/arm/mach-prima2/pm.c     |    6 ++----
 arch/arm/mach-prima2/pm.h     |    2 ++
 3 files changed, 7 insertions(+), 4 deletions(-)

Comments

Barry Song June 3, 2013, 3:51 a.m. UTC | #1
hi Srinivas,

2013/5/31 Srinivas KANDAGATLA <srinivas.kandagatla@st.com>:
> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> This patch moves all  postcore_initcalls to very first calls in
> init_machine. This should achieve the same sequencing as done via
> postcore_initcalls.
> 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.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>

did you see this one?

[PATCH v2] arm: prima2: use of_platform_populate instead of
of_platform_bus_probe
http://www.spinics.net/lists/arm-kernel/msg243710.html


> ---
>  arch/arm/mach-prima2/common.c |    3 +++
>  arch/arm/mach-prima2/pm.c     |    6 ++----
>  arch/arm/mach-prima2/pm.h     |    2 ++
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
> index 9aefcd6..8e27cb7 100644
> --- a/arch/arm/mach-prima2/common.c
> +++ b/arch/arm/mach-prima2/common.c
> @@ -16,6 +16,7 @@
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
>  #include "common.h"
> +#include "pm.h"
>
>  static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
>         { .compatible = "simple-bus", },
> @@ -24,6 +25,8 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
>
>  void __init sirfsoc_mach_init(void)
>  {
> +       sirfsoc_of_pwrc_init();
> +       sirfsoc_memc_init();
>         of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
>  }
>
> diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
> index 9936c18..8850e3b 100644
> --- a/arch/arm/mach-prima2/pm.c
> +++ b/arch/arm/mach-prima2/pm.c
> @@ -96,7 +96,7 @@ static const struct of_device_id pwrc_ids[] = {
>         {}
>  };
>
> -static int __init sirfsoc_of_pwrc_init(void)
> +int __init sirfsoc_of_pwrc_init(void)
>  {
>         struct device_node *np;
>
> @@ -116,7 +116,6 @@ static int __init sirfsoc_of_pwrc_init(void)
>
>         return 0;
>  }
> -postcore_initcall(sirfsoc_of_pwrc_init);
>
>  static const struct of_device_id memc_ids[] = {
>         { .compatible = "sirf,prima2-memc" },
> @@ -143,8 +142,7 @@ static struct platform_driver sirfsoc_memc_driver = {
>         },
>  };
>
> -static int __init sirfsoc_memc_init(void)
> +int __init sirfsoc_memc_init(void)
>  {
>         return platform_driver_register(&sirfsoc_memc_driver);
>  }
> -postcore_initcall(sirfsoc_memc_init);
> diff --git a/arch/arm/mach-prima2/pm.h b/arch/arm/mach-prima2/pm.h
> index bae6d77..b658d66 100644
> --- a/arch/arm/mach-prima2/pm.h
> +++ b/arch/arm/mach-prima2/pm.h
> @@ -23,6 +23,8 @@
>
>  #ifndef __ASSEMBLY__
>  extern int sirfsoc_finish_suspend(unsigned long);
> +extern int __init sirfsoc_of_pwrc_init(void);
> +extern int __init sirfsoc_memc_init(void);
>  #endif
>
>  #endif
> --
> 1.7.6.5

-barry
Srinivas KANDAGATLA June 3, 2013, 8:56 a.m. UTC | #2
On 03/06/13 04:51, Barry Song wrote:
> did you see this one?
> 
> [PATCH v2] arm: prima2: use of_platform_populate instead of
> of_platform_bus_probe
> http://www.spinics.net/lists/arm-kernel/msg243710.html

Yes, I think this is a nice cleanup for simplest case. But Prima
platforms do much more checking at the same init level. An attempt to
get rid of postcore and early init calls might introduce this back.

You could solve both the early and postcore initcall issues by returning
instead of panic, and let every NON Prima platforms call this function.
Or
Do it the right way and clean it up.

I will leave it up to you to decide on how you want to fix the multi_v7
kernel issue.

Thanks,
srini
Barry Song June 3, 2013, 10:07 a.m. UTC | #3
Hi Srinivas,

2013/6/3 Srinivas KANDAGATLA <srinivas.kandagatla@st.com>:
> On 03/06/13 04:51, Barry Song wrote:
>> did you see this one?
>>
>> [PATCH v2] arm: prima2: use of_platform_populate instead of
>> of_platform_bus_probe
>> http://www.spinics.net/lists/arm-kernel/msg243710.html
>
> Yes, I think this is a nice cleanup for simplest case. But Prima
> platforms do much more checking at the same init level. An attempt to
> get rid of postcore and early init calls might introduce this back.
>
> You could solve both the early and postcore initcall issues by returning
> instead of panic, and let every NON Prima platforms call this function.
> Or
> Do it the right way and clean it up.
>
> I will leave it up to you to decide on how you want to fix the multi_v7
> kernel issue.

i want to move sirfsoc_of_pwrc_init and sirfsoc_of_pwrc_init to
sirfsoc_pm_init as only suspend entries need them. then the result is
like:

 int __init sirfsoc_pm_init(void)
 {
+       sirfsoc_of_pwrc_init();
+       sirfsoc_memc_init();
        suspend_set_ops(&sirfsoc_pm_ops);
        return 0;
 }
@@ -98,7 +103,7 @@ static const struct of_device_id pwrc_ids[] = {
        {}
 };


>
> Thanks,
> srini

-barry
Srinivas KANDAGATLA June 3, 2013, 10:46 a.m. UTC | #4
On 03/06/13 11:07, Barry Song wrote:
> i want to move sirfsoc_of_pwrc_init and sirfsoc_of_pwrc_init to
> sirfsoc_pm_init as only suspend entries need them. then the result is
> like:
> 
>  int __init sirfsoc_pm_init(void)
>  {
> +       sirfsoc_of_pwrc_init();
> +       sirfsoc_memc_init();
>         suspend_set_ops(&sirfsoc_pm_ops);
>         return 0;
>  }
> @@ -98,7 +103,7 @@ static const struct of_device_id pwrc_ids[] = {
>         {}
>  };

It looks good, and should fix the issue too.
diff mbox

Patch

diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index 9aefcd6..8e27cb7 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -16,6 +16,7 @@ 
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include "common.h"
+#include "pm.h"
 
 static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 	{ .compatible = "simple-bus", },
@@ -24,6 +25,8 @@  static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 
 void __init sirfsoc_mach_init(void)
 {
+	sirfsoc_of_pwrc_init();
+	sirfsoc_memc_init();
 	of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
 }
 
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
index 9936c18..8850e3b 100644
--- a/arch/arm/mach-prima2/pm.c
+++ b/arch/arm/mach-prima2/pm.c
@@ -96,7 +96,7 @@  static const struct of_device_id pwrc_ids[] = {
 	{}
 };
 
-static int __init sirfsoc_of_pwrc_init(void)
+int __init sirfsoc_of_pwrc_init(void)
 {
 	struct device_node *np;
 
@@ -116,7 +116,6 @@  static int __init sirfsoc_of_pwrc_init(void)
 
 	return 0;
 }
-postcore_initcall(sirfsoc_of_pwrc_init);
 
 static const struct of_device_id memc_ids[] = {
 	{ .compatible = "sirf,prima2-memc" },
@@ -143,8 +142,7 @@  static struct platform_driver sirfsoc_memc_driver = {
 	},
 };
 
-static int __init sirfsoc_memc_init(void)
+int __init sirfsoc_memc_init(void)
 {
 	return platform_driver_register(&sirfsoc_memc_driver);
 }
-postcore_initcall(sirfsoc_memc_init);
diff --git a/arch/arm/mach-prima2/pm.h b/arch/arm/mach-prima2/pm.h
index bae6d77..b658d66 100644
--- a/arch/arm/mach-prima2/pm.h
+++ b/arch/arm/mach-prima2/pm.h
@@ -23,6 +23,8 @@ 
 
 #ifndef __ASSEMBLY__
 extern int sirfsoc_finish_suspend(unsigned long);
+extern int __init sirfsoc_of_pwrc_init(void);
+extern int __init sirfsoc_memc_init(void);
 #endif
 
 #endif