From patchwork Wed Mar 14 16:58:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 131669 Delivered-To: patches@linaro.org Received: by 10.80.210.197 with SMTP id q5csp410084edg; Wed, 14 Mar 2018 09:59:02 -0700 (PDT) X-Received: by 2002:a19:4e5d:: with SMTP id c90-v6mr3813048lfb.98.1521046742785; Wed, 14 Mar 2018 09:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046742; cv=none; d=google.com; s=arc-20160816; b=an4oVmDCJIhMT00YXgR9NGs5LfDLsQoNvDilu1AtzZ7btMq9DB19XeyjxNre7mXJSg fNGs8hyk1xABov1I6HBDo7aTCzapzwBf77WjZ8WhBatSIyYaz4qy5Ms067iH3bMO4HjA cLtL2AVMmyE2wmfAjJLQBYNeJ/jG7np7TMdLB00r0/KQoCKde/vbatvbtNqHuXgwhka4 KYwni1G2vkI59mo9dwipwgQdGmM30kGQyD0oTVD9DmNlwvZTwt7IaOHmBeRx1AtpmHYh lgsGa88tRintZC6AeEdcLbUIoXIAAl9Z7pi2H9KhYEDO4mNV+qeC2tzwGOgwE6dJcUmD kpgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=DaKVfF4uF5CJAa5pbC+gad9RtW1Brmd45kdhU96Gk5E=; b=oLttDq/gWqnSAZkCKv+Vul0hGd2sriH4iEPXN6rQtORKxkK1JLM+cby1SuJO1DjgB/ zz063FZ9J1t2jnbGTuRth3Raf25Ldp5zZFyqKD8NOFKdh0R2NgfbC+LzXmnnZBVG/37T hfMvd2CVTrKW+uMb1CWrDBslXii6oBU1azbfR6h2Ij5CVJ1mDXcBiH2Sj56GK1EyDq3+ JTaG2BSs/fR3r15ddQr96G+4SfJLYw4OWy7LYI7hbIHkdHzloCGfuFMfka3LbUndiguU lnER2AXnyI0ZdHcP2q06qZR8nIsfbaeHWAozh531bNp7kvq9X/p8NyeuX+s+Lmsjq6Y1 Uh5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FbBVBfKi; 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-v6sor857251lfc.59.2018.03.14.09.59.02 for (Google Transport Security); Wed, 14 Mar 2018 09:59:02 -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=FbBVBfKi; 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; bh=DaKVfF4uF5CJAa5pbC+gad9RtW1Brmd45kdhU96Gk5E=; b=FbBVBfKir4K6O66lhzEpOSlH02wAGQoDO9DPivZxrrExoLRwspGaPRdXwwVSyfpC+V dedpnyaN6JpaSiirs3/91aC41VV4CV3fpL57YQI5CLxOhRzyqE7XiYk7j82aRAMdEz1f nNNqUlHy5+iH1qHZWDOzSVPou1l45G4AGft+8= 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; bh=DaKVfF4uF5CJAa5pbC+gad9RtW1Brmd45kdhU96Gk5E=; b=l99KTEh5S7uUKuCXNYp7sb9gTlHzhZbFf9UBzacl0sRmqxVoI7FmDQPVu+Uzmg8Fsc Zl6pp1fRMuDYqoypj42Zv9H1S6AAtU1GI7qJbUJOwNIRtqK7+YZk5Hu0hzgwodehX5gJ 6aOWqb2Bahu6jlf97d2Sufj86SghRqInStUdtlsATN5OIDzFLOMJZXdaiP3wMFUjMSWy NJvf0ZRl9K25HdROE37MD8/1mShJ1/ROGuK/r8z1Mk2Ke1Cz99kAUgNlA+C6d1uDdK6g vCjTbutsdxt7zrG+cV62rgXn248yjP79Xo+hoRBeEWm2gAglIaJ7uF9uBwTmFf1LugHh 4rLw== X-Gm-Message-State: AElRT7Ftu+3v+b94V4R6a9V7r3cMNHucR6cYJcmE8Q7WGjaXcN7TMYIA P9WDUMrZ5ZyBdvrZ3klRPYyZZlYG X-Google-Smtp-Source: AG47ELug+m+uqycA7Xh6vcyn0tL8bJlgPnyi22XSxNTokedbyPyIwBNtckMsR+IA3Mw+NPvmLMVO9Q== X-Received: by 2002:a19:a293:: with SMTP id l141-v6mr4145487lfe.38.1521046742212; Wed, 14 Mar 2018 09:59:02 -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.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:01 -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 00/25] PM / Domains: Support hierarchical CPU arrangement (PSCI/ARM) Date: Wed, 14 Mar 2018 17:58:10 +0100 Message-Id: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 This series is a re-worked version from Lina Iyer's two series [1] that got posted more than a year ago by now. I have picked up the series and done a significant re-work of it and here's the result. All patches have been changed, some have been dropped, some are entirely new. For this reason I decided to not include a version history, as I think people need a fresh start anyway. For those few changes that are kind of similar, I have kept Lina's authorship, the rest are now authored by me. - Lina (or anybody else for that matter) please tell if you think I should change, in regards to what tag/authorship should be for each commit! Some background: Overall this series have been discussed over years at various Linux conferences and LKML, although let me give a brief introduction and then the rest can be read in each changelog. For ARM, the PSCI firmware interface may be managing the power to the CPUs. Depending on the SoC, CPUs may also be arranged in hierarchical manner, which could add another level of complexity from a CPU idle management point of view. PSCI v1.0+ adds support for the so called OS initiated CPU suspend mode, which enables a more fine grained method, allowing Linux to get more control, in regards to being energy efficient. This is typically useful for these kind of complex battery driven platforms. Now, in principle what is missing today around CPU idle management for these SoCs arranging CPUs in a hierarchical manner, that is what this series intends to address. I could potentially have split the series into two parts, but for completeness I decided to post it as one. Please tell if want me to change! - The first part are changes to generic PM code (genpd, cpu_pm and timers): Patch 1 -> Patch 9. - The second part, which depends on the first, are changes specific to PSCI/ARM64 (psci, of, arm64): Patch 10 -> Patch 25. The series is based on v4.16-rc5, but applies also as of today to Rafael's linux-pm.git next branch. The code has been tested on a QCOM 410c dragonboard and I except that test coverage should be increased by some more boards shortly (for ARM64 with PSCI OSI support - only a few DT changes are needed). You may find the code at: git.linaro.org/people/ulf.hansson/linux-pm.git next Kind regards Ulf Hansson [1] https://lwn.net/Articles/716300/ https://www.spinics.net/lists/arm-kernel/msg566200.html Lina Iyer (6): PM / Domains: Add generic data pointer to genpd_power_state struct timer: Export next wakeup time of a CPU dt: psci: Update DT bindings to support hierarchical PSCI states cpuidle: dt: Support hierarchical CPU idle states drivers: firmware: psci: Support hierarchical CPU idle states arm64: dts: Convert to the hierarchical CPU topology layout for MSM8916 Ulf Hansson (19): PM / Domains: Don't treat zero found compatible idle states as an error PM / Domains: Deal with multiple states but no governor in genpd PM / Domains: Add support for CPU devices to genpd PM / Domains: Add helper functions to attach/detach CPUs to/from genpd PM / Domains: Add genpd governor for CPUs PM / Domains: Extend genpd CPU governor to cope with QoS constraints kernel/cpu_pm: Manage runtime PM in the idle path for CPUs of: base: Add of_get_cpu_state_node() to get idle states for a CPU node drivers: firmware: psci: Split psci_dt_cpu_init_idle() drivers: firmware: psci: Simplify error path of psci_dt_init() drivers: firmware: psci: Announce support for OS initiated suspend mode drivers: firmware: psci: Prepare to use OS initiated suspend mode drivers: firmware: psci: Share a few internal PSCI functions drivers: firmware: psci: Add support for PM domains using genpd drivers: firmware: psci: Introduce psci_dt_topology_init() drivers: firmware: psci: Try to attach CPU devices to their PM domains drivers: firmware: psci: Deal with CPU hotplug when using OSI mode MAINTAINERS: Update files for PSCI arm64: kernel: Respect the hierarchical CPU topology in DT for PSCI Documentation/devicetree/bindings/arm/psci.txt | 156 +++++++++++++++++++++ MAINTAINERS | 2 +- arch/arm64/boot/dts/qcom/msm8916.dtsi | 53 +++++++- arch/arm64/kernel/setup.c | 3 + drivers/base/power/domain.c | 156 ++++++++++++++++++++- drivers/base/power/domain_governor.c | 65 ++++++++- drivers/cpuidle/dt_idle_states.c | 5 +- drivers/firmware/Makefile | 2 +- drivers/firmware/psci.c | 169 +++++++++++++++++------ drivers/firmware/psci.h | 19 +++ drivers/firmware/psci_pm_domain.c | 180 +++++++++++++++++++++++++ drivers/of/base.c | 35 +++++ include/linux/of.h | 8 ++ include/linux/pm_domain.h | 16 +++ include/linux/psci.h | 2 + include/linux/tick.h | 10 ++ include/uapi/linux/psci.h | 5 + kernel/cpu_pm.c | 11 ++ kernel/time/tick-sched.c | 11 ++ 19 files changed, 853 insertions(+), 55 deletions(-) create mode 100644 drivers/firmware/psci.h create mode 100644 drivers/firmware/psci_pm_domain.c -- 2.7.4