linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP4: sleep: Save the complete used register stack frame
@ 2012-07-13 12:48 Santosh Shilimkar
  2012-08-08 17:15 ` Kevin Hilman
  0 siblings, 1 reply; 3+ messages in thread
From: Santosh Shilimkar @ 2012-07-13 12:48 UTC (permalink / raw)
  To: linux-arm-kernel

OMAP4 sleep entry code even though itself don't use many CPU registers
makes call to the v7_flush_dcache_all() which uses them. Since
v7_flush_dcache_all() doesn't make use of stack, the caller must take
care of the stack frame. Otherwise it will lead to corrupted stack frame.

Fix it by saving used registers.

Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/sleep44xx.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S
index 9f6b83d..b5823e9 100644
--- a/arch/arm/mach-omap2/sleep44xx.S
+++ b/arch/arm/mach-omap2/sleep44xx.S
@@ -58,7 +58,7 @@ ppa_por_params:
  * CPU failed to transition to targeted OFF/DORMANT state.
  */
 ENTRY(omap4_finish_suspend)
-	stmfd	sp!, {lr}
+	stmfd	sp!, {r4-r12, lr}
 	cmp	r0, #0x0
 	beq	do_WFI				@ No lowpower state, jump to WFI
 
@@ -226,7 +226,7 @@ scu_gp_clear:
 skip_scu_gp_clear:
 	isb
 	dsb
-	ldmfd	sp!, {pc}
+	ldmfd	sp!, {r4-r12, pc}
 ENDPROC(omap4_finish_suspend)
 
 /*
-- 
1.7.9.5

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

* [PATCH] ARM: OMAP4: sleep: Save the complete used register stack frame
  2012-07-13 12:48 [PATCH] ARM: OMAP4: sleep: Save the complete used register stack frame Santosh Shilimkar
@ 2012-08-08 17:15 ` Kevin Hilman
  2012-08-09  5:51   ` Shilimkar, Santosh
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hilman @ 2012-08-08 17:15 UTC (permalink / raw)
  To: linux-arm-kernel

Santosh Shilimkar <santosh.shilimkar@ti.com> writes:

> OMAP4 sleep entry code even though itself don't use many CPU registers
> makes call to the v7_flush_dcache_all() which uses them. Since
> v7_flush_dcache_all() doesn't make use of stack, the caller must take
> care of the stack frame. Otherwise it will lead to corrupted stack frame.
>
> Fix it by saving used registers.
>
> Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>

Please add a brief comment in the code as well explaining why the
additional registers are saved/restored.

After that, I'll add to my PM fixes queue for v3.6-rc.

Thanks for the fix.

Kevin

> ---
>  arch/arm/mach-omap2/sleep44xx.S |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S
> index 9f6b83d..b5823e9 100644
> --- a/arch/arm/mach-omap2/sleep44xx.S
> +++ b/arch/arm/mach-omap2/sleep44xx.S
> @@ -58,7 +58,7 @@ ppa_por_params:
>   * CPU failed to transition to targeted OFF/DORMANT state.
>   */
>  ENTRY(omap4_finish_suspend)
> -	stmfd	sp!, {lr}
> +	stmfd	sp!, {r4-r12, lr}
>  	cmp	r0, #0x0
>  	beq	do_WFI				@ No lowpower state, jump to WFI
>  
> @@ -226,7 +226,7 @@ scu_gp_clear:
>  skip_scu_gp_clear:
>  	isb
>  	dsb
> -	ldmfd	sp!, {pc}
> +	ldmfd	sp!, {r4-r12, pc}
>  ENDPROC(omap4_finish_suspend)
>  
>  /*

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

* [PATCH] ARM: OMAP4: sleep: Save the complete used register stack frame
  2012-08-08 17:15 ` Kevin Hilman
@ 2012-08-09  5:51   ` Shilimkar, Santosh
  0 siblings, 0 replies; 3+ messages in thread
From: Shilimkar, Santosh @ 2012-08-09  5:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 8, 2012 at 10:45 PM, Kevin Hilman <khilman@ti.com> wrote:
> Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
>
>> OMAP4 sleep entry code even though itself don't use many CPU registers
>> makes call to the v7_flush_dcache_all() which uses them. Since
>> v7_flush_dcache_all() doesn't make use of stack, the caller must take
>> care of the stack frame. Otherwise it will lead to corrupted stack frame.
>>
>> Fix it by saving used registers.
>>
>> Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: Kevin Hilman <khilman@ti.com>
>
> Please add a brief comment in the code as well explaining why the
> additional registers are saved/restored.
>
Ok.
> After that, I'll add to my PM fixes queue for v3.6-rc.
>
Thanks.

Regards
Santosh

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

end of thread, other threads:[~2012-08-09  5:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 12:48 [PATCH] ARM: OMAP4: sleep: Save the complete used register stack frame Santosh Shilimkar
2012-08-08 17:15 ` Kevin Hilman
2012-08-09  5:51   ` Shilimkar, Santosh

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