linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] Re-jig cpu_suspend for a saner calling convention
@ 2011-06-13 17:14 Russell King - ARM Linux
  2011-06-13 17:15 ` [PATCH 01/14] ARM: suspend: make MULTI_CPU and !MULTI_CPU resume paths the same Russell King - ARM Linux
                   ` (14 more replies)
  0 siblings, 15 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2011-06-13 17:14 UTC (permalink / raw)
  To: linux-arm-kernel

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 complaint as a normal C-like function, it eliminates
this register saving.  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:
        ENTRY(acmeSoC_cpu_suspend)
                stmfd   sp!, {lr}
                adr     r3, soc_finish_suspend
                bl      cpu_suspend
                ldmfd   sp!, {pc}
        ENDPROC(acmeSoC_cpu_suspend)

        soc_finish_suspend:
                blah
                blah
                put soc to sleep
                never return

or even:

static void soc_suspend(void)
{
        [soc specific preparation]

        cpu_suspend(0, PLAT_PHYS_OFFSET - PAGE_OFFSET,
                soc_suspend_arg, soc_suspend_fn);

        [soc specific cleanup ]
}

where soc_suspend_fn can be either assembly or C code - but must never
return.

Tested on Assabet (SA1100) only.

 arch/arm/kernel/sleep.S       |   70 +++++++++++++++-------------------------
 arch/arm/mach-exynos4/sleep.S |   10 ++----
 arch/arm/mach-pxa/sleep.S     |   48 ++++++++++++++--------------
 arch/arm/mach-s3c64xx/sleep.S |   11 ++-----
 arch/arm/mach-s5pv210/sleep.S |   10 ++----
 arch/arm/mach-sa1100/sleep.S  |   17 +++-------
 arch/arm/plat-s3c24xx/sleep.S |   12 ++-----
 7 files changed, 67 insertions(+), 111 deletions(-)

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

end of thread, other threads:[~2011-06-17  7:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-13 17:14 [PATCH 00/14] Re-jig cpu_suspend for a saner calling convention Russell King - ARM Linux
2011-06-13 17:15 ` [PATCH 01/14] ARM: suspend: make MULTI_CPU and !MULTI_CPU resume paths the same Russell King - ARM Linux
2011-06-13 17:15 ` [PATCH 02/14] ARM: suspend: move return address (for cpu_resume) to top of stack Russell King - ARM Linux
2011-06-13 17:15 ` [PATCH 03/14] ARM: suspend: extract common code from MULTI_CPU/!MULTI_CPU paths Russell King - ARM Linux
2011-06-13 19:29   ` Nicolas Pitre
2011-06-13 20:01     ` Russell King - ARM Linux
2011-06-13 17:16 ` [PATCH 04/14] ARM: suspend: preserve r4 - r11 across a suspend Russell King - ARM Linux
2011-06-13 17:16 ` [PATCH 05/14] ARM: suspend: reallocate registers to avoid r2, r3 Russell King - ARM Linux
2011-06-13 17:16 ` [PATCH 06/14] ARM: suspend: rejig suspend follow-on function calling convention Russell King - ARM Linux
2011-06-17  2:54   ` Rob Herring
2011-06-17  7:21     ` Russell King - ARM Linux
2011-06-13 17:17 ` [PATCH 07/14] ARM: suspend: move sa1100 to use proper suspend func arg0 Russell King - ARM Linux
2011-06-13 17:17 ` [PATCH 08/14] ARM: suspend: convert cpu_suspend() to a normal function Russell King - ARM Linux
2011-06-13 17:17 ` [PATCH 09/14] ARM: suspend: plat-s3c24xx: cleanup s3c_cpu_save Russell King - ARM Linux
2011-06-13 17:18 ` [PATCH 10/14] ARM: suspend: sa1100: cleanup sa1100_cpu_suspend Russell King - ARM Linux
2011-06-13 17:18 ` [PATCH 11/14] ARM: suspend: mach-s5pv210: cleanup s3c_cpu_save Russell King - ARM Linux
2011-06-13 17:18 ` [PATCH 12/14] ARM: suspend: mach-exynos4: " Russell King - ARM Linux
2011-06-13 17:19 ` [PATCH 13/14] ARM: suspend: mach-s3c64xx: " Russell King - ARM Linux
2011-06-13 17:19 ` [PATCH 14/14] ARM: suspend: pxa: cleanup PXA suspend code Russell King - ARM Linux
2011-06-13 19:16 ` [PATCH 00/14] Re-jig cpu_suspend for a saner calling convention Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).