From patchwork Tue Sep 19 22:32:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 113064 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp33761qgf; Tue, 19 Sep 2017 15:32:41 -0700 (PDT) X-Received: by 10.99.60.13 with SMTP id j13mr120915pga.384.1505860361016; Tue, 19 Sep 2017 15:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505860361; cv=none; d=google.com; s=arc-20160816; b=OQ57B2cAy8kUOzhTqzRSSZmB/t6OkAHIggSDrcisg0zUOt3XRnyaZi8RH667AiFMJP CXU25JaPdWBrlisEuyfasX9zabQmycHnOPp3n7xqHzbAXLmhXg3TAl/eLEk6TUgMSYaq YBMhlSWDz4juULmmJsew4ZIYAdz1IbPUjBcanFhP8bubLPXeep7ZAcMStt3nbApAr04R HVJOLr06n3xcq3rfdRTV7e5DRxEf8yQ1cagUxMlU90O1M0Agflt62XQUfJd67WzVgaXf mCTotJcM7Up3hPn6Dg13eCMqOgASDp+ajjwYoqkIvVIhiUv3tk3P44iYwUrv6k06cybq 0yqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=dAml5jQjnqGrNFjcCY9t1+L+ro0Xjl57QoyJXJ53p6Y=; b=WR1N/w1cLajzAh6aSpsJOXQcX5aWrepGzeSs2/IKbLCX2yQrFj3P7FZv2wgsnK/ePE jb8IaZAts3uGN9acPZS+j11FQJRBYiqHsX6G5n+MI/ldIIG6aY0PbhhpHzvPtMMz7okg V0zWWrMgk6uPxHGQitWKb3Tdk+izXttTzcKQKfm1y1ljvPD+/Dy7KC0kKbtDEXQ+0IW5 nXKaL66UCl1WFmBp0UIR/Kq0Te/xWJL6u1dpV826tz1rcX8myNTI4fCK6UqdogoeUzht rF3QIXUY6qjqoDA5RNW31BKpAkOVewRFR04zZ9XTOjKDROLeOowJRXiQplQPYNYGNMfe GMxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eMJqD3np; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si1970709pgc.446.2017.09.19.15.32.40; Tue, 19 Sep 2017 15:32:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eMJqD3np; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751655AbdISWci (ORCPT + 12 others); Tue, 19 Sep 2017 18:32:38 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:51094 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751636AbdISWch (ORCPT ); Tue, 19 Sep 2017 18:32:37 -0400 Received: by mail-pf0-f179.google.com with SMTP id m63so537916pfk.7 for ; Tue, 19 Sep 2017 15:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=dAml5jQjnqGrNFjcCY9t1+L+ro0Xjl57QoyJXJ53p6Y=; b=eMJqD3np9F4BauGL+Ihp1B6RhJBl5cRfm4mKvBxuGBRJGBcOSXu+qECbsIhaHI2YmB iARUk0OyrudCu9z7jcu1shDVX/EkIegcXBvigP9JXzQzGONdjY+ROgQhTohDlBLEK5ly eR3oCYCafsSISuDKTwC6x1gdD6L9LvjpDjDK4= 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=dAml5jQjnqGrNFjcCY9t1+L+ro0Xjl57QoyJXJ53p6Y=; b=cyMqEW2jl0HGOohAOTTE/ZB6EH+Cszr1NwFVca/pkwat+pHZxtjHcNeDhjvvI4hLOG zNiaIxe8Jkn43IzVZtFlK8Bz/A3Emmg4mWYNMiHEI5hNlnMDx01Fjv1uz/DfA5I8YycZ a8EklapZ5B5MFHzpn2xbxkDEtFiFcw+OPo53LNUDN/hLupNp1xwddu/2Wx537e3P63Lf +FSGoJj1CwCaD/csWVvBiao61EYmmMyBhobdJjzyx2jptvJFn2lsJ5fPiKgdzv0tHM4H M7It+MA1vUeMcZpXbUtOw9nAyEQFFtOHEpiD4VlCwO7tIUZLGOZhal+L/OQS7UQh9q6O 0nMQ== X-Gm-Message-State: AHPjjUgD16rjchj5IJOd7hHdKDNt4SqizBSpdrXvX54i1BsCMMDJpZlm Ha/OcRrpMsnZd1nBzTOq7tWRqw== X-Google-Smtp-Source: AOwi7QC5XpWDpVggyBiDPd7okgaTZVYiLTOcOGfm6v7slJSNPyLuKEPooCMmOVDTFD74hqTMh4753A== X-Received: by 10.99.56.29 with SMTP id f29mr125381pga.328.1505860356812; Tue, 19 Sep 2017 15:32:36 -0700 (PDT) Received: from localhost (cpe-172-88-64-62.socal.res.rr.com. [172.88.64.62]) by smtp.gmail.com with ESMTPSA id h70sm4674301pfc.115.2017.09.19.15.32.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Sep 2017 15:32:35 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Kevin Hilman Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , robh+dt@kernel.org, lina.iyer@linaro.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org, Len Brown , Pavel Machek , Andy Gross , David Brown Subject: [PATCH V10 0/3] PM / Domains: Performance state support Date: Tue, 19 Sep 2017 15:32:16 -0700 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi Ulf, This version contains the changes we discussed during the LPC. Some platforms have the capability to configure the performance state of their power domains. The process of configuring the performance state is pretty much platform dependent and we may need to work with a wide range of configurables. For some platforms, like Qcom, it can be a positive integer value alone, while in other cases it can be voltage levels, etc. The power-domain framework until now was only designed for the idle state management of the device and this needs to change in order to reuse the power-domain framework for active state management of the devices. The first patch updates the genpd framework to supply new APIs to support active state management and the second patch uses them from the OPP core. The third patch adds some more checks to the genpd core to catch bugs. Rest of the patches [4-7/7] are included just to show how user drivers would end up using the new APIs and these patches aren't there to get merged and are marked clearly like that. The ideal way is still to get the relation between device and domain states via the DT instead of platform code, but that can be done incrementally later once we have some users for it upstream. This is currently tested by: - /me by hacking the kernel a bit with virtual power-domains for the ARM 64 hikey platform. I have also tested the complex cases where the device's parent power domain doesn't have set_performance_state() callback set, but parents of that domains have it. Lockdep configs were enabled for these tests. - Rajendra Nayak, on msm8996 platform (Qcom) with MMC controller. Thanks Rajendra for helping me testing this out. I also had a chat with Rajendra and we should be able to get a Qualcomm specific power domain driver (which uses these changes) in coming weeks. Though it wouldn't solve all the problems around corners they have, as they need more updates later on (Like support for multiple masters for a device, etc). Pushed here as well: https://git.linaro.org/people/viresh.kumar/linux.git/log/?h=opp/genpd-performance-state Rebased over: 4.14-rc1 V9->V10: - Performance state of masters is updated before the state of the genpd (Ulf). - 2/7 and 3/7 are swapped. V8->V9: - Renamed genpd callbacks and internal routines. - dev_pm_genpd_has_performance_state() simplified a lot and doesn't check master hierarchy now. Rather a new patch (2/7) is added to take care of that and WARN if no master has set genpd_set_performance_state() callback. - Update is propagated to the masters even if the genpd's callback is already called. - Exit _genpd_reeval_performance_state() early if no state change is required and it gets an additional argument (new state of the device/subdomain). - Taken care of genpd on/off cases. - s/parent/master everywhere in comments and logs. - Better explanations in logs, comments etc. - All the other patches (3-7/7) are same as V8. (Just minor update in 5/7 to use the updated callback names). V7->V8: - Ulf helped a lot in reviewing V7 and pointed out couple of issues, specially in locking while dealing with a hierarchy of power domains. - All those locking issues are sorted out now, even for the complex cases. - genpd_lookup_dev() is used in pm_genpd_has_performance_state() to make sure we have a valid genpd available for the device. - Validation of performance state callbacks isn't done anymore in pm_genpd_init() as it gets called very early and the binding of subdomains to their parent domains happens later. This is handled in pm_genpd_has_performance_state() now, which is called from user drivers. - User driver changes (not to be merged) are included for the first time here, to demonstrate how changes would look finally. V6->V7: - Almost a rewrite, only two patches against 9 in earlier version. - No bindings updated now and domain's performance state aren't passed via DT for now (until we know how users are going to use it). - We also skipped the QoS framework completely and new APIs are provided directly by genpd. V5->V6: - Use freq/voltage in OPP table as it is for power domain and don't create "domain-performance-level" property - Create new "power-domain-opp" property for the devices. - Take care of domain providers that provide multiple domains and extend "operating-points-v2" property to contain a list of phandles - Update code according to those bindings. V4->V5: - Only 3 patches were resent and 2 of them are Acked from Ulf. V3->V4: - Use OPP table for genpd devices as well. - Add struct device to genpd, in order to reuse OPP infrastructure. - Based over: https://marc.info/?l=linux-kernel&m=148972988002317&w=2 - Fixed examples in DT document to have voltage in target,min,max order. V2->V3: - Based over latest pm/linux-next - Bindings and code are merged together - Lots of updates in bindings - the performance-states node is present within the power-domain now, instead of its phandle. - performance-level property is replaced by "reg". - domain-performance-state property of the consumers contain an integer value now instead of phandle. - Lots of updates to the code as well - Patch "PM / QOS: Add default case to the switch" is merged with other patches and the code is changed a bit as well. - Don't pass 'type' to dev_pm_qos_add_notifier(), rather handle all notifiers with a single list. A new patch is added for that. - The OPP framework patch can be applied now and has proper SoB from me. - Dropped "PM / domain: Save/restore performance state at runtime suspend/resume". - Drop all WARN(). - Tested-by Rajendra nayak. V1->V2: - Based over latest pm/linux-next - It is mostly a resend of what is sent earlier as this series hasn't got any reviews so far and Rafael suggested that its better I resend it. - Only the 4/6 patch got an update, which was shared earlier as reply to V1 as well. It has got several fixes for taking care of power domain hierarchy, etc. -- viresh Rajendra Nayak (4): soc: qcom: rpmpd: Add a powerdomain driver to model cx/mx powerdomains soc: qcom: rpmpd: Add support for get/set performance state mmc: sdhci-msm: Adapt the driver to use OPPs to set clocks/performance state remoteproc: qcom: q6v5: Vote for proxy powerdomain performance state Viresh Kumar (3): PM / Domains: Add support to select performance-state of domains PM / OPP: Support updating performance state of device's power domains PM / Domains: Catch missing genpd_set_performance_state() in masters .../devicetree/bindings/power/qcom,rpmpd.txt | 10 + arch/arm64/boot/dts/qcom/msm8996.dtsi | 39 ++ drivers/base/power/domain.c | 293 ++++++++++++++- drivers/base/power/opp/core.c | 48 ++- drivers/base/power/opp/opp.h | 2 + drivers/clk/qcom/gcc-msm8996.c | 8 +- drivers/mmc/host/sdhci-msm.c | 39 +- drivers/remoteproc/qcom_q6v5_pil.c | 20 +- drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/rpmpd.c | 412 +++++++++++++++++++++ include/linux/pm_domain.h | 23 ++ 12 files changed, 880 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/qcom,rpmpd.txt create mode 100644 drivers/soc/qcom/rpmpd.c -- 2.7.4