Re: [PATCH] sh: hibernation support

Magnus Damm
2009-03-06T09:53:50Z

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

On Fri, Mar 6, 2009 at 4:06 PM, Francesco VIRLINZI
<francesco.virlinzi@st.com> wrote:
> Hi Magnus
> I was looking your patch and I have few question.

Great! You should try in on some ST hardware as well. =)

> Is it also for sh4 with PMB? If so how are you managing the PMB?
> Moreover what about interrupt controller? This means after a resume from
> hibernation
> you could have a resumed device (and driver) but the interrupt controller
> has the right irq-line not initialized.

I have not tested with PMB. You are right about the interrupt
controller, but it works because swsusp resume boots up the system as
usual with an identical kernel. Look at the attached file for the
swsusp code flow...

Cheers,

/ magnus

[-- Attachment #2: pm.txt --]
[-- Type: text/plain, Size: 2338 bytes --]

CONFIG_HIBERNATE in 2.6.29

suspend operation
------------------
swsusp code arch code driver callbacks

hibernate(): [disk.c]
hibernation_snapshot()

hibernation_snapshot():
suspend_console()
device_suspend(PMSG_FREEZE) prepare(), freeze()
disable_nonboot_cpus()
create_image()

create_image():
arch_prepare_suspend() do nothing
local_irq_disable()
device_power_down(PMSG_FREEZE) freeze_noirq()
save_processor_state() save registers
swsusp_arch_suspend() call swsusp_save()

swsusp_save() [snapshot.c]
create hibernation image

create_image(): [disk.c]
restore_processor_state() restore registers
device_power_up(PMSG_THAW) thaw_noirq()
local_irq_enable()

hibernation_snapshot()
enable_nonboot_cpus()
device_resume(PMSG_THAW) thaw(), complete()
resume_console()

hibernate():
swsusp_write()
swsusp_free()
power_down()

power_down():
hibernation_platform_enter()

hibernation_platform_enter():
suspend_console()
device_suspend(PMSG_HIBERNATE) prepare(), poweroff()
disable_nonboot_cpus()
local_irq_disable()
device_power_down(PMSG_HIBERNATE) poweroff_noirq()

resume operation:
-----------------
swsusp code arch code driver callbacks

software_resume() [disk.c]
swsusp_check()
swsusp_read()
hibernation_restore()

hibernation_restore()
suspend_console()
device_suspend(PMSG_QUIESCE) prepare(), freeze()
disable_nonboot_cpus()
resume_target_kernel()

resume_target_kernel()
local_irq_disable()
device_power_down(PMSG_QUIESCE) freeze_noirq()
save_processor_state() save registers
restore_highmem()
swsusp_arch_resume() overwrite memory

[executing old image now, back in suspend path with in_suspend = 0]

create_image():
restore_processor_state() restore registers
device_power_up(PMSG_RESTORE) restore_noirq()
local_irq_enable()

hibernation_snapshot()
enable_nonboot_cpus()
device_resume(PMSG_RESTORE) restore(), complete()
resume_console()

hibernate():
swsusp_free()