Skip to contentSkip to conversation

soc: imx: secvio: Add secvio support

PATCH Superseded Vabhav Sharma 4 participants 20 messages May 9, 2024 – Jun 17, 2024

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover soc: imx: secvio: Add secvio support

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected.

This detection is done by:
-Analog tampers: measure analogic values
- External clock frequency.
- Temperature.
- Voltage.

- Digital tampers:
- External tamper
- Other detectors:
- Secure real-time counter rollover tamper.
- Monotonic counter rollover tamper.
- Power supply glitch tamper.

The on-chip sensors for voltage, temperature, and clock frequency indicate if tamper scenarios may be present. These sensors generate an out-of-range signal that causes a security violation to clear the authentication and storage keys and to block access to sensitive information.

Add linux module secvio driver to handle security violation interrupt.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering to the user.

The functionalities of the module are accessible via the "debugfs" kernel.The folder containing the interface files for the module is "<kernel_debugfs>/secvio/".

Get status
Reading from the "info" file will return the status of security:
- Fuse related to security tampers.
- SNVS readable registers.
- DGO registers.

---
Vabhav Sharma (4):
dt-bindings: firmware: secvio: Add device tree bindings
firmware: imx: Add SC APIs required for secvio module
soc: imx: secvio: Add support for SNVS secvio and tamper via SCFW
arm64: dts: imx8q: Add node for Security Violation

 .../bindings/arm/freescale/fsl,scu-secvio.yaml     |  35 ++
 .../devicetree/bindings/firmware/fsl,scu.yaml      |  10 +
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi         |   5 +
 drivers/firmware/imx/Makefile                      |   2 +-
 drivers/firmware/imx/imx-scu.c                     |   4 +-
 drivers/firmware/imx/seco.c                        | 216 ++++++++
 drivers/soc/imx/Kconfig                            |  11 +
 drivers/soc/imx/Makefile                           |   1 +
 drivers/soc/imx/secvio/Makefile                    |   2 +
 drivers/soc/imx/secvio/imx-secvio-debugfs.c        | 274 ++++++++++
 drivers/soc/imx/secvio/imx-secvio-sc.c             | 595 +++++++++++++++++++++
 include/linux/firmware/imx/ipc.h                   |   1 +
 include/linux/firmware/imx/sci.h                   |   4 +
 include/linux/firmware/imx/svc/seco.h              |  69 +++
 include/soc/imx/imx-secvio-sc.h                    | 216 ++++++++
 15 files changed, 1443 insertions(+), 2 deletions(-)

---
base-commit: 93a39e4766083050ca0ecd6a3548093a3b9eb60c
change-id: 20240508-secvio-8acfa2838385

Best regards,

Signature · 1 line
Vabhav Sharma <[email protected]>
#1 lore raw

PATCH 1/4 dt-bindings: firmware: secvio: Add device tree bindings

Document the secvio device tree bindings.

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Add the imx-scu secvio sub node and secvio sub node description.

---
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35 ++++++++++++++++++++++
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +35 -0
new file mode 100644
index 000000000000..30dc1e21f903
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/freescale/fsl,scu-secvio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX Security Violation driver
+
+maintainers:
+  - Franck LENORMAND <[email protected]>
+
+description: |
+  Receive security violation from the SNVS via the SCU firmware. Allow to
+  register notifier for additional processing
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-sc-secvio
+
+  nvmem:
+    maxItems: 1
+
+required:
+  - compatible
+  - nvmem
+
+additionalProperties: false
+
+examples:
+  - |
+    secvio {
+        compatible = "fsl,imx-sc-secvio";
+        nvmem = <&ocotp>;
+    };
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +10 -0
index 557e524786c2..b40e127fdc88 100644
@@ -129,6 +129,11 @@ properties:
       RTC controller provided by the SCU
     $ref: /schemas/rtc/fsl,scu-rtc.yaml
 
+  secvio:
+    description:
+      Receive security violation from the SNVS via the SCU firmware
+    $ref: /schemas/arm/freescale/fsl,scu-secvio.yaml
+
   thermal-sensor:
     description:
       Thermal sensor provided by the SCU
@@ -197,6 +202,11 @@ examples:
                 compatible = "fsl,imx8qxp-sc-rtc";
             };
 
+            secvio {
+                compatible = "fsl,imx-sc-secvio";
+                nvmem = <&ocotp>;
+            };
+
             keys {
                 compatible = "fsl,imx8qxp-sc-key", "fsl,imx-sc-key";
                 linux,keycodes = <KEY_POWER>;
Signature · 1 line
2.25.1
#15 lore raw

PATCH 2/4 firmware: imx: Add SC APIs required for secvio module

In reply to Vabhav Sharma

The Security Violation module requires below System Controller Security controller API to interact with SNVS block via SCFW
- imx_sc_seco_build_info
- imx_sc_seco_secvio_enable
- imx_sc_seco_secvio_config
- imx_sc_seco_secvio_dgo_config

---
 drivers/firmware/imx/Makefile         |   2 +-
 drivers/firmware/imx/imx-scu.c        |   4 +-
 drivers/firmware/imx/seco.c           | 216 ++++++++++++++++++++++++++++++++++
 include/linux/firmware/imx/ipc.h      |   1 +
 include/linux/firmware/imx/sci.h      |   4 +
 include/linux/firmware/imx/svc/seco.h |  69 +++++++++++
 6 files changed, 294 insertions(+), 2 deletions(-)
drivers/firmware/imx/Makefile +1 -1
index 8f9f04a513a8..b53d2dee8ff3 100644
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_IMX_DSP)		+= imx-dsp.o
-obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
+obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o seco.o
drivers/firmware/imx/imx-scu.c +3 -1
index 1dd4362ef9a3..c96dc73689a8 100644
@@ -242,9 +242,11 @@ int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp)
 		 * APIs are defined as void function in SCU firmware, so they
 		 * should be treated as return success always.
 		 */
-		if ((saved_svc == IMX_SC_RPC_SVC_MISC) &&
+		if (((saved_svc == IMX_SC_RPC_SVC_MISC) &&
 			(saved_func == IMX_SC_MISC_FUNC_UNIQUE_ID ||
 			 saved_func == IMX_SC_MISC_FUNC_GET_BUTTON_STATUS))
+			 || (saved_svc == IMX_SC_RPC_SVC_SECO &&
+			 saved_func == IMX_SC_SECO_FUNC_BUILD_INFO))
 			ret = 0;
 	}
 
drivers/firmware/imx/seco.c new file +216 -0

216 lines not on this page · raw message

include/linux/firmware/imx/ipc.h +1 -0
index 0b4643571625..df38ab8e7e2e 100644
@@ -25,6 +25,7 @@ enum imx_sc_rpc_svc {
 	IMX_SC_RPC_SVC_PAD = 6,
 	IMX_SC_RPC_SVC_MISC = 7,
 	IMX_SC_RPC_SVC_IRQ = 8,
+	IMX_SC_RPC_SVC_SECO = 9,
 };
 
 struct imx_sc_rpc_msg {
include/linux/firmware/imx/sci.h +4 -0
index df17196df5ff..947e49d8bebc 100644
@@ -15,6 +15,10 @@
 #include <linux/firmware/imx/svc/misc.h>
 #include <linux/firmware/imx/svc/pm.h>
 #include <linux/firmware/imx/svc/rm.h>
+#include <linux/firmware/imx/svc/seco.h>
+
+#define IMX_SC_IRQ_SECVIO            BIT(6)    /* Security violation */
+#define IMX_SC_IRQ_GROUP_WAKE           3   /* Wakeup interrupts */
 
 #if IS_ENABLED(CONFIG_IMX_SCU)
 int imx_scu_enable_general_irq_channel(struct device *dev);
include/linux/firmware/imx/svc/seco.h new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.25.1
#17 lore raw

PATCH 4/4 arm64: dts: imx8q: Add node for Security Violation

In reply to Vabhav Sharma

Add secvio node definition for imx8qxp.

---
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/freescale/imx8qxp.dtsi +5 -0
index 0313f295de2e..09d3e11eef3f 100644
@@ -241,6 +241,11 @@ rtc: rtc {
 			compatible = "fsl,imx8qxp-sc-rtc";
 		};
 
+		secvio: secvio {
+			compatible = "fsl,imx-sc-secvio";
+			nvmem = <&ocotp>;
+		};
+
 		watchdog {
 			compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt";
 			timeout-sec = <60>;
Signature · 1 line
2.25.1
#16 lore raw

PATCH 3/4 soc: imx: secvio: Add support for SNVS secvio and tamper via SCFW

In reply to Vabhav Sharma

The i.MX8QXP SoC contains the Secure Non-Volatile Storage (SNVS) block. This block can detect specific hardware attacks.This block can only be accessible using the SCFW API.

This module interact with the SCU which relay request to/from the SNVS block to detect if security violation occurred.

The driver register an IRQ handle to SCU for security violation interrupt.

When an interruption is fired, the driver inform the user.

---
 drivers/soc/imx/Kconfig                     |  11 +
 drivers/soc/imx/Makefile                    |   1 +
 drivers/soc/imx/secvio/Makefile             |   2 +
 drivers/soc/imx/secvio/imx-secvio-debugfs.c | 274 +++++++++++++
 drivers/soc/imx/secvio/imx-secvio-sc.c      | 595 ++++++++++++++++++++++++++++
 include/soc/imx/imx-secvio-sc.h             | 216 ++++++++++
 6 files changed, 1099 insertions(+)
drivers/soc/imx/Kconfig +11 -0
index 2a90ddd20104..3d2715a8b798 100644
@@ -20,4 +20,15 @@ config SOC_IMX9
 	help
 	  If you say yes here, you get support for the NXP i.MX9 family
 
+config SECVIO_SC
+	tristate "NXP SC secvio support"
+	depends on IMX_SCU
+	default y
+	help
+	   If you say yes here you get support for the NXP SNVS security
+	   violation module. It includes the possibility to read information
+	   related to security violations and tampers. It also gives the
+	   possibility to register user callbacks when a security violation
+	   occurs.
+
 endmenu
drivers/soc/imx/Makefile +1 -0
index 3ad321ca608a..bda0259077be 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_ARCH_MXC) += soc-imx.o
 endif
 obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
 obj-$(CONFIG_SOC_IMX9) += imx93-src.o
+obj-${CONFIG_SECVIO_SC} += secvio/
drivers/soc/imx/secvio/Makefile new file +2 -0
new file mode 100644
index 000000000000..55ef1c044009
@@ -0,0 +1,2 @@
+obj-y +=  imx-secvio-sc.o
+obj-$(CONFIG_DEBUG_FS) += imx-secvio-debugfs.o
drivers/soc/imx/secvio/imx-secvio-debugfs.c new file +274 -0

274 lines not on this page · raw message

drivers/soc/imx/secvio/imx-secvio-sc.c new file +595 -0

595 lines not on this page · raw message

include/soc/imx/imx-secvio-sc.h new file +216 -0

216 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Vabhav Sharma
Quoted 1 line · Vabhav Sharma

Document the secvio device tree bindings.

reduntant sentence.

Quoted 3 lines

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation

^^ space here

Quoted 4 lines

of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected

^^ space here

Quoted 21 lines

to the security-violation ports, which send an alert when an out-of-range value is detected.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Add the imx-scu secvio sub node and secvio sub node description.

---
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35 ++++++++++++++++++++++
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +0 -0
new file mode 100644
index 000000000000..30dc1e21f903

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +7 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/freescale/fsl,scu-secvio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX Security Violation driver

Violation detect driver

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 12

Quoted 5 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +5 -0
+
+maintainers:
+  - Franck LENORMAND <[email protected]>
+
+description: |

Needn't "|"

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 23

Quoted 11 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +11 -0
+  Receive security violation from the SNVS via the SCU firmware. Allow to
+  register notifier for additional processing
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-sc-secvio
+
+  nvmem:
+    maxItems: 1
+

any interrupt defined? how do you notify such violation event?

Quoted 44 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +12 -0
+required:
+  - compatible
+  - nvmem
+
+additionalProperties: false
+
+examples:
+  - |
+    secvio {
+        compatible = "fsl,imx-sc-secvio";
+        nvmem = <&ocotp>;
+    };
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +10 -0
index 557e524786c2..b40e127fdc88 100644
@@ -129,6 +129,11 @@ properties:
       RTC controller provided by the SCU
     $ref: /schemas/rtc/fsl,scu-rtc.yaml
 
+  secvio:
+    description:
+      Receive security violation from the SNVS via the SCU firmware
+    $ref: /schemas/arm/freescale/fsl,scu-secvio.yaml
+
   thermal-sensor:
     description:
       Thermal sensor provided by the SCU
@@ -197,6 +202,11 @@ examples:
                 compatible = "fsl,imx8qxp-sc-rtc";
             };
 
+            secvio {
+                compatible = "fsl,imx-sc-secvio";
+                nvmem = <&ocotp>;
+            };
+
             keys {
                 compatible = "fsl,imx8qxp-sc-key", "fsl,imx-sc-key";
                 linux,keycodes = <KEY_POWER>;
Signature · 2 lines
-- 
2.25.1
#18 lore raw
In reply to Vabhav Sharma
Quoted 43 lines · Vabhav Sharma

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected.

This detection is done by:
-Analog tampers: measure analogic values
- External clock frequency.
- Temperature.
- Voltage.

- Digital tampers:
- External tamper
- Other detectors:
- Secure real-time counter rollover tamper.
- Monotonic counter rollover tamper.
- Power supply glitch tamper.

The on-chip sensors for voltage, temperature, and clock frequency indicate if tamper scenarios may be present. These sensors generate an out-of-range signal that causes a security violation to clear the authentication and storage keys and to block access to sensitive information.

Add linux module secvio driver to handle security violation interrupt.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering to the user.

The functionalities of the module are accessible via the "debugfs" kernel.The folder containing the interface files for the module is "<kernel_debugfs>/secvio/".

Get status
Reading from the "info" file will return the status of security:
- Fuse related to security tampers.
- SNVS readable registers.
- DGO registers.

Quoted 7 lines

---
Vabhav Sharma (4):
dt-bindings: firmware: secvio: Add device tree bindings
firmware: imx: Add SC APIs required for secvio module
soc: imx: secvio: Add support for SNVS secvio and tamper via SCFW
arm64: dts: imx8q: Add node for Security Violation

Please version your patches correctly and provide changelog.

I wrote about b4 already, which solves this as well.

What changed here?

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Vabhav Sharma
Quoted 11 lines · Vabhav Sharma

Document the secvio device tree bindings.

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected.

Quoted 8 lines

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Add the imx-scu secvio sub node and secvio sub node description.

---

That's not v1, right? What changed? Why do we have to guess this?

This is thoroughly documented in kernel process so read the documentation before posting.

Quoted 10 lines
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35 ++++++++++++++++++++++
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +0 -0
new file mode 100644
index 000000000000..30dc1e21f903

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +7 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/freescale/fsl,scu-secvio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX Security Violation driver

Bindings are for hardware, not drivers. Describe hardware.

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 12

Quoted 5 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +5 -0
+
+maintainers:
+  - Franck LENORMAND <[email protected]>
+
+description: |

Do not need '|' unless you need to preserve formatting.

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 14

Quoted 2 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +2 -0
+  Receive security violation from the SNVS via the SCU firmware. Allow to
+  register notifier for additional processing

Notifier? That's a Linux thing, how does it relate to the hardware?

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 19

Quoted 5 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +5 -0
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-sc-secvio

Missing SoC compatibles.

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Frank Li
Quoted 29 lines · Frank Li
Quoted 1 line · Vabhav Sharma

Document the secvio device tree bindings.

reduntant sentence.

Quoted 3 lines

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation

^^ space here

Quoted 4 lines

of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected

^^ space here

Quoted 15 lines

to the security-violation ports, which send an alert when an out-of-range value is detected.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Add the imx-scu secvio sub node and secvio sub node description.

---
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35 ++++++++++++++++++++++
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)
Quoted 15 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml line 7

Quoted 13 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file +7 -0
new file mode 100644
index 000000000000..30dc1e21f903
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/freescale/fsl,scu-secvio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX Security Violation driver

Violation detect driver

Bindings are not for drivers.

Best regards,
Krzysztof

#19 lore raw
In reply to Krzysztof Kozlowski
Quoted 77 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, May 9, 2024 11:21 AM
To: Vabhav Sharma <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Franck Lenormand <[email protected]>; Aisheng Dong <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Varun Sethi <[email protected]>; Silvano Di Ninno <[email protected]>; Pankaj Gupta <[email protected]>; Frank Li <[email protected]>; Daniel Baluta <[email protected]>; Iuliana Prodan <[email protected]>; Horia Geanta <[email protected]>
Subject: [EXT] Re: [PATCH 0/4] soc: imx: secvio: Add secvio support

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 43 lines · Vabhav Sharma

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected.

This detection is done by:
-Analog tampers: measure analogic values
- External clock frequency.
- Temperature.
- Voltage.

- Digital tampers:
- External tamper
- Other detectors:
- Secure real-time counter rollover tamper.
- Monotonic counter rollover tamper.
- Power supply glitch tamper.

The on-chip sensors for voltage, temperature, and clock frequency indicate if tamper scenarios may be present. These sensors generate an out-of-range signal that causes a security violation to clear the authentication and storage keys and to block access to sensitive information.

Add linux module secvio driver to handle security violation interrupt.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering to the user.

The functionalities of the module are accessible via the "debugfs" kernel.The folder containing the interface files for the module is "<kernel_debugfs>/secvio/".

Get status
Reading from the "info" file will return the status of security:
- Fuse related to security tampers.
- SNVS readable registers.
- DGO registers.

Quoted 7 lines

---
Vabhav Sharma (4):
dt-bindings: firmware: secvio: Add device tree bindings
firmware: imx: Add SC APIs required for secvio module
soc: imx: secvio: Add support for SNVS secvio and tamper via SCFW
arm64: dts: imx8q: Add node for Security Violation

Quoted 1 line

Please version your patches correctly and provide changelog.

Sure, I will update the changelog for v1 and v2.

Quoted 2 lines

I wrote about b4 already, which solves this as well.

Ok, I used it, will provide details for changelog in next version

Quoted 2 lines

What changed here?

As highlighted by you, Used b4 script to auto add all maintainer/reviewer.

Quoted 3 lines

Best regards,
Krzysztof

#7 lore raw

RE: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Krzysztof Kozlowski
Quoted 40 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, May 9, 2024 11:24 AM
To: Vabhav Sharma <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Franck Lenormand <[email protected]>; Aisheng Dong <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Varun Sethi <[email protected]>; Silvano Di Ninno <[email protected]>; Pankaj Gupta <[email protected]>; Frank Li <[email protected]>; Daniel Baluta <[email protected]>
Subject: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 14 lines · Vabhav Sharma

Document the secvio device tree bindings.

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Quoted 7 lines
Quoted 5 lines

Add the imx-scu secvio sub node and secvio sub node description.

---

That's not v1, right? What changed? Why do we have to guess this?

Yes, correct this is v2, I will provide changelog details in v3 for v2 and v1

Quoted 52 lines

This is thoroughly documented in kernel process so read the documentation before posting.

Quoted 1 line
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35

++++++++++++++++++++++

Quoted 12 lines
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml b/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file mode 100644
index 000000000000..30dc1e21f903

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +1 -0
+++ aml

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y line 5

Quoted 5 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +5 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
+---
+$id:
+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
+cetree.org%2Fschemas%2Farm%2Ffreescale%2Ffsl%2Cscu-

secvio.yaml%23&dat

Quoted 1 line

+a=05%7C02%7Cvabhav.sharma%40nxp.com%7Cdea3ecc999444d8c3f7108dc 6fec67e

Quoted 1 line

+b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63850830837113 8503%7CU

Quoted 1 line

+nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTi I6Ik1h

Quoted 1 line

+aWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Nl9F3A9%2BTraZboxg3KXT 35pIPAyYZ

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y

Quoted 4 lines

+51URq1wff7XCmo%3D&reserved=0
+$schema:

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +2 -0
+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
+cetree.org%2Fmeta-

schemas%2Fcore.yaml%23&data=05%7C02%7Cvabhav.sharma

Quoted 1 line

+%40nxp.com%7Cdea3ecc999444d8c3f7108dc6fec67eb%7C686ea1d3bc2b4c 6fa92cd

Quoted 1 line

+99c5c301635%7C0%7C0%7C638508308371152796%7CUnknown%7CTWFpb GZsb3d8eyJW

Quoted 1 line

+IjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 0%7C

Quoted 1 line
Quoted 7 lines

+%7C%7C&sdata=dwOG7uVGtO8rccW7vcRwvc2%2B9gyDroIsWnFlXyFxbOM% 3D&reserve

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y

Quoted 3 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +3 -0
+d=0
+
+title: NXP i.MX Security Violation driver

Bindings are for hardware, not drivers. Describe hardware.

Yes, I will use "security violation detection hardware exported through SCU firmware"

Quoted 8 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y

Quoted 6 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +5 -0
+
+maintainers:
+  - Franck LENORMAND <[email protected]>
+
+description: |

Do not need '|' unless you need to preserve formatting.

Ok

Quoted 5 lines
Quoted 3 lines

+ Receive security violation from the SNVS via the SCU firmware.
+ Allow to register notifier for additional processing

Notifier? That's a Linux thing, how does it relate to the hardware?

Violation detected by HW will call driver API to signify the violation.

Quoted 8 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y

Quoted 6 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +5 -0
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-sc-secvio

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 4 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Quoted 3 lines

Best regards,
Krzysztof

#4 lore raw

RE: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Krzysztof Kozlowski
Quoted 100 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, May 9, 2024 11:24 AM
To: Frank Li <[email protected]>; Vabhav Sharma <[email protected]>
Cc: Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Franck Lenormand <[email protected]>; Aisheng Dong <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; [email protected]; linux- [email protected]; [email protected]; linux-arm- [email protected]; Varun Sethi <[email protected]>; Silvano Di Ninno <[email protected]>; Pankaj Gupta <[email protected]>; Daniel Baluta <[email protected]>
Subject: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 7 lines · Frank Li
Quoted 1 line · Vabhav Sharma

Document the secvio device tree bindings.

reduntant sentence.

Quoted 3 lines

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation

Quoted 19 lines

^^ space here

Quoted 4 lines

of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected

^^ space here

Quoted 12 lines

to the security-violation ports, which send an alert when an out-of-range value is detected.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Add the imx-scu secvio sub node and secvio sub node description.

---
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35

++++++++++++++++++++++

Quoted 17 lines
Quoted 12 lines
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml b/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file mode 100644
index 000000000000..30dc1e21f903

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio. new file +1 -0
+++ yaml

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio. line 5

Quoted 5 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio. new file +5 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
+---
+$id:
+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdev
+icetree.org%2Fschemas%2Farm%2Ffreescale%2Ffsl%2Cscu-

secvio.yaml%23&d

Quoted 1 line
Quoted 1 line

+ata=05%7C02%7Cvabhav.sharma%40nxp.com%7C16a07379ee384ddc18f908 dc6fec

Quoted 1 line
Quoted 1 line

+75e7%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63850830857 3434788

Quoted 1 line
Quoted 1 line

+%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIi LCJBTiI

Quoted 1 line
Quoted 1 line

+6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=MBhqXwhXIQjDb3A RdYJ4U5EXM

Quoted 4 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.

Quoted 4 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio. new file +4 -0
+ryEy%2F9m5X6jGuNhHxo%3D&reserved=0
+$schema:
+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdev
+icetree.org%2Fmeta-

schemas%2Fcore.yaml%23&data=05%7C02%7Cvabhav.shar

Quoted 1 line
Quoted 1 line

+ma%40nxp.com%7C16a07379ee384ddc18f908dc6fec75e7%7C686ea1d3bc2 b4c6fa9

Quoted 1 line
Quoted 1 line

+2cd99c5c301635%7C0%7C0%7C638508308573446476%7CUnknown%7CTWF pbGZsb3d8

Quoted 1 line
Quoted 1 line

+eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 D%7

Quoted 1 line
Quoted 1 line

+C0%7C%7C%7C&sdata=m0RzUoVfr%2F2HkLlSOjhTq%2FQX3EM6ZAW7h5hQ Eidnc1g%3D

Quoted 7 lines
Quoted 5 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.

Quoted 3 lines

+&reserved=0

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio. new file +2 -0
+
+title: NXP i.MX Security Violation driver

Violation detect driver

Bindings are not for drivers.

This is security violation detection hardware exported through SCU firmware. I will detail the HW in the binding

Quoted 3 lines

Best regards,
Krzysztof

#5 lore raw

RE: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Frank Li
Quoted 20 lines

-----Original Message-----
From: Frank Li <[email protected]>
Sent: Thursday, May 9, 2024 8:37 AM
To: Vabhav Sharma <[email protected]>
Cc: Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Franck Lenormand <[email protected]>; Aisheng Dong <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; [email protected]; linux- [email protected]; [email protected]; linux-arm- [email protected]; Varun Sethi <[email protected]>; Silvano Di Ninno <[email protected]>; Pankaj Gupta <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Quoted 4 lines
Quoted 1 line · Vabhav Sharma

Document the secvio device tree bindings.

reduntant sentence.

Ok, I am removing in v3.

Quoted 35 lines
Quoted 3 lines

The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation

^^ space here

Quoted 4 lines

of hardware or physical parameters, which can indicate an attack.

The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected

^^ space here

Quoted 6 lines

to the security-violation ports, which send an alert when an out-of-range value is detected.

The "imx-secvio-sc" module is designed to report security violations and tamper triggering via SCU firmware to the user.

Quoted 6 lines

Add the imx-scu secvio sub node and secvio sub node description.

---
 .../bindings/arm/freescale/fsl,scu-secvio.yaml     | 35

++++++++++++++++++++++

Quoted 12 lines
 .../devicetree/bindings/firmware/fsl,scu.yaml      | 10 +++++++
 2 files changed, 45 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml b/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file mode 100644
index 000000000000..30dc1e21f903

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +1 -0
+++ aml
@@ -0,0 +1,35 @@
Quoted 8 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y line 6

Quoted 6 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +6 -0
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/freescale/fsl,scu-secvio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX Security Violation driver

Violation detect driver

Ok

Quoted 8 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y line 11

Quoted 6 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +5 -0
+
+maintainers:
+  - Franck LENORMAND <[email protected]>
+
+description: |

Needn't "|"

Ok

Quoted 14 lines

Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y line 22

Quoted 12 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +11 -0
+  Receive security violation from the SNVS via the SCU firmware.
+ Allow to  register notifier for additional processing
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-sc-secvio
+
+  nvmem:
+    maxItems: 1
+

any interrupt defined? how do you notify such violation event?

Yes, there is security violation interrupt bit in register map of SECVIO HW block with uses RPC call to notify/enable/disable this bit using RPC API exported through SCU firmware

Quoted 46 lines
Quoted 46 lines
Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.y new file +12 -0
+required:
+  - compatible
+  - nvmem
+
+additionalProperties: false
+
+examples:
+  - |
+    secvio {
+        compatible = "fsl,imx-sc-secvio";
+        nvmem = <&ocotp>;
+    };
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +5 -0
index 557e524786c2..b40e127fdc88 100644
@@ -129,6 +129,11 @@ properties:
       RTC controller provided by the SCU
     $ref: /schemas/rtc/fsl,scu-rtc.yaml
 
+  secvio:
+    description:
+      Receive security violation from the SNVS via the SCU firmware
+    $ref: /schemas/arm/freescale/fsl,scu-secvio.yaml
+
   thermal-sensor:
     description:
       Thermal sensor provided by the SCU @@ -197,6 +202,11 @@

examples:

                 compatible = "fsl,imx8qxp-sc-rtc";
             };
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +5 -1
+            secvio {
+                compatible = "fsl,imx-sc-secvio";
+                nvmem = <&ocotp>;
+            };
+
             keys {
                 compatible = "fsl,imx8qxp-sc-key", "fsl,imx-sc-key";
                 linux,keycodes = <KEY_POWER>;
 
--

2.25.1

#8 lore raw

Re: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

In reply to Vabhav Sharma
Quoted 8 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 4 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Best regards,
Krzysztof

#9 lore raw

RE: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Hi Krzysztof

Quoted 8 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月7日 15:08

Quoted 4 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Technically yes. But SCU case is a little bit complicated as there're many functions and all of them are already added as sub nodes in SCU node for consistency and handling platform difference.

I guess some of them, e.g. rtc, could be part of SCU node (reuse) while some couldn't. e.g. pinctrl
Do you want us to only make secvio reuse existing SCU node? This might look a bit strange to the existing sub nodes.

BTW, even we can reuse SCU node for secvio function, we still need update binding doc to add extra property 'nvmem' for secvio.
Please share your suggestions considering above information.

e.g.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/firmware/fsl,scu.yaml

    firmware {
        system-controller {
            compatible = "fsl,imx-scu";
	    ....

            rtc {
                compatible = "fsl,imx8qxp-sc-rtc";
            };

            keys {
                compatible = "fsl,imx8qxp-sc-key", "fsl,imx-sc-key";
                linux,keycodes = <KEY_POWER>;
            };

            watchdog {
                compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt";
                timeout-sec = <60>;
            };

            thermal-sensor {
                compatible = "fsl,imx8qxp-sc-thermal", "fsl,imx-sc-thermal";
                #thermal-sensor-cells = <1>;
            };
	.....
    };

Regards
Aisheng

Quoted 2 lines

Best regards,
Krzysztof

#10 lore raw

Re: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Quoted 19 lines · Aisheng Dong

Hi Krzysztof

Quoted 8 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月7日 15:08

Quoted 4 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Quoted 7 lines

Technically yes. But SCU case is a little bit complicated as there're many functions and all of them are already added as sub nodes in SCU node for consistency and handling platform difference.

I guess some of them, e.g. rtc, could be part of SCU node (reuse) while some couldn't. e.g. pinctrl
Do you want us to only make secvio reuse existing SCU node?

Yes

Quoted 1 line

This might look a bit strange to the existing sub nodes.

Nothing strange/unusual to me.

Quoted 3 lines

BTW, even we can reuse SCU node for secvio function, we still need update binding doc to add extra property 'nvmem' for secvio.

Sure.

Best regards,
Krzysztof

#11 lore raw

RE: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Hi Krzysztof,

Quoted 27 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月13日 14:14

Quoted 23 lines · Aisheng Dong

Hi Krzysztof

Quoted 8 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月7日 15:08

Quoted 4 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Technically yes. But SCU case is a little bit complicated as there're many functions and all of them are already added as sub nodes in SCU node for consistency and handling platform difference.

Quoted 6 lines
Quoted 3 lines

I guess some of them, e.g. rtc, could be part of SCU node (reuse) while some couldn't. e.g. pinctrl Do you want us to only make secvio reuse existing SCU node?

Yes

Digging a bit more on the implementation. It seems there will be a 'parent depends on child' issue when reusing the parent SCU node for secvio. Considering the defer probe support and ocotop could be modules, I'm still thinking If any solution. Do you have a good suggestion?

e.g.

system-controller {
        compatible = "fsl,imx-scu";
		nvmem = <&ocotp>;
        ...

        ocotp: ocotp {
                compatible = "fsl,imx8qxp-scu-ocotp";
                #address-cells = <1>;
                #size-cells = <1>;
                read-only;
        };
		...
}

static int imx_scu_probe(struct platform_device *pdev)

{
		...
        ret = imx_secvio_sc_setup(dev);
        if (ret)
                dev_warn(dev, "failed to initialize secvio: %d\n", ret);
		...
        return devm_of_platform_populate(dev);
}

Regards
Aisheng

Quoted 14 lines
Quoted 1 line

This might look a bit strange to the existing sub nodes.

Nothing strange/unusual to me.

Quoted 3 lines

BTW, even we can reuse SCU node for secvio function, we still need update binding doc to add extra property 'nvmem' for secvio.

Sure.

Best regards,
Krzysztof

#12 lore raw

Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Quoted 33 lines · Aisheng Dong

Hi Krzysztof,

Quoted 31 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月13日 14:14

Quoted 26 lines · Aisheng Dong

Hi Krzysztof

Quoted 8 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月7日 15:08

Quoted 4 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Technically yes. But SCU case is a little bit complicated as there're many functions and all of them are already added as sub nodes in SCU node for consistency and handling platform difference.

I guess some of them, e.g. rtc, could be part of SCU node (reuse) while some couldn't. e.g. pinctrl Do you want us to only make secvio reuse existing SCU node?

Quoted 7 lines
Quoted 2 lines

Yes

Digging a bit more on the implementation. It seems there will be a 'parent depends on child' issue when reusing the parent SCU node for secvio. Considering the defer probe support and ocotop could be modules, I'm still thinking If any solution. Do you have a good suggestion?

I don't see any problem there. You will have even worse if making it children and using populate - unpredictable order.

Best regards,
Krzysztof

#13 lore raw

RE: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Hi Krzystof,

Quoted 39 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月16日 15:34

Quoted 36 lines · Aisheng Dong

Hi Krzysztof,

Quoted 33 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月13日 14:14

Quoted 19 lines · Aisheng Dong

Hi Krzysztof

Quoted 8 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月7日 15:08

Quoted 4 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Quoted 7 lines

Technically yes. But SCU case is a little bit complicated as there're many functions and all of them are already added as sub nodes in SCU node for consistency and handling platform difference.

I guess some of them, e.g. rtc, could be part of SCU node (reuse) while some couldn't. e.g. pinctrl Do you want us to only make secvio reuse existing SCU node?

Yes

Quoted 7 lines
Quoted 4 lines

Digging a bit more on the implementation. It seems there will be a 'parent depends on child' issue when reusing the parent SCU node for secvio. Considering the defer probe support and ocotop could be modules, I'm still thinking If any solution. Do you have a good suggestion?

I don't see any problem there. You will have even worse if making it children and using populate - unpredictable order.

Sorry I didn't find a good solution without making OCOTP node to be party of SCU node too which we can't due to extra required properties of nvmem properties. E.g. #addr/size-cells.

I think the key problem is OCOTP is already a child node and there's a mismatch issue If only making secvio, which depends on OCOTP, re-use their parent SCU node. Maybe you have a good idea. Would you mind share a bit more?

BTW, I don't understand the order problem if making secvio a children as all child nodes are Individual function devices and supports defer probe well.

Regards
Aisheng

Quoted 4 lines

Best regards,
Krzysztof

#14 lore raw

Re: [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings

Quoted 53 lines · Aisheng Dong

Hi Krzystof,

Quoted 39 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月16日 15:34

Quoted 36 lines · Aisheng Dong

Hi Krzysztof,

Quoted 33 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月13日 14:14

Quoted 19 lines · Aisheng Dong

Hi Krzysztof

Quoted 8 lines

From: Krzysztof Kozlowski <[email protected]>
Sent: 2024年6月7日 15:08

Quoted 4 lines · Vabhav Sharma
Quoted 2 lines

Missing SoC compatibles.

Ok, I will use fsl,imx8dxl-sc-secvio

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

So no, that's just abuse of DT to instantiate driver.

NAK. Drop the binding.

I will detail the dt binding to describe the real hardware

Still looks like way just to instantiate driver. Why it cannot be part of existing firmware SCU node?

Quoted 7 lines

Technically yes. But SCU case is a little bit complicated as there're many functions and all of them are already added as sub nodes in SCU node for consistency and handling platform difference.

I guess some of them, e.g. rtc, could be part of SCU node (reuse) while some couldn't. e.g. pinctrl Do you want us to only make secvio reuse existing SCU node?

Yes

Quoted 7 lines
Quoted 4 lines

Digging a bit more on the implementation. It seems there will be a 'parent depends on child' issue when reusing the parent SCU node for secvio. Considering the defer probe support and ocotop could be modules, I'm still thinking If any solution. Do you have a good suggestion?

I don't see any problem there. You will have even worse if making it children and using populate - unpredictable order.

Sorry I didn't find a good solution without making OCOTP node to be party of SCU node too which we can't due to extra required properties of nvmem properties. E.g. #addr/size-cells.

Quoted 6 lines

I think the key problem is OCOTP is already a child node and there's a mismatch issue If only making secvio, which depends on OCOTP, re-use their parent SCU node. Maybe you have a good idea. Would you mind share a bit more?

BTW, I don't understand the order problem if making secvio a children as all child nodes are Individual function devices and supports defer probe well.

You keep talking about drivers but what does it have to do with bindings at all?

You can order your probe however you wish regardless of bindings. You can handle or not handle deferred probe. You can create circular dependencies or break them. All regardless of the bindings.

Best regards,
Krzysztof