From patchwork Wed Oct 3 14:38:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5ADB1515 for ; Wed, 3 Oct 2018 14:39:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C393228AF5 for ; Wed, 3 Oct 2018 14:39:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6EC128B13; Wed, 3 Oct 2018 14:39:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F16B28AF5 for ; Wed, 3 Oct 2018 14:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3EI2RCWZNUFPslhXaVVz0ff/7e92DzgtoXVLn/UqMa4=; b=PZ+WoDkHqSAi8udeJQ5J2CO8lE 3hAMyAJ34hucTR5a+yfEOG0IPkc6hbrjH6MPVC3RL7738qg3rwzenItovkop8aEaemcwauRhsjbFx vWNUozP0x6ytoySXnvZ+JTl39TiAbjqHH94Nr9vlsqPSgJmUbhVX6QtLufz7K0z6/HsXi7N0gVvMQ gwu/VzvW5EQlKPd7W6AkZcGD+XVOkpNOLGKQfnGZhk4Hwlf7SpBFe5M2UzZYBPAaa54oNKgYZhMq8 sc1651uY0RcnTG35MNZPv12Lw702K5XOXNjw1SV/HtZHmKAhM5BO5OvYFZKX4ylhcrWrqnluCZ5+z ruIK259w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iJF-0006lJ-Ur; Wed, 03 Oct 2018 14:39:30 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIe-0006R2-Te for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:38:58 +0000 Received: by mail-lj1-x244.google.com with SMTP id j4-v6so1570783ljc.12 for ; Wed, 03 Oct 2018 07:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lOD5x9dibVDZPPRf+HmlB0VLhQ+dq9aywfJobMmjAbY=; b=RZ8hvbTQATzJjRDFdCkxhcX5piHn5HTxpCsnq5o90Cm5QmrwYKBxaToPvaD0O1X3Bb AcxEUfcmqXX2h9Us8+QrYsjyl3HWR7FVjhoK1muBM3ivgY+vAssmfX6feNbbmzYuJOG2 xdkoBcB1TkhnFERmGxxp9ix/XP2N2t/i/6H5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lOD5x9dibVDZPPRf+HmlB0VLhQ+dq9aywfJobMmjAbY=; b=maTirtFv80ZKsc6Aa97G+8y0sS39B2ZjFKc7T8UvNMV65iE5k1x2ZluPvd3tqmrT90 d0Ugy54jiGW115ZNrdZ/1TBK5OXvG+TSSIZq2KEbIzbWEo9l2bHqRg25ErQt3iQw5elq B7pmHjGWcD2r+cFubSjbVSQWIzfVTh0iQtfHu44NGBEhO1GMocZoDKD1o+RSJYmYqYQU cmjOWCYLX/IwBowkjdopdNuNYZ2vBSkFvjlPzCD+thV4bXoMBOcBGetERpYHWls+48ij DX6D0m6OWvoHHJQ3AD6VmtZLYXRACU/IQfy7A/e8i8CdQqwem7anbGCUroYTENVL10XE 6sIA== X-Gm-Message-State: ABuFfojVsYnWTcOaL9eGMY5mGjei7TgLlDxeVei52U6JOvf5k4n8PCGf gZpmVmpZuQ4aBNqV4niAp4+P5g== X-Google-Smtp-Source: ACcGV61DbPnzSLG0nVWYgX1I5i3G12v3UxOKQEvibV7kGdEUWyHVXws7WQhu9Pzav2u7XCqgP7qPgA== X-Received: by 2002:a2e:8346:: with SMTP id l6-v6mr1385660ljh.72.1538577521080; Wed, 03 Oct 2018 07:38:41 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:40 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 01/11] PM / Domains: Don't treat zero found compatible idle states as an error Date: Wed, 3 Oct 2018 16:38:14 +0200 Message-Id: <20181003143824.13059-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073852_989907_77A8602E X-CRM114-Status: GOOD ( 18.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of returning -EINVAL from of_genpd_parse_idle_states() in case none compatible states was found, let's return 0 to indicate success. Assign also the out-parameter *states to NULL and *n to 0, to indicate to the caller that zero states have been found/allocated. This enables the caller of of_genpd_parse_idle_states() to easier act on the returned error code. Cc: Lina Iyer Signed-off-by: Ulf Hansson Reviewed-by: Lina Iyer --- drivers/base/power/domain.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 4b5714199490..e1bbddb02871 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2478,8 +2478,8 @@ static int genpd_iterate_idle_states(struct device_node *dn, * * Returns the device states parsed from the OF node. The memory for the states * is allocated by this function and is the responsibility of the caller to - * free the memory after use. If no domain idle states is found it returns - * -EINVAL and in case of errors, a negative error code. + * free the memory after use. If any or zero compatible domain idle states is + * found it returns 0 and in case of errors, a negative error code is returned. */ int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n) @@ -2488,8 +2488,14 @@ int of_genpd_parse_idle_states(struct device_node *dn, int ret; ret = genpd_iterate_idle_states(dn, NULL); - if (ret <= 0) - return ret < 0 ? ret : -EINVAL; + if (ret < 0) + return ret; + + if (!ret) { + *states = NULL; + *n = 0; + return 0; + } st = kcalloc(ret, sizeof(*st), GFP_KERNEL); if (!st) From patchwork Wed Oct 3 14:38:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55FF615A6 for ; Wed, 3 Oct 2018 14:40:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CDA928D40 for ; Wed, 3 Oct 2018 14:40:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3110B28D49; Wed, 3 Oct 2018 14:40:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C95FE28D33 for ; Wed, 3 Oct 2018 14:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sD0auFe4OApreYb6m0yfjsrzkA2XG9fDMOIv4tGVz54=; b=BW/jrpYtnhHk0jK3h2neAOOXH1 3urXpSlx0fPjDoeBo4jAgA36mqx29vMPU+hvw1F37CzpcwJV2NVesUWNX0RNTSDd6U+xjjst3Plb5 fGvdh1fs6TtfFDrNh1ixd6yGS+N77tatn/XCvPw5ck+5RzTFbtt3Xmrm0Xw95Jq8TFO+APJ97We2h GtsKdxap6cKXEAIIuh/Vz+TAZARTwxBf4KePhspfBWdatDuM5PdPPP3XtBR7UhHxlQqh/M5iCw/wL YGwKlVKd4ClAftrtwpDr9Sk0fh8SBlXQl7FsBqsp1xb/LglNY2EkAX3SxlvtGZs6j+V45PUw1iSAB yduQO3lA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iK6-0007qi-V0; Wed, 03 Oct 2018 14:40:23 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIg-0006S8-SK for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:14 +0000 Received: by mail-lj1-x242.google.com with SMTP id o14-v6so5374240ljj.2 for ; Wed, 03 Oct 2018 07:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kJSeKBUogM0CddiVrJB+tVbUEkpCSyoWfL42ruK06nI=; b=DwRFYkaoZ6lC+9pxBSR4zeinWa7QO2knEkf2vgyEZ51boEFWR8kOhlNQrxpBY0F/Bv 9rFf56a4v0+He2NkyQVaeO2FF/UBKU51JdN7abJuUVv0q1eopsLZsVq4lBHVf+zDLYUt azaa9ZQZe93Cgh/u0+FgfbwSmdE4bBOgwxbvo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kJSeKBUogM0CddiVrJB+tVbUEkpCSyoWfL42ruK06nI=; b=NsavKdQJl5Qr0hPixESKgJEt9/V+v3EylLpwUGScOsC3RA047mr8CZ+PECYT+X80OB jFx8o0J2ReQ+8fsHOkKEF/MvBeJBk9c0LIsimYp8EXpJ8eqgK6am3RvsciHnoJ1bVWMv ZC8DWx8xClyUAb+Yy/tdjiDcK02v0nrhDGJDzn+8gEDPNVXi36QT6/OClmuYxAjhne/y wb6FevwnhAQ6SDR23G5tkTC34nSGPt9rU+SL8OGtti/sHH3fy4UDgwj4FHbESy6CVDWW 709IIK0xGiVVLw7imD4cnCKV8AQ0MbnAdwmSapjnhHA1X42EMrIvF/FxftCak5GoauS4 wgxg== X-Gm-Message-State: ABuFfoiV0HfL/GbMbe7co+Gu0+kwzUQPA/EfEHPrd/4+UI0/pqA2GIwU szvetWmPQBlQfOEUvfQzJ9qCFg== X-Google-Smtp-Source: ACcGV6370bjHoVakbi2zeNv/IgWVUeb5Wz40qgaKOiXCLbCfIn0ouaVWSqOVrCfjNlpSIpy+kZ3erg== X-Received: by 2002:a2e:9993:: with SMTP id w19-v6mr1327092lji.165.1538577522876; Wed, 03 Oct 2018 07:38:42 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:42 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 02/11] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 3 Oct 2018 16:38:15 +0200 Message-Id: <20181003143824.13059-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073854_942868_A0F7C8CD X-CRM114-Status: GOOD ( 16.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A caller of pm_genpd_init() that provides some states for the genpd via the ->states pointer in the struct generic_pm_domain, should also provide a governor. This because it's the job of the governor to pick a state that satisfies the constraints. Therefore, let's print a warning to inform the user about such bogus configuration and avoid to bail out, by instead picking the shallowest state before genpd invokes the ->power_off() callback. Cc: Lina Iyer Signed-off-by: Ulf Hansson Reviewed-by: Lina Iyer --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e1bbddb02871..7f38a92b444a 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -467,6 +467,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, return -EAGAIN; } + /* Default to shallowest state. */ + if (!genpd->gov) + genpd->state_idx = 0; + if (genpd->power_off) { int ret; @@ -1687,6 +1691,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, ret = genpd_set_default_power_state(genpd); if (ret) return ret; + } else if (!gov) { + pr_warn("%s : no governor for states\n", genpd->name); } device_initialize(&genpd->dev); From patchwork Wed Oct 3 14:38:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624963 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 804F71515 for ; Wed, 3 Oct 2018 14:41:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F6B528B10 for ; Wed, 3 Oct 2018 14:41:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6349128AF7; Wed, 3 Oct 2018 14:41:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E98DE28D7F for ; Wed, 3 Oct 2018 14:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=aBZzydxOV90QTjP35KftODCb797r8F0XRyg6x34/h8E=; b=qCXf6Zke3HM06QI0DKWUYICzAk nRc7cMu6me24IlOhXFbwSEOQSCoEpeEuO4kmMkBOAsUCZKTexbbfNi+YawRveyqcCavL4Ie6GjHdt R/YgqZ8SswEJcb9ds+bg/0ydmeOtA7eFTBoF9u8opTAvrq/P60cZNl/HKiOwkA0jeLnucwxlRkM7C 87nc/jEqpnpeMkdiy5lKguRwQJcEjLajfJi7xOkRX296pOVHldQSRxhMQw0E56ovGLIUvetzvE9Cb ko2vDbtAOdd8Et7u79DURr5MfvQbX1ro04ei82yTInLOuWJJoypM6FHwEO0F5Fu1eBsAcExEajnDo QjRsRpXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iLH-0000Ly-R2; Wed, 03 Oct 2018 14:41:35 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIi-0006SE-Jr for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:29 +0000 Received: by mail-lj1-x241.google.com with SMTP id p1-v6so1472221ljg.6 for ; Wed, 03 Oct 2018 07:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Az8HN+a97vIgrScBCEqR/rzOTiI9JWpLJgNiF/xNs1Y=; b=Fwrq5zIZgGrEsBsxyR54t24qFEqHXkC4DSb+7TXhUtrfB3IWXrdMfuwFYzFi7XS+ud Ha8AaviFQc7guk7xMwsdCNQll3VLrH5kZKgOsnkQHvs6/B/eWYplidelM/qkMrzO2BV9 KWzKRwxQgixw+ofsPAuPI3+F3/iZy0QnSjLRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Az8HN+a97vIgrScBCEqR/rzOTiI9JWpLJgNiF/xNs1Y=; b=JHfircnVOiz2s1TCbzYvD/wl6WSUeu71orjJk8abxIBJms/U/gjIoxUxmHbA5LkuYA bEbKbpgmHuTIgZrEGRkjqLev06/nodV4xVAzGrwSy4JiC+mk1EL8bEa5+VIMtFoQPUDX JNN6508qWW2WainSHU4YdvePZFyU0q/MJSa7XqGRMlZhMw1Ivy6eDhMxcUIAS6yHw8+4 eG+vVlHMSnB5M0YAoLsspePuKN/zkk6Znr3+MBcCknB/ZZQmiHQ9Oz+UPDWqROH01ixO i7YeAg65Pb9ccaW2lPAz16vrb3AIfNdqdn37mJJryony4QR8tJRxDMIjrvI6DTaWr+qb XtmQ== X-Gm-Message-State: ABuFfogYAiO2VskKQTUVPX0ltBjBws/u0vhMnwKC/CzPsNuw3vXu+qaE 1eBU6lLf724ccmFYlKjJIXpWbg== X-Google-Smtp-Source: ACcGV63ZCUlRFuzoFUlWb1bs+KEJI66Yb1IoBIe4epyTsr714kZsnJnvwgbB3Aut6FDAYv3Eilj24g== X-Received: by 2002:a2e:2d0a:: with SMTP id t10-v6mr1494652ljt.8.1538577524605; Wed, 03 Oct 2018 07:38:44 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:44 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 03/11] PM / Domains: Document flags for genpd Date: Wed, 3 Oct 2018 16:38:16 +0200 Message-Id: <20181003143824.13059-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073856_712450_CE27B9C7 X-CRM114-Status: GOOD ( 16.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The current documented description of the GENPD_FLAG_* flags, are too simplified, so let's extend them. Signed-off-by: Ulf Hansson --- include/linux/pm_domain.h | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 776c546d581a..3b5d7280e52e 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -17,11 +17,36 @@ #include #include -/* Defines used for the flags field in the struct generic_pm_domain */ -#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */ -#define GENPD_FLAG_IRQ_SAFE (1U << 1) /* PM domain operates in atomic */ -#define GENPD_FLAG_ALWAYS_ON (1U << 2) /* PM domain is always powered on */ -#define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) /* Keep devices active if wakeup */ +/* + * Flags to control the behaviour of a genpd. + * + * These flags may be set in the struct generic_pm_domain's flags field by a + * genpd backend driver. The flags must be set before it calls pm_genpd_init(), + * which initializes a genpd. + * + * GENPD_FLAG_PM_CLK: Instructs genpd to use the PM clk framework, + * while powering on/off attached devices. + * + * GENPD_FLAG_IRQ_SAFE: This informs genpd that its backend callbacks, + * ->power_on|off(), doesn't sleep. Hence, these + * can be invoked from within atomic context, which + * enables genpd to power on/off the PM domain, + * even when pm_runtime_is_irq_safe() returns true, + * for any of its attached devices. Note that, a + * genpd having this flag set, requires its + * masterdomains to also have it set. + * + * GENPD_FLAG_ALWAYS_ON: Instructs genpd to always keep the PM domain + * powered on. + * + * GENPD_FLAG_ACTIVE_WAKEUP: Instructs genpd to keep the PM domain powered + * on, in case any of its attached devices is used + * in the wakeup path to serve system wakeups. + */ +#define GENPD_FLAG_PM_CLK (1U << 0) +#define GENPD_FLAG_IRQ_SAFE (1U << 1) +#define GENPD_FLAG_ALWAYS_ON (1U << 2) +#define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) enum gpd_status { GPD_STATE_ACTIVE = 0, /* PM domain is active */ From patchwork Wed Oct 3 14:38:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AFCB15A7 for ; Wed, 3 Oct 2018 14:46:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D4D928B44 for ; Wed, 3 Oct 2018 14:46:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E43F28C72; Wed, 3 Oct 2018 14:46:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C2BF728B44 for ; Wed, 3 Oct 2018 14:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Xdf1k3tTaN2UMv2NDdnZS6qbLs1FvLFrOcLWj7A6EU4=; b=klpYEhdo9/MomyMG+ZXyMuL+Ak 0PIlTuXw2dbswvKOSKd1AsJHIqYo2dIicIKbtJzUke4ElRjojv5qyXDk9thFxDhW2sAxmUbFzWI3x 2BceXFrB2Ol1KbbQ6I1PgGD9MdokWDftPKTs/8vVcAWe9qDTte1eGWEj5i3VNzDaLNGZkQzynIWFc RZAb/myLAhf4usQtm1dP8RUIDzlIO3wwpLnSPTpbHIhzRkxWzWJWopTxOj6vNXY3qSzd+ZuRDkVk6 xNRnGyqB4+B82bBKWvC9M2DbdS7w2J+bFTpWsOc8qsHFKdoTv0cQQHxOpOoywdboISAordIxfV+CM X5d2juLg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iPb-0003cN-9C; Wed, 03 Oct 2018 14:46:03 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIk-0006SH-FH for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:50 +0000 Received: by mail-lf1-x144.google.com with SMTP id t22-v6so4318883lfb.7 for ; Wed, 03 Oct 2018 07:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s31a5XHCk1LHbjCX4EljRqRwb2bVRICfynyfVhTJkR0=; b=cJpZuUltyX6boYTW8n4eqSmCtDpkBhfsHeqYJhTyPZ6bb6+Rvz0bCRdZgp3y+Sb2Hb idkNPCM6mStTSZ3vEPyZL81N7AKdv835h4VsriHXyryb0vHe3etv9zGCi3JNVe1XcuDb iKugtj2VvyCC1IJtpJj+OsFeoUpbrUy9sSCpg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s31a5XHCk1LHbjCX4EljRqRwb2bVRICfynyfVhTJkR0=; b=EMh55HPy1crXcDUBBEKiCSLK0C3of1+HwuYmQSDbVOTefMWGLwuzNRDcQ1oNuDvoLT I4erhtKNPGGTrMIW9fN+nq/hhh7tqjLh7aHgcAzaQNSGIDY7H+wlD2dG2oEinlXyQzId PjdhsMriSl2F77Rxhr5CSmfN01lvjo7vfBx4MT1GZaxVImCjutl+A0PsBGXPDdJahCrv J/1pNBC7wq4pHBVVGosjV1jlkw6snhan2AnlHBp1LojoH4OFzJuLaryHo81S6TDFaTSL Dw2lgX8Q3XQxobW2I1UwRlkqb05YfurHk8ogGdIf5+Clm44TAcUdKZ9IQLmTcd/teBUQ 7dTw== X-Gm-Message-State: ABuFfohKE6tWRYaAXYL18TViRzOCtqojV8d62z3YFYhAhyZys6SSQE9k NL6aHPl0RNlDc0maWEd2+B3Z+iqhZD4= X-Google-Smtp-Source: ACcGV63w+k8Ky9ZPT8u3CThlZWEmR6v2MMxYmqJi3yPsnkwQAG4RywU2Gz8ZjEHETXI75Fzvgn697Q== X-Received: by 2002:a19:8f57:: with SMTP id r84-v6mr1172229lfd.131.1538577526472; Wed, 03 Oct 2018 07:38:46 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:45 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 04/11] dt: psci: Update DT bindings to support hierarchical PSCI states Date: Wed, 3 Oct 2018 16:38:17 +0200 Message-Id: <20181003143824.13059-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073858_653812_F6E809F0 X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , Lina Iyer , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lina Iyer Update DT bindings to represent hierarchical CPU and CPU PM domain idle states for PSCI. Also update the PSCI examples to clearly show how flattened and hierarchical idle states can be represented in DT. Cc: Lina Iyer Signed-off-by: Lina Iyer Co-developed-by: Ulf Hansson Signed-off-by: Ulf Hansson Reviewed-by: Rob Herring Reviewed-by: Sudeep Holla --- .../devicetree/bindings/arm/psci.txt | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/psci.txt b/Documentation/devicetree/bindings/arm/psci.txt index a2c4f1d52492..17aa3d3a1c8e 100644 --- a/Documentation/devicetree/bindings/arm/psci.txt +++ b/Documentation/devicetree/bindings/arm/psci.txt @@ -105,7 +105,163 @@ Case 3: PSCI v0.2 and PSCI v0.1. ... }; +ARM systems can have multiple cores sometimes in hierarchical arrangement. +This often, but not always, maps directly to the processor power topology of +the system. Individual nodes in a topology have their own specific power states +and can be better represented in DT hierarchically. + +For these cases, the definitions of the idle states for the CPUs and the CPU +topology, must conform to the domain idle state specification [3]. The domain +idle states themselves, must be compatible with the defined 'domain-idle-state' +binding [1], and also need to specify the arm,psci-suspend-param property for +each idle state. + +DT allows representing CPUs and CPU idle states in two different ways - + +The flattened model as given in Example 1, lists CPU's idle states followed by +the domain idle state that the CPUs may choose. Note that the idle states are +all compatible with "arm,idle-state". + +Example 2 represents the hierarchical model of CPUs and domain idle states. +CPUs define their domain provider in their psci DT node. The domain controls +the power to the CPU and possibly other h/w blocks that would enter an idle +state along with the CPU. The CPU's idle states may therefore be considered as +the domain's idle states and have the compatible "arm,idle-state". Such domains +may also be embedded within another domain that may represent common h/w blocks +between these CPUs. The idle states of the CPU topology shall be represented as +the domain's idle states. + +In PSCI firmware v1.0, the OS-Initiated mode is introduced. In order to use it, +the hierarchical representation must be used. + +Example 1: Flattened representation of CPU and domain idle states + cpus { + #address-cells = <1>; + #size-cells = <0>; + + CPU0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0>; + enable-method = "psci"; + cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>, + <&CLUSTER_PWRDN>; + }; + + CPU1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a57", "arm,armv8"; + reg = <0x100>; + enable-method = "psci"; + cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>, + <&CLUSTER_PWRDN>; + }; + + idle-states { + CPU_PWRDN: cpu-power-down { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x000001>; + entry-latency-us = <10>; + exit-latency-us = <10>; + min-residency-us = <100>; + }; + + CLUSTER_RET: cluster-retention { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x1000010>; + entry-latency-us = <500>; + exit-latency-us = <500>; + min-residency-us = <2000>; + }; + + CLUSTER_PWRDN: cluster-power-down { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x1000030>; + entry-latency-us = <2000>; + exit-latency-us = <2000>; + min-residency-us = <6000>; + }; + }; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + +Example 2: Hierarchical representation of CPU and domain idle states + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + CPU0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0>; + enable-method = "psci"; + power-domains = <&CPU_PD0>; + }; + + CPU1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a57", "arm,armv8"; + reg = <0x100>; + enable-method = "psci"; + power-domains = <&CPU_PD1>; + }; + + idle-states { + CPU_PWRDN: cpu-power-down { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x000001>; + entry-latency-us = <10>; + exit-latency-us = <10>; + min-residency-us = <100>; + }; + + CLUSTER_RET: cluster-retention { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x1000010>; + entry-latency-us = <500>; + exit-latency-us = <500>; + min-residency-us = <2000>; + }; + + CLUSTER_PWRDN: cluster-power-down { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x1000030>; + entry-latency-us = <2000>; + exit-latency-us = <2000>; + min-residency-us = <6000>; + }; + }; + }; + + psci { + compatible = "arm,psci-1.0"; + method = "smc"; + + CPU_PD0: cpu-pd0 { + #power-domain-cells = <0>; + domain-idle-states = <&CPU_PWRDN>; + power-domains = <&CLUSTER_PD>; + }; + + CPU_PD1: cpu-pd1 { + #power-domain-cells = <0>; + domain-idle-states = <&CPU_PWRDN>; + power-domains = <&CLUSTER_PD>; + }; + + CLUSTER_PD: cluster-pd { + #power-domain-cells = <0>; + domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWRDN>; + }; + }; + [1] Kernel documentation - ARM idle states bindings Documentation/devicetree/bindings/arm/idle-states.txt [2] Power State Coordination Interface (PSCI) specification http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf +[3]. PM Domains description + Documentation/devicetree/bindings/power/power_domain.txt From patchwork Wed Oct 3 14:38:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20F2413BB for ; Wed, 3 Oct 2018 14:43:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11EC321E5A for ; Wed, 3 Oct 2018 14:43:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05C0B2580E; Wed, 3 Oct 2018 14:43:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D47721E5A for ; Wed, 3 Oct 2018 14:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fmz173yNeoMTFbfAcNIF6P3U1gPg4DOehF4wUFS/fHA=; b=ucRM47G6GPWQ4XV/haAT8aIbeW 7ZjV5MeQ1+4tbM2Ch90jBbRDAYnFJIIjMEGwDWuelfSIvhlZQdrjZopdF7FjeaN7aYS/mJirCf6aK oho1rDlFOrkvqRjWQBHs5STeMGwbPfB/VBmL9g51VkkGbDfCQLzcwPvvJDrTt7YOWm0ShpnRDvNf2 EwpCAjA5EokoqXtowkmv5CWoyIer4Y/KkqSB6rkP+3bnOzBnKnGGU33Q9NPQMbm8igJCiHH/ok+jh f2g+4//qy7Bst5Ye8+QTL/IjJExI9pCGjrRGFGZw4o3A9FCoYvwKbI/6fmlSpx41StYKq07H53+go VuuZ4xGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iMc-00010X-Db; Wed, 03 Oct 2018 14:42:58 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIi-0006SJ-Jt for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:32 +0000 Received: by mail-lj1-x241.google.com with SMTP id y71-v6so5342068lje.9 for ; Wed, 03 Oct 2018 07:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cS7yfKOveXJgyBYsXQ8YQO6oBGRBpzCQCXH8+3mFFEo=; b=fx8drnSOtxA3anI913lckFGxRqtRu9w78vmnWNXJmbewRUm68yE+tLRZwARZiLhlbp 8s2PeeUM6AktExnm3R52LXidDskn4om25dn5FRc/BgLRDtDTAc6QkltsvqzkgyCSrEaP JRgkyom0mn8LCuWB9BTRe59/wnvMkVSCX+CA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cS7yfKOveXJgyBYsXQ8YQO6oBGRBpzCQCXH8+3mFFEo=; b=s9y+uEwObdnXeyY0RWQDbP9uwJQqnErIyPmL4y7PzAWLxcoyagsQANLkc7Gp5m4fl6 hzrv+Mhp8XUrSm2Roy8VPTZVADjXrMC1MSYoiNHOYLVCsqVNZ60uVyPPG3TMnetdusuK xmaQkFeqnC2mP0tns2ebEIAmxe0umu5kUdzQCNh0bW7gOJoal8fWCHLnfPOr1/iwAuwJ vMr7YfDE81E5iNtzcT6721m0JeMafDhPhhJvLFD33XqAdQi/KIKj3N5ULC9o/ykxBt+K j44T8J9PzYE+5BWuu4fLXGO47IEmDr4xFiIQDTH3chnbdVECvFklUgcd4Zb9x/ZSejox xhcw== X-Gm-Message-State: ABuFfogydWyJcuoRsh1F0cHfGUEWll2PUxiMYaRUiUspxHKR3ryHFvN/ irbXkl6EyIM7jjm+/4SsnQKD2w== X-Google-Smtp-Source: ACcGV60jlY8/LrhTbGcUaUP2h57fyQo8XWU2VREO/R04Mmves3FRLEypNxsuTv3kNJxTH2FkfaaWHg== X-Received: by 2002:a2e:6a19:: with SMTP id f25-v6mr1412659ljc.50.1538577528355; Wed, 03 Oct 2018 07:38:48 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:47 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 05/11] of: base: Add of_get_cpu_state_node() to get idle states for a CPU node Date: Wed, 3 Oct 2018 16:38:18 +0200 Message-Id: <20181003143824.13059-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073856_700625_1D5533AB X-CRM114-Status: GOOD ( 20.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The CPU's idle state nodes are currently parsed at the common cpuidle DT library, but also when initializing back-end data for the arch specific CPU operations, as in the PSCI driver case. To avoid open-coding, let's introduce of_get_cpu_state_node(), which takes the device node for the CPU and the index to the requested idle state node, as in-parameters. In case a corresponding idle state node is found, it returns the node with the refcount incremented for it, else it returns NULL. Moreover, for ARM, there are two generic methods, to describe the CPU's idle states, either via the flattened description through the "cpu-idle-states" binding [1] or via the hierarchical layout, using the "power-domains" and the "domain-idle-states" bindings [2]. Hence, let's take both options into account. [1] Documentation/devicetree/bindings/arm/idle-states.txt [2] Documentation/devicetree/bindings/arm/psci.txt Cc: Rob Herring Cc: devicetree@vger.kernel.org Cc: Lina Iyer Suggested-by: Sudeep Holla Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Reviewed-by: Rob Herring --- drivers/of/base.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/of.h | 8 ++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 74eaedd5b860..bf1d5fa34899 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -424,6 +424,41 @@ int of_cpu_node_to_id(struct device_node *cpu_node) } EXPORT_SYMBOL(of_cpu_node_to_id); +/** + * of_get_cpu_state_node - Get CPU's idle state node at the given index + * + * @cpu_node: The device node for the CPU + * @index: The index in the list of the idle states + * + * Two generic methods can be used to describe a CPU's idle states, either via + * a flattened description through the "cpu-idle-states" binding or via the + * hierarchical layout, using the "power-domains" and the "domain-idle-states" + * bindings. This function check for both and returns the idle state node for + * the requested index. + * + * In case and idle state node is found at index, the refcount incremented for + * it, so call of_node_put() on it when done. Returns NULL if not found. + */ +struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, + int index) +{ + struct of_phandle_args args; + int err; + + err = of_parse_phandle_with_args(cpu_node, "power-domains", + "#power-domain-cells", 0, &args); + if (!err) { + struct device_node *state_node = + of_parse_phandle(args.np, "domain-idle-states", index); + + of_node_put(args.np); + return state_node; + } + + return of_parse_phandle(cpu_node, "cpu-idle-states", index); +} +EXPORT_SYMBOL(of_get_cpu_state_node); + /** * __of_device_is_compatible() - Check if the node matches given constraints * @device: pointer to node diff --git a/include/linux/of.h b/include/linux/of.h index 99b0ebf49632..42dae048674c 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -353,6 +353,8 @@ extern const void *of_get_property(const struct device_node *node, const char *name, int *lenp); extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); +extern struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, + int index); #define for_each_property_of_node(dn, pp) \ for (pp = dn->properties; pp != NULL; pp = pp->next) @@ -754,6 +756,12 @@ static inline struct device_node *of_get_cpu_node(int cpu, return NULL; } +static inline struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, + int index) +{ + return NULL; +} + static inline int of_n_addr_cells(struct device_node *np) { return 0; From patchwork Wed Oct 3 14:38:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A48915A7 for ; Wed, 3 Oct 2018 14:53:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E6DA28C96 for ; Wed, 3 Oct 2018 14:53:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81E2328D20; Wed, 3 Oct 2018 14:53:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 14D2C28C96 for ; Wed, 3 Oct 2018 14:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=YW62/wuz4jD7cJAtSGVZwj2e8uNCP25qPFeeTplApMc=; b=Gq/kemxg5yGy5wQfCol8oHfzVo rMngyoLta/WtlT2tVhCYF5ABkWX0lWSwS0ybn0Msg+vMxiNVGKIyXE19mzbB8O5DlxZR/7jLTowGU 5PipJ8w/MM7T/1W6e1TA3drnA6OJWKKZPdoYmQ1m7nhbYR6fDIulTdRjxyHUuVlBL9h48mOg56+jZ /uUeXAfi+mJMpjWimmxw7NlQSf45D8ALoVboA+8hfL8vT+mEnElHT31PsDMyx3fcLz/o53vl+WJIe sxwam9L4nYaZXuO/Q5/ZWg863QV5XY/MWYTCxcXHDAdtTjI/aK2eflPfh0sjFfG3xJZI+cu2yyjdH yJaXDrvQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iWn-0006m9-VP; Wed, 03 Oct 2018 14:53:30 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIg-0006Sy-Rv for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:16 +0000 Received: by mail-lj1-x242.google.com with SMTP id r83-v6so5348734ljr.7 for ; Wed, 03 Oct 2018 07:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NdOVQOgn6QPfKNtGaQ+NXVIYYOcD0EuuWacQGnuhPH8=; b=WRWo6nk0nJa1hY05q+tQgr8xYnf2RAMUdfJAU1VKIlIychduM+cr+0DxYEisUldbgH +/Rt0QJ+NphPgxHDcGKI/myX65HaEuMqK3zWKyh4M0a9UZFtPkE7T53oOXkcZ4QqMCk6 1+HW35LznBwGCIspaeGz+RXntF71adUgghmqI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NdOVQOgn6QPfKNtGaQ+NXVIYYOcD0EuuWacQGnuhPH8=; b=raE/dOaFE3HF2Zfyda0S1i3HlJ6fHLobDviueL0WPmFglYJcqQopn768mx6i+3VlHM r2rvnpTJJBkPMKrmXLZ0Z2nz8RHeJ2lFTJJS2GpCsyi9QmpHLDqHSy2tocBD9a94gnXX 92IvebmgeiLQmXQubR7ES0L2K2+xc9OXYmZojdSIHx5IG2gO2eyhugp5e4EZDJpR1uGl CChHt9jbh6XOv0NZ6PsoaEAR75z25vfTfMkzENKJmFSbC5312x2TZPAzu2OZB8csVuKf sRh5PKhcQpcYFr08KkvZvhgDlr7CA0u6weqW2R0xZ2KuvaiUbqoWFu3/gBRWVKuMxs4r Gzvg== X-Gm-Message-State: ABuFfogb/bs5KTqLip/AexauIz8T5HWMfUdhrZ2DcKCn/uRSSJPQMocJ z2rRaY5D3+UBKFBnjs8HDTjMPw== X-Google-Smtp-Source: ACcGV63AVZN1e1UHiciRJACevTU85s4dyI3oLi6l675UID00+PW7/sACBRYiDcjYfxt4IYXNSs8MVQ== X-Received: by 2002:a2e:591d:: with SMTP id n29-v6mr1383472ljb.70.1538577530142; Wed, 03 Oct 2018 07:38:50 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:49 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 06/11] cpuidle: dt: Support hierarchical CPU idle states Date: Wed, 3 Oct 2018 16:38:19 +0200 Message-Id: <20181003143824.13059-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073854_952624_231123C4 X-CRM114-Status: GOOD ( 14.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , Lina Iyer , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lina Iyer Currently CPU's idle states are represented in a flattened model, via the "cpu-idle-states" binding from within the CPU's device nodes. Support the hierarchical layout during parsing and validating of the CPU's idle states. This is simply done by calling the new OF helper, of_get_cpu_state_node(). Cc: Lina Iyer Suggested-by: Sudeep Holla Signed-off-by: Lina Iyer Co-developed-by: Ulf Hansson Signed-off-by: Ulf Hansson --- drivers/cpuidle/dt_idle_states.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index 53342b7f1010..13f9b7cd32d1 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -118,8 +118,7 @@ static bool idle_state_valid(struct device_node *state_node, unsigned int idx, for (cpu = cpumask_next(cpumask_first(cpumask), cpumask); cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpumask)) { cpu_node = of_cpu_device_node_get(cpu); - curr_state_node = of_parse_phandle(cpu_node, "cpu-idle-states", - idx); + curr_state_node = of_get_cpu_state_node(cpu_node, idx); if (state_node != curr_state_node) valid = false; @@ -176,7 +175,7 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, cpu_node = of_cpu_device_node_get(cpumask_first(cpumask)); for (i = 0; ; i++) { - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + state_node = of_get_cpu_state_node(cpu_node, i); if (!state_node) break; From patchwork Wed Oct 3 14:38:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D758515A7 for ; Wed, 3 Oct 2018 14:53:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC13921EEB for ; Wed, 3 Oct 2018 14:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF11828D1E; Wed, 3 Oct 2018 14:53:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E46E21EEB for ; Wed, 3 Oct 2018 14:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=xSax/ILU8SfyhNXRDAKpNRN16TrieJaEuBVr587YPy4=; b=m2//MfsRqpzhG6raV0oX8koyQK pxEb1pUb1xJ2xFfccsIJs9/3aVnMUVPcXDinwFEnmffa6te6WWaQNeEqJ0Tiut66fZ0G9ZLW8c+pJ RPtHhpaYPiwO5qYs6iZZm0uXWuKI+JSOufi0R30eEpjFkmjaolV+D9VoiaPqn8dUhdJS0+VaT5cCH /TlcxBlgOSuEF7SCNP+gK2GVy24bz8TtAjjvyTXGC71+JB7Y7N/IcgZiNk33haq695yitgbbfg67v pe370KT4yr0BbokUQe9UU59YfIKlyHry2UDTgA9ttBrV5d9liaTfeS10vT+Vdx/nt9vzfC+L9QtEm 1hPkd9Gg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iWt-0006nx-DD; Wed, 03 Oct 2018 14:53:35 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIi-0006TH-JI for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:31 +0000 Received: by mail-lj1-x241.google.com with SMTP id u21-v6so5339382lja.8 for ; Wed, 03 Oct 2018 07:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=24N1Dc3/4aVSfatj0cCLPTM9sDMCdxo5zYgoCR5YTHc=; b=XjLORK1OYwzVBRY8kPy7QP/UtnW4VxCS18LStrS5+NaSElLf53WYhSsAeOpJRZ878b VqSg3YrZ+3izUx8IHKra0aZC8NThLEYOzlsrPV1UKUz850Cj11Hr//MXWdQh2hoGNqL3 G9+bkTyfOZHm7ZpL8euDuDaqLQg9V8vs/pk+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=24N1Dc3/4aVSfatj0cCLPTM9sDMCdxo5zYgoCR5YTHc=; b=Q0TXyBt/jX8XXarP+nBSK645XeKyP6GJgoxtas3gMemgVaQuRPnYziS4itI/PBs+yh 5hbxJRQQPbbcxqYXL5w5qCss0S/4pjxFC8SXLyBe7HRKaVo9H9DV/tlW471dzMcTiou/ z1PjsMS6NdJxdKZjVrA7/Bbvvw5zGL7TtKkSSsH+a2zsXp76rWVe3IjAfG40F1m922pX J76TUMHszVoTyJ412dO5bdC4DjPMN+DnsPrjpFlFMjHoFvqPtViqS2SZ+3VHe7YODD+x 4bLPIPplKy8qmllalDIdzhsZMOD5B/2CUon3FNlWgMRsDVAH5g+UG9LKs6J6GWNVRrv9 LzFw== X-Gm-Message-State: ABuFfohO/nbdmd5lYhYeaOlEEnGCtrXKGR+rK+Tt/GhSFaXgCwbdE2h1 wTWIIoKTDkwhkDyUJj516BdFZw== X-Google-Smtp-Source: ACcGV60MQ4bvS0UIONM4xmbNp7c8w3D3iNVTmeIbx24qsydvm8zeVD1SDHaFgQtHq/VCA7CWpui8zQ== X-Received: by 2002:a2e:90d8:: with SMTP id o24-v6mr1361712ljg.97.1538577532011; Wed, 03 Oct 2018 07:38:52 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:51 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 07/11] drivers: firmware: psci: Move psci to separate directory Date: Wed, 3 Oct 2018 16:38:20 +0200 Message-Id: <20181003143824.13059-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073856_733419_176A9C95 X-CRM114-Status: GOOD ( 16.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some following changes extends the PSCI driver with some additional new files. Let's avoid to continue cluttering the toplevel firmware directory and first move the PSCI files into a PSCI sub-directory. Suggested-by: Mark Rutland Signed-off-by: Ulf Hansson --- drivers/firmware/Kconfig | 15 +-------------- drivers/firmware/Makefile | 3 +-- drivers/firmware/psci/Kconfig | 13 +++++++++++++ drivers/firmware/psci/Makefile | 4 ++++ drivers/firmware/{ => psci}/psci.c | 0 drivers/firmware/{ => psci}/psci_checker.c | 0 6 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 drivers/firmware/psci/Kconfig create mode 100644 drivers/firmware/psci/Makefile rename drivers/firmware/{ => psci}/psci.c (100%) rename drivers/firmware/{ => psci}/psci_checker.c (100%) diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 6e83880046d7..923c42d5a2e6 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -5,20 +5,6 @@ menu "Firmware Drivers" -config ARM_PSCI_FW - bool - -config ARM_PSCI_CHECKER - bool "ARM PSCI checker" - depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST - help - Run the PSCI checker during startup. This checks that hotplug and - suspend operations work correctly when using PSCI. - - The torture tests may interfere with the PSCI checker by turning CPUs - on and off through hotplug, so for now torture tests and PSCI checker - are mutually exclusive. - config ARM_SCMI_PROTOCOL bool "ARM System Control and Management Interface (SCMI) Message Protocol" depends on ARM || ARM64 || COMPILE_TEST @@ -286,6 +272,7 @@ config TI_SCI_PROTOCOL config HAVE_ARM_SMCCC bool +source "drivers/firmware/psci/Kconfig" source "drivers/firmware/broadcom/Kconfig" source "drivers/firmware/google/Kconfig" source "drivers/firmware/efi/Kconfig" diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index e18a041cfc53..ea284e551dc8 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -2,8 +2,6 @@ # # Makefile for the linux kernel. # -obj-$(CONFIG_ARM_PSCI_FW) += psci.o -obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o obj-$(CONFIG_ARM_SCPI_PROTOCOL) += arm_scpi.o obj-$(CONFIG_ARM_SCPI_POWER_DOMAIN) += scpi_pm_domain.o obj-$(CONFIG_ARM_SDE_INTERFACE) += arm_sdei.o @@ -26,6 +24,7 @@ CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch armv7-a\n.arch_extension sec,-DREQU obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_ARM_SCMI_PROTOCOL) += arm_scmi/ +obj-y += psci/ obj-y += broadcom/ obj-y += meson/ obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig new file mode 100644 index 000000000000..26a3b32bf7ab --- /dev/null +++ b/drivers/firmware/psci/Kconfig @@ -0,0 +1,13 @@ +config ARM_PSCI_FW + bool + +config ARM_PSCI_CHECKER + bool "ARM PSCI checker" + depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST + help + Run the PSCI checker during startup. This checks that hotplug and + suspend operations work correctly when using PSCI. + + The torture tests may interfere with the PSCI checker by turning CPUs + on and off through hotplug, so for now torture tests and PSCI checker + are mutually exclusive. diff --git a/drivers/firmware/psci/Makefile b/drivers/firmware/psci/Makefile new file mode 100644 index 000000000000..1956b882470f --- /dev/null +++ b/drivers/firmware/psci/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +# +obj-$(CONFIG_ARM_PSCI_FW) += psci.o +obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci/psci.c similarity index 100% rename from drivers/firmware/psci.c rename to drivers/firmware/psci/psci.c diff --git a/drivers/firmware/psci_checker.c b/drivers/firmware/psci/psci_checker.c similarity index 100% rename from drivers/firmware/psci_checker.c rename to drivers/firmware/psci/psci_checker.c From patchwork Wed Oct 3 14:38:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7D171515 for ; Wed, 3 Oct 2018 14:44:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AC7428B44 for ; Wed, 3 Oct 2018 14:44:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EAE828BFF; Wed, 3 Oct 2018 14:44:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 406B728B44 for ; Wed, 3 Oct 2018 14:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2vMYuP04GP8HdQDm4wL+/Oy/7CzFxiwdJntWJSzPqks=; b=AKsL1iXafImVo1PUwaXOk95B02 wJY/Lt0KIfbVTftmGgIVM9da0h54NqwHjqhFjkSkza1Yr2/DJObpyAKovnu26Jw6dZvkgQGKEY5uK yRTS9sdXOoKwXpNzm6gKiw9MjK33kivUXf73YGwTDhK+uY4ZP+yAQ+fdun4EtFsRKJQZUJRHRMKDL XnEZUQSgoGuasytQI8EQ24/+h6G+O24/ZGhVugiAbWCHpE1Kk5GmFwAFV4YURjaDC7jL1dkLj59FN 7W7x9p2XTZzhI1B7QaQgIrPNZoPgj4TK8IbwStstjI2+WPxHZTe0tnpOgAql8d0RT3ajUIWj9wf3e xmxcMutQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iNU-0001T3-QQ; Wed, 03 Oct 2018 14:43:52 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIr-0006U2-6b for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:41 +0000 Received: by mail-lj1-x244.google.com with SMTP id v6-v6so5335137ljc.11 for ; Wed, 03 Oct 2018 07:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xjIfDLEOSbswJu1KU5trsLmIXoVIJYa2zHdFwxdeDkw=; b=U3C1wZIbccVX95gm6USfQzQ0KIFAGQLNCGJxAHczc0sW6zurvyAsLwcGQZKmye94yN TdWwdXGnFiIhk1GqGfBo5C5OXqJxbyB6FLYPahHeGXQqpmvMfHYQmFd/aPsdOJCaEB4I rxHYsizpoJLG7SeQHX+4NEJ9kXI/taVpgxH1c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xjIfDLEOSbswJu1KU5trsLmIXoVIJYa2zHdFwxdeDkw=; b=NoqHIk3LG482mTuqRpaf5iTafbyMaPcewsUjIlYMKny2fakz+UI5F47ok7uRxCdcLv bPVlsPIY2WiqxSjqF0IC25wQhGmieer/HIe52+X2Y0Pm9yJPiJGc9YNrp59VNmTGSpVF rTk2AbJFS3obJW0JPMSFrs0Fzx4EwYWtXxvnL4KL3ESicV5I19rrK6Eu7PAF2nSWxaMv uo8FS8DgQln0U+9hsXE9BPUS1j/l3itd1PBR5WLr9a1DQ/1jKaxNXxvY972Rsgf648ka qrAcqZSr1q0cpMHnsagyI5mdoNc3JRFlNytWWkGiM+7/DkTbr1LxPYkojIxOVN8Tc4wk RigA== X-Gm-Message-State: ABuFfojROid1YJoTi9zBtNV7XllfpSHJ/JW0Of8oq3WuoR7VyN/h3BCA og+C8rNsV8O5dy0Cq0iLhelcnw== X-Google-Smtp-Source: ACcGV61z6YccPbjrV9ap4UqG6C7FdyslfItrbDmr+r8uVsqkpaonCiN5ShavWM01TG7ypXVgx40HvA== X-Received: by 2002:a2e:9c59:: with SMTP id t25-v6mr1431593ljj.107.1538577533544; Wed, 03 Oct 2018 07:38:53 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:52 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 08/11] MAINTAINERS: Update files for PSCI Date: Wed, 3 Oct 2018 16:38:21 +0200 Message-Id: <20181003143824.13059-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073905_339777_34556E39 X-CRM114-Status: GOOD ( 14.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The files for the PSCI firmware driver were moved to a sub-directory, let's update MAINTAINERS to reflect that. Suggested-by: Mark Rutland Signed-off-by: Ulf Hansson --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index b22e7fdfd2ea..710b906037ce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11624,7 +11624,7 @@ M: Mark Rutland M: Lorenzo Pieralisi L: linux-arm-kernel@lists.infradead.org S: Maintained -F: drivers/firmware/psci*.c +F: drivers/firmware/psci/ F: include/linux/psci.h F: include/uapi/linux/psci.h From patchwork Wed Oct 3 14:38:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57DAA1515 for ; Wed, 3 Oct 2018 14:44:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4906528B44 for ; Wed, 3 Oct 2018 14:44:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AD1028BFF; Wed, 3 Oct 2018 14:44:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C5E3E28B44 for ; Wed, 3 Oct 2018 14:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=xtgdOB3X5VGaLdtpHxTFcMHR04K9mrSdm1FSgYt3Ft4=; b=RB0sda8eOR7qLjbjBJfD5mmpGa ME+mJWhhtQAN24+ieupQU74uNc4xfhonTijNeDX1AwrukmVCLqgkZJXBQxMOZRjSaXcyzfwhCCwY1 CygtAPYMpyTD+cbeYhK+8w/aWTCktZiX6hMgcY7fLEBhFdHmOQXUfYCwk7sQeoNQs+ICEdWoE4F3k gw5wmbziHd1oRVvZH5dpYB5Ss0HfGny9GGw6RnteMznBA+W31+DD4u016594Q8rkYMY7Ct50MygFw vO8w1zc+pTrtBxWLR6iaXg7m5Ki6PfkIuI2X/U7U9O3Zoc2PmzONQZtvg0Y+TAjoDTZDr0etVjAHc nOafBVqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iOB-0001qx-4N; Wed, 03 Oct 2018 14:44:35 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIt-0006Ut-FF for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:48 +0000 Received: by mail-lj1-x243.google.com with SMTP id 203-v6so5314275ljj.13 for ; Wed, 03 Oct 2018 07:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=60U5bRPKDKJyHR17D5TYGPWZf08eZgljN5hkHwmsDUA=; b=desWZW6kZm9MoHxRhIgV19z7b6BH/QRJ2OPUabhMbRjAACBRrfdos4w49U1tyBVfGU btwLt77IkDaYsTQprkKZB1Jo6BKOJEBmqoiMiLWXNOB/lsM+gjDCj7a4GLIbRSb9OZ7Z h4CEgzpdwfkr4cOrcZUV5LUdctmd0wy/Ld3kM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=60U5bRPKDKJyHR17D5TYGPWZf08eZgljN5hkHwmsDUA=; b=A3VP+D48xi2kxwdrLZOBSoOiJPnqdWIZo8JoZXklDian/KNrwJtqQgKPyoRfvDU7BQ hnH61zVvZf4yNkGApUF8uxLfbsWKAEh5fAF0zB/MR3o2QasBwr7E2MwzTIKfrHW7y6cu w7DECDnbihSz7HornIZxRfGSVfwTqjy6WNFPnqnuqhX6E9ZIxvspW/0iLAoQtyJslPB8 D+bM8MweNqN8t3oXwcYiNM/6lTHTwW6hxt/TcFgz2zeSriu+O3kPNf17bUWIwGCRCoHW 1FLQIPGdUqYoigfgzC8pRXHrJ46HJEhuX2WZWWqcFdEfVfwY44NMd9jYAAYDXxWHPt2e PnBg== X-Gm-Message-State: ABuFfoicbabmLds7/TrcYsJOPfdQ5KuEzfvlOGdDylll+MQyScpUIbiT asrJIzgIHtWWnhnXAFgxwsgeLg== X-Google-Smtp-Source: ACcGV62eYUZ0f1Bynmiavxa68k4auoEEG8yZecIQWETDoD832ixenFDZHZdEHJxZcAlphUS5fEAo0Q== X-Received: by 2002:a2e:7f14:: with SMTP id a20-v6mr1338534ljd.148.1538577535185; Wed, 03 Oct 2018 07:38:55 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:54 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 09/11] drivers: firmware: psci: Split psci_dt_cpu_init_idle() Date: Wed, 3 Oct 2018 16:38:22 +0200 Message-Id: <20181003143824.13059-10-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073907_581398_68A553E7 X-CRM114-Status: GOOD ( 17.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let's split psci_dt_cpu_init_idle() function into two functions, as to allow following changes to re-use some of the code. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/firmware/psci/psci.c | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index c80ec1d03274..9788bfc1cf8b 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -270,9 +270,26 @@ static int __init psci_features(u32 psci_func_id) #ifdef CONFIG_CPU_IDLE static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); +static int psci_dt_parse_state_node(struct device_node *np, u32 *state) +{ + int err = of_property_read_u32(np, "arm,psci-suspend-param", state); + + if (err) { + pr_warn("%pOF missing arm,psci-suspend-param property\n", np); + return err; + } + + if (!psci_power_state_is_valid(*state)) { + pr_warn("Invalid PSCI power state %#x\n", *state); + return -EINVAL; + } + + return 0; +} + static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) { - int i, ret, count = 0; + int i, ret = 0, count = 0; u32 *psci_states; struct device_node *state_node; @@ -291,29 +308,16 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) return -ENOMEM; for (i = 0; i < count; i++) { - u32 state; - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + ret = psci_dt_parse_state_node(state_node, &psci_states[i]); + of_node_put(state_node); - ret = of_property_read_u32(state_node, - "arm,psci-suspend-param", - &state); - if (ret) { - pr_warn(" * %pOF missing arm,psci-suspend-param property\n", - state_node); - of_node_put(state_node); + if (ret) goto free_mem; - } - of_node_put(state_node); - pr_debug("psci-power-state %#x index %d\n", state, i); - if (!psci_power_state_is_valid(state)) { - pr_warn("Invalid PSCI power state %#x\n", state); - ret = -EINVAL; - goto free_mem; - } - psci_states[i] = state; + pr_debug("psci-power-state %#x index %d\n", psci_states[i], i); } + /* Idle states parsed correctly, initialize per-cpu pointer */ per_cpu(psci_power_state, cpu) = psci_states; return 0; From patchwork Wed Oct 3 14:38:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5948E13BB for ; Wed, 3 Oct 2018 14:45:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C3F328B44 for ; Wed, 3 Oct 2018 14:45:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4004128BFF; Wed, 3 Oct 2018 14:45:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C505828B44 for ; Wed, 3 Oct 2018 14:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1+3aPElgAlqTm+Dj8fE4yjOiLjeXr+vGg4YvnQo2FEg=; b=esUOI2Bq0nha5W274g5ojLc1Q5 e/gzOBU9EXU5J7cQMPVYkKVidYDEh0VtrS0ERAzfCofp6jiBK3Xu+dwi0nTk5W6JVpY6slOIsy/c7 +7EPMFneFoqwn4Z6I4imhYOxIHtMG6pV2awk4cx7nFb3vpQHkxpQgBlBcbqoEZXjMTGoSTgIHlygb b05ytOD8anbXRWMkzGF4orAFyoeXGNyxbh/wqOZ7VIsYzso9EDK0IMZc9ySG+U2vm3mv1/SLy0FL9 UL1If5AChmBHX3r957UqgIQHgHFitr+MZ+GTwxGMDOejDSYbxKTaoJxfslI5JhFNK3EgnaoIzWN3c 54H+c7IA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iOx-0002eY-FA; Wed, 03 Oct 2018 14:45:23 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIu-0006W1-E5 for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:39:48 +0000 Received: by mail-lj1-x241.google.com with SMTP id f8-v6so5366432ljk.1 for ; Wed, 03 Oct 2018 07:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3WUKn2dvevp+IRdH7T6aKSOygQUa+Gx75wLOTzgVKrQ=; b=HckMrUezE7fEmusY25qeIMXC09B5MKn2lggvEGrfhbXvyprgkkZsbk7mSbfl9OS+39 PyEOZG79GlLGsAnHWfz2AlLsFCJdLxauI2i2sQj9/26x5rW7kQtlBpWOut+Ow7BI/pST hDY8lQaAmmvARDGOc0V/ih3wyyznRhC1IGRM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3WUKn2dvevp+IRdH7T6aKSOygQUa+Gx75wLOTzgVKrQ=; b=fsLKbwLATh4GRDS+IAVr1cfEwPMNI1clWSN68Jk8+hDgp1IOMMiaJQZnsh65G77aQh DN0nApuFwDyBQuMzA9/oPi2lyX/Xs9VZWqYaIEqY8soj7Kbu7F8Q1oqeG4GN+9Br2kLB Ufl836l2MTxlX2p8dXCXNldNxNPDTn4S+G36zvaMzXjioC+LLUIVjlXmAAhQuBeXuPbp dzpJlTqnsXTsZMKzDJ5FFzzQjASXAEHTG4RJwSpGr5bMICOWaT33PNLEFZ40QEa94ZRQ o45CoAs3JCS9LzhGWPSwwBBESkl52dRbzZtsktPU+PpX2tS8HR7Al2dMD1vevTGHsx7u CHPg== X-Gm-Message-State: ABuFfog1RHdbgoXf7qRC2IlnivTx4Ug2nWVkYySQt7nrp5OmHQKtV68+ TeaqwHDK4CQlbRDZ9aRMTjqZqQ== X-Google-Smtp-Source: ACcGV62S/kE0nzS+/14hY0+pwMhcgKntySwtELjwoN11ELXKVw3eYUQRrI9eg/ZW2gbrfOGyyqP2qw== X-Received: by 2002:a2e:86ca:: with SMTP id n10-v6mr1531860ljj.90.1538577536631; Wed, 03 Oct 2018 07:38:56 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:56 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 10/11] drivers: firmware: psci: Support hierarchical CPU idle states Date: Wed, 3 Oct 2018 16:38:23 +0200 Message-Id: <20181003143824.13059-11-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073908_563846_E8C68471 X-CRM114-Status: GOOD ( 14.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , Lina Iyer , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lina Iyer Currently CPU's idle states are represented in a flattened model, via the "cpu-idle-states" binding from within the CPU's device nodes. Support the hierarchical layout, simply by converting to calling the new OF helper, of_get_cpu_state_node(). Cc: Lina Iyer Suggested-by: Sudeep Holla Signed-off-by: Lina Iyer Co-developed-by: Ulf Hansson Signed-off-by: Ulf Hansson --- drivers/firmware/psci/psci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 9788bfc1cf8b..256b4edbb20a 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -294,8 +294,7 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) struct device_node *state_node; /* Count idle states */ - while ((state_node = of_parse_phandle(cpu_node, "cpu-idle-states", - count))) { + while ((state_node = of_get_cpu_state_node(cpu_node, count))) { count++; of_node_put(state_node); } @@ -308,7 +307,7 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) return -ENOMEM; for (i = 0; i < count; i++) { - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + state_node = of_get_cpu_state_node(cpu_node, i); ret = psci_dt_parse_state_node(state_node, &psci_states[i]); of_node_put(state_node); From patchwork Wed Oct 3 14:38:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10624977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17DDF15A7 for ; Wed, 3 Oct 2018 14:46:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D11528B44 for ; Wed, 3 Oct 2018 14:46:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F421F28C72; Wed, 3 Oct 2018 14:46:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5BFB828B44 for ; Wed, 3 Oct 2018 14:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XcltIZ2HccTOjkQIkwcvcpanyVNIwgZgcClFlw1RrhQ=; b=qSad6rcwXJfXCVVUcSP6LfGFqN r6s+SNbvyz00uEhRzcyCfEsYq2KBG7uwqEJD6UStKjBMuZgVpCO4PrRfDYj0GwNRHLa6OddBzkzhd cufXfFgo0yHy9URKS9h9+fXEBaT6Os0U2Y15GyODNtLswsFwzsNZ0tMGKoWsqyq8O0ppAqEVICyrI xztHzmWrbrTKdhCL/BhXrIDjHNjc0YydIkCuCDHBAxMWzaY06cji3OV3G3JiDkYdDZw7MTIVXUpYq 62EZ3wTIVYFaVILC818Oz1Xv84yZGAVl0o5vdkDOOStA++EkXbr9ktnzg0g0o6R+qVoYy6L0l7sL3 mfb8NHGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iQF-0003ry-HC; Wed, 03 Oct 2018 14:46:43 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iIw-0006X2-9x for linux-arm-kernel@lists.infradead.org; Wed, 03 Oct 2018 14:40:05 +0000 Received: by mail-lf1-x142.google.com with SMTP id m18-v6so4313277lfl.11 for ; Wed, 03 Oct 2018 07:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TjQPuSPVMZIQ7LGnNwV9hx0MvmHHDvnmuj1+IqpIlaE=; b=H0bYXmMhr8euPxdBpNA9AnsaYn53qUB0wHQFSrgL4hE63SPaGSrM+bC/pMemM+dLTN py83DMk+1hfKAd+qyzkiu7hbKNlnKXbxAjm3A6CitXadRIugK3gAq3twnJdizU/V0oKe 4Zecg7CXLZJ8Q7RDZXZR3GMnGDF/iygCBUGfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TjQPuSPVMZIQ7LGnNwV9hx0MvmHHDvnmuj1+IqpIlaE=; b=c+Hj72elm4897g6I5UWuD6RIVyAga+YdjLWupdbzDxPHPcFaWIR4mfbeu4jNrdRSND LbqaGlwVDT7DV+w2sSTgaKc+moafVzXrmTZHmkowoOvIXqefbtWD6aWEaLfIiY4Qjadh B/DJujzc/RRu6XnUztGDqj1bi/q/y52GwIP+v+uUKu+7GELXSiOxpfImJx7W3C6BQT5s 2UiokTwHfJu76EK+qKOmG83mSTXn8oIjH6C1ySqZLPB1uLmeuOr7oZ2q2P3TpuJkPu92 NftsqNdDlOZ8Emrr9mcOqUm5748hoClfJrQpzlsFkHGYNkBsjY28UhF4+VJXsRFyVe3d s/6w== X-Gm-Message-State: ABuFfoiDtP+PCPJn3tPlsLMHxK040fi+IZumVTbEdekg+FvxrmGgAppu w2No+BldSqcq+Gwf+yXr/6YUSA== X-Google-Smtp-Source: ACcGV61f5JUyC6umbYRFx0mdAKGPXSoeFi5/0BwWrS2NmAnUsu6nhSdb24pQow20ow245IggCVsDLw== X-Received: by 2002:a19:ca09:: with SMTP id a9-v6mr1159446lfg.149.1538577538176; Wed, 03 Oct 2018 07:38:58 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id 18-v6sm380867ljo.74.2018.10.03.07.38.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:57 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v9 11/11] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Wed, 3 Oct 2018 16:38:24 +0200 Message-Id: <20181003143824.13059-12-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_073910_387823_CBC3CD43 X-CRM114-Status: GOOD ( 16.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Geert Uytterhoeven , Kevin Hilman , Tony Lindgren , Viresh Kumar , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of having each psci init function taking care of the of_node_put(), let's deal with that from psci_dt_init(), as this enables a bit simpler error path for each psci init function. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Mark Rutland --- drivers/firmware/psci/psci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 256b4edbb20a..38881007584e 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -608,9 +608,9 @@ static int __init psci_0_2_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; + /* * Starting with v0.2, the PSCI specification introduced a call * (PSCI_VERSION) that allows probing the firmware version, so @@ -618,11 +618,7 @@ static int __init psci_0_2_init(struct device_node *np) * can be carried out according to the specific version reported * by firmware */ - err = psci_probe(); - -out_put_node: - of_node_put(np); - return err; + return psci_probe(); } /* @@ -634,9 +630,8 @@ static int __init psci_0_1_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; pr_info("Using PSCI v0.1 Function IDs from DT\n"); @@ -660,9 +655,7 @@ static int __init psci_0_1_init(struct device_node *np) psci_ops.migrate = psci_migrate; } -out_put_node: - of_node_put(np); - return err; + return 0; } static const struct of_device_id psci_of_match[] __initconst = { @@ -677,6 +670,7 @@ int __init psci_dt_init(void) struct device_node *np; const struct of_device_id *matched_np; psci_initcall_t init_fn; + int ret; np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); @@ -684,7 +678,10 @@ int __init psci_dt_init(void) return -ENODEV; init_fn = (psci_initcall_t)matched_np->data; - return init_fn(np); + ret = init_fn(np); + + of_node_put(np); + return ret; } #ifdef CONFIG_ACPI