Message ID | 20230112145424.3791276-3-etienne.carriere@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3942050wrt; Thu, 12 Jan 2023 07:25:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsZRFX8nvfEO5I1Ww7lRrwi4RwfsV0dYvhO4+79+k0SvJdlsr9livt7WHdeB8oJvZvkva98 X-Received: by 2002:a17:906:284a:b0:7c1:e78:1e2 with SMTP id s10-20020a170906284a00b007c10e7801e2mr82638803ejc.11.1673537116376; Thu, 12 Jan 2023 07:25:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673537116; cv=none; d=google.com; s=arc-20160816; b=BB1Mn8IHne+ROZCeXehobEFBdhPPd+ZG0drtrCdEqaC/txuhHLpWiXFUOfa8qsbJ0h 4Bl4fy5i11s8cO/ZECrLlNjCd+8YdeMO3M3SDgraDCCl+C/TT5q7+aijgVLIU5b9Ld0E 2mjdJhUUTjEozNwcRPQnhnMmzJhvZMZA/bBmRMkz7Qqdm5MXNACmXq6cjAGCeByYfx2+ INY8FpPJ1aSdxctV3uDHFZJlTAoN+tj3sCDX7YZU6vQFOXbekgqdusn1hsAvmj/qxHI3 ALQwP2B1pW7sn+XmJkO1u7o/L1vrwv+M5rl7A4stApb6KL3BRKRlJDcdlFo9Jm1HJSKI Rlqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0PZmQdqSd+0aQvVRPY0Zhs8Yzr1xgEW04gBOSVGXblk=; b=csKs8PHd+LY//ijiqZ4U5D+DvmUJuRMd0NOItV846WaECOBE14xWnui+yLgrC/SVJm K1ZWoH42qWagVvHQsHkN0BmDi02/9WmSG08nU4wGg8BQGLdb8z/ykF6dQVnr5slnzy/5 Yy/Qh/xVdN1L8goUXFe1M98dlz1zSg+qzeRzhupwY4bK0feEhrbLvq+cbXUmKNdShiv1 16ncckcGsaq0n8aEEvCrXWWXyzwjyDNMFVU6C0EVNPgQYoLhQUYCn+T3qiP1Eb653bGR nz2msgo7aO9WfZSDjUq3A/hem2v8KQH/2OOzhRsjUdoaAGsO1wjF84iTyYxo+P3vG5ab 3+qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r25oCopo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq16-20020a1709073f1000b007c10ac7fe46si20059224ejc.19.2023.01.12.07.24.52; Thu, 12 Jan 2023 07:25:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r25oCopo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S240317AbjALPHz (ORCPT <rfc822;zhuangel570@gmail.com> + 99 others); Thu, 12 Jan 2023 10:07:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240322AbjALPGs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Jan 2023 10:06:48 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E962437245 for <linux-kernel@vger.kernel.org>; Thu, 12 Jan 2023 06:55:39 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id ay12-20020a05600c1e0c00b003d9ea12bafcso11359333wmb.3 for <linux-kernel@vger.kernel.org>; Thu, 12 Jan 2023 06:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0PZmQdqSd+0aQvVRPY0Zhs8Yzr1xgEW04gBOSVGXblk=; b=r25oCopoNkIeX3PSmYBCj527lFmJgtv1ESE374T1KJYynR/yYWMxc/xqYMk0/TgOPQ MwSbnT/UxJ7p+vPGbfcKxdvOU1GHb50vaI6pcj32sIy14+Yfn9lnU0K7IGpha922c70Y w8TetzkIVuk9PqlrlhI+urUPzQX1ojnommYsA1Rl9pkiA+xK6RE3EnKDWFCK8cMmzhTL /sCVVpdYAPc0E+QC+viIzVM5yWA2faBrxN7s4dZbuuw+ORmNZEUriPbJZCD1iq2WDm1x oFaK5Tjl8ik3ROeCNzS9p8+st3DgNAhpmw+STM+RkiOVR9oWuB7lZydqyN/HPdwdiBf5 qUAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0PZmQdqSd+0aQvVRPY0Zhs8Yzr1xgEW04gBOSVGXblk=; b=fkXUYYVXuD9I5UL6x/itaHd4fmIho3gtSqScencsGFO/LrDxLDTzGYrIIpfvORWc6y 8LJ4quZX1Dw7WNTTl2ZbJecyeW9d9Am+r9PYm1peRquBkY+XNuUqsqQRXPR8iw6xwMLq /1Dr0atcT+EiEX5MRbCRRC2u8jRsRpggg5cABOI2YaukXLfhq+ZslSlyiMVYqE/qF/UH 1a7ouqNyGpmHWz0MMy6/csotjcwCqshJrovNKf90azxUIFONPKD5aUCqOZCckY3F+Xy7 lzD24fQOOtxnd9bJST21iIHKDqciu2lQcHzKsN3Jkv5LmwoOfkQzHdMJpJjWMK6G8GeL sp2g== X-Gm-Message-State: AFqh2kr5EAEFQgq0+DtkoQzRidPLS9/QVInOhGmaJjYd14mn7Axtpz8l gmKzAHsJa+ITDBe0tbBXZAyYSoJlVnexQn3p X-Received: by 2002:a05:600c:22d4:b0:3cf:82b9:2fe6 with SMTP id 20-20020a05600c22d400b003cf82b92fe6mr65827720wmg.8.1673535339224; Thu, 12 Jan 2023 06:55:39 -0800 (PST) Received: from lmecxl1178.lme.st.com ([80.215.38.209]) by smtp.gmail.com with ESMTPSA id v14-20020adff68e000000b002365730eae8sm16599779wrp.55.2023.01.12.06.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 06:55:38 -0800 (PST) From: Etienne Carriere <etienne.carriere@linaro.org> To: linux-kernel@vger.kernel.org Cc: Jens Wiklander <jens.wiklander@linaro.org>, Sumit Garg <sumit.garg@linaro.org>, Marc Zyngier <maz@kernel.org>, op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Rob Herring <robh+dt@kernel.org>, Etienne Carriere <etienne.carriere@linaro.org> Subject: [PATCH 2/3] dt-bindings: arm: optee: add interrupt controller properties Date: Thu, 12 Jan 2023 15:54:23 +0100 Message-Id: <20230112145424.3791276-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112145424.3791276-1-etienne.carriere@linaro.org> References: <20230112145424.3791276-1-etienne.carriere@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754830855258833600?= X-GMAIL-MSGID: =?utf-8?q?1754830855258833600?= |
Series |
optee: async notif with PPI + interrupt provider
|
|
Commit Message
Etienne Carriere
Jan. 12, 2023, 2:54 p.m. UTC
Adds optional interrupt controller properties used when OP-TEE generates
interrupt events optee driver shall notified to its registered
interrupt consumer. The example shows how OP-TEE can trigger a wakeup
interrupt event consumed by a gpio-keys compatible device.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
.../arm/firmware/linaro,optee-tz.yaml | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
Comments
On Thu, Jan 12, 2023 at 03:54:23PM +0100, Etienne Carriere wrote: > Adds optional interrupt controller properties used when OP-TEE generates > interrupt events optee driver shall notified to its registered > interrupt consumer. The example shows how OP-TEE can trigger a wakeup > interrupt event consumed by a gpio-keys compatible device. Why do we need this in DT? It's not a GPIO key, but an abuse of the binding. It looks like unnecessary abstraction to me. > > Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> > --- > .../arm/firmware/linaro,optee-tz.yaml | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > index d4dc0749f9fd..42874ca21b7e 100644 > --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > @@ -40,6 +40,11 @@ properties: > HVC #0, register assignments > register assignments are specified in drivers/tee/optee/optee_smc.h > > + interrupt-controller: true > + > + "#interrupt-cells": > + const: 1 > + > required: > - compatible > - method > @@ -48,12 +53,24 @@ additionalProperties: false > > examples: > - | > + #include <dt-bindings/input/input.h> > #include <dt-bindings/interrupt-controller/arm-gic.h> > firmware { > - optee { > + optee: optee { > compatible = "linaro,optee-tz"; > method = "smc"; > interrupts = <GIC_SPI 187 IRQ_TYPE_EDGE_RISING>; > + interrupt-controller; > + #interrupt-cells = <1>; > + }; > + }; > + > + wake_up { > + compatible = "gpio-keys"; > + > + button { > + linux,code = <KEY_WAKEUP>; > + interrupts-extended = <&optee 0>; In the end, you just need optee IRQ #0 to generate KEY_WAKEUP. Does either the optee interrupt number or the key code need to be configurable? If so, why? Why isn't #0 just wakeup and the driver can send KEY_WAKEUP? DT is for non-discoverable hardware that we can't fix. Why repeat that for software interfaces to firmware? Rob
On Fri, 13 Jan 2023 at 21:42, Rob Herring <robh@kernel.org> wrote: > > On Thu, Jan 12, 2023 at 03:54:23PM +0100, Etienne Carriere wrote: > > Adds optional interrupt controller properties used when OP-TEE generates > > interrupt events optee driver shall notified to its registered > > interrupt consumer. The example shows how OP-TEE can trigger a wakeup > > interrupt event consumed by a gpio-keys compatible device. > > Why do we need this in DT? It's not a GPIO key, but an abuse of the > binding. It looks like unnecessary abstraction to me. This is when for example OP-TEE world controller a IOs controller device. When some IOs are relate to OP-TEE feature, the controller route to OP-TEE handler. When the IO detection relates to Linux irqs it is routed to Linux, using optee driver irqchip. As Linux uses DT for device drivers to get their interrupt (controler phandle + arg), defining the irqchip in the DT of the platform running that OP-TEE firmware make sense to me. The same way OP-TEE can be in charge of the wakeup source controllers and notify Linxu of event for the wakeup that relate to Linux services. > > > > > > Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> > > --- > > .../arm/firmware/linaro,optee-tz.yaml | 19 ++++++++++++++++++- > > 1 file changed, 18 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > > index d4dc0749f9fd..42874ca21b7e 100644 > > --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > > +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > > @@ -40,6 +40,11 @@ properties: > > HVC #0, register assignments > > register assignments are specified in drivers/tee/optee/optee_smc.h > > > > + interrupt-controller: true > > + > > + "#interrupt-cells": > > + const: 1 > > + > > required: > > - compatible > > - method > > @@ -48,12 +53,24 @@ additionalProperties: false > > > > examples: > > - | > > + #include <dt-bindings/input/input.h> > > #include <dt-bindings/interrupt-controller/arm-gic.h> > > firmware { > > - optee { > > + optee: optee { > > compatible = "linaro,optee-tz"; > > method = "smc"; > > interrupts = <GIC_SPI 187 IRQ_TYPE_EDGE_RISING>; > > + interrupt-controller; > > + #interrupt-cells = <1>; > > + }; > > + }; > > + > > + wake_up { > > + compatible = "gpio-keys"; > > + > > + button { > > + linux,code = <KEY_WAKEUP>; > > + interrupts-extended = <&optee 0>; > > In the end, you just need optee IRQ #0 to generate KEY_WAKEUP. Does > either the optee interrupt number or the key code need to be > configurable? If so, why? Why isn't #0 just wakeup and the driver can > send KEY_WAKEUP? The OP-TEE driver is a generic firmware driver. Platforms do not have specific hooks in it. A generic DT definition of the irqs exposed by opte driver irqchip allows consumers to get their irq resource. I even think 'allows' above could be replaced by is-required-by. Here, binding KEY_WAKEUP to the OP-TEE firmware related irq line from the platform DT reuses existing drivers and bindings to get a irq wkaeup source, signaling KEY_WAKEUP even, when wakeup stouce controller is assigned to (controller by) OP-TEE world. This is an example. Maybe the binding are miss used, but I don't see why. Another example I plan to post is building an mailbox for SMCI notification from a SCMI service host in OP-TEE. OP-TEE would use this optee irqchip to get the interrupt related to the SCMI notification channel. In embedded system, limited resources can be shared by subsystems. > > DT is for non-discoverable hardware that we can't fix. Why repeat that > for software interfaces to firmware? Do you mean the optee driver should enumerate the interrupt lines exposed by OP-TEE and register each line accordingly? This is doable I guess. But that would not prevent Linux kernel DT to define a interrupt controller consumer device nodes can refer to for their need. BR, Etienne > > Rob
diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml index d4dc0749f9fd..42874ca21b7e 100644 --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml @@ -40,6 +40,11 @@ properties: HVC #0, register assignments register assignments are specified in drivers/tee/optee/optee_smc.h + interrupt-controller: true + + "#interrupt-cells": + const: 1 + required: - compatible - method @@ -48,12 +53,24 @@ additionalProperties: false examples: - | + #include <dt-bindings/input/input.h> #include <dt-bindings/interrupt-controller/arm-gic.h> firmware { - optee { + optee: optee { compatible = "linaro,optee-tz"; method = "smc"; interrupts = <GIC_SPI 187 IRQ_TYPE_EDGE_RISING>; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + + wake_up { + compatible = "gpio-keys"; + + button { + linux,code = <KEY_WAKEUP>; + interrupts-extended = <&optee 0>; }; };