From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo2-f5.google.com (mail-oo2-f5.google.com [74.125.231.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A94A92DCF6C for ; Thu, 2 Jul 2026 15:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783005133; cv=none; b=cI5gtT+msEiJN0eIyLyzwzzJ+qZKjBQDn3h0Y1Rj0aoFbvm5UZqS44/KW4jZr+yBrymSFcobFUR95mW+oD45cK8W/JJHBBCCpp21lVFTAGhAYQ4j05ZdLUhTHmOgbSK7T4A/LMjeONjC4kBfReHcBe1tl1SSK8EnPFPCZ0ZxDrY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783005133; c=relaxed/simple; bh=EMllpPReduF4xF9JY3i/M4ky8A9qb/2SY9VZU70ZYso=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UVo4zGjAg+wmVOAMQICIq5ArhVpy8+EGakonvzELzdfXfNQpc1Z01Dt67M9DxGgf2aywq8XvzV6vcDTt9PpntcTVyOPuPBpvOkZfrZyEJ9zEuqnrime0DewVQcUjSJJK9GYh4pNj9n96HoTrVO3lBQBgBoGRYOPSrfgVFO5HyMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qTOPux73; arc=none smtp.client-ip=74.125.231.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qTOPux73" Received: by mail-oo2-f5.google.com with SMTP id 006d021491bc7-6a317229906so102210eaf.0 for ; Thu, 02 Jul 2026 08:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783005130; x=1783609930; darn=vger.kernel.org; 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:content-type; bh=EUdfn0E+HkL5zwEpZVP9/C/NdRDvTd2wtK5Vkg7/59k=; b=qTOPux73KI0+kZ4jyAY1I4v+szDNHkXYG3RQtYi2zk5LV3Bb49k42/yo4xHtmWCbc5 esguO3txdmsrtE1I+C7xLZwneI9+z0CiAt1pH6CsFnKChjrRz+YqmevZM7v9zOpFFlNt /s0Zyn3MtRGn69KzFY4y5H3ndYocxE4H/sIuYLDpwTU0gfuz4QjSLS43r9PmnDOPcuHQ FqaZDnFUVMmUoBsm5qGx4DMMGZX3Al0h0HWT9X2NpPEFN/79+0eYbZAX8wYwh1XNeQQr Ur5ibjFUvMctEIIzJXnCSC/wSRcr0LjoxOYRETsgPNrHPdubT5EmNUEazGDqgJ/oYESQ V1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783005130; x=1783609930; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=EUdfn0E+HkL5zwEpZVP9/C/NdRDvTd2wtK5Vkg7/59k=; b=DX+emxhFJzQQHno9nUcDbwuE+B/1R4t0VJDhX0K+45odLw0ui3fkYIuQ+3HOEn0qGa +tKJODy1YUa6ZAFQqAcIevE/Km5fapmZA9+CbVvgciC9v6IQcYJm2vgChiXjrntbl64B W2AhM4QgQQozSwPxgVOrNiLaB4D28VSJAjdtDyWJhy4KL9gFuGFXB8GrzOJe1g2czURO GbfoYQ3NFP8t72mfoepUOm4y6qG+ORBBcN3m03+CQvy+v8gyJgENBQyHTtMbHqpFGMqG fRq6SuJfqrwALALABomE3EVk8na3kDO1OQS5U/Cf3cF0PuZYzPsrJz49KB7lwBie5zDC HbNg== X-Forwarded-Encrypted: i=1; AFNElJ9AEYmRcB0M0C88gtenXeZqyN0t7l5JP+FNVbUiHtcwjBKsZ6jo7EiGbre37nvQhx0Eg0Y9sFp0f6lrzzw=@vger.kernel.org X-Gm-Message-State: AOJu0YyTrtrCpMw7PNSBqHWWpf5QqG1wdY3w+s8fBUFh6T5w4yLGsZSX T+4H077023rAShXmvZ938lfgiFYSbXR7jXmNomlZvYQHMniYkzxUi0jJ X-Gm-Gg: AfdE7ckVL3j/dSzI3fObXFDVeZKfULTu7qkmq4Lp5XjhoN/n4TrgqL6cXKPwo/j5lLQ snDOdSn5aTFiVb2oxi4mLWeyIaGREgYKthO4D/R+Kuw5KuPDsFhFG4pl0AJd1mH20AfMT6pqTWl rziczvzRIbZ/iSa9CIVn+Hg40MkA9+FpiagYMlPhPzmkaJqIr9Gh/VEDp+3oRCH4bWJMgeJIxSe +gW0Ean8NlFZYn1wrbSPSl6I/f21Dh0AXpIEhm1ENWH/n1h11FXY1GF+R5czaAXcPX4Eb9iZAl+ 4tiGoYrgSb6lplcvLfUOYKJbhsqqE6f5chqc1LGSXtQ23Bs3e3AVXwbsIBCt4zSNOZx+2PBFgTN oghs6MN0uTJJ9Vp9592ENujr8XL+3lZdOHMP96NeoWyrqhyjNqlbXXIJInZQCztaUpUJFfor9f2 o0d9lREyLVmuMJy8YCW5Z4RDNpPF39xTTR8bSgt62Qs0++ckYWSrX8gDQ= X-Received: by 2002:a05:6820:2903:b0:69e:98c0:a9c with SMTP id 006d021491bc7-6a30d747a2cmr3407719eaf.11.1783005130487; Thu, 02 Jul 2026 08:12:10 -0700 (PDT) Received: from ubuntu24.. (dsl092-249-254.sfo4.dsl.speakeasy.net. [66.92.249.254]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-44cbec9a113sm3094561fac.9.2026.07.02.08.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2026 08:12:10 -0700 (PDT) From: Xing Loong To: Jens Wiklander Cc: Krzysztof Kozlowski , Conor Dooley , Rob Herring , Sumit Garg , op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Xing Loong Subject: [PATCH v2 2/3] dt-bindings: firmware: add mbedtee,tee binding Date: Thu, 2 Jul 2026 23:11:14 +0800 Message-ID: <20260702151115.544016-3-xing.xl.loong@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260702151115.544016-1-xing.xl.loong@gmail.com> References: <20260701132514.186953-1-xing.xl.loong@gmail.com> <20260702151115.544016-1-xing.xl.loong@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 containers, reg addresses, riscv wrapper); the ARM example now uses bare interrupts (matching arm,sbsa-gwdt.yaml precedent) with only phandle-required stubs (imsic, t2r-ring, r2t-ring) - Add maxItems: 1 constraint to interrupts property (Sashiko AI review) --- .../bindings/firmware/mbedtee,tee.yaml | 132 ++++++++++++++++++ 1 file changed, 132 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..62f2522 --- /dev/null +++ b/Documentation/devicetree/bindings/firmware/mbedtee,tee.yaml @@ -0,0 +1,132 @@ +# 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 Trusted Execution Environment + +maintainers: + - Xing Loong + +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. + + The REE and TEE CPUs sharing the RPC memory must be in a + hardware-coherent domain (same CPU cluster, coherent caches). + + Two or three reserved-memory regions are required: + + t2r-ring ring buffer for TEE-to-REE notifications (all platforms) + t2r-shm shared memory for TEE-to-REE RPC payloads (all platforms) + r2t-ring ring buffer for REE-to-TEE command submissions (RISC-V only) + + On ARM/AArch64 the TEE is invoked via SMC and signals the REE via + a GIC SPI edge interrupt. + + On RISC-V the TEE signals the REE via IMSIC MSI; the REE submits + commands via r2t-ring that the TEE polls. No REE-to-TEE interrupt + is used. No SBI ecall is involved. + +properties: + compatible: + const: mbedtee,tee + + interrupts: + maxItems: 1 + + msi-parent: + maxItems: 1 + + memory-region: + minItems: 2 + maxItems: 3 + # Minimum across platforms (ARM: 2, RISC-V: 3), constrained by allOf below + + memory-region-names: + minItems: 2 + maxItems: 3 + items: + enum: + - t2r-ring + - t2r-shm + - r2t-ring + +required: + - compatible + - memory-region + - memory-region-names + +allOf: + - if: + required: + - interrupts + then: + required: + - interrupts + properties: + msi-parent: false + memory-region: + maxItems: 2 + memory-region-names: + items: + - const: t2r-ring + - const: t2r-shm + else: + required: + - msi-parent + properties: + memory-region: + minItems: 3 + memory-region-names: + items: + - const: t2r-ring + - const: t2r-shm + - const: r2t-ring + +additionalProperties: false + +examples: + - | + /* ARM TrustZone (SMC) */ + #include + + firmware { + mbedtee { + compatible = "mbedtee,tee"; + interrupts = ; + memory-region = <&mbedtee_t2r_ring>, <&mbedtee_t2r_shm>; + memory-region-names = "t2r-ring", "t2r-shm"; + }; + }; + + /* memory-region phandle targets */ + mbedtee_t2r_ring: t2r-ring {}; + mbedtee_t2r_shm: t2r-shm {}; + + - | + /* RISC-V IMSIC (ring-buffer polling REE->TEE, MSI TEE->REE) */ + + firmware { + mbedtee { + compatible = "mbedtee,tee"; + msi-parent = <&imsic>; + memory-region = <&rv_t2r_ring>, <&rv_t2r_shm>, + <&rv_r2t_ring>; + memory-region-names = "t2r-ring", "t2r-shm", + "r2t-ring"; + }; + }; + + /* msi-parent phandle target */ + imsic: imsic { + msi-controller; + #msi-cells = <0>; + }; + + /* memory-region phandle targets */ + rv_t2r_ring: t2r-ring {}; + rv_t2r_shm: t2r-shm {}; + rv_r2t_ring: r2t-ring {}; -- 2.43.0