All of lore.kernel.org
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v5] ARM hibernation / suspend-to-disk (fwd)
Date: Mon, 13 Jun 2011 17:44:52 +0100	[thread overview]
Message-ID: <20110613164452.GE13643@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.DEB.2.00.1106131400090.25153@localhost6.localdomain6>

On Mon, Jun 13, 2011 at 02:20:12PM +0100, Frank Hofmann wrote:
>
>
> On Mon, 13 Jun 2011, Russell King - ARM Linux wrote:
>
>> On Mon, Jun 13, 2011 at 01:04:02PM +0100, Frank Hofmann wrote:
>>>   To make it clear: IF AND ONLY IF your suspend(-to-ram) func looks like:
>>>
>>> 	ENTRY(acmeSoC_cpu_suspend)
>>> 		stmfd	sp!, {r4-r12,lr}
>>> 		ldr	r3, resume_mmu_done
>>> 		bl	cpu_suspend
>>> 	resume_mmu_done:
>>> 		ldmfd	sp!, {r3-r12,pc}
>>> 	ENDPROC(acmeSoC_cpu_suspend)
>>
>> Nothing has that - because you can't execute that ldmfd after the call
>> to cpu_suspend returns.  I don't think you've understood what I said on
>> that subject in the previous thread.
>>
>
> Ok, to illustrate a bit more, what is ok and what not.

Actually, we can do something about cpu_suspend.

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.  Patches will follow this evening.

  parent reply	other threads:[~2011-06-13 16:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 12:04 [RFC PATCH v5] ARM hibernation / suspend-to-disk (fwd) Frank Hofmann
2011-06-13 12:26 ` Russell King - ARM Linux
2011-06-13 12:40   ` Frank Hofmann
2011-06-13 13:20   ` Frank Hofmann
2011-06-13 13:56     ` Dave Martin
2011-06-13 13:56       ` Dave Martin
2011-06-13 15:34       ` Frank Hofmann
2011-06-13 15:34         ` Frank Hofmann
2011-06-13 16:11         ` Frank Hofmann
2011-06-13 16:11           ` Frank Hofmann
2011-06-13 16:44     ` Russell King - ARM Linux [this message]
2011-06-15 13:35       ` Frank Hofmann
2011-06-16 21:31         ` Russell King - ARM Linux
2011-06-20 12:32           ` Frank Hofmann
2011-06-21 14:35             ` Russell King - ARM Linux
2011-06-29 14:52         ` Matthieu CASTET
2011-06-29 15:14           ` Frank Hofmann
2011-06-29 20:08             ` Will Deacon
2011-07-05 12:37         ` Matthieu CASTET
     [not found]           ` <2C577202CB5719438D4E9608C565CB2C01B69D7F@NL-EXC-07.intra.local>
2011-07-05 17:09             ` Matthieu CASTET
2011-09-30  7:48 ` Barry Song

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=20110613164452.GE13643@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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.