From patchwork Thu Jun 16 21:31:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 889552 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5GLW4Ht017795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Jun 2011 21:32:25 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXKAA-00016Z-3o; Thu, 16 Jun 2011 21:31:42 +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 1QXKA9-0006zP-PJ; Thu, 16 Jun 2011 21:31:41 +0000 Received: from [2002:4e20:1eda::1] (helo=caramon.arm.linux.org.uk) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXKA5-0006z6-KJ for linux-arm-kernel@lists.infradead.org; Thu, 16 Jun 2011 21:31:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=aydfN1lB6emZPfC9KbOstSHQ1rkCv/qa9GVvdm0mND8=; b=mNeHAsnKY6W/T/0YZT/sx1ZjWeLZGXdQsb0IS4LUnTs0uuHu4QZS1eFthXsRfWPTDnb+TGAhscvpuVDsnFvMj5eP0kyJoh4DcHFNuVOgpYA2pCgqiDngkD0KGikK3WK4pE/izFFHUJT0zcTlBFD8Ik4WlrUj9Ty/j+QLbEaTStY=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1QXK9y-0005Yp-8Q; Thu, 16 Jun 2011 22:31:30 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.72) (envelope-from ) id 1QXK9w-0002VO-Ql; Thu, 16 Jun 2011 22:31:28 +0100 Date: Thu, 16 Jun 2011 22:31:28 +0100 From: Russell King - ARM Linux To: Frank Hofmann Subject: Re: [RFC PATCH v5] ARM hibernation / suspend-to-disk (fwd) Message-ID: <20110616213128.GC32629@n2100.arm.linux.org.uk> References: <20110613122601.GC12325@n2100.arm.linux.org.uk> <20110613164452.GE13643@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110616_173138_417790_15811492 X-CRM114-Status: GOOD ( 16.53 ) X-Spam-Score: 1.4 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid Cc: linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list 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]); Thu, 16 Jun 2011 21:32:25 +0000 (UTC) On Wed, Jun 15, 2011 at 02:35:26PM +0100, Frank Hofmann wrote: > this change is perfect; with this, the hibernation support code turns > into the attached. Should I assume that's an ack for all the patches? > That's both better and simpler to perform a full suspend/resume cycle > (via resetting in the cpu_suspend "finisher") after the snapshot image > has been created, instead of shoehorning a return into this. It's now not soo difficult to have an error code returned from the finisher function - the only thing we have to make sure is that the cpu_do_suspend helper just saves state and does not make any state changes. We can then do this, which makes it possible for the finisher to return, and we propagate its return value. We also ensure that a path through from cpu_resume will result in a zero return value from cpu_suspend. This isn't an invitation for people to make the S2RAM path return after they time out waiting for suspend to happen - that's potentially dangerous because in that case the suspend may happen while we're resuming devices which wouldn't be nice. Acked-by: Frank Hofmann diff -u b/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S --- b/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -12,7 +12,6 @@ * r1 = v:p offset * r2 = suspend function arg0 * r3 = suspend function - * Note: does not return until system resumes */ ENTRY(cpu_suspend) stmfd sp!, {r4 - r11, lr} @@ -26,7 +25,7 @@ #endif mov r6, sp @ current virtual SP sub sp, sp, r5 @ allocate CPU state on stack - mov r0, sp @ save pointer + mov r0, sp @ save pointer to CPU save block add ip, ip, r1 @ convert resume fn to phys stmfd sp!, {r1, r6, ip} @ save v:p, virt SP, phys resume fn ldr r5, =sleep_save_sp @@ -55,10 +54,17 @@ #else bl __cpuc_flush_kern_all #endif + adr lr, BSYM(cpu_suspend_abort) ldmfd sp!, {r0, pc} @ call suspend fn ENDPROC(cpu_suspend) .ltorg +cpu_suspend_abort: + ldmia sp!, {r1 - r3} @ pop v:p, virt SP, phys resume fn + mov sp, r2 + ldmfd sp!, {r4 - r11, pc} +ENDPROC(cpu_suspend_abort) + /* * r0 = control register value * r1 = v:p offset (preserved by cpu_do_resume) @@ -88,6 +94,7 @@ cpu_resume_after_mmu: str r5, [r2, r4, lsl #2] @ restore old mapping mcr p15, 0, r0, c1, c0, 0 @ turn on D-cache + mov r0, #0 @ return zero on success ldmfd sp!, {r4 - r11, pc} ENDPROC(cpu_resume_after_mmu)