From patchwork Wed Apr 7 13:59:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 417833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 098A5C433ED for ; Wed, 7 Apr 2021 14:01:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D29B5611CC for ; Wed, 7 Apr 2021 14:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242411AbhDGOBc (ORCPT ); Wed, 7 Apr 2021 10:01:32 -0400 Received: from foss.arm.com ([217.140.110.172]:57702 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352734AbhDGOBc (ORCPT ); Wed, 7 Apr 2021 10:01:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C31D1FB for ; Wed, 7 Apr 2021 07:01:22 -0700 (PDT) Received: from bogus (unknown [10.57.52.142]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0C0D83F792 for ; Wed, 7 Apr 2021 07:01:21 -0700 (PDT) Received: from AM0PR08MB5057.eurprd08.prod.outlook.com (2603:10a6:208:165::33) by DB8PR08MB5068.eurprd08.prod.outlook.com with HTTPS; Wed, 7 Apr 2021 13:59:29 +0000 Received: from DU2PR04CA0329.eurprd04.prod.outlook.com (2603:10a6:10:2b5::34) by AM0PR08MB5057.eurprd08.prod.outlook.com (2603:10a6:208:165::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Wed, 7 Apr 2021 13:59:27 +0000 Received: from DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b5:cafe::14) by DU2PR04CA0329.outlook.office365.com (2603:10a6:10:2b5::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Wed, 7 Apr 2021 13:59:27 +0000 Authentication-Results: spf=pass (sender IP is 217.140.110.172) smtp.mailfrom=arm.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=arm.com;compauth=pass reason=100 Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.110.172 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.110.172; helo=foss.arm.com; Received: from 64aa7808-inbound-1.mta.getcheckrecipient.com (34.249.187.16) by DB5EUR03FT005.mail.protection.outlook.com (10.152.20.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 13:59:27 +0000 Received: ("Tessian outbound ee4b51dcee79:v90"); Wed, 07 Apr 2021 13:59:27 +0000 Received: from foss.arm.com (217.140.110.172) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 13:59:21 +0000 X-TS-Email-ID: 43bbdfb9-eb70-4349-b453-383bd675d1ec Received: from 6c86eef88602.1 by 64aa7808-inbound-1.mta.getcheckrecipient.com id A15F35E6-A0A0-45ED-8896-BC69C94D4E8E.1; Wed, 07 Apr 2021 13:59:23 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-inbound-1.mta.getcheckrecipient.com with ESMTPS id 6c86eef88602.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 07 Apr 2021 13:59:23 +0000 Received: from AS8PR04CA0031.eurprd04.prod.outlook.com (2603:10a6:20b:312::6) by AM5PR0801MB1793.eurprd08.prod.outlook.com (2603:10a6:203:3b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Wed, 7 Apr 2021 13:59:22 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:312:cafe::fa) by AS8PR04CA0031.outlook.office365.com (2603:10a6:20b:312::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Wed, 7 Apr 2021 13:59:22 +0000 Authentication-Results-Original: spf=pass (sender IP is 217.140.110.172) smtp.mailfrom=arm.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=arm.com;compauth=pass reason=100 Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.110.172 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.110.172; helo=foss.arm.com; Received: from foss.arm.com (217.140.110.172) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 13:59:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 66F451FB; Wed, 7 Apr 2021 06:59:21 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2E8143F792; Wed, 7 Apr 2021 06:59:20 -0700 (PDT) From: Sudeep Holla To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Bjorn Andersson , Hector Yuan , Manivannan Sadhasivam , Rob Herring , Viresh Kumar , Rob Herring Subject: [PATCH v3] dt-bindings: dvfs: Add support for generic performance domains Date: Wed, 7 Apr 2021 14:59:13 +0100 Message-Id: <20210407135913.2067694-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.25.1 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09f4bf22-294e-47e3-c274-08d8f9cd5bcb X-MS-TrafficTypeDiagnostic: AM5PR0801MB1793:|AM0PR08MB5057: X-MS-Exchange-AtpMessageProperties: SA x-checktessianinbound: true MS-Exchange-Organization-PhishThresholdLevel: 2 X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: F9tnMlVHhEdzBNh2tVlU0tB9HILMFaiH23LYZvs7AWNUuwg/rEBnt2e8Dbhp9NcFvKByNNkS/efCGxccsElgce62mm41D4VhjNoz6/0qWsokc9nryUPUkh2tV9AtOfOSp5Q6ZgDgUN5zFBUDvGa6TPpolRraTDTfjHn1GUF70TS5uD9c2r2lI9dVFFkNjU70TUby7Ft8dGkXiI0Yfe4IgGnKDsG0BWJffZqGHDs4CmIn2nwqPbJpxJyUu1Yqr6LZaNURVIO161qLVwzx2Qy5hT2on9kYtEQ24GJNjKyOGG4DymD7YvKY8oOrpwLwLWO8JSEGZ9q/ITl0bHSkL0HqtIoyLrW4HeFu7wb9EiwcpvqWmDWLPdP8TYtycuHomtO+pi4YRbbx0nrrOUdnJoCjJWHsk+MAco+Fhs7rcS0bhNdiY+EkvO/f5OvxugPvsO4cxIXNulVwwg2vmojyjZkMZOQR6HJsSrNL7aEEfyIkh6BYfS/4D8cUKWSEAgDgId49/3zR7qbcUi3GwWBi9GAQyFO4Oi5O5o9SsRN4zCJYwBKz/u4mChmo3q8cHoQOfOKQe3wXPi7Jf7i+kGo6t86QFTTGAL5siOMV8axANLpSKjc25N/qZoHRrGzC17TreZvXNYRImGBmN+wmCVnp4rYyMsmdE1x4vqjZ4LjqqLcIZeFRYqk9dzolK8MkWbDYgQ7k5xLHNDFiPmIGIqpnxX0FYtlJAHEf2bZhK53as+8XUlBDZh0fg12ncPsCVZ8SfOAWPK85s9vDGWRWN7mZQRwpeGMMDe6DQ9QKQtQRZvi0n298AKlpRaVVUcU8UhOC8iWOffrkUVJtAK8FlW3CbU5NiIXf1v/C6kR24yzs2gMY3Z+NhZ/IfetaOLL9K/KxzSNRKQkZPZQVeAixLw3oAaWyx2Js8aVWWHbgHtrcQB5P8rmuKBZ+KPirYlwCJruiSKQX0cHmWLVzJsz5J3b8/SXmopibiBD8GZT9t0b+tJIHY4nMSJwQ62upoP1HKV6/ohjR3s+SQgnqsPxRFIRGRYs1h1sRSc7XgeYkzqvunaGZlzvMoo1RmeHh+WlnnCvVcnFj/T3HxkFQqfoL0lsx70ONgzydOPv9SwT+LnLN3wKKP7hpmwD6z6rroSnpJLKkj+qJ X-Forefront-Antispam-Report-Untrusted: CIP:217.140.110.172; CTRY:US; LANG:en; SCL:-1; SRV:; IPV:NLI; SFV:SKN; H:foss.arm.com; PTR:foss.arm.com; CAT:NONE; SFS:; DIR:INB; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1793 X-OrganizationHeadersPreserved: AM5PR0801MB1793.eurprd08.prod.outlook.com Original-Authentication-Results: spf=pass (sender IP is 217.140.110.172) smtp.mailfrom=arm.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=arm.com;compauth=pass reason=100 X-MS-Exchange-Organization-ExpirationStartTime: 07 Apr 2021 13:59:27.6617 (UTC) X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000 X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit X-MS-Exchange-Organization-Network-Message-Id: 09f4bf22-294e-47e3-c274-08d8f9cd5bcb X-MS-Exchange-Organization-MessageDirectionality: Originating X-MS-Exchange-SkipListedInternetSender: ip=[217.140.110.172]; domain=foss.arm.com X-MS-Exchange-ExternalOriginalInternetSender: ip=[217.140.110.172]; domain=foss.arm.com X-MS-Exchange-Organization-SCL: -1 X-CrossPremisesHeadersPromoted: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-CrossPremisesHeadersFiltered: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-Organization-AuthSource: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-Organization-AuthAs: Anonymous X-OriginatorOrg: arm.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 72ae5e7a-7263-467d-83a2-08d8f9cd588d X-Microsoft-Antispam: BCL:0; X-Forefront-Antispam-Report: CIP:34.249.187.16; CTRY:US; LANG:en; SCL:-1; SRV:; IPV:NLI; SFV:SKN; H:foss.arm.com; PTR:foss.arm.com; CAT:NONE; SFS:; DIR:INB; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2021 13:59:27.6537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09f4bf22-294e-47e3-c274-08d8f9cd5bcb X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[34.249.187.16]; Helo=[64aa7808-inbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5057 X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.7842942 X-MS-Exchange-Processed-By-BccFoldering: 15.20.3999.032 X-Microsoft-Antispam-Mailbox-Delivery: ucf:1; jmr:0; auth:0; dest:C; OFR:CustomRules; ENG:(750129)(520011016)(944506458)(944626604); X-Microsoft-Antispam-Message-Info: =?iso-8859-1?q?zl60HDzEmq3mcz9F1V+6hVN?= =?iso-8859-1?q?dKk0uiMIR6lrSeIqMqBIvmue4ML1Sk9zrZhHptq8RXIzL2uVB9C?= =?iso-8859-1?q?UNd5PVuVYqotlJFYCfKcN2d3q6BcB0K2Oe2u+xydxqpSKFHH/eP?= =?iso-8859-1?q?xBLyn6JwgiBNb/km7ySlkMFbGppTHydI8Ri50gAQyuB0U7IWyr2?= =?iso-8859-1?q?31JFnOwHfZGB36kUgHZnFfCVn3HiJbUz/4qn0s8LK/E0OOaEpdo?= =?iso-8859-1?q?UAjnFrt4k3FUdnr92ipb0w/RKJf6oKWQ5kYSzLdAs3GGUnHg/ID?= =?iso-8859-1?q?VdFGy4EGXYYvXeCm/LGenyfv+iRfwIgZq5MwnSS68INmYZ+KuAM?= =?iso-8859-1?q?yfl0e3r1Iv0S0yTyixVMgoVy5FVSQltOZc1iU7UxivwGLV64cRu?= =?iso-8859-1?q?ScMWtYd7Zm3pI5zeEKv3hPrsfRfuj3qDDwTm0Q8vxhjItbVw173?= =?iso-8859-1?q?PQw6sqgX9TWOwstJZBzK10X0OOpqYtoD2u7OaNjI5EgxzwK+pMY?= =?iso-8859-1?q?dWPgPCrZfDie8iVYg1/JocpbOFNResrM6SxzXJWYFvQt/2A56L7?= =?iso-8859-1?q?4n3nLTw6jIPu6NeTxySUd/nkWeWLCwHALr+LQ8sU3VQTsMQUewr?= =?iso-8859-1?q?MD8kY/qqrNTm+ENI0SyB4VZkXeZoXASGS4AV6VF7eJcmLdB1ewk?= =?iso-8859-1?q?jDA66r+z8Nv+IjsaFLjnqMN0Lqgj1u9SQmpJpUY6pQEydGZS+CV?= =?iso-8859-1?q?LgfYGtWHtzWUQelhFDfvZ9rB8NWkd5/HkWozj7f5vksviEr6enQ?= =?iso-8859-1?q?ZOaUQciB6/2jx6dmQ7ylVxbNyeMmA3J92WHRnVoT7eN9I6nonxO?= =?iso-8859-1?q?zFEbptGx1vRhTGA3DCcajf/LeoDOvp+vH5oyl+OP9yhzwLpNs/I?= =?iso-8859-1?q?ofXQHmt9zXx/Fm7JP4FP3HiUEDMM24sjQAThYUWs9ihYGv6b4/U?= =?iso-8859-1?q?SjGC1yJ43Q1uGoT47jkv8FOUyGDk4bUtdvc3Ew7FBnxtSYpLvUY?= =?iso-8859-1?q?TtYSmdjKS6/8FPZYqPY8vK71Y1kLYLRBr3VKh5TlMzHqX6/FW5b?= =?iso-8859-1?q?rANNurjglZGPMattwmg2zkFjXXP7e4IzYHD4Fv2YYm+d0BqI6EL?= =?iso-8859-1?q?fBumgr/QDqByDFh/TWuVfPMTDX2edpArHOWei0A4UNM9IBwZPv/?= =?iso-8859-1?q?5Ks0Xrbqr46hwA3AUaY4VLNEs3sGlFmkm5WEp6nD45h6kg8S6o8?= =?iso-8859-1?q?FAPrhiQjB9aCDNeVg6hif+yPUswkg=3D=3D?= MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The CLKSCREW attack [0] exposed security vulnerabilities in energy management implementations where untrusted software had direct access to clock and voltage hardware controls. In this attack, the malicious software was able to place the platform into unsafe overclocked or undervolted configurations. Such configurations then enabled the injection of predictable faults to reveal secrets. Many Arm-based systems used to or still use voltage regulator and clock frameworks in the kernel. These frameworks allow callers to independently manipulate frequency and voltage settings. Such implementations can render systems susceptible to this form of attack. Attacks such as CLKSCREW are now being mitigated by not having direct and independent control of clock and voltage in the kernel and moving that control to a trusted entity, such as the SCP firmware or secure world firmware/software which are to perform sanity checking on the requested performance levels, thereby preventing any attempted malicious programming. With the advent of such an abstraction, there is a need to replace the generic clock and regulator bindings used by such devices with a generic performance domains bindings. [0] https://www.usenix.org/conference/usenixsecurity17/technical-sessions/presentation/tang Link: https://lore.kernel.org/r/20201116181356.804590-1-sudeep.holla@arm.com Cc: Rob Herring Acked-by: Viresh Kumar Signed-off-by: Sudeep Holla --- Hi All, Sorry for the delay, I thought I had sent this out last week and it turns out that I had dry-run in my git email command and never removed it. Just noticed now looking for response for this patch on the list to find out that I never sent it out :(. v2[2]->v3: - Dropped required properties - Added non cpu device example - Updated cpu bindings too v1[1]->v2[2]: - Changed to Dual License - Added select: true, enum for #performance-domain-cells and $ref for performance-domain - Changed the example to use real existing compatibles instead of made-up ones [1] https://lore.kernel.org/lkml/20201105173539.1426301-1-sudeep.holla@arm.com [2] https://lore.kernel.org/lkml/20201116181356.804590-1-sudeep.holla@arm.com .../devicetree/bindings/arm/cpus.yaml | 7 ++ .../bindings/dvfs/performance-domain.yaml | 80 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dvfs/performance-domain.yaml diff --git a/Documentation/devicetree/bindings/arm/cpus.yaml b/Documentation/devicetree/bindings/arm/cpus.yaml index 26b886b20b27..98590a2982d0 100644 --- a/Documentation/devicetree/bindings/arm/cpus.yaml +++ b/Documentation/devicetree/bindings/arm/cpus.yaml @@ -255,6 +255,13 @@ description: |+ where voltage is in V, frequency is in MHz. + performance-domains: + $ref: '/schemas/types.yaml#/definitions/phandle-array' + description: + List of phandles and performance domain specifiers, as defined by + bindings of the performance domain provider. See also + dvfs/performance-domain.yaml. + power-domains: $ref: '/schemas/types.yaml#/definitions/phandle-array' description: diff --git a/Documentation/devicetree/bindings/dvfs/performance-domain.yaml b/Documentation/devicetree/bindings/dvfs/performance-domain.yaml new file mode 100644 index 000000000000..640e676ed228 --- /dev/null +++ b/Documentation/devicetree/bindings/dvfs/performance-domain.yaml @@ -0,0 +1,80 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dvfs/performance-domain.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic performance domains + +maintainers: + - Sudeep Holla + +description: |+ + This binding is intended for performance management of groups of devices or + CPUs that run in the same performance domain. Performance domains must not + be confused with power domains. A performance domain is defined by a set + of devices that always have to run at the same performance level. For a given + performance domain, there is a single point of control that affects all the + devices in the domain, making it impossible to set the performance level of + an individual device in the domain independently from other devices in + that domain. For example, a set of CPUs that share a voltage domain, and + have a common frequency control, is said to be in the same performance + domain. + + This device tree binding can be used to bind performance domain consumer + devices with their performance domains provided by performance domain + providers. A performance domain provider can be represented by any node in + the device tree and can provide one or more performance domains. A consumer + node can refer to the provider by a phandle and a set of phandle arguments + (so called performance domain specifiers) of length specified by the + \#performance-domain-cells property in the performance domain provider node. + +select: true + +properties: + "#performance-domain-cells": + description: + Number of cells in a performance domain specifier. Typically 0 for nodes + representing a single performance domain and 1 for nodes providing + multiple performance domains (e.g. performance controllers), but can be + any value as specified by device tree binding documentation of particular + provider. + enum: [ 0, 1 ] + + performance-domains: + $ref: '/schemas/types.yaml#/definitions/phandle-array' + description: + A phandle and performance domain specifier as defined by bindings of the + performance controller/provider specified by phandle. + +additionalProperties: true + +examples: + - | + performance: performance-controller@12340000 { + compatible = "qcom,cpufreq-hw"; + reg = <0x12340000 0x1000>; + #performance-domain-cells = <1>; + }; + + // The node above defines a performance controller that is a performance + // domain provider and expects one cell as its phandle argument. + gpu@2d000000 { + compatible = "arm,mali-t624"; + reg = <0x2d000000 0x10000>; + power-domains = <&power_devpd 2>; + performance-domains = <&performance 4>; + }; + + cpus { + #address-cells = <2>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + performance-domains = <&performance 1>; + }; + }; +