From patchwork Fri Dec 19 05:32:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonghwa Lee X-Patchwork-Id: 5517391 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EA90D9F30B for ; Fri, 19 Dec 2014 05:37:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 158642012D for ; Fri, 19 Dec 2014 05:37:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F02C02012B for ; Fri, 19 Dec 2014 05:36:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y1qBp-0008Rd-84; Fri, 19 Dec 2014 05:33:25 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y1qBk-0008MY-Md for linux-arm-kernel@lists.infradead.org; Fri, 19 Dec 2014 05:33:21 +0000 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGT009AUE2XNV20@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 19 Dec 2014 14:32:57 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.113]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 47.ED.18167.888B3945; Fri, 19 Dec 2014 14:32:57 +0900 (KST) X-AuditID: cbfee690-f79ab6d0000046f7-f5-5493b888c3fc Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AC.BC.09430.888B3945; Fri, 19 Dec 2014 14:32:56 +0900 (KST) Received: from localhost.localdomain ([10.252.82.199]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGT002JBE2VLJE0@mmp2.samsung.com>; Fri, 19 Dec 2014 14:32:56 +0900 (KST) From: Jonghwa Lee To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: psci: Support generic pm suspend withtout CPUIDLE subsystem's help. Date: Fri, 19 Dec 2014 14:32:54 +0900 Message-id: <1418967174-23943-1-git-send-email-jonghwa3.lee@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLLMWRmVeSWpSXmKPExsWyRsSkULdzx+QQgwldLBbvl/UwWnSefcJs senxNVaLy7vmsFm8+f2C3WLp9YtMFi8/nmBxYPdYM28No8fmJfUefVtWMXp83iQXwBLFZZOS mpNZllqkb5fAlfHpL0vBDOGK5h1LWRoYr/J3MXJySAiYSGybuIIZwhaTuHBvPVsXIxeHkMBS RomFK5eywRRtedYOlZjOKLGm/yqU08YkcXHlFEaQKjYBHYn/+26yg9giAm4S/9YdAitiFuhm lPj5exrYKGGBWIlpWz+xgNgsAqoSq57cA2vmFfCQaN52GsjmAFqnIDFnkg1Ir4TAZzaJfd9u M0PUC0h8m3yIBaJGVmLTAaizJSUOrrjBMoFRcAEjwypG0dSC5ILipPQiE73ixNzi0rx0veT8 3E2MwFA9/e/ZhB2M9w5YH2IU4GBU4uF9UDw5RIg1say4MvcQoynQhonMUqLJ+cCIyCuJNzQ2 M7IwNTE1NjK3NFMS530t9TNYSCA9sSQ1OzW1ILUovqg0J7X4ECMTB6dUA6PXJHN/hn29HaeP d25wWqkr8HGv5qKJ5QvPbok+a8TbNF34cEmPUYSOx74ZuzeZdWy18l557+peYa2pu46mZiys mH5f1sVUobSnMftYgVqs7eK7zFJt3Ar+yw8c2LkrddHu3s2nNlS+abbNWvakUn3pJlXzwNLU 3g/+AuVNARrsCnVfdU8wz1BiKc5INNRiLipOBAAOhp+DUAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42I5/e+xoG7HjskhBnM/Wli8X9bDaNF59gmz xabH11gtLu+aw2bx5vcLdoul1y8yWbz8eILFgd1jzbw1jB6bl9R79G1ZxejxeZNcAEtUA6NN RmpiSmqRQmpecn5KZl66rZJ3cLxzvKmZgaGuoaWFuZJCXmJuqq2Si0+ArltmDtAFSgpliTml QKGAxOJiJX07TBNCQ9x0LWAaI3R9Q4LgeowM0EDCGsaMT39ZCmYIVzTvWMrSwHiVv4uRk0NC wERiy7N2NghbTOLCvfVANheHkMB0Rok1/VehnDYmiYsrpzCCVLEJ6Ej833eTHcQWEXCT+Lfu EFgRs0A3o8TP39PARgkLxEpM2/qJBcRmEVCVWPXkHlgzr4CHRPO200A2B9A6BYk5k2wmMHIv YGRYxSiaWpBcUJyUnmukV5yYW1yal66XnJ+7iREcCc+kdzCuarA4xCjAwajEw9tRODlEiDWx rLgy9xCjBAezkgiveSZQiDclsbIqtSg/vqg0J7X4EKMp0PKJzFKiyfnAKM0riTc0NjEzsjQy N7QwMjZXEudVsm8LERJITyxJzU5NLUgtgulj4uCUamD03ubX7vajf/EfGZdKzq16YnMOlzHw pJhK+vROTNhb0H1Rl+WK5oxS//k8J16928czf2GJ9+czOvXKVaFS/nplu689SM0oPVVYxKha HtU98erWf2EnlDZmmcps0Q451a3lt+6DqeqzIzKbD7l7OfT2BrYE1Csvv1JTOMOCf/OVFvtF e12+zFRiKc5INNRiLipOBACuqeZYmgIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141218_213320_883948_40BFA371 X-CRM114-Status: GOOD ( 15.47 ) X-Spam-Score: -4.9 (----) Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Jonghwa Lee , lorenzo.pieralisi@arm.com, will.deacon@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current psci's cpu_suspend callback can be used only when common cpu idle configuration is enabled. However, it's also needed for system which only uses generic pm suspend not cpu idle. This patch modifies psci driver to support both of cases. Signed-off-by: Jonghwa Lee --- arch/arm64/kernel/psci.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index f1dbca7..06d5527 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c @@ -35,6 +35,13 @@ #define PSCI_POWER_STATE_TYPE_STANDBY 0 #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1 +enum psci_affinity_level { + PSCI_AFFINITY_LEVEL_0, + PSCI_AFFINITY_LEVEL_1, + PSCI_AFFINITY_LEVEL_2, + PSCI_AFFINITY_LEVEL_3, +}; + struct psci_power_state { u16 id; u8 type; @@ -513,27 +520,37 @@ static int psci_suspend_finisher(unsigned long index) { struct psci_power_state *state = __this_cpu_read(psci_power_state); + /* Generic PM suspend without CPUIDLE functionality */ + if (!state) { + struct psci_power_state s = { + .affinity_level = PSCI_AFFINITY_LEVEL_3, + .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, + }; + return psci_ops.cpu_suspend(s, virt_to_phys(cpu_resume)); + } + return psci_ops.cpu_suspend(state[index - 1], virt_to_phys(cpu_resume)); } static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index) { - int ret; struct psci_power_state *state = __this_cpu_read(psci_power_state); - /* - * idle state index 0 corresponds to wfi, should never be called - * from the cpu_suspend operations - */ - if (WARN_ON_ONCE(!index)) - return -EINVAL; - if (state[index - 1].type == PSCI_POWER_STATE_TYPE_STANDBY) - ret = psci_ops.cpu_suspend(state[index - 1], 0); - else - ret = __cpu_suspend(index, psci_suspend_finisher); + if (state) { + if (WARN_ON_ONCE(!index)) + return -EINVAL; + + /* + * If idle state initialization is successfully done, + * idle state index 0 corresponds to wfi, should never be + * called from the cpu_suspend operations + */ + if (state[index - 1].type == PSCI_POWER_STATE_TYPE_STANDBY) + return psci_ops.cpu_suspend(state[index - 1], 0); + } - return ret; + return __cpu_suspend(index, psci_suspend_finisher); } const struct cpu_operations cpu_psci_ops = {