linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/25] Re-jig cpu_suspend for a saner calling convention
@ 2011-06-23 19:09 Russell King - ARM Linux
  2011-06-23 19:09 ` [PATCH 01/25] ARM: pm: ensure ARMv7 CPUs save and restore the TLS register Russell King - ARM Linux
                   ` (26 more replies)
  0 siblings, 27 replies; 32+ messages in thread
From: Russell King - ARM Linux @ 2011-06-23 19:09 UTC (permalink / raw)
  To: linux-arm-kernel

Version 3.

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.

I've also changed cpu_suspend() to have a saner visible prototype for
calling from platforms, hiding the needed v:p offset parameter in the
inline function.

So, this becomes:
static void soc_suspend(void)
{
        [soc specific preparation]

        cpu_suspend(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.

I've been able to convert OMAP3 suspend support and test it in both
retention and off modes.

The only platform not converted to cpu_suspend() is the shmobile stuff,
which I've requested their assistance with.

This patch set also eliminates 300 LOC from platform code.

Tested on Assabet (SA1100) and 3430LDP only.

 arch/arm/include/asm/suspend.h          |   21 ++++
 arch/arm/kernel/setup.c                 |   99 ++++++++++----------
 arch/arm/kernel/sleep.S                 |   73 ++++++---------
 arch/arm/mach-exynos4/pm.c              |    2 +-
 arch/arm/mach-exynos4/sleep.S           |   22 ----
 arch/arm/mach-omap2/pm34xx.c            |   48 ++-------
 arch/arm/mach-omap2/sleep34xx.S         |  160 ++-----------------------------
 arch/arm/mach-pxa/include/mach/pm.h     |    4 +-
 arch/arm/mach-pxa/palmz72.c             |    1 +
 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              |   14 +++-
 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               |    7 +-
 arch/arm/mach-sa1100/sleep.S            |   19 +----
 arch/arm/mm/proc-sa1100.S               |    4 +-
 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              |   11 +--
 28 files changed, 180 insertions(+), 474 deletions(-)

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

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

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 19:09 [PATCH 00/25] Re-jig cpu_suspend for a saner calling convention Russell King - ARM Linux
2011-06-23 19:09 ` [PATCH 01/25] ARM: pm: ensure ARMv7 CPUs save and restore the TLS register Russell King - ARM Linux
2011-06-23 19:09 ` [PATCH 02/25] ARM: pm: arrange for cpu_proc_init() to be called on resume Russell King - ARM Linux
2011-06-23 19:10 ` [PATCH 03/25] ARM: pm: sa1100: no need to re-enable clock switching Russell King - ARM Linux
2011-06-23 19:10 ` [PATCH 04/25] ARM: pm: make MULTI_CPU and !MULTI_CPU resume paths the same Russell King - ARM Linux
2011-06-23 19:10 ` [PATCH 05/25] ARM: pm: move return address (for cpu_resume) to top of stack Russell King - ARM Linux
2011-06-23 19:11 ` [PATCH 06/25] ARM: pm: extract common code from MULTI_CPU/!MULTI_CPU paths Russell King - ARM Linux
2011-06-23 19:11 ` [PATCH 07/25] ARM: pm: preserve r4 - r11 across a suspend Russell King - ARM Linux
2011-06-23 19:11 ` [PATCH 08/25] ARM: pm: reallocate registers to avoid r2, r3 Russell King - ARM Linux
2011-06-23 19:12 ` [PATCH 09/25] ARM: pm: rejig suspend follow-on function calling convention Russell King - ARM Linux
2011-06-23 19:12 ` [PATCH 10/25] ARM: pm: move sa1100 to use proper suspend func arg0 Russell King - ARM Linux
2011-06-23 19:12 ` [PATCH 11/25] ARM: pm: convert cpu_suspend() to a normal function Russell King - ARM Linux
2011-06-23 19:13 ` [PATCH 12/25] ARM: pm: move cpu_init() call into core code Russell King - ARM Linux
2011-06-23 19:13 ` [PATCH 13/25] ARM: pm: sa1100: move cpu_suspend into C code Russell King - ARM Linux
2011-06-23 19:13 ` [PATCH 14/25] ARM: pm: plat-s3c24xx: cleanup s3c_cpu_save Russell King - ARM Linux
2011-06-24  6:48   ` Kukjin Kim
2011-06-23 19:14 ` [PATCH 15/25] ARM: pm: mach-s5pv210: " Russell King - ARM Linux
2011-06-23 19:14 ` [PATCH 16/25] ARM: pm: mach-exynos4: " Russell King - ARM Linux
2011-06-23 19:14 ` [PATCH 17/25] ARM: pm: mach-s3c64xx: " Russell King - ARM Linux
2011-06-23 19:15 ` [PATCH 18/25] ARM: pm: samsung: move cpu_suspend into C code Russell King - ARM Linux
2011-06-23 19:15 ` [PATCH 19/25] ARM: pm: samsung: no need to call flush_cache_all() Russell King - ARM Linux
2011-06-23 19:15 ` [PATCH 20/25] ARM: pm: pxa: move cpu_suspend into C code Russell King - ARM Linux
2011-06-23 19:16 ` [PATCH 21/25] ARM: pm: omap34xx: no need to save all registers in sleep34xx.S Russell King - ARM Linux
2011-06-23 19:16 ` [PATCH 22/25] ARM: pm: omap34xx: remove misleading comment and use of r9 Russell King - ARM Linux
2011-06-23 19:16 ` [PATCH 23/25] ARM: pm: omap34xx: convert to generic suspend/resume support Russell King - ARM Linux
2011-06-24  7:37   ` Jean Pihet
2011-06-24  7:42     ` Russell King - ARM Linux
2011-06-23 19:17 ` [PATCH 24/25] ARM: pm: hide 1st and 2nd arguments to cpu_suspend from platform code Russell King - ARM Linux
2011-06-23 21:27   ` Kevin Hilman
2011-06-23 19:17 ` [PATCH 25/25] ARM: pm: ensure our temporary page table entry is removed from the TLB Russell King - ARM Linux
2011-06-23 22:14 ` [PATCH 00/25] Re-jig cpu_suspend for a saner calling convention Kevin Hilman
2011-06-24  7:43 ` Jean Pihet

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).