From patchwork Fri Dec 22 14:32:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122652 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2328521qgn; Fri, 22 Dec 2017 06:32:25 -0800 (PST) X-Received: by 10.46.89.69 with SMTP id n66mr9739725ljb.26.1513953144915; Fri, 22 Dec 2017 06:32:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513953144; cv=none; d=google.com; s=arc-20160816; b=JBPXUA9X1ae3A9+PwSiCDTJk/MIKVOtlNsphAz9eh9JXqUEhQTtWUVMWpU4VAWQXb8 iqmGnkbonni0/obQ4U6nIUH2u0xzBIOuQhMXBQJ5uNxAQ+Uda+l8HVdt5Fl4DzRrCDwf JFQNQP1UuLDvizG8ZJJgswTaplZD/ILh/vRFS6M+F1Bzpc4kUcB06zwWBhdNUrfsecy3 21a7notkDGPihNLlu+qfj2MXV9dhQfmADC2b3VJOU4tZHIkZWO8vejNJRB/OlDTIcljP E6x12JaDZWhkF2jKAmi1qjKgkkr5anoYY7XNXc/VUIFo/oXhmW9W1K5HZo1PhE6Zn6dL AdLg== 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=hoWuS4PWXknMs/VB1dfn2Xo9rSC6xYwUkn5nsbmkJS8=; b=SBvizQGbhiEvriz4V/HTm40+26mOAjFByLavJJymxD5O4dHFVSy6bJYIICeVYJBlXk 5OCAwhADlHDnC481M+Q5h8oy2HjYF1bCkMHQFsNEKX2gO+Weu+0eTufCsagVJ5AYkydt bs9TiohRKO2BF+Iu1sEUY+UTe+wlNMtQXnm0k7CxqxwLfj4cZkAjgWIftzl6l8jg1y1g ffnzwKIhnTRQc0DaSK93mNQ924ZS/8AIqUgIJRyzfSnwtVvjoUZp1t/mfchNT7WE9C/7 nOUIzku26/M3iQEiba/oG4/UujfUQ4FuRG/+tMLnqfmZQmLgd4hgXa1kYoctYRzn+vgj sVVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iaLYJ78R; 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 103sor4181096ljb.54.2017.12.22.06.32.24 for (Google Transport Security); Fri, 22 Dec 2017 06:32:24 -0800 (PST) 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=iaLYJ78R; 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=hoWuS4PWXknMs/VB1dfn2Xo9rSC6xYwUkn5nsbmkJS8=; b=iaLYJ78REU6VbEZW5rH1Za/da6RDL6FHdP+eUj13v2laA5BSFwvrr8xhMnNp12vakq O+VRFDnogYzZtdjoMJ5t/2cH2Va84/SwNgU6Bnov4UOI0Rj7Kyj/Ab+ciNpBwVDbAUMB zY393X9yMs6TINtaAybINThiH4YEs1jbSlZSQ= 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=hoWuS4PWXknMs/VB1dfn2Xo9rSC6xYwUkn5nsbmkJS8=; b=soBkosVV2Y+qUIlvlgyR+b2adFTzWNZzzouJGDM9ajfdqaXie+pXxB836hSOHoOM/c 1XAm1Z+YoARgDKexuPa/5aSVwRyTsF3WRHCVhjBZYNn97SwS15Ex0zqhZBCE4h3Hq2kx 4IspCJpdPEQDWzDM0XVv/Q/N2SHynDyCLob8LptMOLBVpskCn59Ds+wza1ZCNWUrAGN+ 7VXRl+AmPHiRSEHfFDRFIbouA1XvmhLHQAl8mOE5PCB+WKE9CLG0Lhci4kfvIU7ZqTbq 5xevgOK/2rbVh23iz7om+zaw0/cNg72RFciyBt1TKi/24Nvbw1zQX7kIMwdiBOd5qtgk 1lJQ== X-Gm-Message-State: AKGB3mKLkNSFPY/HnMBcRbdMFREhJ4oH5vtZM/irnN9QJAT7REfP1TUU L4s6PJ0z5YJNWm0ro6g5Jng+5RwM X-Google-Smtp-Source: ACJfBouxkgVnleHcakQysh3M1N5dUJPXZW7UgEcpvyLDAurb/2QZTpkTl2FMJr9grJlnACPCgzyrcQ== X-Received: by 10.46.70.18 with SMTP id t18mr8937895lja.120.1513953144162; Fri, 22 Dec 2017 06:32:24 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id g83sm4514702ljb.48.2017.12.22.06.32.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Dec 2017 06:32:23 -0800 (PST) From: Ulf Hansson To: Rob Herring , Mark Rutland , devicetree@vger.kernel.org Cc: Sudeep Holla , Lorenzo Pieralisi , Brendan Jackman , Lina Iyer , Ulf Hansson , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] dt: psci: Update DT bindings to support hierarchical PSCI states Date: Fri, 22 Dec 2017 15:32:07 +0100 Message-Id: <1513953127-3321-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 From: Lina Iyer Update DT bindings to represent hierarchical CPU and CPU domain idle states for PSCI. Also update the PSCI examples to clearly show how flattened and hierarchical idle states can be represented in DT. Signed-off-by: Lina Iyer Signed-off-by: Ulf Hansson --- For your information, I have picked up the work from Lina Iyer around the so called CPU cluster idling series [1,2] and I working on new versions. However, I decided to post the updates to the PSCI DT bindings first, as they will be needed to be agreed upon before further changes can be done to the PSCI firmware driver. Note, these bindings have been discussed over and over again, at LKML, but especially also at various Linux conferences, like LPC and Linaro Connect. We finally came to a conclusion and the changes we agreed upon, should be reflected in this update. Of course, it's a while ago since the latest discussions, but hopefully people don't have too hard time to remember. Kind regards Uffe [1] https://www.spinics.net/lists/arm-kernel/msg566200.html [2] https://lwn.net/Articles/716300/ --- Documentation/devicetree/bindings/arm/psci.txt | 152 +++++++++++++++++++++++++ 1 file changed, 152 insertions(+) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/arm/psci.txt b/Documentation/devicetree/bindings/arm/psci.txt index a2c4f1d..5a8f11b 100644 --- a/Documentation/devicetree/bindings/arm/psci.txt +++ b/Documentation/devicetree/bindings/arm/psci.txt @@ -105,7 +105,159 @@ Case 3: PSCI v0.2 and PSCI v0.1. ... }; +PSCI v1.0 onwards, supports OS-Initiated mode for powering off CPUs and CPU +clusters from the firmware. For such topologies the PSCI firmware driver acts +as pseudo-controller, which may be specified in the psci DT node. The +definitions of the CPU and the CPU cluster topology, must conform to the domain +idle state specification [3]. The domain idle states themselves, must be +compatible with the defined 'domain-idle-state' binding [1], and also need to +specify the arm,psci-suspend-param property for each idle state. + +DT allows representing CPU and CPU cluster idle states in two different ways - + +The flattened model as given in Example 1, lists CPU's idle states followed by +the domain idle state that the CPUs may choose. This is the general practice +followed in PSCI firmwares that support Platform Coordinated mode. Note that +the idle states are all compatible with "arm,idle-state". + +Example 2 represents the hierarchical model of CPU and domain idle states. +CPUs define their domain provider in their DT node. The domain controls the +power to the CPU and possibly other h/w blocks that would be powered off when +the CPU is powered off. The CPU's idle states may therefore be considered as +the domain's idle states and have the compatible "arm,idle-state". Such domains +may be embedded within another domain that represents common h/w blocks between +these CPUs viz. the cluster. The idle states of the cluster would be +represented as the domain's idle states. In order to use OS-Initiated mode of +PSCI in the firmware, the hierarchical representation must be used. + +Example 1: Flattened representation of CPU and domain idle states + cpus { + #address-cells = <1>; + #size-cells = <0>; + + CPU0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0>; + enable-method = "psci"; + cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>, + <&CLUSTER_PWR_DWN>; + }; + + CPU1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a57", "arm,armv8"; + reg = <0x100>; + enable-method = "psci"; + cpu-idle-states = <&CPU_PWRDN>, <&CLUSTER_RET>, + <&CLUSTER_PWR_DWN>; + }; + + idle-states { + CPU_PWRDN: cpu_power_down{ + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x000001>; + entry-latency-us = <10>; + exit-latency-us = <10>; + min-residency-us = <100>; + }; + + CLUSTER_RET: domain_ret { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x1000010>; + entry-latency-us = <500>; + exit-latency-us = <500>; + min-residency-us = <2000>; + }; + + CLUSTER_PWR_DWN: domain_off { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x1000030>; + entry-latency-us = <2000>; + exit-latency-us = <2000>; + min-residency-us = <6000>; + }; + }; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + +Example 2: Hierarchical representation of CPU and domain idle states + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + CPU0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0>; + enable-method = "psci"; + power-domains = <&CPU_PD0>; + }; + + CPU1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a57", "arm,armv8"; + reg = <0x100>; + enable-method = "psci"; + power-domains = <&CPU_PD1>; + }; + + idle-states { + CPU_PWRDN: cpu_power_down{ + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x000001>; + entry-latency-us = <10>; + exit-latency-us = <10>; + min-residency-us = <100>; + }; + + CLUSTER_RET: domain_ret { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x1000010>; + entry-latency-us = <500>; + exit-latency-us = <500>; + min-residency-us = <2000>; + }; + + CLUSTER_PWR_DWN: domain_off { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x1000030>; + entry-latency-us = <2000>; + exit-latency-us = <2000>; + min-residency-us = <6000>; + }; + }; + }; + + psci { + compatible = "arm,psci-1.0"; + method = "smc"; + + CPU_PD0: cpu-pd@0 { + #power-domain-cells = <0>; + domain-idle-states = <&CPU_PWRDN>; + power-domains = <&CLUSTER_PD>; + }; + + CPU_PD1: cpu-pd@1 { + #power-domain-cells = <0>; + domain-idle-states = <&CPU_PWRDN>; + power-domains = <&CLUSTER_PD>; + }; + + CLUSTER_PD: cluster-pd@0 { + #power-domain-cells = <0>; + domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWR_DWN>; + }; + }; + [1] Kernel documentation - ARM idle states bindings Documentation/devicetree/bindings/arm/idle-states.txt [2] Power State Coordination Interface (PSCI) specification http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf +[3]. PM Domains description + Documentation/devicetree/bindings/power/power_domain.txt