Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp221050ybv; Wed, 5 Feb 2020 04:28:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzKWvwd0hz1AXGSEysAMnLqurS252CCrjj5XWK1DlUXVKemDgmwJACaqJqa/2vAtvhitRhg X-Received: by 2002:a9d:7d87:: with SMTP id j7mr15428102otn.159.1580905715236; Wed, 05 Feb 2020 04:28:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580905715; cv=none; d=google.com; s=arc-20160816; b=uDIsA7eqSU3yWlx4IqGQlj1QAzLL7TmZ9BKHB8eb6z3ISDyxA5URYQsh3lnoLpP9Hk 90p0C3F+ue0cBqy8xLPzvy9d8FHMUms8ppyfbbZh37e6MpcA5I8s7ZOZQSdFO0IWmPJG 3ytH08NdZzMPOqUDtYIkx9WN79ZIMNsBhyKR9NKoBqwoGIfKCDKw+YOh58iW1MCaH1wR 92ury58CTqTMRGsI14PKkW76wObwJ5tUZM92PFaHZU4PQGhRneZU3HYuTu1JVSsEynoM p3N0xdZCGph6L7XS2cELV+ZP7sYBQsFgULFdnTTGbPmNAFfyeGKl+A+gZwWUDVUPL/Cu c4MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=Yj5wsZyZdrouBY0XL6JYIchV28OgZyZH1skDBxxWH4Y=; b=WH3rkz9fOA6uJU4sS9w0DGhbZyNMQxyzM32GP4whtCDOOUyhWlsIB9r+NlMrQcjys9 RchZS4i0RTNXhzE9P5Ki1Lh+QB56duegbFMGTykR0q5vY3vcNKpKQW+e8c6Qjmss2m7U Hq+dVZSbW3EcWC80WVxLm5HmssH04j2RHnpU1lRaQ6XfpCTwjDw0HEpT6UqBa96Ku1qM n0/l8XnKzV5LNCW/X4DuhJH+lLmaTXqqXsX3MKT59hjF0XrK/tr6qDgZodQ7YJlJqqkS /Azut746zUuVOXyNpqAgk4gqj0eLhTVUE60YAX5RJ7QlxLG4RtCuSts2S70j5QyqKGHH 2r5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=nFjzSchn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si13280124otp.69.2020.02.05.04.28.23; Wed, 05 Feb 2020 04:28:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=nFjzSchn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728134AbgBEM1E (ORCPT + 99 others); Wed, 5 Feb 2020 07:27:04 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:14855 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727922AbgBEM1D (ORCPT ); Wed, 5 Feb 2020 07:27:03 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1580905623; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Yj5wsZyZdrouBY0XL6JYIchV28OgZyZH1skDBxxWH4Y=; b=nFjzSchnik+WTujBu+fLKRo/BuCOpOoxY1WEPjQMShwcYZftBg0rzwJQHeUY0tdMiBgz1u4P vWifrwxe4tvsKtpSnb4IAGfK2XL5OUpaz1ZEh+g+76M/M/jazl2FSo87bc7VaJm0H3geTXoJ E9ntW0bTCWLKPNt6PBh+dK2hvVw= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e3ab496.7ff3e03b25a8-smtp-out-n03; Wed, 05 Feb 2020 12:27:02 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 75C52C447A6; Wed, 5 Feb 2020 12:27:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mkshah-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id E71F3C433CB; Wed, 5 Feb 2020 12:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E71F3C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org From: Maulik Shah To: swboyd@chromium.org, agross@kernel.org, david.brown@linaro.org, sudeep.holla@arm.com, Lorenzo.Pieralisi@arm.com Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bjorn.andersson@linaro.org, evgreen@chromium.org, dianders@chromium.org, rnayak@codeaurora.org, ilina@codeaurora.org, lsrao@codeaurora.org, ulf.hansson@linaro.org, rjw@rjwysocki.net, Maulik Shah Subject: [PATCH v4 5/6] drivers: firmware: psci: Allow hierarchical topology in PC mode Date: Wed, 5 Feb 2020 17:56:11 +0530 Message-Id: <1580905572-22712-6-git-send-email-mkshah@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1580905572-22712-1-git-send-email-mkshah@codeaurora.org> References: <1580905572-22712-1-git-send-email-mkshah@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson If the hierarchical CPU topology is used, but the OS initiated mode isn't supported, we need to rely solely on the regular cpuidle framework to manage the idle state selection. Remove current limitation of hierarchical topology to be used in OSI mode only. Signed-off-by: Ulf Hansson [applied to new path, updated commit text] Signed-off-by: Maulik Shah --- drivers/cpuidle/cpuidle-psci-domain.c | 32 +++++++++++++++----------------- drivers/cpuidle/cpuidle-psci.c | 34 ++++++++++++++++------------------ 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c index 423f03b..fcab330 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -125,11 +125,14 @@ static int __init psci_pd_init(struct device_node *np) * Parse the domain idle states and let genpd manage the state selection * for those being compatible with "domain-idle-state". */ - ret = psci_pd_parse_states(np, &states, &state_count); - if (ret) - goto free_name; - pd->free_states = psci_pd_free_states; + if (psci_has_osi_support()) { + ret = psci_pd_parse_states(np, &states, &state_count); + if (ret) + goto free_name; + pd->free_states = psci_pd_free_states; + } + pd->name = kbasename(pd->name); pd->power_off = psci_pd_power_off; pd->states = states; @@ -236,10 +239,6 @@ static int __init psci_idle_init_domains(void) if (!np) return -ENODEV; - /* Currently limit the hierarchical topology to be used in OSI mode. */ - if (!psci_has_osi_support()) - goto out; - /* * Parse child nodes for the "#power-domain-cells" property and * initialize a genpd/genpd-of-provider pair when it's found. @@ -265,14 +264,16 @@ static int __init psci_idle_init_domains(void) goto remove_pd; /* Try to enable OSI mode. */ - ret = psci_set_osi_mode(); - if (ret) { - pr_warn("failed to enable OSI mode: %d\n", ret); - psci_pd_remove_topology(np); - goto remove_pd; + if (psci_has_osi_support()) { + ret = psci_set_osi_mode(); + if (ret) { + pr_warn("failed to enable OSI mode: %d\n", ret); + psci_pd_remove_topology(np); + goto remove_pd; + } else + osi_mode_enabled = true; } - osi_mode_enabled = true; of_node_put(np); pr_info("Initialized CPU PM domain topology\n"); return pd_count; @@ -293,9 +294,6 @@ struct device __init *psci_dt_attach_cpu(int cpu) { struct device *dev; - if (!osi_mode_enabled) - return NULL; - dev = dev_pm_domain_attach_by_name(get_cpu_device(cpu), "psci"); if (IS_ERR_OR_NULL(dev)) return dev; diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index edd7a54..16d8baa 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -193,24 +193,22 @@ 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; - } + 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; } /* Idle states parsed correctly, store them in the per-cpu struct. */ -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation