From: Russell King - ARM Linux <linux@arm.linux.org.uk> To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH 00/25 v2] Re-jig cpu_suspend for a saner calling convention Date: Wed, 22 Jun 2011 16:08:16 +0100 [thread overview] Message-ID: <20110622150816.GT23234@n2100.arm.linux.org.uk> (raw) Currently cpu_suspend is not like a normal C function - when it's called it returns normally to a bunch of code which is not expected to return. The return path is via code pointed to by 'r3'. It also corrupts a bunch of registers in ways which make it non-compliant with a C API. If we do make this compliant as a normal C-like function, it eliminates this register saving, and also allows us to make greater savings. We also swap 'lr' and 'r3', so cpu_suspend effectively only returns to following code on resume - and r3 points to the suspend code. So, this becomes: static void soc_suspend(void) { [soc specific preparation] cpu_suspend(0, PLAT_PHYS_OFFSET - PAGE_OFFSET, soc_suspend_arg, soc_finish_suspend); [soc specific cleanup ] } where soc_suspend_fn can be either assembly or C code - but must never return. (See separate patch posted on 13th June to allow it to return.) This patch series also merges the call to cpu_init() into cpu_suspend(), and makes cpu_init() call the per-CPU initialization function to ensure that various registers are setup (eg, clock switching on StrongARM, read-buffer enabled for userspace, etc.) This allows some more custom platform suspend code to be removed. Lastly, I've made an attempt to (a) clean up OMAP3 suspend support a little and (b) convert it to use cpu_suspend(). This works, but I've been unable to test cpuidle as cpuidle doesn't want to enter any of the deeper sleep states. The only platform not converted to cpu_suspend() is the shmobile stuff, which I've requested their assistance with. This patch set also eliminates about 300 LOC from platform code. Tested on Assabet (SA1100) and 3430LDP only. arch/arm/include/asm/system.h | 2 + arch/arm/kernel/setup.c | 99 +++++++++++---------- arch/arm/kernel/sleep.S | 71 ++++++--------- arch/arm/mach-exynos4/pm.c | 2 +- arch/arm/mach-exynos4/sleep.S | 22 ----- arch/arm/mach-omap2/pm34xx.c | 39 ++------- arch/arm/mach-omap2/sleep34xx.S | 147 ++---------------------------- arch/arm/mach-pxa/include/mach/pm.h | 4 +- arch/arm/mach-pxa/pm.c | 1 - arch/arm/mach-pxa/pxa25x.c | 3 +- arch/arm/mach-pxa/pxa27x.c | 11 ++- arch/arm/mach-pxa/pxa3xx.c | 13 +++- arch/arm/mach-pxa/sleep.S | 55 ++---------- arch/arm/mach-pxa/zeus.c | 3 +- arch/arm/mach-s3c2412/pm.c | 4 +- arch/arm/mach-s3c2416/pm.c | 4 +- arch/arm/mach-s3c64xx/pm.c | 2 +- arch/arm/mach-s3c64xx/sleep.S | 23 ----- arch/arm/mach-s5pv210/pm.c | 2 +- arch/arm/mach-s5pv210/sleep.S | 21 ----- arch/arm/mach-sa1100/pm.c | 6 +- arch/arm/mach-sa1100/sleep.S | 19 +---- arch/arm/mm/proc-v7.S | 10 ++- arch/arm/plat-s3c24xx/sleep.S | 25 ----- arch/arm/plat-samsung/include/plat/pm.h | 5 +- arch/arm/plat-samsung/pm.c | 10 +-- 26 files changed, 152 insertions(+), 451 deletions(-)
WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 00/25 v2] Re-jig cpu_suspend for a saner calling convention Date: Wed, 22 Jun 2011 16:08:16 +0100 [thread overview] Message-ID: <20110622150816.GT23234@n2100.arm.linux.org.uk> (raw) Currently cpu_suspend is not like a normal C function - when it's called it returns normally to a bunch of code which is not expected to return. The return path is via code pointed to by 'r3'. It also corrupts a bunch of registers in ways which make it non-compliant with a C API. If we do make this compliant as a normal C-like function, it eliminates this register saving, and also allows us to make greater savings. We also swap 'lr' and 'r3', so cpu_suspend effectively only returns to following code on resume - and r3 points to the suspend code. So, this becomes: static void soc_suspend(void) { [soc specific preparation] cpu_suspend(0, PLAT_PHYS_OFFSET - PAGE_OFFSET, soc_suspend_arg, soc_finish_suspend); [soc specific cleanup ] } where soc_suspend_fn can be either assembly or C code - but must never return. (See separate patch posted on 13th June to allow it to return.) This patch series also merges the call to cpu_init() into cpu_suspend(), and makes cpu_init() call the per-CPU initialization function to ensure that various registers are setup (eg, clock switching on StrongARM, read-buffer enabled for userspace, etc.) This allows some more custom platform suspend code to be removed. Lastly, I've made an attempt to (a) clean up OMAP3 suspend support a little and (b) convert it to use cpu_suspend(). This works, but I've been unable to test cpuidle as cpuidle doesn't want to enter any of the deeper sleep states. The only platform not converted to cpu_suspend() is the shmobile stuff, which I've requested their assistance with. This patch set also eliminates about 300 LOC from platform code. Tested on Assabet (SA1100) and 3430LDP only. arch/arm/include/asm/system.h | 2 + arch/arm/kernel/setup.c | 99 +++++++++++---------- arch/arm/kernel/sleep.S | 71 ++++++--------- arch/arm/mach-exynos4/pm.c | 2 +- arch/arm/mach-exynos4/sleep.S | 22 ----- arch/arm/mach-omap2/pm34xx.c | 39 ++------- arch/arm/mach-omap2/sleep34xx.S | 147 ++---------------------------- arch/arm/mach-pxa/include/mach/pm.h | 4 +- arch/arm/mach-pxa/pm.c | 1 - arch/arm/mach-pxa/pxa25x.c | 3 +- arch/arm/mach-pxa/pxa27x.c | 11 ++- arch/arm/mach-pxa/pxa3xx.c | 13 +++- arch/arm/mach-pxa/sleep.S | 55 ++---------- arch/arm/mach-pxa/zeus.c | 3 +- arch/arm/mach-s3c2412/pm.c | 4 +- arch/arm/mach-s3c2416/pm.c | 4 +- arch/arm/mach-s3c64xx/pm.c | 2 +- arch/arm/mach-s3c64xx/sleep.S | 23 ----- arch/arm/mach-s5pv210/pm.c | 2 +- arch/arm/mach-s5pv210/sleep.S | 21 ----- arch/arm/mach-sa1100/pm.c | 6 +- arch/arm/mach-sa1100/sleep.S | 19 +---- arch/arm/mm/proc-v7.S | 10 ++- arch/arm/plat-s3c24xx/sleep.S | 25 ----- arch/arm/plat-samsung/include/plat/pm.h | 5 +- arch/arm/plat-samsung/pm.c | 10 +-- 26 files changed, 152 insertions(+), 451 deletions(-)
next reply other threads:[~2011-06-22 15:08 UTC|newest] Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-22 15:08 Russell King - ARM Linux [this message] 2011-06-22 15:08 ` [PATCH 00/25 v2] Re-jig cpu_suspend for a saner calling convention Russell King - ARM Linux 2011-06-22 15:08 ` [PATCH 01/25] ARM: pm: make MULTI_CPU and !MULTI_CPU resume paths the same Russell King - ARM Linux 2011-06-22 15:08 ` Russell King - ARM Linux 2011-06-22 15:09 ` [PATCH 02/25] ARM: pm: move return address (for cpu_resume) to top of stack Russell King - ARM Linux 2011-06-22 15:09 ` Russell King - ARM Linux 2011-06-22 15:09 ` [PATCH 03/25] ARM: pm: extract common code from MULTI_CPU/!MULTI_CPU paths Russell King - ARM Linux 2011-06-22 15:09 ` Russell King - ARM Linux 2011-06-22 15:09 ` [PATCH 04/25] ARM: pm: preserve r4 - r11 across a suspend Russell King - ARM Linux 2011-06-22 15:09 ` Russell King - ARM Linux 2011-06-22 15:10 ` [PATCH 05/25] ARM: pm: reallocate registers to avoid r2, r3 Russell King - ARM Linux 2011-06-22 15:10 ` Russell King - ARM Linux 2011-06-22 15:10 ` [PATCH 06/25] ARM: pm: rejig suspend follow-on function calling convention Russell King - ARM Linux 2011-06-22 15:10 ` Russell King - ARM Linux 2011-06-22 15:10 ` [PATCH 07/25] ARM: pm: move sa1100 to use proper suspend func arg0 Russell King - ARM Linux 2011-06-22 15:10 ` Russell King - ARM Linux 2011-06-22 15:11 ` [PATCH 08/25] ARM: pm: convert cpu_suspend() to a normal function Russell King - ARM Linux 2011-06-22 15:11 ` Russell King - ARM Linux 2011-06-22 15:11 ` [PATCH 09/25] ARM: pm: plat-s3c24xx: cleanup s3c_cpu_save Russell King - ARM Linux 2011-06-22 15:11 ` Russell King - ARM Linux 2011-06-22 15:11 ` [PATCH 10/25] ARM: pm: sa1100: cleanup sa1100_cpu_suspend Russell King - ARM Linux 2011-06-22 15:11 ` Russell King - ARM Linux 2011-06-22 15:12 ` [PATCH 11/25] ARM: pm: mach-s5pv210: cleanup s3c_cpu_save Russell King - ARM Linux 2011-06-22 15:12 ` Russell King - ARM Linux 2011-06-22 15:12 ` [PATCH 12/25] ARM: pm: mach-exynos4: " Russell King - ARM Linux 2011-06-22 15:12 ` Russell King - ARM Linux 2011-06-22 15:12 ` [PATCH 13/25] ARM: pm: mach-s3c64xx: " Russell King - ARM Linux 2011-06-22 15:12 ` Russell King - ARM Linux 2011-06-22 15:13 ` [PATCH 14/25] ARM: pm: pxa: cleanup PXA suspend code Russell King - ARM Linux 2011-06-22 15:13 ` Russell King - ARM Linux 2011-06-22 15:13 ` [PATCH 15/25] ARM: pm: sa1100: move cpu_suspend into C code Russell King - ARM Linux 2011-06-22 15:13 ` Russell King - ARM Linux 2011-06-22 15:13 ` [PATCH 16/25] ARM: pm: pxa: " Russell King - ARM Linux 2011-06-22 15:13 ` Russell King - ARM Linux 2011-06-22 15:14 ` [PATCH 17/25] ARM: pm: move cpu_init() call into core code Russell King - ARM Linux 2011-06-22 15:14 ` Russell King - ARM Linux 2011-06-22 15:14 ` [PATCH 18/25] ARM: pm: arrange for cpu_proc_init() to be called on resume Russell King - ARM Linux 2011-06-22 15:14 ` Russell King - ARM Linux 2011-06-22 15:14 ` [PATCH 19/25] ARM: pm: sa1100: no need to re-enable clock switching Russell King - ARM Linux 2011-06-22 15:14 ` Russell King - ARM Linux 2011-06-22 15:15 ` [PATCH 20/25] ARM: pm: samsung: move cpu_suspend into C code Russell King - ARM Linux 2011-06-22 15:15 ` Russell King - ARM Linux 2011-06-22 15:15 ` [PATCH 21/25] ARM: pm: samsung: no need to call flush_cache_all() Russell King - ARM Linux 2011-06-22 15:15 ` Russell King - ARM Linux 2011-06-22 15:15 ` [PATCH 22/25] ARM: pm: omap: no need to save all registers in sleep34xx.S Russell King - ARM Linux 2011-06-22 15:15 ` Russell King - ARM Linux 2011-06-22 15:16 ` [PATCH 23/25] ARM: pm: omap34xx: remove misleading comment and use of r9 Russell King - ARM Linux 2011-06-22 15:16 ` Russell King - ARM Linux 2011-06-22 15:16 ` [PATCH 24/25] ARM: pm: ensure ARMv7 CPUs save and restore the TLS register Russell King - ARM Linux 2011-06-22 15:16 ` Russell King - ARM Linux 2011-06-22 15:16 ` [PATCH 25/25] ARM: pm: omap34xx: convert to generic suspend/resume support Russell King - ARM Linux 2011-06-22 15:16 ` Russell King - ARM Linux 2011-06-22 16:10 ` Russell King - ARM Linux 2011-06-22 16:10 ` Russell King - ARM Linux 2011-06-22 23:33 ` Santosh Shilimkar 2011-06-22 23:33 ` Santosh Shilimkar 2011-06-23 10:47 ` Russell King - ARM Linux 2011-06-23 10:47 ` Russell King - ARM Linux 2011-06-23 6:33 ` Tony Lindgren 2011-06-23 6:33 ` Tony Lindgren 2011-06-23 10:06 ` Russell King - ARM Linux 2011-06-23 10:06 ` Russell King - ARM Linux 2011-06-23 10:21 ` Russell King - ARM Linux 2011-06-23 10:21 ` Russell King - ARM Linux 2011-06-23 19:05 ` Kevin Hilman 2011-06-23 19:05 ` Kevin Hilman 2011-06-23 20:37 ` Kevin Hilman 2011-06-23 20:37 ` Kevin Hilman 2011-06-23 21:57 ` Kevin Hilman 2011-06-23 21:57 ` Kevin Hilman 2011-06-22 21:01 ` [PATCH 00/25 v2] Re-jig cpu_suspend for a saner calling convention Russell King - ARM Linux 2011-06-22 21:01 ` Russell King - ARM Linux 2011-06-22 23:26 ` Santosh Shilimkar 2011-06-22 23:26 ` Santosh Shilimkar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20110622150816.GT23234@n2100.arm.linux.org.uk \ --to=linux@arm.linux.org.uk \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.