From patchwork Thu Feb 27 12:45:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11408517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B298E14BC for ; Thu, 27 Feb 2020 12:46:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66B6724695 for ; Thu, 27 Feb 2020 12:46:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CJOd4QUr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mXb6at++" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66B6724695 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=fpE9AgqrlZBpBiMsbvmj1JX2z8kVPd77/eaiv9S1aOQ=; b=CJOd4QUrdovSUG cfoKbzUGm3/p7n8U+oHwNMue1Dm44kEJn1E8cWUBNXi2b9sHVWxW3/r5JLv9Vf4mhKeP/Vy+pulRW 5v1sKvVV08U+Ol9fq9vFLbDYnh7q9D/04gCJ5HlO3fabKdJKZIA2G3WzciIzcjin9IT8oTfxPix3C z8c1N2cWrjckvSPMELgYcRUhR4x0Y7TtcNRfDaeg1NkMZxeRADXBjEo8cQB2lwAT3DpLuodI0fzqM UNxNRlWKgsUwNnifSI2soulbtFCJnkfInR9Rllyxl8V34qq6XnVaY2ov4iVGafPMEf8qCRbdbH5wb qMhgXqmM4LPKwSnHEzWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IYe-0000Sx-Bs; Thu, 27 Feb 2020 12:46:28 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IYT-0000Ja-Eu for linux-arm-kernel@lists.infradead.org; Thu, 27 Feb 2020 12:46:18 +0000 Received: by mail-lf1-x143.google.com with SMTP id b15so1987671lfc.4 for ; Thu, 27 Feb 2020 04:46:16 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=3+0UYj3qVJZMwBRFalwhwumi1SLOyZkXHX2X4PQigTk=; b=mXb6at++ivddD2NTVyokGX6Bv9FhnYBxuwJBu37CLMiC7ZKw+agfQ8IcqYkg5R62dV UbBJskVFA9v0xAAj88zbm115M1Ky/Shbongm6s1uqNzblmPlJpA2AlhbNzAonTqF6KVT 3f/G2VBMbDM89Gh1lBSYuFEgrllGeNDN08WuURX9P9tevKQmiXieDsY0P2yJqyq3PT9i oVHssqDaQ1V4wZZAid9+NJ84Jnb46rLodKD+SSpZ/3FX0TCDUBxHuSYZBntM+ZH66VrM J7J/NKuN7xia8AKCAQQtvg87aTIL4OKo8vWc6bJ6Ce5c9W/CjOlDCG+LC+WNFAbe2hcJ eX7g== 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:mime-version:content-transfer-encoding; bh=3+0UYj3qVJZMwBRFalwhwumi1SLOyZkXHX2X4PQigTk=; b=RfrgoddLs/PbE2xU7Cket85Dz4XCxFTq5xBbn34e9husijXVHiXoMWHnQrvaqCPdx0 ipSj7vyd6QNb/hwv82wkJ37rhdtsKKmflqLwKv3fUij7Yk4QBEwgFOo7P43Sr+Xp3i6J sYAzOGX1xDECWOae2jys3F02KcknA+lStDgDboWQSZP6pGCXRLzInbeJkAFKD8e4dhYz ywAs/vkdn63hIsMaeoU0EB8spvVQqZEmjyIBDWTMeHVg4nHrxawtyhxTlsbjLEj8kMkU ydR5ze6vmuw96ry7kfNc45cqj9PR5wBW34yYL0qYKNix7wIvBnckhp+0vnFpKCQKuBKJ bwRw== X-Gm-Message-State: ANhLgQ02yF7DUcGMIFt03HkgC6S6w/Gx/OV90tyZKN7GsWEWVwbb3f9f wF6EFDO2Mj9wy7Y6JYiC/S3c/w== X-Google-Smtp-Source: ADFU+vsHQVosAGa6s8cq304/BYeC23/PJ+nzRpBSOGRg4zjwsWrSheAAC7nA+O5n//KNTf0/gfXSPw== X-Received: by 2002:ac2:5299:: with SMTP id q25mr2092593lfm.213.1582807575348; Thu, 27 Feb 2020 04:46:15 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id l16sm2669334lfh.74.2020.02.27.04.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 04:46:12 -0800 (PST) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Subject: [PATCH 1/4] PM / Domains: Allow no domain-idle-states DT property in genpd when parsing Date: Thu, 27 Feb 2020 13:45:48 +0100 Message-Id: <20200227124551.31860-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227124551.31860-1-ulf.hansson@linaro.org> References: <20200227124551.31860-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200227_044617_513715_8BF6E1C3 X-CRM114-Status: GOOD ( 14.06 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Benjamin Gaignard , Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Commit 2c361684803e ("PM / Domains: Don't treat zero found compatible idle states as an error"), moved of_genpd_parse_idle_states() towards allowing none compatible idle state to be found for the device node, rather than returning an error code. However, it didn't consider that the "domain-idle-states" DT property may be missing as it's optional, which makes of_count_phandle_with_args() to return -ENOENT. Let's fix this to make the behaviour consistent. Reported-by: Benjamin Gaignard Fixes: 2c361684803e ("PM / Domains: Don't treat zero found compatible idle states as an error") Cc: Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 959d6d5eb000..0a01df608849 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2653,7 +2653,7 @@ static int genpd_iterate_idle_states(struct device_node *dn, ret = of_count_phandle_with_args(dn, "domain-idle-states", NULL); if (ret <= 0) - return ret; + return ret == -ENOENT ? 0 : ret; /* Loop over the phandles until all the requested entry is found */ of_for_each_phandle(&it, ret, dn, "domain-idle-states", NULL, 0) { From patchwork Thu Feb 27 12:45:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11408519 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86243159A for ; Thu, 27 Feb 2020 12:46:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 646F824697 for ; Thu, 27 Feb 2020 12:46:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HF245wpb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zJlxUbiY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 646F824697 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=8ZWXe379gw6NXHjN9lvBaDXO0aVXEyFns/9pw3WwjJg=; b=HF245wpbuPHPK/ W+vyyZ2fUhPovDNQP9Cdy2Fg3T/Wh1vIH/5BWyC4sNfy/FVzgb2lr8kw0f8zc8I5xSX3spd45Kxsf p7J4MUHOm+T3aA4HT8k4lHu8q5katqAW1/9x0SqAtFUeZwedU+hkorRJl1jQcMY6pCUqtUDr0H10e Jbzxb8alnlo6wDKbUv6HcwhajuvsCQw5BfgwgQY/aoVfKF+DTlO9lQBl33MZGlPgt+H6JzYXMEucZ byrlnc2MLltpXeW152mP8QjdEXmhn7XLUrO/7X90KCg7DfzkrzSc1zRmeAOpwFJ6waCEofKVxJg0w bJnW3AxxozWiSJi/pjzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IZ1-0000oA-Pp; Thu, 27 Feb 2020 12:46:51 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IYb-0000SV-8M for linux-arm-kernel@lists.infradead.org; Thu, 27 Feb 2020 12:46:28 +0000 Received: by mail-lf1-x144.google.com with SMTP id z5so1955438lfd.12 for ; Thu, 27 Feb 2020 04:46:24 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=NROpLkqIKQsmOxVfnI3TCB5D/se19mcdjX7Jsvn77Ws=; b=zJlxUbiYhFoF+ODVDIvKjAu386tBZM5zdC9FOjCrrAN13EelHbSprIimZNdA9DUoAV HkDCSE3OSDzA5dNryQ2b9btHIUkJRTlRng1zEMwkc+XwCHscftdZISwd1pqrl+BwtHqv GlD8ZaB9R1oX1MDCPKIlITtO4YG6dJh7RZZAOXumSZkEOwCp3JhVK/bpllsEEQrzn8k2 o/gU2N6cqqB7dbSwPiqnkijOTNTasogux6I/C8ZWBKKFy9gM8lmYh4TTcTBQQJ/CxsrM XWv6ndjECgFxLLJ/1x/6NU6gCzaV5JEcxLS17mV1i0dmQtSDVdQQ9/QeAcybUpkrhOLN /DaA== 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:mime-version:content-transfer-encoding; bh=NROpLkqIKQsmOxVfnI3TCB5D/se19mcdjX7Jsvn77Ws=; b=sFcNJ9+ylV7/GguVKKUwILwU5DrZMc2IbUISu9Na1y2VdqlJvmb8iOBX0XmPtxs0iy 0P+danfbCZFpV0XxpPb4k5yFPGvLzjb4PUy/5lTT3+1ivS9zHadRIohwRWIZZR4060J0 TOlqsqKWEpxYSWh/61H3vkx90k26Gtme/WjyyG0L6VH4quEcA82tWFKEMxZDYQKBsb9n rhBkK1nNvFunj+hHwrIr5GMqNXeCIpfhfmVeJcPhdHJHHXQqbYCivFwB4+SYmSA1hRG2 HaFVXKomvcwu5GnTfn3NVmSZ0qCWT42X9//xUrpce4k9Mgs1d4EhYOskltnhlRFWn0os 1lnw== X-Gm-Message-State: ANhLgQ1X0RAXDKfVBBVtEKo2w3ylhuhYhAR8xY8BZVKwczUBtMW/wZQ7 WaN8F1Hm+shU7X1xeVAp52yhMA== X-Google-Smtp-Source: ADFU+vu8QOXDccJ4lKeIOMwWimtNYjnsyBTcgqPyMEimE4UADfTmMgToy/05O3pHPo7qI+ThXa9XeA== X-Received: by 2002:ac2:4a66:: with SMTP id q6mr2085068lfp.16.1582807579162; Thu, 27 Feb 2020 04:46:19 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id l16sm2669334lfh.74.2020.02.27.04.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 04:46:17 -0800 (PST) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Subject: [PATCH 2/4] cpuidle: psci: Fixup support for domain idle states being zero Date: Thu, 27 Feb 2020 13:45:49 +0100 Message-Id: <20200227124551.31860-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227124551.31860-1-ulf.hansson@linaro.org> References: <20200227124551.31860-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200227_044625_473220_6AB16AA8 X-CRM114-Status: GOOD ( 11.72 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:144 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Benjamin Gaignard , Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The current code intends to allow a PSCI PM domain to have none domain idle states defined in DT. However, a few minor things needs to be fixed to make this correctly supported, so let's do that. Reported-by: Benjamin Gaignard Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using genpd") Signed-off-by: Ulf Hansson --- drivers/cpuidle/cpuidle-psci-domain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c index 423f03bbeb74..c34b12c4069a 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -49,6 +49,9 @@ static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states, int i, ret; u32 psci_state, *psci_state_buf; + if (!states) + return 0; + for (i = 0; i < state_count; i++) { ret = psci_dt_parse_state_node(to_of_node(states[i].fwnode), &psci_state); @@ -96,6 +99,9 @@ static void psci_pd_free_states(struct genpd_power_state *states, { int i; + if (!states) + return; + for (i = 0; i < state_count; i++) kfree(states[i].data); kfree(states); From patchwork Thu Feb 27 12:45:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11408521 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8919814BC for ; Thu, 27 Feb 2020 12:47:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E18024697 for ; Thu, 27 Feb 2020 12:47:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="P6dVzWmU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GRMBtDnu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E18024697 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=Bfo+Vi7zw20GxG+lf63l0fH0j9uHzaXn46gVFygbfWY=; b=P6dVzWmUBWZZc/ T3txaRPUcgQfclBAa+2wg8gNOVQqtImbicm9vxqS2FugNQi55E+50EZbenmSvqj9Drrl7Sbb6dvYK bdMLCizYLV5zk1fJRWVUhhF2fd+grtD2076u8y7g/y0wnTtcGTRDoJkEfmSJ3raRnhtc9HHHpMams ZfcNxhuXdHZO8S96uJkWc/ZRhNbY6ejSfhlpw37AF3TZUSBUZhVfNah++rLFy7qDgwMuJnR7rrWG4 skKh/LGnttOtIyer7Gzkk2Rv2WJaQGgAr3eGVyOpDToyiJkwmY8krwF8sG6GvydIkQyXu3r+zijzQ I1J1Mpwkmulnh3CL/IRg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IZA-0000zQ-Eo; Thu, 27 Feb 2020 12:47:00 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IYa-0000RD-LJ for linux-arm-kernel@lists.infradead.org; Thu, 27 Feb 2020 12:46:26 +0000 Received: by mail-lf1-x144.google.com with SMTP id 7so1957491lfz.11 for ; Thu, 27 Feb 2020 04:46:23 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=ZPYRIg41YwW5y7gzBIFCCQYc7BuElmJfratXvS9/RTU=; b=GRMBtDnuFIHhKQLNR5bYnf0YeAvzu8Lkr45VhsfqrQDfegayFVkGEDHxmkTQbBM127 d0GGkdb82XKNRJ+F0B/Y7uK2QtkhbkfZmBzDRNEW6o1VKKoUgSaYFLuKaD6kIzusy/rg VlObzJ6OLnbrt7IhkbLN+nAxe8wDM2LT2gZCSH+4Pib6NlW6ItxKWAWYb2xtBk5FDUQT KJMjc+wYUwfzW8jO13sOV78g6kTWdJn2sAcNBULDQIhQ5JwOsvghkPFsog4VDoMa2+3T 6TmnBYL2K1XcXcMwVwiBUOdbZUS2b4DvOfXDcQ1w17MtSe8UwPRJgNyllErCUf8gBaZw iXKg== 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:mime-version:content-transfer-encoding; bh=ZPYRIg41YwW5y7gzBIFCCQYc7BuElmJfratXvS9/RTU=; b=FuwcAP/tcf522DdaTUjxlAxG2d1eNouFGaVI43sYaqTA4cqMw6xhYUmByzvL/afGY3 JoQ5m5K6WZz9erUqkdt8d4ViQVh4ne3lVNd2D7UfE500gDm07TzlSRbVoT4ADoQSr5hW ZT8f9sgFRB2ShF6OVuK2Iq1UVGLNAyoHB0YE85CnUE5UqAkqgKfoSfQSSHNG7vQXH5uu c2Xh0gFh5RpUXHfOAKmIAkK0lYR80X2UvPU7HkN1yjT2Y3B5/8ep51+6y78OIm8OIbEE Det+gVIkjcerDMWgsQbrAq6SDiOwW8Pn4n/GE/4Wh4/CadLz4hWkATwXPerinD1aTgAr poRg== X-Gm-Message-State: ANhLgQ3jmyH4cE5BAL5orgrZ4NoxACIcbjoORV0FvK1j0e9WWpT0xBl4 KYbZZHBEiPWwfbkOo1FdA4N+aw== X-Google-Smtp-Source: ADFU+vvy3xadzFJgMR579KvBJp97cg/u1LNr5iTXRd789EXBWJ1RL/VY1A+sJYMUch7iOHDB2kfK+w== X-Received: by 2002:a19:6445:: with SMTP id b5mr2044742lfj.187.1582807582480; Thu, 27 Feb 2020 04:46:22 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id l16sm2669334lfh.74.2020.02.27.04.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 04:46:20 -0800 (PST) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Subject: [PATCH 3/4] cpuidle: psci: Split psci_dt_cpu_init_idle() Date: Thu, 27 Feb 2020 13:45:50 +0100 Message-Id: <20200227124551.31860-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227124551.31860-1-ulf.hansson@linaro.org> References: <20200227124551.31860-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200227_044624_716392_180383EA X-CRM114-Status: GOOD ( 17.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:144 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Benjamin Gaignard , Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org To make the code a bit more readable, but also to prepare some code to be re-used, let's move the OSI specific initialization out of the psci_dt_cpu_init_idle() and into a separate function. Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using genpd") Signed-off-by: Ulf Hansson --- drivers/cpuidle/cpuidle-psci.c | 49 +++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index edd7a54ef0d3..7b459f987c50 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -160,6 +160,32 @@ int __init psci_dt_parse_state_node(struct device_node *np, u32 *state) return 0; } +static int __init psci_dt_cpu_init_topology(struct cpuidle_driver *drv, + struct psci_cpuidle_data *data, + unsigned int state_count, int cpu) +{ + /* Currently limit the hierarchical topology to be used in OSI mode. */ + if (!psci_has_osi_support()) + return 0; + + data->dev = psci_dt_attach_cpu(cpu); + if (IS_ERR(data->dev)) + return PTR_ERR(data->dev); + + /* + * Using the deepest state for the CPU to trigger a potential selection + * of a shared state for the domain, assumes the domain states are all + * deeper states. + */ + if (data->dev) { + drv->states[state_count - 1].enter = + psci_enter_domain_idle_state; + psci_cpuidle_use_cpuhp = true; + } + + return 0; +} + static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv, struct device_node *cpu_node, unsigned int state_count, int cpu) @@ -193,25 +219,10 @@ static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv, goto free_mem; } - /* Currently limit the hierarchical topology to be used in OSI mode. */ - if (psci_has_osi_support()) { - data->dev = psci_dt_attach_cpu(cpu); - if (IS_ERR(data->dev)) { - ret = PTR_ERR(data->dev); - goto free_mem; - } - - /* - * Using the deepest state for the CPU to trigger a potential - * selection of a shared state for the domain, assumes the - * domain states are all deeper states. - */ - if (data->dev) { - drv->states[state_count - 1].enter = - psci_enter_domain_idle_state; - psci_cpuidle_use_cpuhp = true; - } - } + /* Initialize optional data, used for the hierarchical topology. */ + ret = psci_dt_cpu_init_topology(drv, data, state_count, cpu); + if (ret < 0) + goto free_mem; /* Idle states parsed correctly, store them in the per-cpu struct. */ data->psci_states = psci_states; From patchwork Thu Feb 27 12:45:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11408523 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A00AA159A for ; Thu, 27 Feb 2020 12:47:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75C3E24695 for ; Thu, 27 Feb 2020 12:47:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hHYZkG4F"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xFBxcPAE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75C3E24695 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=TfrT++6+0m1YPvCIq89euHwbeJ3HgsUN8/9g7+G0bNk=; b=hHYZkG4F7Uz6zd OQi9GR/BQkOy+q+dmzMSo1yTntE9/zPOi93PzoavdVQ+rH4SpIIeemqYMm100akv2uCEEJz6YL0h3 2cKtcSmBw4jCAfQK5o3l2n3mf1XxPRGLIMBG9dXES9wq9g40Z3c+tiXjn1ntloGnlnN7vzA77ykgV 7KAmo4cGDpzQLykbapm1Slye3DHKHpgQRhgWkTl/iEwBfTVtmO2JLVgUkv9SEPsO23DPU4Kznu5nJ lCub//KbTWjbljpQPykeV8CC2n77QD+emANRPuD8mRN3+8CQ2eaouqYO5AYkrvaOyAldtAqGsOVx/ 8RjrqcQ8FmZjNEhhvEjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IZO-0001Fm-QW; Thu, 27 Feb 2020 12:47:14 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IYf-0000Vl-9u for linux-arm-kernel@lists.infradead.org; Thu, 27 Feb 2020 12:46:31 +0000 Received: by mail-lj1-x243.google.com with SMTP id e3so3215637lja.10 for ; Thu, 27 Feb 2020 04:46:28 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=QTt6UBxA6W5SX+1ICKiklMI9uA6M1ZbDrJNq6V8cSwg=; b=xFBxcPAEgZhFSYaozHLmDlFYl2fFzeMwv0JES7iXa4HWNnguu8lRelP1AwlGXLi4Qy PXZ2IGeC7mCYSD4xntHc/sAo8J5Xel+aewoQbyw+hhIROWcalIsqchcyI/nUDI7+Ezjn gRfLnTl1Dnu9W+EwekxM1i0OuJAZi1egMepLusHNJCyyyYFrfOM6GaB87hkHSQ2rX5k3 wZs1KJyTfwGRQadAaYQh24FuXwXLM4Xy/JcfzQbiH+NNGi6AVVG2pqzCOzf75aKeuNSz H7aSSCv2FmrbgwHqn/ZfbZIxSpHqAmmzzMwLxN5arR4pyQyUL8ZB24l1u39rCDrlIDGz UqZA== 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:mime-version:content-transfer-encoding; bh=QTt6UBxA6W5SX+1ICKiklMI9uA6M1ZbDrJNq6V8cSwg=; b=DuTRsFxIMMVL5SaZ3M33Rb0GTH0ic4AT6vlvzX6afPWkUVTMgYxN3TXOwTVQ1J3lSP UwTevSPp3Pj3tb1LyknhaA7DKDyI6HaS983JhPEJyDNCi/Ti3W+YPXSsURrSjUSAw8Ky kjvdqusx3sFR/A2hQT+2jL67wVZpl0qULqqgvmX44UVCGHGIRFETNO3DeMRRTG1w5TAg 9oKErylkFdcdjlGCNYYlc4iQh3O2k6xIHVhRZ56BNi5dnRZcwpRdzRwsVX8uIa7ZBkOA CpfbzQ/wChBDe1rLwVtj3jno2SN8A+TDtizjactLViQVKS8wFcq3Ot3cVXATZynIuzI5 eFDw== X-Gm-Message-State: ANhLgQ07wGHsB++uGU8lOfYtQYWIfPKCMxhx2rFqdMeRDv8tyjS/JzfV r8aRUXAchhIzm4bT3QzGPfGFNA== X-Google-Smtp-Source: ADFU+vtahVhqQemAkBHrVNd22ZkStLpI5Lit/jghKpl6hbLD66xlZ/d/3Okl8cC8HxMB8genhlJvdg== X-Received: by 2002:a2e:81c7:: with SMTP id s7mr2781657ljg.3.1582807586339; Thu, 27 Feb 2020 04:46:26 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id l16sm2669334lfh.74.2020.02.27.04.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 04:46:24 -0800 (PST) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Subject: [PATCH 4/4] cpuidle: psci: Allow WFI to be the only state for the hierarchical topology Date: Thu, 27 Feb 2020 13:45:51 +0100 Message-Id: <20200227124551.31860-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227124551.31860-1-ulf.hansson@linaro.org> References: <20200227124551.31860-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200227_044629_792566_BF535CA5 X-CRM114-Status: GOOD ( 21.90 ) X-Spam-Score: 0.8 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:243 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 1.0 FILL_THIS_FORM_SHORT Fill in a short form with personal information X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Benjamin Gaignard , Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org It's possible that only the WFI state is supported for the CPU, while also a shared idle state exists for a group of CPUs. When the hierarchical topology is used, the shared idle state may not be compatible with arm,idle-state, rather with "domain-idle-state", which makes dt_init_idle_driver() to return zero. This leads to that the cpuidle-psci driver bails out during initialization, avoiding to register a cpuidle driver and instead relies on the default architectural back-end (called via cpu_do_idle()). In other words, the shared idle state becomes unused. Let's fix this behaviour, by allowing the dt_init_idle_driver() to return 0 and then continue with the initialization. If it turns out that the hierarchical topology is used and we have some additional states to manage, then continue with the cpuidle driver registration, otherwise bail out, as we did before. Reported-by: Benjamin Gaignard Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using genpd") Signed-off-by: Ulf Hansson --- drivers/cpuidle/cpuidle-psci.c | 47 ++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 7b459f987c50..7699b2dab622 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -56,16 +56,19 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, u32 *states = data->psci_states; struct device *pd_dev = data->dev; u32 state; - int ret; + int ret = 0; /* Do runtime PM to manage a hierarchical CPU toplogy. */ pm_runtime_put_sync_suspend(pd_dev); state = psci_get_domain_state(); - if (!state) + if (!state && states) state = states[idx]; - ret = psci_enter_state(idx, state); + if (state) + ret = psci_cpu_suspend_enter(state); + else + cpu_do_idle(); pm_runtime_get_sync(pd_dev); @@ -181,6 +184,7 @@ static int __init psci_dt_cpu_init_topology(struct cpuidle_driver *drv, drv->states[state_count - 1].enter = psci_enter_domain_idle_state; psci_cpuidle_use_cpuhp = true; + return 1; } return 0; @@ -195,6 +199,13 @@ static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv, struct device_node *state_node; struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu); + /* + * Special case when WFI is the only state, as we may still need to + * initialize data, if the hierarchical topology is used. + */ + if (!state_count) + return psci_dt_cpu_init_topology(drv, data, 1, cpu); + state_count++; /* Add WFI state too */ psci_states = kcalloc(state_count, sizeof(*psci_states), GFP_KERNEL); if (!psci_states) @@ -226,7 +237,7 @@ static int __init psci_dt_cpu_init_idle(struct cpuidle_driver *drv, /* Idle states parsed correctly, store them in the per-cpu struct. */ data->psci_states = psci_states; - return 0; + return state_count; free_mem: kfree(psci_states); @@ -285,33 +296,35 @@ static int __init psci_idle_init_cpu(int cpu) return -ENOMEM; drv->cpumask = (struct cpumask *)cpumask_of(cpu); + drv->state_count = 1; /* - * Initialize idle states data, starting at index 1, since - * by default idle state 0 is the quiescent state reached - * by the cpu by executing the wfi instruction. - * - * If no DT idle states are detected (ret == 0) let the driver - * initialization fail accordingly since there is no reason to - * initialize the idle driver if only wfi is supported, the - * default archictectural back-end already executes wfi - * on idle entry. + * Initialize idle states data, starting at index 1, since by default + * idle state 0 is the quiescent state reached by the cpu by executing + * the wfi instruction. If no DT idle states are detected (ret == 0), + * we may still use the hierarchical topology. */ ret = dt_init_idle_driver(drv, psci_idle_state_match, 1); - if (ret <= 0) { - ret = ret ? : -ENODEV; + if (ret < 0) goto out_kfree_drv; - } /* * Initialize PSCI idle states. */ ret = psci_cpu_init_idle(drv, cpu, ret); - if (ret) { + if (ret < 0) { pr_err("CPU %d failed to PSCI idle\n", cpu); goto out_kfree_drv; } + /* If there are no idle states to manage, but the wfi state and we also + * don't use the hierarchical topology, let the driver initialization + * fail. Instead, let's rely on the default architectural back-end to + * execute wfi on idle entry. + */ + if (!ret) + goto out_kfree_drv; + ret = cpuidle_register(drv, NULL); if (ret) goto out_kfree_drv;