From patchwork Fri May 27 15:01:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Hofmann X-Patchwork-Id: 824532 Received: from bombadil.infradead.org (173-166-109-252-newengland.hfc.comcastbusiness.net [173.166.109.252]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4RFEwcu016379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 27 May 2011 15:15:19 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QPyXX-0005BF-K1; Fri, 27 May 2011 15:01:27 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPyXT-0003o5-3i; Fri, 27 May 2011 15:01:23 +0000 Received: from mxvs2.esa.t-systems.com ([81.7.202.143]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPyXP-0003nm-CK for linux-arm-kernel@lists.infradead.org; Fri, 27 May 2011 15:01:20 +0000 Received: from unknown (HELO nl-exc-01.intra.local) ([82.210.235.24]) by mx.esa.t-systems.com with ESMTP; 27 May 2011 15:01:17 +0000 Received: from magrathea ([10.101.8.37]) by nl-exc-01.intra.local with Microsoft SMTPSVC(6.0.3790.3959); Fri, 27 May 2011 17:01:17 +0200 Date: Fri, 27 May 2011 16:01:13 +0100 (BST) From: Frank Hofmann To: linux-arm-kernel@lists.infradead.org, linux-pm@lists.linux-foundation.org, tuxonice-devel@tuxonice.net Subject: Re: [RFC PATCH v3] ARM hibernation/suspend-to-disk support In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-OriginalArrivalTime: 27 May 2011 15:01:17.0498 (UTC) FILETIME=[EE3799A0:01CC1C7E] X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110527_110119_566703_44351E2D X-CRM114-Status: GOOD ( 17.65 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [81.7.202.143 listed in list.dnswl.org] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: frank.hofmann@tomtom.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 27 May 2011 15:15:19 +0000 (UTC) On Wed, 25 May 2011, Frank Hofmann wrote: > Hi, > > I've cleaned this up by the suggestions in the previous thread; this is the > result. > > - now baselined against rmk/devel-stable > - didn't create the because Rafael is just removing > that everywhere anyway > - Fixes re prev suggestion: > local_fiq_enable/disable bracketing > save only absolutely essential regs and let cpu_init do the rest > thumb2 clean assembly > allows mach hooks (but they're not defined by this code) > > - Also: uses the "generic suspend/resume support" code > (commit f6b0fa02e8b0708d17d631afce456524eadf87ff, rmk/devel-stable) > > Via the latter, the previously-used hooks into machine-dependent code, > __save/__restore_processor_state, have become unnecessary. > > This now simply calls the cpu_do_suspend/resume utilities provided by the > generic code. > > > I'm still figuring out how to best test a recent devel-stable kernel ... Ok, I have figured out a way to test (on ARM1176, not yet Cortex-A8), by bringing my kernel up to a recent-enough baseline. I've found that the cpu_resume_mmu call done at the end of cpu_do_resume is reliant on having the MMU off at that point. If it's on (as is the case when coming through the hibernation resume point) the TTBR table modification in cpu_resume_mmu crashes ... well, it's a PA after all. I could make hibernation resume to work through the generic paths if I add a "fast exit" case: and "mov r1,#0" before calling cpu_do_suspend, from swsusp_arch_resume. It leaves an unsatisfying feeling about this not being "quite right" though. I wonder; is there a proper/suggested way to switch MMU off (and not end in binary nirvana), to have the reentry / reenable work ? FrankH. diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index 6398ead..d83123a 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -71,10 +71,13 @@ ENDPROC(cpu_suspend) /* * r0 = control register value * r1 = v:p offset (preserved by cpu_do_resume) + * if this is zero, do not reenable MMU (it's on) * r2 = phys page table base * r3 = L1 section flags */ ENTRY(cpu_resume_mmu) + teq r1, #0 + moveq pc, lr @ return if MMU already on adr r4, cpu_resume_turn_mmu_on mov r4, r4, lsr #20 orr r3, r3, r4, lsl #20