From patchwork Tue Mar 10 10:40:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184346 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp552366ile; Tue, 10 Mar 2020 03:40:30 -0700 (PDT) X-Received: by 2002:ac2:4316:: with SMTP id l22mr12296837lfh.150.1583836830273; Tue, 10 Mar 2020 03:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583836830; cv=none; d=google.com; s=arc-20160816; b=Q2lqSlnR5L0sGiy73b/dXKJbUm06QiD8MMoHeBQ3fhjATKQVhPQvutgL+CY1hpVN3g Fg/to3CqCunqdefZd9IRBvvFmc6Peg38jxhVzz4+S40wnRor5nUV1MCQfIBY7/E/sI9I 0L+GWchS98GboU5yVPYc8FL12KtmtUICt2GJEbVo8ZYKSdvX/CqP90cpdR0w37AdUP1W zJ8kG+YmO1lwUgsZdl7HqHVfTd1Iy0w2PQEqJBUinaXnMmaR3gwBY/X6EmBS5LrTAFJy qXkibAruC8mjzz1ys3HamNTp7cbj2cWKvLVys9gA8LtRGUZ7qH2DAKUIiACIo560Rkwr GK2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=VOmLbFg4f7m0VWnyO1xDaH/AZNMu+kPMNjgBVvsbMM4=; b=MayNC7MQWiop54+HdOVUAEcPxz2oUSE5yDYKgppCUzbabCKiWGpwRFNlPppyrJZPLo cyzuBLGN/yeIP3EO/s4foNO4eGr20/tUGWPkqsRCa+FgNgLLwE4Z9NCgpvkCiYJBdZq5 hLlMqk6A0p4z1dITvNgJ3si21mO8guLJRJ6cFOdn1Ce23+3vYhFK3janvpvYoYzQHMFE oe6f8bQy43UzeBfLlYF3XKYhu+m1guuRkFo2PMsVtG+odyV0CW1elma+jc/yXQd935Vb MfY3J8xoHkYLX5UHexnLDhkLtvBtcsoU5HzNv4BOgxwnDtPgCB5+KUpZ/+ACcgwahITi c4cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XmPV7pmf; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w4sor665790ljo.27.2020.03.10.03.40.30 for (Google Transport Security); Tue, 10 Mar 2020 03:40:30 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XmPV7pmf; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=VOmLbFg4f7m0VWnyO1xDaH/AZNMu+kPMNjgBVvsbMM4=; b=XmPV7pmfeVwv3eR7FYLArkOxNj27Kv2v7Sx7iRQrmZdzWxfxlm1/2+6ROU4I24Rih4 sfMG2dff10ReM0skBVyIR8ywsuBgmcvdt12e2ZCTI4Qo81wWI1tCCP6jUdZkGjLPQ50P C2QGEB9K3G/dqaRMfDNWxuHMFPrymb3R5agvF0Agm+VQuOdUfUNHoEj/9ksEQ9gUlLxo gzqwva0Zs4/SDsB2Rmj4itCDw/94E8QchLWRxf8WuPigcg2aybGDW82RNXqaWGSTHjDk n8qThSPy6zFIN95KirHptSJJ8TZgWB1sm61UPdbxfwz5KxBBZLhuMi4nL8GQ5ebHturv M2nQ== 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=VOmLbFg4f7m0VWnyO1xDaH/AZNMu+kPMNjgBVvsbMM4=; b=IBjylpZxFtSJKv05AWo1k6H3vaNf5E56CbYbkDyGKhzZafIPhhxTbqCKrwnHdsvDBw 5WO28yRt9nEmLfMfgcAjqm7RoxQ5m+219qnW86cnnuLM1FeLOe3N5TxzWIkibbWYs/WH 9GbnFhP5nioWvZpKxkj1Qpe9HmMsQORC3dreCODpN+ZrIJxIfF6AVNBhGFjNII6EnRIg ukzEI5EpWtGWniT5tb7xNHpejgkTvEBNjJgMO+Z8B7n0cEOGWymCtChQaJtMGqPS73U3 RlOtCaJc/3wYNE3bT9Tm4KdXEW0SRgqWu0/1mMFmO4M9ovuPaSn25j6vTRpTgSCA49dJ 0Rjw== X-Gm-Message-State: ANhLgQ0syoPHvtptKCxP5/kpTNaDlj77h36Hy9sEmiz1p2F45TN3zmGK uh/UH1A0imTNkX2eKl4O6s5vIqXzRrp7nQ== X-Google-Smtp-Source: ADFU+vt0BFBJbAznVQSE1PNl5MnrDZymFS2judAVRaRDmr4mbgXWDTWu7QcpSCh+5klHcSq6m8dkfw== X-Received: by 2002:a2e:8654:: with SMTP id i20mr12334652ljj.248.1583836829816; Tue, 10 Mar 2020 03:40:29 -0700 (PDT) Return-Path: Received: from uffe-XPS13.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j6sm3414632lfb.13.2020.03.10.03.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 03:40:28 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Daniel Lezcano , Lina Iyer , Vincent Guittot , Stephen Boyd , Bjorn Andersson , Benjamin Gaignard , Ulf Hansson , linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org Subject: [PATCH v3 1/2] PM / Domains: Allow no domain-idle-states DT property in genpd when parsing Date: Tue, 10 Mar 2020 11:40:23 +0100 Message-Id: <20200310104023.4018-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <0002-cpuidle-psci-Split-psci_dt_cpu_init_idle.patch> References: <0002-cpuidle-psci-Split-psci_dt_cpu_init_idle.patch> MIME-Version: 1.0 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: Reviewed-by: Sudeep Holla Signed-off-by: Ulf Hansson --- Changes in v3: - Resending with reviewed-tags added. --- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 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 Tue Mar 10 10:40:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184347 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp552540ile; Tue, 10 Mar 2020 03:40:43 -0700 (PDT) X-Received: by 2002:a19:c34e:: with SMTP id t75mr11720101lff.197.1583836843164; Tue, 10 Mar 2020 03:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583836843; cv=none; d=google.com; s=arc-20160816; b=AAcKGd2stJsHDvNdyVt42JMul3dzHHWz1ZW8OHi4oQY8zkDPhee5a8D/yU2v10Qzwv +iRNWeM6u7yjNzewmRACwgjcXIL+y+1S6WV6QM+IceiT74yQTFO2N+Sqiey+TLUQ6bHr iUoXgGUX+MfcJoimtpJt1rEXicJr6G1gmnBO19ag8yo+2CYkZ4/hLUpiV1EEFVSegjWf n120G9APDA1w9m2Sel/Li3JkeTI5I8bknx8npkSmvesgCBk/knN6SZYu/zReQJnXWqx1 uTvLnN1g+aux3Di4/JY8kRWIIJrhVzzvcmMpSh50heJ+zjUpsD6Ofc3UhSrMNtAtxwM+ CnQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=6pxlLk38rJ+HhQrbDG9StMgSzEGNLqFsirKScynCScU=; b=O17IH9zFmZPSfsqW3hcyJBWlRZ5pAQL3RJ6LVwiefLpcWTQok2iai2TJ4Xy7XOFQHk cwLO1kN5qDsUcHVqxfKEqVkfATERN5efSP+sE6qR/kLHJLfaid+ZUtafohMw4mSINROR 5axfbZSxkbxVzgrHrh7hejfNmwZJWO9ol9yyIcIvA073tMB24WLiOLqny56AJ6X1XPoS jJFB0iqTKyQ+jBH2W0wfSwiHmY4tXkTdNoZOKBAGXQK8MMJZVRGmAKR4SQlp3quonmzx 6J19u0uVUISyP8hJYpehfcIKy9g9GZkarUtJY5/QbijjXgiZrTR0Q7H5FEgn2ayw0iBP 3Zwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nc6/NWC0"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m22sor3320888ljb.33.2020.03.10.03.40.42 for (Google Transport Security); Tue, 10 Mar 2020 03:40:43 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nc6/NWC0"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=6pxlLk38rJ+HhQrbDG9StMgSzEGNLqFsirKScynCScU=; b=nc6/NWC0ZnA3EHC5pXdWeUncJizYLSupGGwOcnk1c26mwggUrbQlWG54DY4FknvUYC 28jVQAIJIwqs8DWroIOThx0+dpmmj9ek3g7+J7ZWSAEJAKnjaEuEu0hL1in+KrU4I2Cj 6EoKk8Z2W08D0X5hLNTyxIPOnrkzo2mxdpjQabpM/cozVARF9SSCYuukC6rnk6NPDafV WXiPDg3mmSwA2N6t5wckhRmEi1FF+EFsr03KtdQ+hOPcjc/Agv4GfUakYa+50CUuMlEc 541J2z+kFc8ewkil29Pgiqwh5Yynam9/Aigi50NWSaFUYN/1Nzj5TaoYkStWR2ciEepb q00w== 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:mime-version :content-transfer-encoding; bh=6pxlLk38rJ+HhQrbDG9StMgSzEGNLqFsirKScynCScU=; b=JzMhooe1EujIMD/LqhNLZX/tEJdXf7R5VP5j4zbocYXB38Q4F2RikHPMe/q1DHKvyx JVdPY8l8DA8Bevmd0R0pHEJvPVElMU6k5C/D6PoOcl2RQxeqOi6+EGvZyUYKz67VqUk3 WwwW1HvIJjkLPMI9ALjyy7bCzE5i/nSEbP2qsJuVPbGG3tT9xw2uV+LyWeww3LH8tCrr QZVcOow0JiKSaxt1ChRfnbI/eGc+OupSiNtk4OSqe9Dli2wiIUptCGQCYULLYEENzmM0 akCZFNd1XZbFlJJKmrZAYq0DJMM+Ftxu/51Ffs5q46FJOaYQ1AsJbe0imFjVtaBe2HjT hEdQ== X-Gm-Message-State: ANhLgQ3yNvjDA4qxJ9pSzG228Y+jaEBvCp9Kz6YsZFNxmVq1v/aLJh4p dbcrUaZw5GIJMkJ1EY5+3gVOknJL X-Google-Smtp-Source: ADFU+vtyugMzukSnO3/aD1ZXvAqRaTZfqRTHJXjr2Xlk1nBcgblQDVHM7XoSCktNZFEhOicuiCITog== X-Received: by 2002:a2e:8802:: with SMTP id x2mr8541132ljh.291.1583836842549; Tue, 10 Mar 2020 03:40:42 -0700 (PDT) Return-Path: Received: from uffe-XPS13.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e2sm21511582ljp.55.2020.03.10.03.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 03:40:41 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Daniel Lezcano , Lina Iyer , Vincent Guittot , Stephen Boyd , Bjorn Andersson , Benjamin Gaignard , Ulf Hansson , linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/2] cpuidle: psci: Split psci_dt_cpu_init_idle() Date: Tue, 10 Mar 2020 11:40:39 +0100 Message-Id: <20200310104039.4066-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 To make the code a bit more readable, let's move the OSI specific initialization out of the psci_dt_cpu_init_idle() and into a separate function. Reviewed-by: Sudeep Holla Signed-off-by: Ulf Hansson --- Changes in v3: - Resending with reviewed-tags added and dropped fixes tag. --- drivers/cpuidle/cpuidle-psci.c | 46 ++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 19 deletions(-) -- 2.20.1 diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index edd7a54ef0d3..bae9140a65a5 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -160,6 +160,29 @@ 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_OR_NULL(data->dev)) + return PTR_ERR_OR_ZERO(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. + */ + 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 +216,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;