[PATCH 00/14] Re-jig cpu_suspend for a saner calling convention

Nicolas Pitre nico at fluxnic.net
Mon Jun 13 15:16:08 EDT 2011


On Mon, 13 Jun 2011, Russell King - ARM Linux wrote:

> 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,

Please let's try not to use PLAT_PHYS_OFFSET if it can be avoided, 
especially when the plain PHYS_OFFSET would do just as well.  I'm 
currently trying to get rid of all instances of PLAT_PHYS_OFFSET from 
the kernel in order to eventually support multiple SOCs in a single 
kernel image.


Nicolas



More information about the linux-arm-kernel mailing list