On Mon, 23 May 2011, Russell King - ARM Linux wrote: > On Mon, May 23, 2011 at 02:37:19PM +0100, Frank Hofmann wrote: >> What I've found necessary to save/restore via swsusp_arch_suspend/resume >> are the SYSTEM_MODE and SVC_MODE registers. >> Yesterday, I had thought that cpu_init() resets SVC_MODE sufficiently but >> that doesn't seem to be the case, if I leave that out, resume-from-disk >> doesn't work anymore. > > You will be running in SVC mode, so the SVC mode registers are your > current register set. At some point you need to do an effective > "context switch" between the kernel doing the resume and the kernel > which was running. That involves restoring the saved register state. > > System mode on the other hand is unused by the kernel. > Ah, and I had it the other way round ... that's why. Thanks ! I've tried that, saving/restoring just CPSR/SPSR and the reg set - and that seems sufficient, works fine ! All this means that the basic code has again become smaller. Attached is a new version, integrating all the feedback so far: * save/restore only those parts of the register set that the kernel cannot reinitialize from scratch * take care of FIQ disable/enable bracketing * use traditional stmfd/ldmfd instead of push/pop * don't rely on thread state, current->active_mm, but use global &init_mm * dump arch_prepare_suspend (skipping ahead of Rafael's suggested fix) * ditch the vmlinux.lds changes as they're not needed What other outstanding things are there to address for this ? All the best, FrankH.