From patchwork Wed Mar 14 16:58:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 131690 Delivered-To: patches@linaro.org Received: by 10.80.210.197 with SMTP id q5csp410849edg; Wed, 14 Mar 2018 09:59:41 -0700 (PDT) X-Received: by 2002:a19:d0d5:: with SMTP id h204-v6mr3787898lfg.124.1521046781255; Wed, 14 Mar 2018 09:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046781; cv=none; d=google.com; s=arc-20160816; b=GRC8FFnka5m/wc3u7KYODyNVAePdGJmKLwnNImnQhN0Izc1zXsja6G4v2UJhLQUxlz sKWhbEeom4odcQc1pNdyxbEw9EMrneySAtthkAwz5WtaDR0rgcDZfq9bWrYTgo3KIRJY vOLlr+FGvb2wxYb56EfdGJ7NKbyJloHWfiymrSinIdrKDimMQ1y7kO8/9NSOZRLAyUJl EpBugXedMO4RwDDOa+TIsWseaH/fBP5QVZcWVriktAgVeIKNmkvrbv5mFonGqmiloPNg ozf6gZH+N2wjLFjcDznqzWEmMc83dZvmnMw7iNBSWfgOmD3qOBIo/z1tBnVoh//hYF41 J0bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=J6ldBd391MN9+dSovGT58nU3Aete+nPqspX9bPdHUFw=; b=g5deykXgHdEQUQMgLifecq/T7qJhT8TSaHZW7y9m5EPyby1MaC51IN0ouqrRWma8kG Q4bZNCG2Ixc3PoFxNBdmFfvHbLrvMxNs+JXrRLdXh0dnle4GM12uxGIE70OBLDrRIAjA f3JdIeOCNV/1kqF6u7/um5n/QGRI39THTz3TcAXuyn23cZln6jAAFnldAz9h5TTMUCPw Rw+iat1/nn23iTC1OIHywVe7cTbpOEkTsMqKUKzaR0JZIiCv8jrpTk6FisnUQjbnkw32 hlzOm/4i+PPMoAEGC0W0TVR0QmEh4vNBGFkw3N8fVDnjzs+m6w/DTIPRZpUj8ixZedz2 umYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=irW7RLex; 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 d23-v6sor857569lfc.59.2018.03.14.09.59.41 for (Google Transport Security); Wed, 14 Mar 2018 09:59:41 -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=irW7RLex; 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; bh=J6ldBd391MN9+dSovGT58nU3Aete+nPqspX9bPdHUFw=; b=irW7RLexOHZTnPPDGDj/CsdONcshA06y3qB5nzQ2dquT3eG/jVuLDzp9a0bI1qqHwd Yy3ptLilr60T0Dd2h6n8IWy/jzPaIPj2+mT27RX7fAhWQ5RdJQ9U+KwWh33uoZQQXVQ6 BSHGr97/E5PvNsZn3cHHuhHPhTPKvOy+ro3xw= 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=J6ldBd391MN9+dSovGT58nU3Aete+nPqspX9bPdHUFw=; b=mW3/LX0GmKJ6OPak8tdpnXvmRCUFr2iGVcWIHILqcd2SRJNE6cjdJLKOJL54BvJ6YX LxvJjiKMmSFeHeBvZAjDJVmJ82tar+hZhJnEwNE9yMtjioR5PUT8Ab2SclMvswwXzcZi oAgYgfVNTpyZVNnKpXBVbuOzYN+9ZvXDpH01y4R1FNDmqyXsm9KEwUcAGyOHXafgi3Kj NjDi5J/BQnzrSFzqSZR2r6uu2uo5dQtuHTnpMVPFiTIw1nrazJmHAMlg93IwjXxo22bk mhtser2Kp2mAn9fG7QBMqFPpdxLK7wq9Xyq1N9eJM67lpOnEu8602w8cYXg1ilQ3vE3q vMOw== X-Gm-Message-State: AElRT7FIeow7L+bDWkqEyV5J829sbBKrj3vRgmv/sGIUVefcEjlRNc/J Ta2SGPh6bSD7P5Gic8O7ZQdXpx6E X-Google-Smtp-Source: AG47ELuYlZZaBkRXPbOX1Fpim8g97uwbyhYbBN1X56jiw2zEsXIKehlMJoRu8yX9/6I448tp/xIzqw== X-Received: by 2002:a19:a293:: with SMTP id l141-v6mr4146970lfe.38.1521046780943; Wed, 14 Mar 2018 09:59:40 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t24-v6sm724849lfi.30.2018.03.14.09.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:40 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 21/25] drivers: firmware: psci: Try to attach CPU devices to their PM domains Date: Wed, 14 Mar 2018 17:58:31 +0100 Message-Id: <1521046715-30683-22-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> References: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> In case the OS initiated CPU suspend mode have been enabled, the PM domain topology for CPUs have earlier been created by PSCI. Let's use this information in psci_dt_cpu_init_idle() as a condition for when it makes sense to try to attach the CPU to its corresponding PM domain, via calling of_genpd_attach_cpu(). If the CPU is attached successfully to its PM domain, idle management is now fully prepared to be controlled through runtime PM for the CPU. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/firmware/psci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.7.4 diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 45d55fc..944d6f6 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ static u32 psci_function_id[PSCI_FN_MAX]; static DEFINE_PER_CPU(u32, domain_state); static u32 psci_cpu_suspend_feature; +static bool psci_osi_mode_enabled; u32 psci_get_domain_state(void) { @@ -339,6 +341,14 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) /* Idle states parsed correctly, initialize per-cpu pointer */ per_cpu(psci_power_state, cpu) = psci_states; + + /* If running OSI mode, attach the CPU device to its PM domain. */ + if (psci_osi_mode_enabled) { + ret = of_genpd_attach_cpu(cpu); + if (ret) + goto free_mem; + } + return 0; free_mem: @@ -748,6 +758,7 @@ int __init psci_dt_topology_init(void) goto out; } + psci_osi_mode_enabled = true; pr_info("OSI mode enabled.\n"); out: of_node_put(np);