Re: [PATCH v3 2/3] dt-bindings: firmware: add mbedtee,tee binding

Rob Herring via OP-TEE <[email protected]> Fri, 31 Jul 2026 15:19:55 -0500
Newsgroups org.trustedfirmware.lists.op-tee,org.infradead.lists.linux-riscv,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
> ---
> 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 <[email protected]>
> +
> +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
>