From patchwork Wed Jun 20 17:22:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 139368 Delivered-To: patches@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1050301lji; Wed, 20 Jun 2018 10:22:35 -0700 (PDT) X-Received: by 2002:a2e:7403:: with SMTP id p3-v6mr14616704ljc.59.1529515355707; Wed, 20 Jun 2018 10:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515355; cv=none; d=google.com; s=arc-20160816; b=aLUmAG+PiL3/90wZ+Zb4Pzz7Tlf9unNACSHSjsacbMrJz6e/nTZ9zFy23WvEusH/sN paAG6ubq1vY9rduyYXEdxphEMMjoYzuUMPsiCN9yq0/eXjQALOSibuSYpG3Z/DBeDC7z PuHWlbOu3PO1nbWJ8X4fmj8DZ8k/nTQPEtiUPxP4sQ/tYTvbFSl8PeYBcLglvDtiCeMh dIeb71Q5ahiAeXctm1Ab3HWgiwCrzTDzheQD5nHEkxTRzmzzIjN44XIOUpu8tWBDoT/g kD1P9rzYsIRWB9o0MgnS0FtkSm85x3idLGAYN2+XwdN75v81rJC8cqhqe//lllaTm+1Z VEzA== 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=2rOnhZC3M8EvYQA2pnS1IS2IzGGNUg71SNxnGjjFgcI=; b=xBoK/M9usUqEEjV2Z4GkjK3pXlQoh4adlAjq/KK9rb7Xwuc1e26uTDX8Qmh277gNhj 9iDP6c/FWA4q5i76GIaoIW3Yj8JZbUwD/nC+Fxpe3sGxZqWN7xzNVnBC1im2x50gA2H2 /zhEBB39mrjXI9+FM+KqzR4HWKtXi+V4Wpl6F/l5AXtuKzEGb1s/uBv03iRnFIvLn+c6 2dVGtgAizKqxv7IESbYqL29EnaF6o0350aHKpbs777UtGDCjwrWfDJtPHUJLkYusRITk il7TLCD+Wi6FamAdLqR8mDjhFbxUGCQ0OxemJzJAZlwzSeDoQo31TUFDUBX6K+1mjvJy a/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HN4tGITL; 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 d24-v6sor717895ljg.7.2018.06.20.10.22.35 for (Google Transport Security); Wed, 20 Jun 2018 10:22:35 -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=HN4tGITL; 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=2rOnhZC3M8EvYQA2pnS1IS2IzGGNUg71SNxnGjjFgcI=; b=HN4tGITLriAPJBOwSUImCbB68VgiP2Xs07VoBelIjZQOv6yV5px2TyapLHwB9f8fRj E2obSd5hLORAYOW6hlWz9JUdtvMYnbI3/r07Rpl9vK614YRHNtFvJed12jNUBzdyz4va wtsSJKH3Cmv0rqRzccG+W/1zYzJfi+DjdVBxA= 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=2rOnhZC3M8EvYQA2pnS1IS2IzGGNUg71SNxnGjjFgcI=; b=bjQmo11dWBVjw6rJT0RvpK2loaq2Ga9HCNFSulnVGs5GELj9gdmh6iLy+hI9OVOHBJ XKuTgic8Z7cbTOedBKcdJvg8xC8DY2mLsDNPslDH7w/m8YHx1yyURIkt3+FS2z4AwDiq mYugCnc8AMUtHIpZgKvU6r51pkIpbMmB3Rc56s/KGNQ03LY93c+VkaG0AsVR6sAiOr4j 5OSMfPrphlysKeeTdWHo/DOEijukLrKWYXdoyyAeZllVKRNaig97o2fmcBlV0xbsvkqo 16yQoPaZGBFqv8ch8hKxbO09kljkdV9Z1I7PzQgyugwf92uRC55mr3U+sQabINQrI1C8 QuRw== X-Gm-Message-State: APt69E2Na5QdbdFXzIr0c3jODXihH1OU7IF4g0bOkp3OSYITTAm+QCi8 ZUOMKaokhXbLXxLnagL2b32HiQ3t X-Google-Smtp-Source: ADUXVKIfzTehd4tkt5s4EsEdMBJEYy9Vy7O3YlRtXefLYSfaBNLk8MSa/yz+RiNRihX58JkJ7t6z+A== X-Received: by 2002:a2e:2917:: with SMTP id u23-v6mr493044lje.130.1529515355349; Wed, 20 Jun 2018 10:22:35 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:22:34 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , 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 v8 00/26] PM / Domains: Support hierarchical CPU arrangement (PSCI/ARM) Date: Wed, 20 Jun 2018 19:22:00 +0200 Message-Id: <20180620172226.15012-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 Changes in v8: - Added some tags for reviews and acks. - Cleanup timer patch (patch6) according to comments from Rafael. - Rebased series on top of v4.18rc1 - it applied cleanly, except for patch 5. - While adopting patch 5 to new genpd changes, I took the opportunity to improve the new function description a bit. - Corrected malformed SPDX-License-Identifier in patch20. Changes in v7: - Addressed comments concerning the PSCI changes from Mark Rutland, which moves the psci firmware driver to a new firmware subdir and change to force PSCI PC mode during boot to cope with kexec'ed booted kernels. - Added some maintainers in cc for the timer/nohz patches. - Minor update to the new genpd governor, taking into account the state's poweroff latency while validating the sleep duration time. - Addressed a problem pointed out by Geert Uytterhoeven, around calling pm_runtime_get|put() for CPUs that has not been attached to a CPU PM domain. - Re-based on Linus' latest master. 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. - Patch 1 -> Patch 12: The first part are generic changes to genpd, cpu_pm, timers, cpuidle and DT. Of course the solution is based on an opt-in method, so no users should be affected of any of these changes. - Patch 13 -> Patch 26: The second part are changes to PSCI and ARM64, which deploys the support for CPU idle management, based upon the new generic changes from the first part. The series is based on v4.18rc1 and the code has been tested on a QCOM 410c dragonboard. You may find the code at: git.linaro.org/people/ulf.hansson/linux-pm.git next Kind regards Ulf Hansson 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 (20): 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: Move psci to separate directory MAINTAINERS: Update files for PSCI 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 arm64: kernel: Respect the hierarchical CPU topology in DT for PSCI .../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 | 158 ++++++++++++++- drivers/base/power/domain_governor.c | 67 ++++++- drivers/cpuidle/dt_idle_states.c | 5 +- drivers/firmware/Kconfig | 15 +- drivers/firmware/Makefile | 3 +- drivers/firmware/psci/Kconfig | 13 ++ drivers/firmware/psci/Makefile | 4 + drivers/firmware/{ => psci}/psci.c | 174 +++++++++++++---- drivers/firmware/psci/psci.h | 19 ++ drivers/firmware/{ => psci}/psci_checker.c | 0 drivers/firmware/psci/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 | 8 + include/uapi/linux/psci.h | 5 + kernel/cpu_pm.c | 11 ++ kernel/time/tick-sched.c | 10 + 23 files changed, 877 insertions(+), 70 deletions(-) create mode 100644 drivers/firmware/psci/Kconfig create mode 100644 drivers/firmware/psci/Makefile rename drivers/firmware/{ => psci}/psci.c (83%) create mode 100644 drivers/firmware/psci/psci.h rename drivers/firmware/{ => psci}/psci_checker.c (100%) create mode 100644 drivers/firmware/psci/psci_pm_domain.c -- 2.17.1