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: 824542 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4RFNFg4032404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 27 May 2011 15:23:37 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p4RFFinp029738; Fri, 27 May 2011 08:16:14 -0700 Received: from mxvs2.esa.t-systems.com (mxvs2.esa.t-systems.com [81.7.202.143]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p4RF1Ld2027217 for ; Fri, 27 May 2011 08:01:23 -0700 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 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] Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-3.41 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Subject: Re: [linux-pm] [RFC PATCH v3] ARM hibernation/suspend-to-disk support X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: frank.hofmann@tomtom.com List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 27 May 2011 15:23:37 +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