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: 10624913 X-Patchwork-Delegate: rjw@sisk.pl 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 DA2691926 for ; Wed, 3 Oct 2018 14:38:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C87C228AF5 for ; Wed, 3 Oct 2018 14:38:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBCB428B0D; Wed, 3 Oct 2018 14:38:48 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6469E28AF5 for ; Wed, 3 Oct 2018 14:38:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbeJCV1Y (ORCPT ); Wed, 3 Oct 2018 17:27:24 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:35007 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbeJCV1X (ORCPT ); Wed, 3 Oct 2018 17:27:23 -0400 Received: by mail-lj1-f195.google.com with SMTP id o14-v6so5374138ljj.2 for ; Wed, 03 Oct 2018 07:38:41 -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=SpVdTh9N2efi1dzdlDpqj0eBIoY6ZWg9t9EkwWj/Gj582ZcIOXeBIrsLlUxjm1xPfl nqDtnnwtI5+k2BmYZRsWmxgQ4nyK7Y6nfoRA0/4SujrFs4xJ/RoyE0pyd3qwJi0NfuxP rUSO5p7FHhSAXUcSg5BckTpQssdJN4JQbv5A0PiXLSRFq7QwxqAPHS2IG464x/8sNl8b v8mVzBid4QfPmKmYUWyJEKf0oLBvGKjtVcy2mKywQtTCQk72vbrXLkfPl31LcKsU2esH ruhmhwGHarngFlxpb/X4LVJw1p9wgzxpPz3aZNuwZZkHZQHmj78yyGc8e65XQHkOGQLW 81Og== X-Gm-Message-State: ABuFfojRhOVOWtjcjvCGG88z3R7F7jZel6NaNVwX9co8yqZmOnS91z9t 0sV57GlCmFKwQGbwIiLQyZJcAw== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624911 X-Patchwork-Delegate: rjw@sisk.pl 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 39EAA175A for ; Wed, 3 Oct 2018 14:38:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28A2A28AF5 for ; Wed, 3 Oct 2018 14:38:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A78F28B16; Wed, 3 Oct 2018 14:38:48 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9A1728AF7 for ; Wed, 3 Oct 2018 14:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727016AbeJCV1Z (ORCPT ); Wed, 3 Oct 2018 17:27:25 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45777 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbeJCV1Z (ORCPT ); Wed, 3 Oct 2018 17:27:25 -0400 Received: by mail-lj1-f193.google.com with SMTP id j4-v6so1570871ljc.12 for ; Wed, 03 Oct 2018 07:38:43 -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=LIcFMm0m4yuKE1Ugm4pIxvCLIVcJPg37c/SE53NAkukF1mji+c/5GHX75i+FmdD744 43ZwAYN4Yp7rM/rjjin2CRu7DQJI+nmHWvaQ0426Xf4l1/f92m/QlzE91bY4WA6UM5Ty UvFzDUXAep4t8jrDensVSsWBjIhs3rmTW3M1AwICWEj6xyn7kZVhrvZA/wjw87Rr6uR3 CzvRy5YmazJblroghYb9LNZysv9oSCbxvJB6zBiGfApD9Smoivu19uPjalDw7mBNhlnw 3COdmbTMvRRezhOmJJJ7lR56apHsc8rfggAS19VFb3zh5QEMZhRjxbEUMf4f1dqTmDsY 5y0A== X-Gm-Message-State: ABuFfogT/+aeAc5WEWfjOdS5tDqlMiV4K1rQZitl0okIv4SJxhBaeStm fNkg8RWo4MLLeJV+6Xy6wXwiCw== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624951 X-Patchwork-Delegate: rjw@sisk.pl 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 694F314BD for ; Wed, 3 Oct 2018 14:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5587428AF5 for ; Wed, 3 Oct 2018 14:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 459D128B13; Wed, 3 Oct 2018 14:39: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D793E28AF5 for ; Wed, 3 Oct 2018 14:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727143AbeJCV11 (ORCPT ); Wed, 3 Oct 2018 17:27:27 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42362 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726966AbeJCV11 (ORCPT ); Wed, 3 Oct 2018 17:27:27 -0400 Received: by mail-lj1-f195.google.com with SMTP id y71-v6so5341871lje.9 for ; Wed, 03 Oct 2018 07:38:45 -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=NyCapqWo4mZhgcWbUiqjBBaAgHTH6D/VdADLHkIfWx0akIHWdmXlDLeLOEVas19Xxr BEejoauq6fUY/7beLIF/uX7QfrE8e1jPzah0YVznOZyclfpk1uNmvBlRtdwSclI0wiAH 2Bbdd9bakY9pqslSFRGqnJTW2Oy95VDSkYxWxgtPTOjiU2dSN+GNtBmlGfp1ZT45RmTW tM0T8d6WQB/YnngrZsz3OFthL7I62Qx5O/X+7xnXhWj1p1IHRwCrWx5vav6eYHBIllz5 t3PwZnr3i57GA2eQ6VPqjsqQG5BIE2vlbp2oc9ZrBkUWGcSPQBvNiYKiMv97GtjBJZtO fPYQ== X-Gm-Message-State: ABuFfohNJtiRyhbUGgTVg5ohaOGaVkQTA29X9wieKuOlcBD/btOQBoob URbs1zk9MBtcYvlHtitJpXspGg== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624949 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 87B8615A6 for ; Wed, 3 Oct 2018 14:39:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76EBE28AF5 for ; Wed, 3 Oct 2018 14:39:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69B9028B10; Wed, 3 Oct 2018 14:39:40 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D68A728AF5 for ; Wed, 3 Oct 2018 14:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbeJCV13 (ORCPT ); Wed, 3 Oct 2018 17:27:29 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:37717 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbeJCV12 (ORCPT ); Wed, 3 Oct 2018 17:27:28 -0400 Received: by mail-lf1-f66.google.com with SMTP id a82-v6so4339219lfa.4 for ; Wed, 03 Oct 2018 07:38:47 -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=Lghw+sETx24HfDO6/4YQ+HTokuzblJxOlA0eVbZTJs9nDE7B/2rFBsU08mwIKPuaFu YxfDFhXwPxO8UUHtMET5Y0lGzCfp/klq1YlHzZbmMfaEdioQBUI/KtLguxYD9pBRiT+d ppptkg2p0HBCCnnRnKlKbLu96sFl/V3yinyMjHseVVnJDGySGmaawATkzH4li5mQBkeE JeknkFW3gVBc56uSAwUQO8a39A+cQRimaCQCmAHoWeuLyA1NihFvJOna1eeZil4A2iMf u8UD1uJjyVFw1C2f0HN77woMlWamY9nExuyshdIF2vOd9qH6a7dxd2rpbrSqmCQUqt2g Hg4g== X-Gm-Message-State: ABuFfoiwFKxWPHNWP7Qe+espoktn8qKqcNu8F4/X2/HEoiH1EGeH5ROk MBN23ZhEC827p04WK5/SrYKZIA== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Lina Iyer 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624919 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 075CA16B1 for ; Wed, 3 Oct 2018 14:38:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA54C28AF5 for ; Wed, 3 Oct 2018 14:38:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE1FC28B0D; Wed, 3 Oct 2018 14:38:53 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A98728AF5 for ; Wed, 3 Oct 2018 14:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbeJCV1b (ORCPT ); Wed, 3 Oct 2018 17:27:31 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42367 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeJCV1b (ORCPT ); Wed, 3 Oct 2018 17:27:31 -0400 Received: by mail-lj1-f196.google.com with SMTP id y71-v6so5342070lje.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=H2kmN1dh6XA1HA8wyhQOi2RNL8xlnD7U3us6SBozpDq9zLdryrK5SLzIkYfQSqWjLS yiczqx6omDj9YL6P5nwr+q2SLOW0VAGvYi/MDio05HcfPJZwNrLMdtxcpWpalG9nSidj xUgBXhDnBH32Z7TOKDYoT2fQz2Qzcs999uZh0I9LxI14mWxRYf41PSk5YMTN+qbQyapt DQzKm7iRpIeKaF6hzMAVW2oYX264mlFLP1imSUV+nyhe6NVbNA9foHNU2xmKmwoGKXc2 syudcVo4WMhezSMOTa7hEPL0zT7VeT3tN4YMUes67wpMzYh+C4pTmnTXETUvaQicBBDp 2mqw== X-Gm-Message-State: ABuFfog3w3U6Omy22QmduDrU3VO+by+5s7CRnyNqLwhqpWK6US//lBGS QWQBXr9daw6OQ/+8fD5UuvBS1A== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624947 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 4BC6415A6 for ; Wed, 3 Oct 2018 14:39:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39DDB28B13 for ; Wed, 3 Oct 2018 14:39:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D7D628B10; Wed, 3 Oct 2018 14:39:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2FEF28B10 for ; Wed, 3 Oct 2018 14:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727353AbeJCV1d (ORCPT ); Wed, 3 Oct 2018 17:27:33 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42369 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbeJCV1c (ORCPT ); Wed, 3 Oct 2018 17:27:32 -0400 Received: by mail-lj1-f196.google.com with SMTP id y71-v6so5342162lje.9 for ; Wed, 03 Oct 2018 07:38:50 -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=HFMCzegujcMc5wGb33ukkoArpu9EDUYuV4Yq4FKhLLD5TD6HV3FoJpUrICPtpP3nMR QgU5nTMszf1hLCyAvKJz9uxQzDxrpZQwDDAZA3wnTjqIIbv2/xzzHN5S8/zHq2Gsrx49 9z3sjBsAU5sPWOu3jcVHNl8Cywilj7bVP5hI6lDd9Tv8Ja5NHfNPQQqj3bCscFdRILVI 3vmrmq5AlmjIzdgYIJp+Wy5GuiKiBCegJmD2Sxd0XvsYtqC38mX3oV/KtlUM+3Spbrkv Q+pd1jNUc4VYKSU7y9xIBJqqeKPpyGeXuhBX3RSamZofa9iQrC0EZryQt2k5T1Mq/ErZ ZbKg== X-Gm-Message-State: ABuFfog97Z2FK9RsUc7RLZuyB3CO/VafX4+dJQCP66V/T1yhGNLyy9QN IZjeqRYYGqkKyofaqAQCD7RTlA== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Lina Iyer 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624939 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 1C5C415A6 for ; Wed, 3 Oct 2018 14:39:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFFA28B0D for ; Wed, 3 Oct 2018 14:39:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00A8628B25; Wed, 3 Oct 2018 14:39:27 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8625528B0D for ; Wed, 3 Oct 2018 14:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727443AbeJCV1g (ORCPT ); Wed, 3 Oct 2018 17:27:36 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36228 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbeJCV1f (ORCPT ); Wed, 3 Oct 2018 17:27:35 -0400 Received: by mail-lj1-f193.google.com with SMTP id p89-v6so5363335ljb.3 for ; Wed, 03 Oct 2018 07:38:52 -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=h32gEPcc080LFd4Ayq9D9zphDuzmIDREzRlWVnP0Cy6yqXBvkIl8ophIuQUBPVR5JW gP3nsiv9LkwDRDJF6dCz24+c9MRkwjnUEuro/KXsd9z1HqZ1pSYmkdpwsflns5KtQAY8 vkadSj73KEnu3M/ZPFqcssISwF+AL+txQ39SEAetxVjkj7Q++Ky4aXQsr9B13NPfiPpA XTz4WrhIOsQ1ML/t3JOuPIv2xLBLbmMyDa7PyAgIt4tksjSHIzO02MdB+HH96LeE9Jmz HVCUvk3dVqKPmEA271kcVLH3OjViUk9i1MmA/8ZveIgKw0nnQs2pTPaKvqGItn6Zh1ik +S7g== X-Gm-Message-State: ABuFfohfa4sAK23sDi7TqmOvuwW1suQGbB8C2i7WugkYf9kAAYM498aL UMLaKJDUzx74SDY6xGItHbfZag== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624941 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 25AD216B1 for ; Wed, 3 Oct 2018 14:39:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15BD128B10 for ; Wed, 3 Oct 2018 14:39:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09EED28B16; Wed, 3 Oct 2018 14:39:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A117528B10 for ; Wed, 3 Oct 2018 14:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727429AbeJCV1g (ORCPT ); Wed, 3 Oct 2018 17:27:36 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33683 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727422AbeJCV1f (ORCPT ); Wed, 3 Oct 2018 17:27:35 -0400 Received: by mail-lj1-f194.google.com with SMTP id z21-v6so5366866ljz.0 for ; Wed, 03 Oct 2018 07:38:54 -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=LzY/Fjqdr1FK1Ca7jyzhtS5QMBPUx1y6+iyJkPKe7XAzDv26pGi6DiMvMFtpKH0MC6 oV20K9I3MjiB26PCUenkZkkcuvLXlDQZC/IK4MEjkRUMz7gDX44Ob+m6i6E5DojdaLBX IQse2H37FF+vKHuRr0biZZUtZZwm5QdEVqjG3/T73uq3C+3MpriT0+ulLWZ72uu8O3eP revV7jEg24HPpQ09sa68RXn5cKj7sWTCgQpgShWRdP/eC4ujmdIDiIi/90ttNkhDu5de 41lUB9vnW7IAVZ89khPtRTsHvD6f8NPWhs1qC0YnstYR7DNxEGvFc32keshMBhNTagKA 7DFA== X-Gm-Message-State: ABuFfojCCupDKM5mlfOP9qgN+CLJjBFcI5sw+bcXmr/h0rPAedtJqBOl EUtBfKfn9UO5vkSFPo8j258jpA== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624931 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 8215016B1 for ; Wed, 3 Oct 2018 14:39:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F99228AF5 for ; Wed, 3 Oct 2018 14:39:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63F2C28B10; Wed, 3 Oct 2018 14:39:22 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0862028AF5 for ; Wed, 3 Oct 2018 14:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727428AbeJCV2B (ORCPT ); Wed, 3 Oct 2018 17:28:01 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35031 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbeJCV1h (ORCPT ); Wed, 3 Oct 2018 17:27:37 -0400 Received: by mail-lj1-f194.google.com with SMTP id o14-v6so5374913ljj.2 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=PU7G+8k2j6AkADj7knuAKPS05Jrogz4hYDghgNgI/hcboqxssYyRdG5MfIl5mJZFWV S7TWUngQw7Hv2AVbHXQOcggJ7mr1DaGZdlu6Q1qpJHA1CAqTJMUYlEY7ThGWYtO4geJS RRLK/++HcirWpbaQOYGnMPFJs77hW8DEq+JQcMqsbysvlJ0/SvxoBe2nnw/XB9OcVXpJ AZ6WKI3RtBVMocVKVG/5RoUHi6IFYhoS7xCtUwGOsLmr2xiSGu9dBrSfeN0skFOmeOmK YT42M6PdBzJuVmqpQMMOFEuOmjWcLsdTOVzLvFgAJrrtvawEWkaOXSJ7pzATWGwOIwY2 EzYQ== X-Gm-Message-State: ABuFfohwptsOfI2LHQeLgni1t8wNUrIwqzcOjUduRMqGEc2liYJqjdB0 ch+ywGnQdd1hNNvZ5R0qCaBUDQ== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624921 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 2E37C16B1 for ; Wed, 3 Oct 2018 14:39:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B22228AF5 for ; Wed, 3 Oct 2018 14:39:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F84C28B0D; Wed, 3 Oct 2018 14:39:02 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A946328AF7 for ; Wed, 3 Oct 2018 14:39:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbeJCV1k (ORCPT ); Wed, 3 Oct 2018 17:27:40 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46870 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727486AbeJCV1j (ORCPT ); Wed, 3 Oct 2018 17:27:39 -0400 Received: by mail-lj1-f193.google.com with SMTP id 203-v6so5314355ljj.13 for ; Wed, 03 Oct 2018 07:38:57 -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=jab8rIkfxbvFvmgafc6ri3EGz+1KQiS14nHFU9LhzxRPypxYPUj5eGGOngraeoJaOP M0ruEdXkDy1gpy4+tKEJjb6woRdgnjCx9XHXw2PSp+ucg7SHkUEnIRqg7oPKUjeOZxJ2 v2J3Sj1FslM1R+nsv60u+r1RFvCf1WPVuMwXM6vs3VtGvweKt6QbHUpf/q1dmuz96zur hL0u0wroyHJoN2YhxW3F5wKZzoAp2thfqitBCc+qrLniqx6hi9jK5KoRlnQXyFlEZTJX anJ4awaRO7Aj+vZnllbmachyd12yYMq2Fnhtob2TTay2HBLYtBXkW97c3lE2szN88pjJ zYmA== X-Gm-Message-State: ABuFfojwRaJLxFe5rrBYoBgnyhAZNZNveiFH5e62J3QHR+K9e5ZcfCiQ poTUqQxi/RezE+GxPru/+e/lOw== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Lina Iyer 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 10624923 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 10C6A16B1 for ; Wed, 3 Oct 2018 14:39:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3D2028AF5 for ; Wed, 3 Oct 2018 14:39:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7E5128B10; Wed, 3 Oct 2018 14:39:04 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A39128AF5 for ; Wed, 3 Oct 2018 14:39:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbeJCV1n (ORCPT ); Wed, 3 Oct 2018 17:27:43 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37731 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727532AbeJCV1k (ORCPT ); Wed, 3 Oct 2018 17:27:40 -0400 Received: by mail-lf1-f68.google.com with SMTP id a82-v6so4339640lfa.4 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=ChvpDpAsKt/lNCU51TiFIxPbKCBtPbAClJlGFGm0vZO7NBAEmbnK27p0y4NxjSGTSH Z1McaLmN9D5RpAe2WosqLkpFO1+m3b1sFKKw1m3cJh6YBeso6XGoyo93Gui1SGm7no8n Q5l5VZhb69P/6om7W+du15uX3KHzJLWpWszZkiBCXRFk05b1c39jPPbN5H4UQEzqwZow vjnTepHuJyTeiplCURpPX8FYF+pWUlwiZ0M9IHz40WKod0SmxUW0L9R5ZD3N7wkay6M4 tOHQlWqtmYpFnRPj60T9sPM73jrSneu3k45DM7aXduewcDLMGdyYr21DG8FrivvkMgh+ UQxQ== X-Gm-Message-State: ABuFfogLvm+1PPrc8giGMBCFcbl6i/KkBIX236iiLR2vsFheWtKwtVrE jME6OrI/zOG7P/5jyYk6ayRtew== 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 Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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