diff mbox

ARM: Samsung: Select ARM_CPU_SUSPEND when required

Message ID 2cd601ce343f$7d6aac50$784004f0$%kim@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kim Kukjin April 8, 2013, 9:57 a.m. UTC
Sylwester Nawrocki wrote:
> 
> The power management code of S3C24XX, S3C64XX, S5PV210 platform in
> arch/arm/plat-samsung/, arch/arm/mach-s3c24xx/, arch/arm/mach-s3c64xx/
> directories uses generic cpu_suspend routine. Make sure it is compiled
> in when building with power management support. Without this patch
> compilation fails with errors as below. It can be reproduced by using
> default config files with CONFIG_SUSPEND disabled and CONFIG_PM_RUNTIME
> enabled.
> 
>  - s5pv210_defconfig
>  arch/arm/plat-samsung/built-in.o: In function `s3c_pm_enter':
>  arch/arm/plat-samsung/pm.c:304: undefined reference to `cpu_suspend'
>  arch/arm/plat-samsung/built-in.o: In function `s3c_cpu_resume':
>  arch/arm/plat-samsung/s5p-sleep.S:74: undefined reference to `cpu_resume'
> 
>  - s3c24xx_defconfig
>  arch/arm/mach-s3c24xx/built-in.o: In function `s3c_cpu_resume':
>  arch/arm/mach-s3c24xx/sleep.S:83: undefined reference to `cpu_resume'
>  arch/arm/plat-samsung/built-in.o: In function `s3c_pm_enter':
>  arch/arm/plat-samsung/pm.c:304: undefined reference to `cpu_suspend'
> 
>  - s3c64xx_defconfig
>  arch/arm/mach-s3c64xx/built-in.o: In function `s3c_cpu_resume':
>  arch/arm/mach-s3c64xx/sleep.S:72: undefined reference to `cpu_resume'
>  arch/arm/plat-samsung/built-in.o: In function `s3c_pm_enter':
>  arch/arm/plat-samsung/pm.c:304: undefined reference to `cpu_suspend'
> 
> To fix this issue select ARM_CPU_SUSPEND for PLAT_SAMSUNG when PM is set.
> 
> The build break occurs for kernels at least back to v3.0, however this
> patch applies without conflicts only back to v3.7.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Cc: stable@vger.kernel.org
> ---
>  arch/arm/plat-samsung/Kconfig |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index 54d1861..02355ba 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -10,6 +10,7 @@ config PLAT_SAMSUNG
>  	default y
>  	select GENERIC_IRQ_CHIP
>  	select NO_IOPORT
> +	select ARM_CPU_SUSPEND if PM
>  	help
>  	  Base platform code for all Samsung SoC based systems
> 
> --
> 1.7.4.1

Yes, right. The pm.c in plat-samsung should be built with
arch/arm/kernel/sleep.S and suspend.c.

BTW it should be shown in alphabetical order and we don't need more
following in mach-exynos.

--------8<----------------8<--------
--------8<----------------8<--------

If you have any objections, let me know.

Thanks.

- Kukjin

Comments

On 04/08/2013 11:57 AM, Kukjin Kim wrote:
> Sylwester Nawrocki wrote:
[...]
> Yes, right. The pm.c in plat-samsung should be built with
> arch/arm/kernel/sleep.S and suspend.c.
> 
> BTW it should be shown in alphabetical order and we don't need more
> following in mach-exynos.
> 
> --------8<----------------8<--------
> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index 2f45906..bc0a8b2 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -31,7 +31,6 @@ config CPU_EXYNOS4210
>  	bool "SAMSUNG EXYNOS4210"
>  	default y
>  	depends on ARCH_EXYNOS4
> -	select ARM_CPU_SUSPEND if PM
>  	select PM_GENERIC_DOMAINS
>  	select S5P_PM if PM
>  	select S5P_SLEEP if PM
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index b708b3e..30a976d 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -8,6 +8,7 @@ config PLAT_SAMSUNG
>  	Bool
>  	depends on PLAT_S3C24XX || ARCH_S3C64XX || PLAT_S5P
> 	default y
> +	select ARM_CPU_SUSPEND if PM
>  	select GENERIC_IRQ_CHIP
>  	select NO_IOPORT
>  	help
> --------8<----------------8<--------
> 
> If you have any objections, let me know.

Yes, this looks better. However after posting this patch I noticed linker
errors in some builds due to undefined cpu_arm920_do_suspend,
cpu_arm920_do_resume routines.

It seems it is because various cpu_*_do_suspend routines are selected by
CONFIG_PM_SLEEP.  And the PM code in arch/arm/mach-s3c24xx, arch/arm/mach-
s3c64xx is selected by CONFIG_PM.

$ git grep -1 "ENTRY(cpu_.*_do_suspend"
arch/arm/mm/proc-arm920.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-arm920.S:ENTRY(cpu_arm920_do_suspend)
arch/arm/mm/proc-arm920.S-      stmfd   sp!, {r4 - r6, lr}
--
arch/arm/mm/proc-arm926.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-arm926.S:ENTRY(cpu_arm926_do_suspend)
arch/arm/mm/proc-arm926.S-      stmfd   sp!, {r4 - r6, lr}
--
arch/arm/mm/proc-mohawk.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-mohawk.S:ENTRY(cpu_mohawk_do_suspend)
arch/arm/mm/proc-mohawk.S-      stmfd   sp!, {r4 - r9, lr}
--
arch/arm/mm/proc-sa1100.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-sa1100.S:ENTRY(cpu_sa1100_do_suspend)
arch/arm/mm/proc-sa1100.S-      stmfd   sp!, {r4 - r6, lr}
--
arch/arm/mm/proc-v6.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-v6.S:ENTRY(cpu_v6_do_suspend)
arch/arm/mm/proc-v6.S-  stmfd   sp!, {r4 - r9, lr}
--
arch/arm/mm/proc-v7.S-#ifdef CONFIG_ARM_CPU_SUSPEND
arch/arm/mm/proc-v7.S:ENTRY(cpu_v7_do_suspend)
arch/arm/mm/proc-v7.S-  stmfd   sp!, {r4 - r10, lr}
--
arch/arm/mm/proc-xsc3.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-xsc3.S:ENTRY(cpu_xsc3_do_suspend)
arch/arm/mm/proc-xsc3.S-        stmfd   sp!, {r4 - r9, lr}
--
arch/arm/mm/proc-xscale.S-#ifdef CONFIG_PM_SLEEP
arch/arm/mm/proc-xscale.S:ENTRY(cpu_xscale_do_suspend)
arch/arm/mm/proc-xscale.S-      stmfd   sp!, {r4 - r9, lr}

However I can't reproduce it now :-/ Anyway the $subject patch fixes
the main issue, which I can easily reproduce here as well. So I'll
prepare another patch if needed when I get back to this later.

Thanks,
Sylwester
diff mbox

Patch

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2f45906..bc0a8b2 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -31,7 +31,6 @@  config CPU_EXYNOS4210
 	bool "SAMSUNG EXYNOS4210"
 	default y
 	depends on ARCH_EXYNOS4
-	select ARM_CPU_SUSPEND if PM
 	select PM_GENERIC_DOMAINS
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index b708b3e..30a976d 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -8,6 +8,7 @@  config PLAT_SAMSUNG
 	Bool
 	depends on PLAT_S3C24XX || ARCH_S3C64XX || PLAT_S5P
	default y
+	select ARM_CPU_SUSPEND if PM
 	select GENERIC_IRQ_CHIP
 	select NO_IOPORT
 	help