From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/14] ARM: suspend: rejig suspend follow-on function calling convention
Date: Thu, 16 Jun 2011 21:54:48 -0500 [thread overview]
Message-ID: <4DFAC1F8.7040503@gmail.com> (raw)
In-Reply-To: <E1QWAku-0002e3-3d@rmk-PC.arm.linux.org.uk>
Russell,
On 06/13/2011 12:16 PM, Russell King - ARM Linux wrote:
> Save the suspend function pointer onto the stack for use when returning.
> Allocate r2 to pass an argument to the suspend function.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
> arch/arm/kernel/sleep.S | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
> index 358be13..b924bcc 100644
> --- a/arch/arm/kernel/sleep.S
> +++ b/arch/arm/kernel/sleep.S
> @@ -10,6 +10,7 @@
> /*
> * Save CPU state for a suspend
> * r1 = v:p offset
> + * r2 = suspend function arg0
> * r3 = virtual return function
> * Note: sp is decremented to allocate space for CPU state on stack
> * r0-r3,ip,lr corrupted
> @@ -17,7 +18,6 @@
> ENTRY(cpu_suspend)
> stmfd sp!, {r3}
> stmfd sp!, {r4 - r11}
> - mov r9, lr
> #ifdef MULTI_CPU
> ldr r10, =processor
> ldr r5, [r10, #CPU_SLEEP_SIZE] @ size of CPU sleep state
> @@ -33,6 +33,7 @@ ENTRY(cpu_suspend)
> stmfd sp!, {r1, r6, ip} @ save v:p, virt SP, phys resume fn
> ldr r5, =sleep_save_sp
> add r6, sp, r1 @ convert SP to phys
> + stmfd sp!, {r2, lr} @ save suspend func arg and pointer
> #ifdef CONFIG_SMP
> ALT_SMP(mrc p15, 0, lr, c0, c0, 5)
> ALT_UP(mov lr, #0)
> @@ -51,12 +52,12 @@ ENTRY(cpu_suspend)
> @ flush data cache
> #ifdef MULTI_CACHE
> ldr r10, =cpu_cache
> - mov lr, r9
> + mov lr, pc
> ldr pc, [r10, #CACHE_FLUSH_KERN_ALL]
> #else
> - mov lr, r9
> - b __cpuc_flush_kern_all
> + bl __cpuc_flush_kern_all
> #endif
If you change:
> + ldmfd sp!, {r0, pc} @ call suspend fn
To:
mov lr, pc
ldmfd sp!, {r0, pc}
ldmfd sp!, {r1, r6, ip}
mov sp, r6
ldmfd sp!, {r4-r11, pc}
It will allow the suspend fn to return and abort suspend. With that, I'm
able to use this for core powerdown in cpuidle.
Rob
next prev parent reply other threads:[~2011-06-17 2:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=4DFAC1F8.7040503@gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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: link
Be 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.