Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Xing Loong <xing.xl.loong@gmail.com>
Cc: Jens Wiklander <jenswi@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sumit Garg <sumit.garg@kernel.org>,
	op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] dt-bindings: firmware: add mbedtee,tee binding
Date: Fri, 31 Jul 2026 15:19:55 -0500	[thread overview]
Message-ID: <20260731201955.GA1585970-robh@kernel.org> (raw)
In-Reply-To: <20260720073558.799755-3-xing.xl.loong@gmail.com>

On Mon, Jul 20, 2026 at 03:35:56PM +0800, Xing Loong wrote:
> MbedTEE is a Trusted Execution Environment for embedded
> systems (https://github.com/mbedtee). It communicates with
> the REE via shared-memory ring buffers using a fixed RPC
> protocol. Two platform configurations are supported:
> 
>   - ARM/AArch64 (TrustZone, SMC): two reserved-memory
>     regions (t2r-ring and t2r-shm) plus a GIC SPI edge
>     interrupt for TEE-to-REE notifications.
>   - RISC-V (IMSIC): three reserved-memory regions, adding
>     r2t-ring for REE-to-TEE command submissions; no
>     interrupts property (T2R notifications use IMSIC MSI
>     allocated at runtime).
> 
> Signed-off-by: Xing Loong <xing.xl.loong@gmail.com>
> ---
> Changes in v3:
> - Drop all phandle stub nodes from examples.
> - Remove redundant required: - interrupts from then branch.
> - Simplify title and description.
> 
> Changes in v2:
> - Fix DT binding review comments from Krzysztof Kozlowski:
>   - Drop $nodename, "YAML devicetree binding" wording, property descriptions
>   - Rename compatible string to mbedtee,tee
>   - Rename memory regions: rpc-t2r-ring -> t2r-ring, rpc-t2r-shm -> t2r-shm,
>     rpc-r2t-ring -> r2t-ring
>   - Add memory-region / memory-region-names to required
>   - Simplify allOf constraints (drop redundant else-branch items)
>   - Rewrite description to describe hardware/firmware, not the binding or driver
>   - Drop all irrelevant platform nodes (gic, cpus, reserved-memory)
>   - Add maxItems: 1 constraint to interrupts property (Sashiko AI review)
> 
> ---
> 
>  .../bindings/firmware/mbedtee,tee.yaml        | 109 ++++++++++++++++++
>  1 file changed, 109 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/firmware/mbedtee,tee.yaml
> 
> diff --git a/Documentation/devicetree/bindings/firmware/mbedtee,tee.yaml b/Documentation/devicetree/bindings/firmware/mbedtee,tee.yaml
> new file mode 100644
> index 0000000..a8f1201
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/firmware/mbedtee,tee.yaml
> @@ -0,0 +1,109 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/firmware/mbedtee,tee.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MbedTEE
> +
> +maintainers:
> +  - Xing Loong <xing.xl.loong@gmail.com>
> +
> +description: |
> +  MbedTEE is a Trusted Execution Environment for embedded systems.
> +  It communicates with the REE (Linux) via shared-memory ring
> +  buffers using a fixed RPC protocol.
> +
> +  We're using "mbedtee" as the vendor prefix for the open-source TEE
> +  project at https://github.com/mbedtee.
> +
> +  The REE and TEE CPUs sharing the RPC memory must be in a
> +  hardware-coherent domain.
> +
> +  Two or three reserved-memory regions are required:
> +    t2r-ring: ring buffer for TEE-to-REE notifications
> +    t2r-shm:  shared memory for TEE-to-REE RPC payloads
> +    r2t-ring: ring buffer for REE-to-TEE command submissions (RISC-V)

Put any details about specific properties with the property schema.

> +
> +  On ARM the transport uses SMC and a GIC SPI interrupt. On RISC-V
> +  the transport uses shared-memory rings and IMSIC MSI; the TEE
> +  polls r2t-ring for commands from the REE.
> +
> +properties:
> +  compatible:
> +    const: mbedtee,tee
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  msi-parent:
> +    maxItems: 1
> +
> +  memory-region:
> +    minItems: 2
> +    maxItems: 3
> +
> +  memory-region-names:
> +    minItems: 2
> +    maxItems: 3
> +    items:
> +      enum:
> +        - t2r-ring
> +        - t2r-shm
> +        - r2t-ring

Needs to define the order as sashiko points out. The order doesn't 
change, so it doesn't need to be defined in the if/then schemas.

> +
> +required:
> +  - compatible
> +  - memory-region
> +  - memory-region-names
> +
> +allOf:
> +  - if:
> +      required:
> +        - interrupts
> +    then:
> +      properties:
> +        msi-parent: false
> +        memory-region:
> +          maxItems: 2
> +        memory-region-names:
> +          items:
> +            - const: t2r-ring
> +            - const: t2r-shm

Just 'maxItems: 2'

> +    else:
> +      required:
> +        - msi-parent
> +      properties:
> +        interrupts: false
> +        memory-region:
> +          minItems: 3
> +        memory-region-names:
> +          items:
> +            - const: t2r-ring
> +            - const: t2r-shm
> +            - const: r2t-ring

Just 'minItems: 3'

> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    firmware {
> +        mbedtee {
> +            compatible = "mbedtee,tee";
> +            interrupts = <GIC_SPI 72 IRQ_TYPE_EDGE_RISING>;
> +            memory-region = <&t2r_ring>, <&t2r_shm>;
> +            memory-region-names = "t2r-ring", "t2r-shm";
> +        };
> +    };
> +
> +  - |
> +    firmware {
> +        mbedtee {
> +            compatible = "mbedtee,tee";
> +            msi-parent = <&imsic>;
> +            memory-region = <&t2r_ring>, <&t2r_shm>, <&r2t_ring>;
> +            memory-region-names = "t2r-ring", "t2r-shm", "r2t-ring";
> +        };
> +    };
> -- 
> 2.43.0
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-07-31 20:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  7:35 [PATCH v3 0/3] tee: add MbedTEE driver Xing Loong
2026-07-20  7:35 ` [PATCH v3 1/3] dt-bindings: vendor-prefixes: add mbedtee Xing Loong
2026-07-31 20:15   ` Rob Herring (Arm)
2026-07-20  7:35 ` [PATCH v3 2/3] dt-bindings: firmware: add mbedtee,tee binding Xing Loong
2026-07-31 20:19   ` Rob Herring [this message]
2026-07-20  7:35 ` [PATCH v3 3/3] tee: add MbedTEE driver Xing Loong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260731201955.GA1585970-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jenswi@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=sumit.garg@kernel.org \
    --cc=xing.xl.loong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox