* [PATCH 0/3] dt-bindings: tpm: Clean all the things
@ 2023-11-21 9:48 Lukas Wunner
2023-11-21 9:48 ` [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 9:48 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: devicetree, linux-integrity, Lino Sanfilippo
Rob asked me to consolidate and convert the TPM dt-bindings:
https://lore.kernel.org/all/20230927115300.GA1587935-robh@kernel.org/
I came across several issues:
First, this pull request is needed to cope with ibm,#dma-address-cells
and ibm,#dma-size-cells properties used in ibm,vtpm.yaml:
https://github.com/devicetree-org/dt-schema/pull/116
Second, the compatible string "google,cr50" refers to a chip which has
both an i2c and an spi interface (see drivers/char/tpm/tpm_tis_i2c_cr50.c
as well as tpm_tis_spi_main.c) This confuses the schema validator
because it thinks that "google,cr50" may only use i2c properties but
tcg,tpm_tis-spi.yaml contains an spi example, which causes some warnings.
It seems deeper code changes to the schema validator are required to
avoid them:
Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: compatible:1: 'tcg,tpm-tis-i2c' was expected
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: Unevaluated properties are not allowed ('compatible', 'spi-max-frequency' were unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
Third, the schema validator raises warnings about three properties
I've defined in tpm-common.yaml: "linux,sml-base" and "linux,sml-size"
are nested in a oneOf/allOf clause and "lpcpd-gpios" is nested in an
allOf/if-then clause. This seems to confuse the validator:
Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.example.dtb: tpm@57: Unevaluated properties are not allowed ('linux,sml-base', 'linux,sml-size' were unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.example.dtb: tpm@13: Unevaluated properties are not allowed ('lpcpd-gpios' was unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
I can get rid of those warnings by setting "unevaluatedProperties: true",
but that doesn't seem to be desirable.
Lukas Wunner (3):
dt-bindings: tpm: Consolidate TCG TIS bindings
dt-bindings: tpm: Convert IBM vTPM bindings to DT schema
dt-bindings: tpm: Document Microsoft fTPM bindings
.../bindings/security/tpm/google,cr50.txt | 19 ----
.../bindings/security/tpm/ibmvtpm.txt | 41 -------
.../bindings/security/tpm/st33zp24-i2c.txt | 34 ------
.../bindings/security/tpm/st33zp24-spi.txt | 32 ------
.../bindings/security/tpm/tpm-i2c.txt | 26 -----
.../bindings/security/tpm/tpm_tis_mmio.txt | 25 ----
.../bindings/security/tpm/tpm_tis_spi.txt | 23 ----
.../devicetree/bindings/tpm/ibm,vtpm.yaml | 101 +++++++++++++++++
.../bindings/tpm/microsoft,ftpm.yaml | 48 ++++++++
.../bindings/tpm/tcg,tpm-tis-i2c.yaml | 107 ++++++++++++++++++
.../bindings/tpm/tcg,tpm-tis-mmio.yaml | 50 ++++++++
.../bindings/tpm/tcg,tpm_tis-spi.yaml | 88 ++++++++++++++
.../devicetree/bindings/tpm/tpm-common.yaml | 56 +++++++++
.../devicetree/bindings/trivial-devices.yaml | 16 ---
14 files changed, 450 insertions(+), 216 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
create mode 100644 Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tpm-common.yaml
--
2.40.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings
2023-11-21 9:48 [PATCH 0/3] dt-bindings: tpm: Clean all the things Lukas Wunner
@ 2023-11-21 9:48 ` Lukas Wunner
2023-11-21 10:57 ` Rob Herring
2023-11-21 15:56 ` Rob Herring
2023-11-21 9:48 ` [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema Lukas Wunner
` (2 subsequent siblings)
3 siblings, 2 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 9:48 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: devicetree, linux-integrity, Lino Sanfilippo
A significant number of Trusted Platform Modules conform to the "TIS"
specification published by the Trusted Computing Group ("TCG PC Client
Specific TPM Interface Specification"). These chips typically use an
SPI, I²C or LPC bus as transport (via MMIO in the latter case). Some
of them even support multiple of those buses (selectable through a
config strap) or the same chip is available in multiple SKUs, each with
a different bus interface.
The devicetree bindings for these TPMs have not been converted to DT
schema yet and are spread out across 3 generic files and 3 chip-specific
files. A few TPM compatible strings were added to trivial-devices.yaml
even though additional properties are documented in the plaintext
bindings.
Consolidate the devicetree bindings into 3 files, one per bus.
Move common properties to a separate tpm-common.yaml.
Document compatible strings which are supported by the TPM TIS driver
but were neglected to be added to the devicetree bindings.
Document the memory-region property recently introduced by commit
1e2714bb83fc ("tpm: Add reserved memory event log").
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
.../bindings/security/tpm/google,cr50.txt | 19 ----
.../bindings/security/tpm/st33zp24-i2c.txt | 34 ------
.../bindings/security/tpm/st33zp24-spi.txt | 32 ------
.../bindings/security/tpm/tpm-i2c.txt | 26 -----
.../bindings/security/tpm/tpm_tis_mmio.txt | 25 ----
.../bindings/security/tpm/tpm_tis_spi.txt | 23 ----
.../bindings/tpm/tcg,tpm-tis-i2c.yaml | 107 ++++++++++++++++++
.../bindings/tpm/tcg,tpm-tis-mmio.yaml | 50 ++++++++
.../bindings/tpm/tcg,tpm_tis-spi.yaml | 88 ++++++++++++++
.../devicetree/bindings/tpm/tpm-common.yaml | 56 +++++++++
.../devicetree/bindings/trivial-devices.yaml | 16 ---
11 files changed, 301 insertions(+), 175 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
create mode 100644 Documentation/devicetree/bindings/tpm/tpm-common.yaml
diff --git a/Documentation/devicetree/bindings/security/tpm/google,cr50.txt b/Documentation/devicetree/bindings/security/tpm/google,cr50.txt
deleted file mode 100644
index cd69c2efdd37..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/google,cr50.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-* H1 Secure Microcontroller with Cr50 Firmware on SPI Bus.
-
-H1 Secure Microcontroller running Cr50 firmware provides several
-functions, including TPM-like functionality. It communicates over
-SPI using the FIFO protocol described in the PTP Spec, section 6.
-
-Required properties:
-- compatible: Should be "google,cr50".
-- spi-max-frequency: Maximum SPI frequency.
-
-Example:
-
-&spi0 {
- tpm@0 {
- compatible = "google,cr50";
- reg = <0>;
- spi-max-frequency = <800000>;
- };
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt b/Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt
deleted file mode 100644
index 0dc121b6eace..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-* STMicroelectronics SAS. ST33ZP24 TPM SoC
-
-Required properties:
-- compatible: Should be "st,st33zp24-i2c".
-- clock-frequency: I²C work frequency.
-- reg: address on the bus
-
-Optional ST33ZP24 Properties:
-- interrupts: GPIO interrupt to which the chip is connected
-- lpcpd-gpios: Output GPIO pin used for ST33ZP24 power management D1/D2 state.
-If set, power must be present when the platform is going into sleep/hibernate mode.
-
-Optional SoC Specific Properties:
-- pinctrl-names: Contains only one value - "default".
-- pintctrl-0: Specifies the pin control groups used for this controller.
-
-Example (for ARM-based BeagleBoard xM with ST33ZP24 on I2C2):
-
-&i2c2 {
-
-
- st33zp24: st33zp24@13 {
-
- compatible = "st,st33zp24-i2c";
-
- reg = <0x13>;
- clock-frequency = <400000>;
-
- interrupt-parent = <&gpio5>;
- interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
-
- lpcpd-gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
- };
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt b/Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt
deleted file mode 100644
index 37198971f17b..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-* STMicroelectronics SAS. ST33ZP24 TPM SoC
-
-Required properties:
-- compatible: Should be "st,st33zp24-spi".
-- spi-max-frequency: Maximum SPI frequency (<= 10000000).
-
-Optional ST33ZP24 Properties:
-- interrupts: GPIO interrupt to which the chip is connected
-- lpcpd-gpios: Output GPIO pin used for ST33ZP24 power management D1/D2 state.
-If set, power must be present when the platform is going into sleep/hibernate mode.
-
-Optional SoC Specific Properties:
-- pinctrl-names: Contains only one value - "default".
-- pintctrl-0: Specifies the pin control groups used for this controller.
-
-Example (for ARM-based BeagleBoard xM with ST33ZP24 on SPI4):
-
-&mcspi4 {
-
-
- st33zp24@0 {
-
- compatible = "st,st33zp24-spi";
-
- spi-max-frequency = <10000000>;
-
- interrupt-parent = <&gpio5>;
- interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
-
- lpcpd-gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
- };
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt b/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
deleted file mode 100644
index a65d7b71e81a..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-* Device Tree Bindings for I2C based Trusted Platform Module(TPM)
-
-Required properties:
-
-- compatible : 'manufacturer,model', eg. nuvoton,npct650
-- label : human readable string describing the device, eg. "tpm"
-- linux,sml-base : 64-bit base address of the reserved memory allocated for
- the firmware event log
-- linux,sml-size : size of the memory allocated for the firmware event log
-
-Optional properties:
-
-- powered-while-suspended: present when the TPM is left powered on between
- suspend and resume (makes the suspend/resume
- callbacks do nothing).
-
-Example (for OpenPower Systems with Nuvoton TPM 2.0 on I2C)
-----------------------------------------------------------
-
-tpm@57 {
- reg = <0x57>;
- label = "tpm";
- compatible = "nuvoton,npct650", "nuvoton,npct601";
- linux,sml-base = <0x7f 0xfd450000>;
- linux,sml-size = <0x10000>;
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt b/Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
deleted file mode 100644
index 7c6304426da1..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Trusted Computing Group MMIO Trusted Platform Module
-
-The TCG defines multi vendor standard for accessing a TPM chip, this
-is the standard protocol defined to access the TPM via MMIO. Typically
-this interface will be implemented over Intel's LPC bus.
-
-Refer to the 'TCG PC Client Specific TPM Interface Specification (TIS)' TCG
-publication for the specification.
-
-Required properties:
-
-- compatible: should contain a string below for the chip, followed by
- "tcg,tpm-tis-mmio". Valid chip strings are:
- * "atmel,at97sc3204"
-- reg: The location of the MMIO registers, should be at least 0x5000 bytes
-- interrupts: An optional interrupt indicating command completion.
-
-Example:
-
- tpm_tis@90000 {
- compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
- reg = <0x90000 0x5000>;
- interrupt-parent = <&EIC0>;
- interrupts = <1 2>;
- };
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt b/Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
deleted file mode 100644
index b800667da92b..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Required properties:
-- compatible: should be one of the following
- "st,st33htpm-spi"
- "infineon,slb9670"
- "tcg,tpm_tis-spi"
-- spi-max-frequency: Maximum SPI frequency (depends on TPMs).
-
-Optional SoC Specific Properties:
-- pinctrl-names: Contains only one value - "default".
-- pintctrl-0: Specifies the pin control groups used for this controller.
-
-Example (for ARM-based BeagleBoard xM with TPM_TIS on SPI4):
-
-&mcspi4 {
-
-
- tpm_tis@0 {
-
- compatible = "tcg,tpm_tis-spi";
-
- spi-max-frequency = <10000000>;
- };
-};
diff --git a/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
new file mode 100644
index 000000000000..2f95916046a1
--- /dev/null
+++ b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: I²C-attached Trusted Platform Module conforming to TCG TIS specification
+
+maintainers:
+ - Lukas Wunner <lukas@wunner.de>
+
+description: |
+ The Trusted Computing Group (TCG) has defined a multi-vendor standard
+ for accessing a TPM chip. It can be transported over various buses,
+ one of them being I²C. The standard is named:
+ TCG PC Client Specific TPM Interface Specification (TIS)
+ https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - atmel,at97sc3204t
+ - google,cr50 # H1 Secure Microcontroller running Cr50 firmware
+ - infineon,slb9635tt
+ - infineon,slb9645tt
+ - infineon,slb9673
+ - infineon,tpm_i2c_infineon
+ - nuvoton,npct501
+ - nuvoton,npct601
+ - st,st33zp24-i2c
+ - winbond,wpct301
+ - const: tcg,tpm-tis-i2c
+
+ reg:
+ description: address of TPM on the I²C bus
+
+ clock-frequency:
+ description: clock frequency used to access TPM on the I²C bus
+
+allOf:
+ - $ref: tpm-common.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: at97sc3201
+ then:
+ properties:
+ $nodename:
+ pattern: "^tpm$"
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: infineon,slb9635tt
+ then:
+ properties:
+ clock-frequency:
+ maximum: 100000
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: infineon,slb9645tt
+ then:
+ properties:
+ clock-frequency:
+ maximum: 400000
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tpm@57 {
+ label = "tpm";
+ compatible = "nuvoton,npct601", "tcg,tpm-tis-i2c";
+ reg = <0x57>;
+ linux,sml-base = <0x7f 0xfd450000>;
+ linux,sml-size = <0x10000>;
+ };
+ };
+
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tpm@13 {
+ reg = <0x13>;
+ compatible = "st,st33zp24-i2c", "tcg,tpm-tis-i2c";
+ clock-frequency = <400000>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
+ lpcpd-gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
+ };
+ };
diff --git a/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
new file mode 100644
index 000000000000..ce578cf22079
--- /dev/null
+++ b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-mmio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MMIO-accessed Trusted Platform Module conforming to TCG TIS specification
+
+maintainers:
+ - Lukas Wunner <lukas@wunner.de>
+
+description: |
+ The Trusted Computing Group (TCG) has defined a multi-vendor standard
+ for accessing a TPM chip. It can be transported over various buses,
+ one of them being LPC (via MMIO). The standard is named:
+ TCG PC Client Specific TPM Interface Specification (TIS)
+ https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - at97sc3201
+ - atmel,at97sc3204
+ - nuvoton,npct650
+ - socionext,synquacer-tpm-mmio
+ - const: tcg,tpm-tis-mmio
+
+ reg:
+ description:
+ location and length of the MMIO registers, length should be
+ at least 0x5000 bytes
+
+allOf:
+ - $ref: tpm-common.yaml#
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ tpm@90000 {
+ compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
+ reg = <0x90000 0x5000>;
+ interrupt-parent = <&EIC0>;
+ interrupts = <1 2>;
+ };
diff --git a/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml b/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
new file mode 100644
index 000000000000..2415839eda7f
--- /dev/null
+++ b/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/tpm/tcg,tpm_tis-spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI-attached Trusted Platform Module conforming to TCG TIS specification
+
+maintainers:
+ - Lukas Wunner <lukas@wunner.de>
+
+description: |
+ The Trusted Computing Group (TCG) has defined a multi-vendor standard
+ for accessing a TPM chip. It can be transported over various buses,
+ one of them being SPI. The standard is named:
+ TCG PC Client Specific TPM Interface Specification (TIS)
+ https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - google,cr50 # H1 Secure Microcontroller running Cr50 firmware
+ - infineon,slb9670
+ - st,st33htpm-spi
+ - st,st33zp24-spi
+ - const: tcg,tpm_tis-spi
+
+allOf:
+ - $ref: tpm-common.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: st,st33zp24-spi
+ then:
+ properties:
+ spi-max-frequency:
+ maximum: 10000000
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tpm@0 {
+ reg = <0>;
+ compatible = "google,cr50", "tcg,tpm_tis-spi";
+ spi-max-frequency = <800000>;
+ };
+ };
+
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tpm@0 {
+ reg = <0>;
+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
+ spi-max-frequency = <10000000>;
+ };
+ };
+
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tpm@0 {
+ reg = <0>;
+ compatible = "st,st33zp24-spi", "tcg,tpm_tis-spi";
+ spi-max-frequency = <10000000>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
+ lpcpd-gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
+ };
+ };
diff --git a/Documentation/devicetree/bindings/tpm/tpm-common.yaml b/Documentation/devicetree/bindings/tpm/tpm-common.yaml
new file mode 100644
index 000000000000..03569b74a318
--- /dev/null
+++ b/Documentation/devicetree/bindings/tpm/tpm-common.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/tpm/tpm-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Trusted Platform Module common properties
+
+maintainers:
+ - Lukas Wunner <lukas@wunner.de>
+
+properties:
+ interrupts:
+ description: indicates command completion
+ maxItems: 1
+
+ label:
+ description: human readable string describing the device, e.g. "tpm"
+
+ oneOf:
+ - memory-region:
+ description: reserved memory allocated for firmware event log
+ maxItems: 1
+ - allOf:
+ - linux,sml-base:
+ description:
+ base address of reserved memory allocated for firmware event log
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 2
+ maxItems: 2
+ - linux,sml-size:
+ description:
+ size of reserved memory allocated for firmware event log
+ $ref: /schemas/types.yaml#/definitions/uint32
+
+ powered-while-suspended:
+ description:
+ present when the TPM is left powered on between suspend and resume
+ (makes the suspend/resume callbacks do nothing)
+
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: st,st33zp24
+ then:
+ properties:
+ lpcpd-gpios:
+ description:
+ Output GPIO pin used for ST33ZP24 power management of D1/D2 state.
+ If set, power must be present when the platform is going into
+ sleep/hibernate mode.
+ maxItems: 1
+
+additionalProperties: true
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index c3190f2a168a..29aed5ddba6b 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -49,8 +49,6 @@ properties:
- ams,iaq-core
# i2c serial eeprom (24cxx)
- at,24c08
- # i2c trusted platform module (TPM)
- - atmel,at97sc3204t
# ATSHA204 - i2c h/w symmetric crypto module
- atmel,atsha204
# ATSHA204A - i2c h/w symmetric crypto module
@@ -145,12 +143,6 @@ properties:
- infineon,ir38263
# Infineon IRPS5401 Voltage Regulator (PMIC)
- infineon,irps5401
- # Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
- - infineon,slb9635tt
- # Infineon SLB9645 I2C TPM (new protocol, max 400khz)
- - infineon,slb9645tt
- # Infineon SLB9673 I2C TPM 2.0
- - infineon,slb9673
# Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor
- infineon,tlv493d-a1b6
# Infineon Multi-phase Digital VR Controller xdpe11280
@@ -301,10 +293,6 @@ properties:
- national,lm85
# I2C ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator
- national,lm92
- # i2c trusted platform module (TPM)
- - nuvoton,npct501
- # i2c trusted platform module (TPM2)
- - nuvoton,npct601
# Nuvoton Temperature Sensor
- nuvoton,w83773g
# OKI ML86V7667 video decoder
@@ -349,8 +337,6 @@ properties:
- silabs,si7020
# Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply
- skyworks,sky81452
- # Socionext SynQuacer TPM MMIO module
- - socionext,synquacer-tpm-mmio
# SparkFun Qwiic Joystick (COM-15168) with i2c interface
- sparkfun,qwiic-joystick
# i2c serial eeprom (24cxx)
@@ -405,8 +391,6 @@ properties:
- winbond,w83793
# Vicor Corporation Digital Supervisor
- vicor,pli1209bc
- # i2c trusted platform module (TPM)
- - winbond,wpct301
required:
- compatible
--
2.40.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema
2023-11-21 9:48 [PATCH 0/3] dt-bindings: tpm: Clean all the things Lukas Wunner
2023-11-21 9:48 ` [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
@ 2023-11-21 9:48 ` Lukas Wunner
2023-11-21 10:57 ` Rob Herring
2023-11-21 16:19 ` Rob Herring
2023-11-21 9:48 ` [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings Lukas Wunner
2023-11-21 16:10 ` [PATCH 0/3] dt-bindings: tpm: Clean all the things Rob Herring
3 siblings, 2 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 9:48 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: devicetree, linux-integrity, Lino Sanfilippo
Convert the devicetree bindings for the IBM Virtual Trusted Platform
Module to DT schema. Drop properties which are already documented in
tpm-common.yaml.
Document the "IBM,vtpm20" compatible string introduced by commit
18b3670d79ae ("tpm: ibmvtpm: Add support for TPM2").
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
.../bindings/security/tpm/ibmvtpm.txt | 41 -------
.../devicetree/bindings/tpm/ibm,vtpm.yaml | 101 ++++++++++++++++++
2 files changed, 101 insertions(+), 41 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
create mode 100644 Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
deleted file mode 100644
index d89f99971368..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
-
-Required properties:
-
-- compatible : property name that conveys the platform architecture
- identifiers, as 'IBM,vtpm'
-- device_type : specifies type of virtual device
-- interrupts : property specifying the interrupt source number and
- sense code associated with this virtual I/O Adapters
-- ibm,my-drc-index : integer index for the connector between the device
- and its parent - present only if Dynamic
- Reconfiguration(DR) Connector is enabled
-- ibm,#dma-address-cells: specifies the number of cells that are used to
- encode the physical address field of dma-window
- properties
-- ibm,#dma-size-cells : specifies the number of cells that are used to
- encode the size field of dma-window properties
-- ibm,my-dma-window : specifies DMA window associated with this virtual
- IOA
-- ibm,loc-code : specifies the unique and persistent location code
- associated with this virtual I/O Adapters
-- linux,sml-base : 64-bit base address of the reserved memory allocated
- for the firmware event log
-- linux,sml-size : size of the memory allocated for the firmware event log
-
-Example (IBM Virtual Trusted Platform Module)
----------------------------------------------
-
- vtpm@30000003 {
- ibm,#dma-size-cells = <0x2>;
- compatible = "IBM,vtpm";
- device_type = "IBM,vtpm";
- ibm,my-drc-index = <0x30000003>;
- ibm,#dma-address-cells = <0x2>;
- linux,sml-base = <0xc60e 0x0>;
- interrupts = <0xa0003 0x0>;
- ibm,my-dma-window = <0x10000003 0x0 0x0 0x0 0x10000000>;
- ibm,loc-code = "U8286.41A.10082DV-V3-C3";
- reg = <0x30000003>;
- linux,sml-size = <0xbce10200>;
- };
diff --git a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
new file mode 100644
index 000000000000..a88ed96c80cf
--- /dev/null
+++ b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/tpm/ibm,vtpm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IBM Virtual Trusted Platform Module (vTPM)
+
+maintainers:
+ - Nayna Jain <nayna@linux.ibm.com>
+
+description: |
+ Virtual TPM is used on IBM POWER7+ and POWER8 systems running POWERVM.
+ It is supported through the adjunct partition with firmware release 740
+ or higher. With vTPM support, each lpar is able to have its own vTPM
+ without the physical TPM hardware. The TPM functionality is provided by
+ communicating with the vTPM adjunct partition through Hypervisor calls
+ (Hcalls) and Command/Response Queue (CRQ) commands.
+
+properties:
+ compatible:
+ enum:
+ - IBM,vtpm
+ - IBM,vtpm20
+
+ device_type:
+ description:
+ type of virtual device
+
+ reg:
+ maxItems: 1
+
+ 'ibm,#dma-address-cells':
+ description:
+ number of cells that are used to encode the physical address field of
+ dma-window properties
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+
+ 'ibm,#dma-size-cells':
+ description:
+ number of cells that are used to encode the size field of
+ dma-window properties
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+
+ ibm,my-dma-window:
+ description:
+ DMA window associated with this virtual I/O Adapter
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 5
+ maxItems: 5
+
+ ibm,my-drc-index:
+ description:
+ integer index for the connector between the device and its parent;
+ present only if Dynamic Reconfiguration (DR) Connector is enabled
+ $ref: /schemas/types.yaml#/definitions/uint32
+
+ ibm,loc-code:
+ description:
+ unique and persistent location code associated with this virtual
+ I/O Adapter
+ $ref: /schemas/types.yaml#/definitions/string
+
+required:
+ - compatible
+ - device_type
+ - reg
+ - interrupts
+ - ibm,#dma-address-cells
+ - ibm,#dma-size-cells
+ - ibm,my-dma-window
+ - ibm,my-drc-index
+ - ibm,loc-code
+ - linux,sml-base
+ - linux,sml-size
+
+allOf:
+ - $ref: tpm-common.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ soc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ vtpm@30000003 {
+ compatible = "IBM,vtpm";
+ device_type = "IBM,vtpm";
+ reg = <0x30000003>;
+ interrupts = <0xa0003 0x0>;
+ ibm,#dma-address-cells = <0x2>;
+ ibm,#dma-size-cells = <0x2>;
+ ibm,my-dma-window = <0x10000003 0x0 0x0 0x0 0x10000000>;
+ ibm,my-drc-index = <0x30000003>;
+ ibm,loc-code = "U8286.41A.10082DV-V3-C3";
+ linux,sml-base = <0xc60e 0x0>;
+ linux,sml-size = <0xbce10200>;
+ };
+ };
--
2.40.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings
2023-11-21 9:48 [PATCH 0/3] dt-bindings: tpm: Clean all the things Lukas Wunner
2023-11-21 9:48 ` [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
2023-11-21 9:48 ` [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema Lukas Wunner
@ 2023-11-21 9:48 ` Lukas Wunner
2023-11-21 10:57 ` Rob Herring
2023-11-21 16:20 ` Rob Herring
2023-11-21 16:10 ` [PATCH 0/3] dt-bindings: tpm: Clean all the things Rob Herring
3 siblings, 2 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 9:48 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: devicetree, linux-integrity, Lino Sanfilippo
A driver for Microsoft's firmware-based Trusted Platform Module (fTPM)
was merged with commit 09e574831b27 ("tpm/tpm_ftpm_tee: A driver for
firmware TPM running inside TEE"), but its devicetree bindings were not.
This is the only remaining undocumented compatible string for a TPM,
so add a DT schema based on the patch linked below.
Link: https://lore.kernel.org/all/20190409184958.7476-2-sashal@kernel.org/
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
.../bindings/tpm/microsoft,ftpm.yaml | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml
diff --git a/Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml b/Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml
new file mode 100644
index 000000000000..cc9c3aa6d48d
--- /dev/null
+++ b/Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/tpm/microsoft,ftpm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microsoft firmware-based Trusted Platform Module (fTPM)
+
+maintainers:
+ - Thirupathaiah Annapureddy <thiruan@microsoft.com>
+ - Sasha Levin <sashal@kernel.org>
+
+description: |
+ Commodity CPU architectures, such as ARM and Intel CPUs, have started to
+ offer trusted computing features in their CPUs aimed at displacing dedicated
+ trusted hardware. Unfortunately, these CPU architectures raise serious
+ challenges to building trusted systems because they omit providing secure
+ resources outside the CPU perimeter.
+
+ Microsoft's firmware-based TPM 2.0 (fTPM) leverages ARM TrustZone to overcome
+ these challenges and provide software with security guarantees similar to
+ those of dedicated trusted hardware.
+
+ https://www.microsoft.com/en-us/research/publication/ftpm-software-implementation-tpm-chip/
+ https://github.com/Microsoft/ms-tpm-20-ref/tree/main/Samples/ARM32-FirmwareTPM
+
+properties:
+ compatible:
+ enum:
+ - microsoft,ftpm
+
+required:
+ - compatible
+ - linux,sml-base
+ - linux,sml-size
+
+allOf:
+ - $ref: tpm-common.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ tpm {
+ compatible = "microsoft,ftpm";
+ linux,sml-base = <0x0 0xc0000000>;
+ linux,sml-size = <0x10000>;
+ };
--
2.40.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings
2023-11-21 9:48 ` [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
@ 2023-11-21 10:57 ` Rob Herring
2023-11-21 11:02 ` Lukas Wunner
2023-11-21 15:56 ` Rob Herring
1 sibling, 1 reply; 16+ messages in thread
From: Rob Herring @ 2023-11-21 10:57 UTC (permalink / raw)
To: Lukas Wunner
Cc: linux-integrity, Krzysztof Kozlowski, Conor Dooley, Rob Herring,
Lino Sanfilippo, devicetree
On Tue, 21 Nov 2023 10:48:41 +0100, Lukas Wunner wrote:
> A significant number of Trusted Platform Modules conform to the "TIS"
> specification published by the Trusted Computing Group ("TCG PC Client
> Specific TPM Interface Specification"). These chips typically use an
> SPI, I²C or LPC bus as transport (via MMIO in the latter case). Some
> of them even support multiple of those buses (selectable through a
> config strap) or the same chip is available in multiple SKUs, each with
> a different bus interface.
>
> The devicetree bindings for these TPMs have not been converted to DT
> schema yet and are spread out across 3 generic files and 3 chip-specific
> files. A few TPM compatible strings were added to trivial-devices.yaml
> even though additional properties are documented in the plaintext
> bindings.
>
> Consolidate the devicetree bindings into 3 files, one per bus.
>
> Move common properties to a separate tpm-common.yaml.
>
> Document compatible strings which are supported by the TPM TIS driver
> but were neglected to be added to the devicetree bindings.
>
> Document the memory-region property recently introduced by commit
> 1e2714bb83fc ("tpm: Add reserved memory event log").
>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> .../bindings/security/tpm/google,cr50.txt | 19 ----
> .../bindings/security/tpm/st33zp24-i2c.txt | 34 ------
> .../bindings/security/tpm/st33zp24-spi.txt | 32 ------
> .../bindings/security/tpm/tpm-i2c.txt | 26 -----
> .../bindings/security/tpm/tpm_tis_mmio.txt | 25 ----
> .../bindings/security/tpm/tpm_tis_spi.txt | 23 ----
> .../bindings/tpm/tcg,tpm-tis-i2c.yaml | 107 ++++++++++++++++++
> .../bindings/tpm/tcg,tpm-tis-mmio.yaml | 50 ++++++++
> .../bindings/tpm/tcg,tpm_tis-spi.yaml | 88 ++++++++++++++
> .../devicetree/bindings/tpm/tpm-common.yaml | 56 +++++++++
> .../devicetree/bindings/trivial-devices.yaml | 16 ---
> 11 files changed, 301 insertions(+), 175 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
> create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
> create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
> create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
> create mode 100644 Documentation/devicetree/bindings/tpm/tpm-common.yaml
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tpm-common.yaml: properties:oneOf: [{'memory-region': {'description': 'reserved memory allocated for firmware event log', 'maxItems': 1}}, {'allOf': [{'linux,sml-base': {'description': 'base address of reserved memory allocated for firmware event log', '$ref': '/schemas/types.yaml#/definitions/uint32-array', 'minItems': 2, 'maxItems': 2}}, {'linux,sml-size': {'description': 'size of reserved memory allocated for firmware event log', '$ref': '/schemas/types.yaml#/definitions/uint32'}}]}] is not of type 'object', 'boolean'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tpm-common.yaml: properties: 'oneOf' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
hint: A json-schema keyword was found instead of a DT property name.
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tpm-common.yaml: properties:oneOf: [{'memory-region': {'description': 'reserved memory allocated for firmware event log', 'maxItems': 1}}, {'allOf': [{'linux,sml-base': {'description': 'base address of reserved memory allocated for firmware event log', '$ref': '/schemas/types.yaml#/definitions/uint32-array', 'minItems': 2, 'maxItems': 2}}, {'linux,sml-size': {'description': 'size of reserved memory allocated for firmware event log', '$ref': '/schemas/types.yaml#/definitions/uint32'}}]}] is not of type 'object', 'boolean'
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tpm-common.yaml: powered-while-suspended: missing type definition
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: compatible:1: 'tcg,tpm-tis-i2c' was expected
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: Unevaluated properties are not allowed ('compatible', 'spi-max-frequency' were unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: Unevaluated properties are not allowed ('lpcpd-gpios' was unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm_tis-spi.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.example.dtb: tpm@57: Unevaluated properties are not allowed ('linux,sml-base', 'linux,sml-size' were unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.example.dtb: tpm@13: Unevaluated properties are not allowed ('lpcpd-gpios' was unexpected)
from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/e83a43a67c96b4f2614f029666209cb408da8678.1700555862.git.lukas@wunner.de
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema
2023-11-21 9:48 ` [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema Lukas Wunner
@ 2023-11-21 10:57 ` Rob Herring
2023-11-21 11:03 ` Lukas Wunner
2023-11-21 16:19 ` Rob Herring
1 sibling, 1 reply; 16+ messages in thread
From: Rob Herring @ 2023-11-21 10:57 UTC (permalink / raw)
To: Lukas Wunner
Cc: Lino Sanfilippo, devicetree, Krzysztof Kozlowski, Rob Herring,
linux-integrity, Conor Dooley
On Tue, 21 Nov 2023 10:48:42 +0100, Lukas Wunner wrote:
> Convert the devicetree bindings for the IBM Virtual Trusted Platform
> Module to DT schema. Drop properties which are already documented in
> tpm-common.yaml.
>
> Document the "IBM,vtpm20" compatible string introduced by commit
> 18b3670d79ae ("tpm: ibmvtpm: Add support for TPM2").
>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> .../bindings/security/tpm/ibmvtpm.txt | 41 -------
> .../devicetree/bindings/tpm/ibm,vtpm.yaml | 101 ++++++++++++++++++
> 2 files changed, 101 insertions(+), 41 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> create mode 100644 Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml: required:4: 'ibm,#dma-address-cells' does not match '^([a-zA-Z#][a-zA-Z0-9,+\\-._@]{0,63}|\\$nodename)$'
hint: 'required' must be valid DT property or node names
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml: required:5: 'ibm,#dma-size-cells' does not match '^([a-zA-Z#][a-zA-Z0-9,+\\-._@]{0,63}|\\$nodename)$'
hint: 'required' must be valid DT property or node names
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/ibm,vtpm.example.dtb: vtpm@30000003: Unevaluated properties are not allowed ('linux,sml-base', 'linux,sml-size' were unexpected)
from schema $id: http://devicetree.org/schemas/tpm/ibm,vtpm.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/ibm,vtpm.example.dtb: vtpm@30000003: 'ibm,#dma-address-cells', 'ibm,#dma-size-cells' do not match any of the regexes: '.*-names$', '.*-supply$', '^#.*-cells$', '^#[a-zA-Z0-9,+\\-._]{0,63}$', '^[a-zA-Z0-9][a-zA-Z0-9,+\\-._]{0,63}$', '^[a-zA-Z0-9][a-zA-Z0-9,+\\-._]{0,63}@[0-9a-fA-F]+(,[0-9a-fA-F]+)*$', '^__.*__$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/dt-core.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/fc5c973d30df7ece297e19edad19ffe86378b6b1.1700555862.git.lukas@wunner.de
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings
2023-11-21 9:48 ` [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings Lukas Wunner
@ 2023-11-21 10:57 ` Rob Herring
2023-11-21 11:03 ` Lukas Wunner
2023-11-21 16:20 ` Rob Herring
1 sibling, 1 reply; 16+ messages in thread
From: Rob Herring @ 2023-11-21 10:57 UTC (permalink / raw)
To: Lukas Wunner
Cc: Krzysztof Kozlowski, linux-integrity, devicetree, Conor Dooley,
Lino Sanfilippo, Rob Herring
On Tue, 21 Nov 2023 10:48:43 +0100, Lukas Wunner wrote:
> A driver for Microsoft's firmware-based Trusted Platform Module (fTPM)
> was merged with commit 09e574831b27 ("tpm/tpm_ftpm_tee: A driver for
> firmware TPM running inside TEE"), but its devicetree bindings were not.
>
> This is the only remaining undocumented compatible string for a TPM,
> so add a DT schema based on the patch linked below.
>
> Link: https://lore.kernel.org/all/20190409184958.7476-2-sashal@kernel.org/
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> .../bindings/tpm/microsoft,ftpm.yaml | 48 +++++++++++++++++++
> 1 file changed, 48 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/tpm/microsoft,ftpm.example.dtb: tpm: Unevaluated properties are not allowed ('linux,sml-base', 'linux,sml-size' were unexpected)
from schema $id: http://devicetree.org/schemas/tpm/microsoft,ftpm.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/ad4b484da8190c83902b2525823ceb3439a7576e.1700555862.git.lukas@wunner.de
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings
2023-11-21 10:57 ` Rob Herring
@ 2023-11-21 11:02 ` Lukas Wunner
2023-11-21 15:37 ` Rob Herring
0 siblings, 1 reply; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 11:02 UTC (permalink / raw)
To: Rob Herring
Cc: linux-integrity, Krzysztof Kozlowski, Conor Dooley, Rob Herring,
Lino Sanfilippo, devicetree
On Tue, Nov 21, 2023 at 03:57:21AM -0700, Rob Herring wrote:
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
Your bot hasn't read the cover letter, which discusses those errors:
https://lore.kernel.org/linux-devicetree/cover.1700555862.git.lukas@wunner.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema
2023-11-21 10:57 ` Rob Herring
@ 2023-11-21 11:03 ` Lukas Wunner
0 siblings, 0 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 11:03 UTC (permalink / raw)
To: Rob Herring
Cc: Lino Sanfilippo, devicetree, Krzysztof Kozlowski, Rob Herring,
linux-integrity, Conor Dooley
On Tue, Nov 21, 2023 at 03:57:21AM -0700, Rob Herring wrote:
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
Your bot hasn't read the cover letter, which discusses those errors:
https://lore.kernel.org/linux-devicetree/cover.1700555862.git.lukas@wunner.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings
2023-11-21 10:57 ` Rob Herring
@ 2023-11-21 11:03 ` Lukas Wunner
0 siblings, 0 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-21 11:03 UTC (permalink / raw)
To: Rob Herring
Cc: Krzysztof Kozlowski, linux-integrity, devicetree, Conor Dooley,
Lino Sanfilippo, Rob Herring
On Tue, Nov 21, 2023 at 03:57:21AM -0700, Rob Herring wrote:
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
Your bot hasn't read the cover letter, which discusses those errors:
https://lore.kernel.org/linux-devicetree/cover.1700555862.git.lukas@wunner.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings
2023-11-21 11:02 ` Lukas Wunner
@ 2023-11-21 15:37 ` Rob Herring
0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2023-11-21 15:37 UTC (permalink / raw)
To: Lukas Wunner
Cc: linux-integrity, Krzysztof Kozlowski, Conor Dooley,
Lino Sanfilippo, devicetree
On Tue, Nov 21, 2023 at 12:02:10PM +0100, Lukas Wunner wrote:
> On Tue, Nov 21, 2023 at 03:57:21AM -0700, Rob Herring wrote:
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> Your bot hasn't read the cover letter, which discusses those errors:
>
> https://lore.kernel.org/linux-devicetree/cover.1700555862.git.lukas@wunner.de/
Yeah, the bot doesn't read. It used to, but then replies would only
happen if its master was working. It's all Krzysztof's fault for
reviewing faster than the bot.
This should all be fixed in dtschema main branch now.
Rob
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings
2023-11-21 9:48 ` [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
2023-11-21 10:57 ` Rob Herring
@ 2023-11-21 15:56 ` Rob Herring
1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2023-11-21 15:56 UTC (permalink / raw)
To: Lukas Wunner
Cc: Krzysztof Kozlowski, Conor Dooley, devicetree, linux-integrity,
Lino Sanfilippo
On Tue, Nov 21, 2023 at 10:48:41AM +0100, Lukas Wunner wrote:
> A significant number of Trusted Platform Modules conform to the "TIS"
> specification published by the Trusted Computing Group ("TCG PC Client
> Specific TPM Interface Specification"). These chips typically use an
> SPI, I²C or LPC bus as transport (via MMIO in the latter case). Some
> of them even support multiple of those buses (selectable through a
> config strap) or the same chip is available in multiple SKUs, each with
> a different bus interface.
>
> The devicetree bindings for these TPMs have not been converted to DT
> schema yet and are spread out across 3 generic files and 3 chip-specific
> files. A few TPM compatible strings were added to trivial-devices.yaml
> even though additional properties are documented in the plaintext
> bindings.
Thanks for doing this. Looks pretty good.
>
> Consolidate the devicetree bindings into 3 files, one per bus.
>
> Move common properties to a separate tpm-common.yaml.
>
> Document compatible strings which are supported by the TPM TIS driver
> but were neglected to be added to the devicetree bindings.
>
> Document the memory-region property recently introduced by commit
> 1e2714bb83fc ("tpm: Add reserved memory event log").
>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> .../bindings/security/tpm/google,cr50.txt | 19 ----
> .../bindings/security/tpm/st33zp24-i2c.txt | 34 ------
> .../bindings/security/tpm/st33zp24-spi.txt | 32 ------
> .../bindings/security/tpm/tpm-i2c.txt | 26 -----
> .../bindings/security/tpm/tpm_tis_mmio.txt | 25 ----
> .../bindings/security/tpm/tpm_tis_spi.txt | 23 ----
> .../bindings/tpm/tcg,tpm-tis-i2c.yaml | 107 ++++++++++++++++++
> .../bindings/tpm/tcg,tpm-tis-mmio.yaml | 50 ++++++++
> .../bindings/tpm/tcg,tpm_tis-spi.yaml | 88 ++++++++++++++
> .../devicetree/bindings/tpm/tpm-common.yaml | 56 +++++++++
> .../devicetree/bindings/trivial-devices.yaml | 16 ---
> 11 files changed, 301 insertions(+), 175 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-i2c.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/st33zp24-spi.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
> create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
> create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
> create mode 100644 Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
> create mode 100644 Documentation/devicetree/bindings/tpm/tpm-common.yaml
> diff --git a/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
> new file mode 100644
> index 000000000000..2f95916046a1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.yaml
> @@ -0,0 +1,107 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: I²C-attached Trusted Platform Module conforming to TCG TIS specification
> +
> +maintainers:
> + - Lukas Wunner <lukas@wunner.de>
> +
> +description: |
> + The Trusted Computing Group (TCG) has defined a multi-vendor standard
> + for accessing a TPM chip. It can be transported over various buses,
> + one of them being I²C. The standard is named:
> + TCG PC Client Specific TPM Interface Specification (TIS)
> + https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
> +
> +properties:
> + compatible:
> + items:
> + - enum:
> + - atmel,at97sc3204t
> + - google,cr50 # H1 Secure Microcontroller running Cr50 firmware
> + - infineon,slb9635tt
> + - infineon,slb9645tt
> + - infineon,slb9673
> + - infineon,tpm_i2c_infineon
> + - nuvoton,npct501
> + - nuvoton,npct601
> + - st,st33zp24-i2c
> + - winbond,wpct301
> + - const: tcg,tpm-tis-i2c
> +
> + reg:
> + description: address of TPM on the I²C bus
> +
> + clock-frequency:
> + description: clock frequency used to access TPM on the I²C bus
> +
> +allOf:
> + - $ref: tpm-common.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: at97sc3201
> + then:
> + properties:
> + $nodename:
> + pattern: "^tpm$"
Devices on I2C bus have a unit address.
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: infineon,slb9635tt
> + then:
> + properties:
> + clock-frequency:
> + maximum: 100000
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: infineon,slb9645tt
> + then:
> + properties:
> + clock-frequency:
> + maximum: 400000
> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + tpm@57 {
> + label = "tpm";
> + compatible = "nuvoton,npct601", "tcg,tpm-tis-i2c";
> + reg = <0x57>;
> + linux,sml-base = <0x7f 0xfd450000>;
> + linux,sml-size = <0x10000>;
> + };
> + };
> +
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> + #include <dt-bindings/interrupt-controller/irq.h>
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + tpm@13 {
> + reg = <0x13>;
> + compatible = "st,st33zp24-i2c", "tcg,tpm-tis-i2c";
> + clock-frequency = <400000>;
> + interrupt-parent = <&gpio5>;
> + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
> + lpcpd-gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
> + };
> + };
> diff --git a/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
> new file mode 100644
> index 000000000000..ce578cf22079
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/tpm/tcg,tpm-tis-mmio.yaml
> @@ -0,0 +1,50 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-mmio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MMIO-accessed Trusted Platform Module conforming to TCG TIS specification
> +
> +maintainers:
> + - Lukas Wunner <lukas@wunner.de>
> +
> +description: |
> + The Trusted Computing Group (TCG) has defined a multi-vendor standard
> + for accessing a TPM chip. It can be transported over various buses,
> + one of them being LPC (via MMIO). The standard is named:
> + TCG PC Client Specific TPM Interface Specification (TIS)
> + https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
> +
> +properties:
> + compatible:
> + items:
> + - enum:
> + - at97sc3201
> + - atmel,at97sc3204
> + - nuvoton,npct650
> + - socionext,synquacer-tpm-mmio
> + - const: tcg,tpm-tis-mmio
> +
> + reg:
> + description:
> + location and length of the MMIO registers, length should be
> + at least 0x5000 bytes
> +
> +allOf:
> + - $ref: tpm-common.yaml#
> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + tpm@90000 {
> + compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
> + reg = <0x90000 0x5000>;
> + interrupt-parent = <&EIC0>;
> + interrupts = <1 2>;
> + };
> diff --git a/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml b/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
> new file mode 100644
> index 000000000000..2415839eda7f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.yaml
> @@ -0,0 +1,88 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/tpm/tcg,tpm_tis-spi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SPI-attached Trusted Platform Module conforming to TCG TIS specification
> +
> +maintainers:
> + - Lukas Wunner <lukas@wunner.de>
> +
> +description: |
> + The Trusted Computing Group (TCG) has defined a multi-vendor standard
> + for accessing a TPM chip. It can be transported over various buses,
> + one of them being SPI. The standard is named:
> + TCG PC Client Specific TPM Interface Specification (TIS)
> + https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
> +
> +properties:
> + compatible:
> + items:
> + - enum:
> + - google,cr50 # H1 Secure Microcontroller running Cr50 firmware
> + - infineon,slb9670
> + - st,st33htpm-spi
> + - st,st33zp24-spi
> + - const: tcg,tpm_tis-spi
> +
> +allOf:
> + - $ref: tpm-common.yaml#
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: st,st33zp24-spi
> + then:
> + properties:
> + spi-max-frequency:
> + maximum: 10000000
> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + tpm@0 {
> + reg = <0>;
> + compatible = "google,cr50", "tcg,tpm_tis-spi";
> + spi-max-frequency = <800000>;
> + };
> + };
> +
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + tpm@0 {
> + reg = <0>;
> + compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
> + spi-max-frequency = <10000000>;
> + };
> + };
Just a different compatible string and frequency doesn't really justify
an example.
> +
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> + #include <dt-bindings/interrupt-controller/irq.h>
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + tpm@0 {
> + reg = <0>;
> + compatible = "st,st33zp24-spi", "tcg,tpm_tis-spi";
> + spi-max-frequency = <10000000>;
> + interrupt-parent = <&gpio5>;
> + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
> + lpcpd-gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
> + };
> + };
> diff --git a/Documentation/devicetree/bindings/tpm/tpm-common.yaml b/Documentation/devicetree/bindings/tpm/tpm-common.yaml
> new file mode 100644
> index 000000000000..03569b74a318
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/tpm/tpm-common.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/tpm/tpm-common.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Trusted Platform Module common properties
> +
> +maintainers:
> + - Lukas Wunner <lukas@wunner.de>
> +
> +properties:
> + interrupts:
> + description: indicates command completion
> + maxItems: 1
> +
> + label:
> + description: human readable string describing the device, e.g. "tpm"
> +
> + oneOf:
This will be an error because 'oneOf' here is a DT property name.
> + - memory-region:
> + description: reserved memory allocated for firmware event log
> + maxItems: 1
> + - allOf:
> + - linux,sml-base:
> + description:
> + base address of reserved memory allocated for firmware event log
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + minItems: 2
> + maxItems: 2
You can just define this as a uint64 instead. The source encoding
doesn't matter.
> + - linux,sml-size:
> + description:
> + size of reserved memory allocated for firmware event log
> + $ref: /schemas/types.yaml#/definitions/uint32
What you need here is just define these properties and then add this:
dependentRequired:
linux,sml-base: ['linux,sml-size']
linux,sml-size: ['linux,sml-base']
dependentSchemas:
memory-region:
properties:
linux,sml-base: false
linux,sml-base:
properties:
memory-region: false
> +
> + powered-while-suspended:
> + description:
> + present when the TPM is left powered on between suspend and resume
> + (makes the suspend/resume callbacks do nothing)
Needs a type (type: boolean).
> +
> +allOf:
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: st,st33zp24
> + then:
> + properties:
> + lpcpd-gpios:
> + description:
> + Output GPIO pin used for ST33ZP24 power management of D1/D2 state.
> + If set, power must be present when the platform is going into
> + sleep/hibernate mode.
> + maxItems: 1
> +
> +additionalProperties: true
> diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> index c3190f2a168a..29aed5ddba6b 100644
> --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> @@ -49,8 +49,6 @@ properties:
> - ams,iaq-core
> # i2c serial eeprom (24cxx)
> - at,24c08
> - # i2c trusted platform module (TPM)
> - - atmel,at97sc3204t
> # ATSHA204 - i2c h/w symmetric crypto module
> - atmel,atsha204
> # ATSHA204A - i2c h/w symmetric crypto module
> @@ -145,12 +143,6 @@ properties:
> - infineon,ir38263
> # Infineon IRPS5401 Voltage Regulator (PMIC)
> - infineon,irps5401
> - # Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
> - - infineon,slb9635tt
> - # Infineon SLB9645 I2C TPM (new protocol, max 400khz)
> - - infineon,slb9645tt
> - # Infineon SLB9673 I2C TPM 2.0
> - - infineon,slb9673
> # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor
> - infineon,tlv493d-a1b6
> # Infineon Multi-phase Digital VR Controller xdpe11280
> @@ -301,10 +293,6 @@ properties:
> - national,lm85
> # I2C ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator
> - national,lm92
> - # i2c trusted platform module (TPM)
> - - nuvoton,npct501
> - # i2c trusted platform module (TPM2)
> - - nuvoton,npct601
> # Nuvoton Temperature Sensor
> - nuvoton,w83773g
> # OKI ML86V7667 video decoder
> @@ -349,8 +337,6 @@ properties:
> - silabs,si7020
> # Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply
> - skyworks,sky81452
> - # Socionext SynQuacer TPM MMIO module
> - - socionext,synquacer-tpm-mmio
> # SparkFun Qwiic Joystick (COM-15168) with i2c interface
> - sparkfun,qwiic-joystick
> # i2c serial eeprom (24cxx)
> @@ -405,8 +391,6 @@ properties:
> - winbond,w83793
> # Vicor Corporation Digital Supervisor
> - vicor,pli1209bc
> - # i2c trusted platform module (TPM)
> - - winbond,wpct301
>
> required:
> - compatible
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] dt-bindings: tpm: Clean all the things
2023-11-21 9:48 [PATCH 0/3] dt-bindings: tpm: Clean all the things Lukas Wunner
` (2 preceding siblings ...)
2023-11-21 9:48 ` [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings Lukas Wunner
@ 2023-11-21 16:10 ` Rob Herring
3 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2023-11-21 16:10 UTC (permalink / raw)
To: Lukas Wunner
Cc: Krzysztof Kozlowski, Conor Dooley, devicetree, linux-integrity,
Lino Sanfilippo
On Tue, Nov 21, 2023 at 10:48:40AM +0100, Lukas Wunner wrote:
> Rob asked me to consolidate and convert the TPM dt-bindings:
> https://lore.kernel.org/all/20230927115300.GA1587935-robh@kernel.org/
>
> I came across several issues:
>
> First, this pull request is needed to cope with ibm,#dma-address-cells
> and ibm,#dma-size-cells properties used in ibm,vtpm.yaml:
>
> https://github.com/devicetree-org/dt-schema/pull/116
Now applied.
> Second, the compatible string "google,cr50" refers to a chip which has
> both an i2c and an spi interface (see drivers/char/tpm/tpm_tis_i2c_cr50.c
> as well as tpm_tis_spi_main.c) This confuses the schema validator
> because it thinks that "google,cr50" may only use i2c properties but
> tcg,tpm_tis-spi.yaml contains an spi example, which causes some warnings.
> It seems deeper code changes to the schema validator are required to
> avoid them:
>
> Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: compatible:1: 'tcg,tpm-tis-i2c' was expected
> from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
> Documentation/devicetree/bindings/tpm/tcg,tpm_tis-spi.example.dtb: tpm@0: Unevaluated properties are not allowed ('compatible', 'spi-max-frequency' were unexpected)
> from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
You either need to put "google,cr50" into its own schema file with a
custom 'select' that omits the generic compatibles or the spi and i2c
schemas need a custom select omitting "google,cr50" or having just the
generic compatible.
However, none of the current users of "google,cr50" have a fallback
compatible, so perhaps its own schema file with no fallback is the
answer. Is the fallback useful and is it worth updating all the users?
Probably not since we have to keep support for "google,cr50" explicitly
in the driver.
> Third, the schema validator raises warnings about three properties
> I've defined in tpm-common.yaml: "linux,sml-base" and "linux,sml-size"
> are nested in a oneOf/allOf clause and "lpcpd-gpios" is nested in an
> allOf/if-then clause. This seems to confuse the validator:
>
> Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.example.dtb: tpm@57: Unevaluated properties are not allowed ('linux,sml-base', 'linux,sml-size' were unexpected)
> from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
Should be fixed with my suggestion in patch 1.
> Documentation/devicetree/bindings/tpm/tcg,tpm-tis-i2c.example.dtb: tpm@13: Unevaluated properties are not allowed ('lpcpd-gpios' was unexpected)
> from schema $id: http://devicetree.org/schemas/tpm/tcg,tpm-tis-i2c.yaml#
The issue is here:
+ properties:
+ compatible:
+ contains:
+ const: st,st33zp24
That's an exact match, not a pattern. You could do 'pattern: '^st,st33zp24'
or an enum with both compatible strings.
Rob
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema
2023-11-21 9:48 ` [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema Lukas Wunner
2023-11-21 10:57 ` Rob Herring
@ 2023-11-21 16:19 ` Rob Herring
2023-11-24 8:43 ` Lukas Wunner
1 sibling, 1 reply; 16+ messages in thread
From: Rob Herring @ 2023-11-21 16:19 UTC (permalink / raw)
To: Lukas Wunner
Cc: Krzysztof Kozlowski, Conor Dooley, devicetree, linux-integrity,
Lino Sanfilippo
On Tue, Nov 21, 2023 at 10:48:42AM +0100, Lukas Wunner wrote:
> Convert the devicetree bindings for the IBM Virtual Trusted Platform
> Module to DT schema. Drop properties which are already documented in
> tpm-common.yaml.
>
> Document the "IBM,vtpm20" compatible string introduced by commit
> 18b3670d79ae ("tpm: ibmvtpm: Add support for TPM2").
>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> .../bindings/security/tpm/ibmvtpm.txt | 41 -------
> .../devicetree/bindings/tpm/ibm,vtpm.yaml | 101 ++++++++++++++++++
> 2 files changed, 101 insertions(+), 41 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> create mode 100644 Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
>
> diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> deleted file mode 100644
> index d89f99971368..000000000000
> --- a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
> -
> -Required properties:
> -
> -- compatible : property name that conveys the platform architecture
> - identifiers, as 'IBM,vtpm'
> -- device_type : specifies type of virtual device
> -- interrupts : property specifying the interrupt source number and
> - sense code associated with this virtual I/O Adapters
> -- ibm,my-drc-index : integer index for the connector between the device
> - and its parent - present only if Dynamic
> - Reconfiguration(DR) Connector is enabled
> -- ibm,#dma-address-cells: specifies the number of cells that are used to
> - encode the physical address field of dma-window
> - properties
> -- ibm,#dma-size-cells : specifies the number of cells that are used to
> - encode the size field of dma-window properties
> -- ibm,my-dma-window : specifies DMA window associated with this virtual
> - IOA
> -- ibm,loc-code : specifies the unique and persistent location code
> - associated with this virtual I/O Adapters
> -- linux,sml-base : 64-bit base address of the reserved memory allocated
> - for the firmware event log
> -- linux,sml-size : size of the memory allocated for the firmware event log
> -
> -Example (IBM Virtual Trusted Platform Module)
> ----------------------------------------------
> -
> - vtpm@30000003 {
> - ibm,#dma-size-cells = <0x2>;
> - compatible = "IBM,vtpm";
> - device_type = "IBM,vtpm";
> - ibm,my-drc-index = <0x30000003>;
> - ibm,#dma-address-cells = <0x2>;
> - linux,sml-base = <0xc60e 0x0>;
> - interrupts = <0xa0003 0x0>;
> - ibm,my-dma-window = <0x10000003 0x0 0x0 0x0 0x10000000>;
> - ibm,loc-code = "U8286.41A.10082DV-V3-C3";
> - reg = <0x30000003>;
> - linux,sml-size = <0xbce10200>;
> - };
> diff --git a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> new file mode 100644
> index 000000000000..a88ed96c80cf
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> @@ -0,0 +1,101 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/tpm/ibm,vtpm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: IBM Virtual Trusted Platform Module (vTPM)
> +
> +maintainers:
> + - Nayna Jain <nayna@linux.ibm.com>
> +
> +description: |
> + Virtual TPM is used on IBM POWER7+ and POWER8 systems running POWERVM.
> + It is supported through the adjunct partition with firmware release 740
> + or higher. With vTPM support, each lpar is able to have its own vTPM
> + without the physical TPM hardware. The TPM functionality is provided by
> + communicating with the vTPM adjunct partition through Hypervisor calls
> + (Hcalls) and Command/Response Queue (CRQ) commands.
> +
> +properties:
> + compatible:
> + enum:
> + - IBM,vtpm
> + - IBM,vtpm20
> +
> + device_type:
> + description:
> + type of virtual device
const: IBM,vtpm
> +
> + reg:
> + maxItems: 1
> +
> + 'ibm,#dma-address-cells':
> + description:
> + number of cells that are used to encode the physical address field of
> + dma-window properties
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> +
> + 'ibm,#dma-size-cells':
> + description:
> + number of cells that are used to encode the size field of
> + dma-window properties
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> +
> + ibm,my-dma-window:
> + description:
> + DMA window associated with this virtual I/O Adapter
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + minItems: 5
> + maxItems: 5
> +
> + ibm,my-drc-index:
> + description:
> + integer index for the connector between the device and its parent;
> + present only if Dynamic Reconfiguration (DR) Connector is enabled
> + $ref: /schemas/types.yaml#/definitions/uint32
> +
> + ibm,loc-code:
> + description:
> + unique and persistent location code associated with this virtual
> + I/O Adapter
> + $ref: /schemas/types.yaml#/definitions/string
> +
> +required:
> + - compatible
> + - device_type
> + - reg
> + - interrupts
> + - ibm,#dma-address-cells
> + - ibm,#dma-size-cells
> + - ibm,my-dma-window
> + - ibm,my-drc-index
> + - ibm,loc-code
> + - linux,sml-base
> + - linux,sml-size
> +
> +allOf:
> + - $ref: tpm-common.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + soc {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + vtpm@30000003 {
tpm@...
With that,
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings
2023-11-21 9:48 ` [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings Lukas Wunner
2023-11-21 10:57 ` Rob Herring
@ 2023-11-21 16:20 ` Rob Herring
1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2023-11-21 16:20 UTC (permalink / raw)
To: Lukas Wunner
Cc: Krzysztof Kozlowski, Conor Dooley, devicetree, linux-integrity,
Lino Sanfilippo
On Tue, Nov 21, 2023 at 10:48:43AM +0100, Lukas Wunner wrote:
> A driver for Microsoft's firmware-based Trusted Platform Module (fTPM)
> was merged with commit 09e574831b27 ("tpm/tpm_ftpm_tee: A driver for
> firmware TPM running inside TEE"), but its devicetree bindings were not.
>
> This is the only remaining undocumented compatible string for a TPM,
> so add a DT schema based on the patch linked below.
>
> Link: https://lore.kernel.org/all/20190409184958.7476-2-sashal@kernel.org/
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> .../bindings/tpm/microsoft,ftpm.yaml | 48 +++++++++++++++++++
> 1 file changed, 48 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/tpm/microsoft,ftpm.yaml
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema
2023-11-21 16:19 ` Rob Herring
@ 2023-11-24 8:43 ` Lukas Wunner
0 siblings, 0 replies; 16+ messages in thread
From: Lukas Wunner @ 2023-11-24 8:43 UTC (permalink / raw)
To: Rob Herring
Cc: Krzysztof Kozlowski, Conor Dooley, devicetree, linux-integrity,
Lino Sanfilippo
On Tue, Nov 21, 2023 at 09:19:25AM -0700, Rob Herring wrote:
> On Tue, Nov 21, 2023 at 10:48:42AM +0100, Lukas Wunner wrote:
> > +properties:
> > + compatible:
> > + enum:
> > + - IBM,vtpm
> > + - IBM,vtpm20
> > +
> > + device_type:
> > + description:
> > + type of virtual device
>
> const: IBM,vtpm
Hm, since IBM,vtpm20 is a valid compatible string, I'm guessing it's a
valid device_type as well, so instead of a const I intend to use:
device_type:
description:
type of virtual device
enum:
- IBM,vtpm
- IBM,vtpm20
Thanks,
Lukas
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-11-24 8:43 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21 9:48 [PATCH 0/3] dt-bindings: tpm: Clean all the things Lukas Wunner
2023-11-21 9:48 ` [PATCH 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
2023-11-21 10:57 ` Rob Herring
2023-11-21 11:02 ` Lukas Wunner
2023-11-21 15:37 ` Rob Herring
2023-11-21 15:56 ` Rob Herring
2023-11-21 9:48 ` [PATCH 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema Lukas Wunner
2023-11-21 10:57 ` Rob Herring
2023-11-21 11:03 ` Lukas Wunner
2023-11-21 16:19 ` Rob Herring
2023-11-24 8:43 ` Lukas Wunner
2023-11-21 9:48 ` [PATCH 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings Lukas Wunner
2023-11-21 10:57 ` Rob Herring
2023-11-21 11:03 ` Lukas Wunner
2023-11-21 16:20 ` Rob Herring
2023-11-21 16:10 ` [PATCH 0/3] dt-bindings: tpm: Clean all the things Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).