From patchwork Fri Feb 11 16:19:15 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: 549931 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1BGHqdF030367 for ; Fri, 11 Feb 2011 16:19:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757724Ab1BKQTa (ORCPT ); Fri, 11 Feb 2011 11:19:30 -0500 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:34520 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756725Ab1BKQTa (ORCPT ); Fri, 11 Feb 2011 11:19:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Date:Sender:Message-Id:Content-Type:MIME-Version:Cc:Subject:To:From:References:In-Reply-To; bh=BMBjQApoU2u76Pv7KvPCg00P0ajHZmkV59DJeiJ86tk=; b=d1lGeEabLhMdMg3cFcb+S7XH5VArjqUnCFo6ukiGhB5iv7htdeO5zXzuAaUtzTITMGz0O5eOQfc+Qe9I+GoMoTro/TmRzzxl1BgJ5VcHqsBD8hNwbM7zsHX4/5ljN2pJv7Eitp17GoHfIMSlwADvY7xR5mLMOqnRHYUKP4E6NDA=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd] helo=rmk-PC.arm.linux.org.uk) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1PnviG-0004oC-72; Fri, 11 Feb 2011 16:19:16 +0000 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.69) (envelope-from ) id 1PnviF-0002yt-EC; Fri, 11 Feb 2011 16:19:15 +0000 In-Reply-To: <20110211161626.GA31356@n2100.arm.linux.org.uk> References: <20110211161626.GA31356@n2100.arm.linux.org.uk> From: Russell King - ARM Linux To: Eric Miao , Kukjin Kim Subject: [PATCH 6/6] ARM: pm: allow generic sleep code to be used with SMP CPU idle Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 11 Feb 2011 16:19:15 +0000 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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, 11 Feb 2011 16:19:31 +0000 (UTC) diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index 9f106fa..e10618f 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -25,7 +25,14 @@ ENTRY(cpu_suspend) stmfd sp!, {r1, r2, r3, ip} @ save v:p, virt SP, retfn, phys resume fn ldr r3, =sleep_save_sp add r2, sp, r1 @ convert SP to phys +#ifdef CONFIG_SMP + ALT_SMP(mrc p15, 0, lr, c0, c0, 5) + ALT_UP(mov lr, #0) + and lr, lr, #15 + str r2, [r3, lr, lsl #2] @ save phys SP +#else str r2, [r3] @ save phys SP +#endif mov lr, pc ldr pc, [r10, #CPU_DO_SUSPEND] @ save CPU state #else @@ -36,7 +43,14 @@ ENTRY(cpu_suspend) stmfd sp!, {r1, r2, r3} @ save v:p, virt SP, return fn ldr r3, =sleep_save_sp add r2, sp, r1 @ convert SP to phys +#ifdef CONFIG_SMP + ALT_SMP(mrc p15, 0, lr, c0, c0, 5) + ALT_UP(mov lr, #0) + and lr, lr, #15 + str r2, [r3, lr, lsl #2] @ save phys SP +#else str r2, [r3] @ save phys SP +#endif bl cpu_do_suspend #endif @@ -96,7 +110,15 @@ cpu_resume_after_mmu: .data .align ENTRY(cpu_resume) +#ifdef CONFIG_SMP + adr r0, sleep_save_sp + ALT_SMP(mrc p15, 0, r1, c0, c0, 5) + ALT_UP(mov r1, #0) + and r1, r1, #15 + ldr r0, [r0, r1, lsl #2] @ stack phys addr +#else ldr r0, sleep_save_sp @ stack phys addr +#endif msr cpsr_c, #PSR_I_BIT | PSR_F_BIT | SVC_MODE @ set SVC, irqs off #ifdef MULTI_CPU ldmia r0!, {r1, sp, lr, pc} @ load v:p, stack, return fn, resume fn @@ -107,4 +129,6 @@ ENTRY(cpu_resume) ENDPROC(cpu_resume) sleep_save_sp: - .word 0 @ preserve stack phys ptr here + .rept CONFIG_NR_CPUS + .long 0 @ preserve stack phys ptr here + .endr