From patchwork Sat May 14 15:20:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 12849863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C644DC433F5 for ; Sat, 14 May 2022 15:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=4ddauxx1lX32KpTjoqcp1c7sDByodsuUFvbaDcl1CPw=; b=3MXWc7H7L52sKg mIQTIaCbVwUZsqxCzB1W3jKqpczHuxo5PbWbLuQfqELJW+eWOgpGe+hW/VjTOYAyv/GjDanaFL+VD cKuT3MF5jKnN/IiwxxFIDFCgbZk04+6zmp5jJVXeroqDkP3JXdqlgzwlWKD9eCI5MrgNuTXPch1PJ bxdw69MFfWXWN2YMqHnhfgDv0FhJNMDWESdz8KdtPsEUxZrgP0z+GsJFkExioDCZVTyT6+20syeez i8RdVyKbcbbpM9QXSLHNsU37Fcop+zWIcSI1O/0tJwahSISosAgbsQpdNGhTaEVQOnFgVq4cWLjyX wqZ5s95Sy1UB6dygy6hA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nptZf-001itP-2H; Sat, 14 May 2022 15:20:55 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nptZT-001iqu-Qd for linux-riscv@lists.infradead.org; Sat, 14 May 2022 15:20:45 +0000 Received: by mail-lf1-x12a.google.com with SMTP id i10so19066825lfg.13 for ; Sat, 14 May 2022 08:20: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:mime-version :content-transfer-encoding; bh=vgEQZGj7XdPzKpml1xZjmFHRxmKWGvcEYL2lJUBaVsU=; b=m4skFe/fjMkgPeZRXHRT7lmXSxKYhwE0VfUTRb6cHXLVXCDTZt5kYDzRQN4cIad6Nx +FrVOkwHES6FDU42vMw/5rykZLePnGTUoeBjEXJhQVZj9Qayk2t1n9YpZg96DuECzAME RWTlrtbZOW5GSCumUcHWt8Vgpok46Zj7DOMqdhszEG96AbuK+JjKEn44NbI9ZV/v8eMJ oHVzLswLqY3uTDBt8WWlevlNynqtJwst1Utjvj5kO8EQz115KPb2lymke80pTSum56iq yTXeFxnJ4UcTJsWXwiHotDVDytOGWrJsF4W8vUSNznvd98uO07FIN8XePxzJBGDYh7Ng ZSTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vgEQZGj7XdPzKpml1xZjmFHRxmKWGvcEYL2lJUBaVsU=; b=mtE8ebHlZU3lVlbfF5SffXetBDbADPliI1A4z6GkEDNGAwsN0XS32kY/kL3Roydbmr Da8fcWh1wVHe+K98x7mXfCuVlmHJpEfd/FqfWTPHuafeQV/HI67IVeaXhSLuI+Crubz7 UThogU06zY2YwZfxHK8TVZKdG11xxoteCak9LPLchBcecQf1N+WkgZqyvmuTMXmf8a2V Pv+O+AyZKnXV2zYCEOEQYirJj1U0PJRLsf6m1v1Ly+IP8LYxX4kRNmwdB2WuDGLHmDJf 1UGBBQPrrNOYBNhARPDiM3FpZleHKJ/lxcmAJjS8jBF01oFYYaD+oUEV7DH/DeDtusXH ZFVA== X-Gm-Message-State: AOAM531rZMKU16kYo5SkP4rKOLj49Y7Dn4kNoEQwwSAnMNyGJNSlJQry plJa8oRZUkBoE7HFVPV6jjzeRw== X-Google-Smtp-Source: ABdhPJzzPOWb8YcOcXdI0jUpKc7cMAmRKte6m/hGPjpztOpdV6al6mOvoJFC7cx2XnwypmlVC4xSzg== X-Received: by 2002:a05:6512:553:b0:472:205b:97ba with SMTP id h19-20020a056512055300b00472205b97bamr7001418lfl.314.1652541640290; Sat, 14 May 2022 08:20:40 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id q18-20020a2e9152000000b0024f3d1daee5sm830413ljg.109.2022.05.14.08.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 08:20:39 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Anup Patel , linux-pm@vger.kernel.org Cc: Sudeep Holla , Lorenzo Pieralisi , Maulik Shah , Daniel Lezcano , Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor Date: Sat, 14 May 2022 17:20:32 +0200 Message-Id: <20220514152032.758738-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_082043_890277_725E51C9 X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org While factoring out the PM domain related code from PSCI domain driver into a set of library functions, a regression when initializing the genpds got introduced. More precisely, we fail to assign a genpd governor, so let's fix this. Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver") Signed-off-by: Ulf Hansson Reviewed-by: Anup Patel --- drivers/cpuidle/cpuidle-psci-domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c index 755bbdfc5b82..3db4fca1172b 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi) struct generic_pm_domain *pd; struct psci_pd_provider *pd_provider; struct dev_power_governor *pd_gov; - int ret = -ENOMEM, state_count = 0; + int ret = -ENOMEM; pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node); if (!pd) @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi) pd->flags |= GENPD_FLAG_ALWAYS_ON; /* Use governor for CPU PM domains if it has some states to manage. */ - pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL; + pd_gov = pd->states ? &pm_domain_cpu_gov : NULL; ret = pm_genpd_init(pd, pd_gov, false); if (ret) From patchwork Sat May 14 15:20:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 12849864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B5A0CC433F5 for ; Sat, 14 May 2022 15:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=segXeEGMrcKSKmAH9Ntibyz2/zOGJlLdslZJw6ivZL4=; b=S60eDGk6SSAO+O RdV2w/Vzl6UHUttgDkjX0pF7egLbxGR1vIN1f0VRCsHN077MZ7xITCpNWdHLrX24uE5kMAdFmkOmk du7svkzX+Yo0xM+M2sFRb1tbNntasXrayyRu2k5Yjn+nMJcU/bbZX9lft59cy4QdT61cRYvI20N4M 6hqNciHad3H5oSGL9dD629S37eGh3wLZuW9mcCXXS0qJFgvPNyp31xf3wLVtc3faFwYTda3P8Bng3 FVR1ex2ex8ETcQGkjgT9J0LsairzoAi35RR1gXl7b/+vsWj/n/9RA9tBvTGIR6U3buXKGeR+sdeAX VpfkbLTT25qovtuT/j2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nptZg-001itu-IH; Sat, 14 May 2022 15:20:56 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nptZb-001isF-9o for linux-riscv@lists.infradead.org; Sat, 14 May 2022 15:20:52 +0000 Received: by mail-lj1-x22e.google.com with SMTP id b32so13478627ljf.1 for ; Sat, 14 May 2022 08:20: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:mime-version :content-transfer-encoding; bh=jN8Cl5mMVbr+UVzRRSRn5vcrJAUsBCcLDo+azLgnVmQ=; b=ZGnFOk9hnpw6WfZAAwaIom/4T/t0E3RIw3N5rrztcNKF1+cnTHgUXQ5eAksdWhd8F8 LL0Hp6hlh1rBhZ8SpqPVGfvIw1MIfkwUwzEuLT4zYmqW6XfwWdjbxmugBH1rWe5FqKDc /qih7U8rfz8MXQKbPbRmdkUNl+VZR0fZnSe8Q4oWjwleOFkxqjHQ/eJrOdyGQDvcczNR uGhzOiBs06Bu55Kp2793VRtPn+Ke5pCYovkRcYRg8YBg0l1vBMPZuK4oTnnzOcVgfDBl fNQiOTkxaUGgmBGs3YjN5kH6dZHJKibKoPXPqoxNpBYmiG4gQRpsZF3hN6DD9NrCN8f0 YkDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jN8Cl5mMVbr+UVzRRSRn5vcrJAUsBCcLDo+azLgnVmQ=; b=TL9YOKyMGZg2+Vfe6uS6T1bqv/wZDwrcNfUJBE0YTeoAD1h4PBmL/L88L7vvsqU4Aa jwhz/8O9FUa7za+TM8mQTxb9FOC7kO6a+5MWkt/76Fhh12RnTTDS4z6do2+80Op7owjr 3slQSOXeSNuibuJri6XIMKpRz4A8t+5I0lFieM0NAF23WEFk+wsNubF9H2Lqkj01L0ts sInRaAHEAn5uEkf5hrUgSeWC4bRu9yw7al4IbYFPxsNuEWhElTAyN/UE3Ryz0v8v2zPJ oY//kuA7s12h21+vU2DIDgerktsvcGFpc/SxtLjaSwtUAsWwQ7fgX30e9bzCON/cDj5M 7bNw== X-Gm-Message-State: AOAM530nejgWwqllZPWC/EA7KRYEJHq2Koc9jKBv5/NMNe9KlEN5ZT5r lxbaECtMeodLO/dr1Ix48N58bg== X-Google-Smtp-Source: ABdhPJyo0RugdTImkXnKS+tdrl2IGYQ36+s5tAYiGXLQWyQLsPLFwsaWHeGOeGJoSr0CzPerDZPL/g== X-Received: by 2002:a2e:84c7:0:b0:24b:6842:1923 with SMTP id q7-20020a2e84c7000000b0024b68421923mr6306348ljh.166.1652541648677; Sat, 14 May 2022 08:20:48 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id j18-20020ac24552000000b0047255d211d4sm734170lfm.259.2022.05.14.08.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 08:20:47 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Anup Patel , linux-pm@vger.kernel.org Cc: Sudeep Holla , Lorenzo Pieralisi , Maulik Shah , Daniel Lezcano , Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] cpuidle: riscv-sbi: Fix code to allow a genpd governor to be used Date: Sat, 14 May 2022 17:20:44 +0200 Message-Id: <20220514152044.758802-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_082051_402209_64EEA01C X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The intent is to use a genpd governor when there are some states that needs to be managed. Although, the current code ends up to never assign a governor, let's fix this. Fixes: 6abf32f1d9c50 ("cpuidle: Add RISC-V SBI CPU idle driver") Signed-off-by: Ulf Hansson Reviewed-by: Anup Patel Tested-by: Anup Patel --- drivers/cpuidle/cpuidle-riscv-sbi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index b459eda2cd37..478970fa3b0c 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -413,7 +413,7 @@ static int sbi_pd_init(struct device_node *np) struct generic_pm_domain *pd; struct sbi_pd_provider *pd_provider; struct dev_power_governor *pd_gov; - int ret = -ENOMEM, state_count = 0; + int ret = -ENOMEM; pd = dt_idle_pd_alloc(np, sbi_dt_parse_state_node); if (!pd) @@ -432,7 +432,7 @@ static int sbi_pd_init(struct device_node *np) pd->flags |= GENPD_FLAG_ALWAYS_ON; /* Use governor for CPU PM domains if it has some states to manage. */ - pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL; + pd_gov = pd->states ? &pm_domain_cpu_gov : NULL; ret = pm_genpd_init(pd, pd_gov, false); if (ret)