Skip to contentSkip to conversation

STM32 ETZPC bus controller

PATCH Superseded Benjamin Gaignard 2 participants 9 messages May 5, 2020

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover STM32 ETZPC bus controller

STM32 Extended TrustZone Protection controller act like a firewall on the platform bus. Depending of its configuration devices could be accessible by the TrustZone, the co-processor or the non-secure world. ETZPC configuration could evolve at runtime for example to switch a device from non-secure world to co-processor.

The series introduce 'firewall' helpers to handle the new devices-tree properties. These properties are not dedicated to ETZPC and will be reused for STM32 next generation of bus controller.

version 3:
- add description in firewall consumer bindings
- add Linus reviewed-by tag

version 2:
- fix unit name into st,stm32-etzpc.yaml example and DT

Benjamin Gaignard (5):
dt-bindings: bus: Add firewall bindings
bus: stm32: Introduce firewall controller helpers
dt-bindings: bus: Add STM32 ETZPC firewall controller
bus: stm32: Add stm32 ETZPC firewall bus controller
ARM: dts: stm32: Use ETZPC firewall bus

 .../bindings/bus/stm32/firewall-consumer.yaml      |  36 +++
 .../bindings/bus/stm32/firewall-provider.yaml      |  18 ++
 .../bindings/bus/stm32/st,stm32-etzpc.yaml         |  46 ++++
 arch/arm/boot/dts/stm32mp151.dtsi                  |   7 +-
 drivers/bus/Kconfig                                |   2 +
 drivers/bus/Makefile                               |   2 +
 drivers/bus/stm32/Kconfig                          |  11 +
 drivers/bus/stm32/Makefile                         |   2 +
 drivers/bus/stm32/firewall.c                       | 266 +++++++++++++++++++++
 drivers/bus/stm32/firewall.h                       |  75 ++++++
 drivers/bus/stm32/stm32-etzpc.c                    | 160 +++++++++++++
 include/dt-bindings/bus/stm32/stm32-etzpc.h        |  90 +++++++
 12 files changed, 713 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/bus/stm32/firewall-consumer.yaml
 create mode 100644 Documentation/devicetree/bindings/bus/stm32/firewall-provider.yaml
 create mode 100644 Documentation/devicetree/bindings/bus/stm32/st,stm32-etzpc.yaml
 create mode 100644 drivers/bus/stm32/Kconfig
 create mode 100644 drivers/bus/stm32/Makefile
 create mode 100644 drivers/bus/stm32/firewall.c
 create mode 100644 drivers/bus/stm32/firewall.h
 create mode 100644 drivers/bus/stm32/stm32-etzpc.c
 create mode 100644 include/dt-bindings/bus/stm32/stm32-etzpc.h
Signature · 1 line
2.15.0
#1 lore raw

PATCH v3 1/5 dt-bindings: bus: Add firewall bindings

Add schemas for firewall consumer and provider.

---
version 3:
- add description in firewall consumer bindings
- add Linus reviewed-by tag

 .../bindings/bus/stm32/firewall-consumer.yaml      | 36 ++++++++++++++++++++++
 .../bindings/bus/stm32/firewall-provider.yaml      | 18 +++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/stm32/firewall-consumer.yaml
 create mode 100644 Documentation/devicetree/bindings/bus/stm32/firewall-provider.yaml
Documentation/devicetree/bindings/bus/stm32/firewall-consumer.yaml new file +36 -0
new file mode 100644
index 000000000000..d3d76f99b38d
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/stm32/firewall-consumer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Common Bus Firewall consumer binding
+
+description: |
+  Firewall properties provide the possible firewall bus controller
+  configurations for a device.
+  Bus firewall controllers are typically used to control if a hardware
+  block can perform read or write operations on bus.
+  The contents of the firewall bus configuration properties are defined by
+  the binding for the individual firewall controller device.
+
+  The first configuration 'firewall-0' or the one named 'default' is
+  applied before probing the device itself.
+
+maintainers:
+  - Benjamin Gaignard <[email protected]>
+
+# always select the core schema
+select: true
+
+properties:
+  firewall-0: true
+
+  firewall-names: true
+
+patternProperties:
+  "firewall-[0-9]":
+    $ref: "/schemas/types.yaml#/definitions/phandle-array"
+
+dependencies:
+  firewall-names: [ firewall-0 ]
Documentation/devicetree/bindings/bus/stm32/firewall-provider.yaml new file +18 -0
new file mode 100644
index 000000000000..299824c620ea
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/stm32/firewall-provider.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Common Bus Firewall provider binding
+
+maintainers:
+  - Benjamin Gaignard <[email protected]>
+
+properties:
+  '#firewall-cells':
+     $ref: /schemas/types.yaml#/definitions/uint32
+     description: Number of cells in a bus firewall specifier
+
+required:
+  - '#firewall-cells'
Signature · 1 line
2.15.0
#2 lore raw

PATCH v3 2/5 bus: stm32: Introduce firewall controller helpers

In reply to Benjamin Gaignard

The goal of these helpers are to offer an interface for the hardware blocks controlling bus accesses rights.

Bus firewall controllers are typically used to control if a hardware block can perform read or write operations on bus.

Smarter firewall controllers could be able to define accesses rights per hardware blocks to control where they can read or write.

Firewall controller configurations are provided in device node, parsed by the helpers and send to the driver to apply them. Each controller may need different number and type of inputs to configure the firewall so device-tree properties size have to be define by using "#firewall-cells".
Firewall configurations properties have to be named "firewall-X" on device node.
"firewall-names" keyword can also be used to give a name to a specific configuration.

Example of device-tree:

ctrl0: firewall@0 {
	#firewall-cells = <2>;
      };
foo: foo@0 {
	firewall-names = "default", "setting1";
	firewall-0 = <&ctrl0 1 2>;
	firewall-1 = <&ctrl0 3 4>;
};

Configurations could be applied with functions like firewall_set_config_by_index() or firewall_set_config_by_name().

firewall_set_default_config() function will apply the configuration named "default" (if existing) or the configuration with index 0 (i.e. firewall-0).

Drivers could register/unregister themselves be calling firewall_register/firewall_unregister functions.

---
 drivers/bus/Kconfig          |   2 +
 drivers/bus/Makefile         |   2 +
 drivers/bus/stm32/Kconfig    |   3 +
 drivers/bus/stm32/Makefile   |   1 +
 drivers/bus/stm32/firewall.c | 266 +++++++++++++++++++++++++++++++++++++++++++
 drivers/bus/stm32/firewall.h |  75 ++++++++++++
 6 files changed, 349 insertions(+)
 create mode 100644 drivers/bus/stm32/Kconfig
 create mode 100644 drivers/bus/stm32/Makefile
 create mode 100644 drivers/bus/stm32/firewall.c
 create mode 100644 drivers/bus/stm32/firewall.h
drivers/bus/Kconfig +2 -0
index 6d4e4497b59b..843b356322d9 100644
@@ -203,4 +203,6 @@ config DA8XX_MSTPRI
 source "drivers/bus/fsl-mc/Kconfig"
 source "drivers/bus/mhi/Kconfig"
 
+source "drivers/bus/stm32/Kconfig"
+
 endmenu
drivers/bus/Makefile +2 -0
index 05f32cd694a4..5e0e34b10235 100644
@@ -37,3 +37,5 @@ obj-$(CONFIG_DA8XX_MSTPRI)	+= da8xx-mstpri.o
 
 # MHI
 obj-$(CONFIG_MHI_BUS)		+= mhi/
+
+obj-$(CONFIG_MACH_STM32MP157) 	+= stm32/
\ No newline at end of file
drivers/bus/stm32/Kconfig new file +3 -0
new file mode 100644
index 000000000000..57221e833e2d
@@ -0,0 +1,3 @@
+config FIREWALL_CONTROLLERS
+	bool "Support of bus firewall controllers"
+	depends on OF
drivers/bus/stm32/Makefile new file +1 -0
new file mode 100644
index 000000000000..eb6b978d6450
@@ -0,0 +1 @@
+obj-$(CONFIG_FIREWALL_CONTROLLERS) += firewall.o
drivers/bus/stm32/firewall.c new file +266 -0

266 lines not on this page · raw message

drivers/bus/stm32/firewall.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.15.0
#3 lore raw

Re: [PATCH v3 2/5] bus: stm32: Introduce firewall controller helpers

Quoted 110 lines · Benjamin Gaignard

The goal of these helpers are to offer an interface for the hardware blocks controlling bus accesses rights.

Bus firewall controllers are typically used to control if a hardware block can perform read or write operations on bus.

Smarter firewall controllers could be able to define accesses rights per hardware blocks to control where they can read or write.

Firewall controller configurations are provided in device node, parsed by the helpers and send to the driver to apply them. Each controller may need different number and type of inputs to configure the firewall so device-tree properties size have to be define by using "#firewall-cells".
Firewall configurations properties have to be named "firewall-X" on device node.
"firewall-names" keyword can also be used to give a name to a specific configuration.

Example of device-tree:

ctrl0: firewall@0 {
	#firewall-cells = <2>;
      };
foo: foo@0 {
	firewall-names = "default", "setting1";
	firewall-0 = <&ctrl0 1 2>;
	firewall-1 = <&ctrl0 3 4>;
};

Configurations could be applied with functions like firewall_set_config_by_index() or firewall_set_config_by_name().

firewall_set_default_config() function will apply the configuration named "default" (if existing) or the configuration with index 0 (i.e. firewall-0).

Drivers could register/unregister themselves be calling firewall_register/firewall_unregister functions.

---
 drivers/bus/Kconfig          |   2 +
 drivers/bus/Makefile         |   2 +
 drivers/bus/stm32/Kconfig    |   3 +
 drivers/bus/stm32/Makefile   |   1 +
 drivers/bus/stm32/firewall.c | 266 +++++++++++++++++++++++++++++++++++++++++++
 drivers/bus/stm32/firewall.h |  75 ++++++++++++
 6 files changed, 349 insertions(+)
 create mode 100644 drivers/bus/stm32/Kconfig
 create mode 100644 drivers/bus/stm32/Makefile
 create mode 100644 drivers/bus/stm32/firewall.c
 create mode 100644 drivers/bus/stm32/firewall.h
drivers/bus/Kconfig +2 -0
index 6d4e4497b59b..843b356322d9 100644
@@ -203,4 +203,6 @@ config DA8XX_MSTPRI
 source "drivers/bus/fsl-mc/Kconfig"
 source "drivers/bus/mhi/Kconfig"
 
+source "drivers/bus/stm32/Kconfig"
+
 endmenu
drivers/bus/Makefile +2 -0
index 05f32cd694a4..5e0e34b10235 100644
@@ -37,3 +37,5 @@ obj-$(CONFIG_DA8XX_MSTPRI)	+= da8xx-mstpri.o
 
 # MHI
 obj-$(CONFIG_MHI_BUS)		+= mhi/
+
+obj-$(CONFIG_MACH_STM32MP157) 	+= stm32/
\ No newline at end of file
drivers/bus/stm32/Kconfig new file +3 -0
new file mode 100644
index 000000000000..57221e833e2d
@@ -0,0 +1,3 @@
+config FIREWALL_CONTROLLERS
+	bool "Support of bus firewall controllers"
+	depends on OF
drivers/bus/stm32/Makefile new file +1 -0
new file mode 100644
index 000000000000..eb6b978d6450
@@ -0,0 +1 @@
+obj-$(CONFIG_FIREWALL_CONTROLLERS) += firewall.o
drivers/bus/stm32/firewall.c new file +11 -0
new file mode 100644
index 000000000000..95f716cf926f
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) STMicroelectronics 2020 - All Rights Reserved
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/list.h>

drivers/bus/stm32/firewall.c line 21

Quoted 10 lines
drivers/bus/stm32/firewall.c new file +10 -0
+#include <linux/of.h>
+#include <linux/slab.h>
+
+#include "firewall.h"
+
+/* Mutex taken to protect firewall_list */
+static DEFINE_MUTEX(firewall_list_mutex);
+
+/* Global list of firewall control devices */
+static LIST_HEAD(firewall_list);

Why is that needed? Why can't you just walk the list of devices on this "bus/class" if you really wanted to?

Along those lines, why is this going around the driver model and ignoring it? Shouldn't this be a bus and you have devices attached to it of the specific type?

greg k-h

#4 lore raw

Re: [PATCH v3 2/5] bus: stm32: Introduce firewall controller helpers

Quoted 124 lines · Greg KH
Quoted 110 lines · Benjamin Gaignard

The goal of these helpers are to offer an interface for the hardware blocks controlling bus accesses rights.

Bus firewall controllers are typically used to control if a hardware block can perform read or write operations on bus.

Smarter firewall controllers could be able to define accesses rights per hardware blocks to control where they can read or write.

Firewall controller configurations are provided in device node, parsed by the helpers and send to the driver to apply them. Each controller may need different number and type of inputs to configure the firewall so device-tree properties size have to be define by using "#firewall-cells".
Firewall configurations properties have to be named "firewall-X" on device node.
"firewall-names" keyword can also be used to give a name to a specific configuration.

Example of device-tree:

ctrl0: firewall@0 {
	#firewall-cells = <2>;
       };
foo: foo@0 {
	firewall-names = "default", "setting1";
	firewall-0 = <&ctrl0 1 2>;
	firewall-1 = <&ctrl0 3 4>;
};

Configurations could be applied with functions like firewall_set_config_by_index() or firewall_set_config_by_name().

firewall_set_default_config() function will apply the configuration named "default" (if existing) or the configuration with index 0 (i.e. firewall-0).

Drivers could register/unregister themselves be calling firewall_register/firewall_unregister functions.

---
  drivers/bus/Kconfig          |   2 +
  drivers/bus/Makefile         |   2 +
  drivers/bus/stm32/Kconfig    |   3 +
  drivers/bus/stm32/Makefile   |   1 +
  drivers/bus/stm32/firewall.c | 266 +++++++++++++++++++++++++++++++++++++++++++
  drivers/bus/stm32/firewall.h |  75 ++++++++++++
  6 files changed, 349 insertions(+)

create mode 100644 drivers/bus/stm32/Kconfig
create mode 100644 drivers/bus/stm32/Makefile
create mode 100644 drivers/bus/stm32/firewall.c
create mode 100644 drivers/bus/stm32/firewall.h

drivers/bus/Kconfig +2 -0
index 6d4e4497b59b..843b356322d9 100644
@@ -203,4 +203,6 @@ config DA8XX_MSTPRI
  source "drivers/bus/fsl-mc/Kconfig"
  source "drivers/bus/mhi/Kconfig"
 
+source "drivers/bus/stm32/Kconfig"
+
  endmenu
drivers/bus/Makefile +2 -0
index 05f32cd694a4..5e0e34b10235 100644
@@ -37,3 +37,5 @@ obj-$(CONFIG_DA8XX_MSTPRI)	+= da8xx-mstpri.o
 
  # MHI
  obj-$(CONFIG_MHI_BUS)		+= mhi/
+
+obj-$(CONFIG_MACH_STM32MP157) 	+= stm32/
\ No newline at end of file
drivers/bus/stm32/Kconfig new file +3 -0
new file mode 100644
index 000000000000..57221e833e2d
@@ -0,0 +1,3 @@
+config FIREWALL_CONTROLLERS
+	bool "Support of bus firewall controllers"
+	depends on OF
drivers/bus/stm32/Makefile new file +1 -0
new file mode 100644
index 000000000000..eb6b978d6450
@@ -0,0 +1 @@
+obj-$(CONFIG_FIREWALL_CONTROLLERS) += firewall.o
drivers/bus/stm32/firewall.c new file +11 -0
new file mode 100644
index 000000000000..95f716cf926f
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) STMicroelectronics 2020 - All Rights Reserved
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/list.h>

drivers/bus/stm32/firewall.c line 21

Quoted 10 lines
drivers/bus/stm32/firewall.c new file +10 -0
+#include <linux/of.h>
+#include <linux/slab.h>
+
+#include "firewall.h"
+
+/* Mutex taken to protect firewall_list */
+static DEFINE_MUTEX(firewall_list_mutex);
+
+/* Global list of firewall control devices */
+static LIST_HEAD(firewall_list);

Why is that needed? Why can't you just walk the list of devices on this "bus/class" if you really wanted to?

Quoted 3 lines

Along those lines, why is this going around the driver model and ignoring it? Shouldn't this be a bus and you have devices attached to it of the specific type?

This part of the series is only a a set of common functions and bindings that I plan to reuse for futur STM32 SoCs.
The 'real' bus implementation is in patch 4.

Benjamin

Quoted 3 lines

greg k-h

#5 lore raw

Re: [PATCH v3 2/5] bus: stm32: Introduce firewall controller helpers

Quoted 127 lines · Benjamin GAIGNARD
Quoted 124 lines · Greg KH
Quoted 110 lines · Benjamin Gaignard

The goal of these helpers are to offer an interface for the hardware blocks controlling bus accesses rights.

Bus firewall controllers are typically used to control if a hardware block can perform read or write operations on bus.

Smarter firewall controllers could be able to define accesses rights per hardware blocks to control where they can read or write.

Firewall controller configurations are provided in device node, parsed by the helpers and send to the driver to apply them. Each controller may need different number and type of inputs to configure the firewall so device-tree properties size have to be define by using "#firewall-cells".
Firewall configurations properties have to be named "firewall-X" on device node.
"firewall-names" keyword can also be used to give a name to a specific configuration.

Example of device-tree:

ctrl0: firewall@0 {
	#firewall-cells = <2>;
       };
foo: foo@0 {
	firewall-names = "default", "setting1";
	firewall-0 = <&ctrl0 1 2>;
	firewall-1 = <&ctrl0 3 4>;
};

Configurations could be applied with functions like firewall_set_config_by_index() or firewall_set_config_by_name().

firewall_set_default_config() function will apply the configuration named "default" (if existing) or the configuration with index 0 (i.e. firewall-0).

Drivers could register/unregister themselves be calling firewall_register/firewall_unregister functions.

---
  drivers/bus/Kconfig          |   2 +
  drivers/bus/Makefile         |   2 +
  drivers/bus/stm32/Kconfig    |   3 +
  drivers/bus/stm32/Makefile   |   1 +
  drivers/bus/stm32/firewall.c | 266 +++++++++++++++++++++++++++++++++++++++++++
  drivers/bus/stm32/firewall.h |  75 ++++++++++++
  6 files changed, 349 insertions(+)

create mode 100644 drivers/bus/stm32/Kconfig
create mode 100644 drivers/bus/stm32/Makefile
create mode 100644 drivers/bus/stm32/firewall.c
create mode 100644 drivers/bus/stm32/firewall.h

drivers/bus/Kconfig +2 -0
index 6d4e4497b59b..843b356322d9 100644
@@ -203,4 +203,6 @@ config DA8XX_MSTPRI
  source "drivers/bus/fsl-mc/Kconfig"
  source "drivers/bus/mhi/Kconfig"
 
+source "drivers/bus/stm32/Kconfig"
+
  endmenu
drivers/bus/Makefile +2 -0
index 05f32cd694a4..5e0e34b10235 100644
@@ -37,3 +37,5 @@ obj-$(CONFIG_DA8XX_MSTPRI)	+= da8xx-mstpri.o
 
  # MHI
  obj-$(CONFIG_MHI_BUS)		+= mhi/
+
+obj-$(CONFIG_MACH_STM32MP157) 	+= stm32/
\ No newline at end of file
drivers/bus/stm32/Kconfig new file +3 -0
new file mode 100644
index 000000000000..57221e833e2d
@@ -0,0 +1,3 @@
+config FIREWALL_CONTROLLERS
+	bool "Support of bus firewall controllers"
+	depends on OF
drivers/bus/stm32/Makefile new file +1 -0
new file mode 100644
index 000000000000..eb6b978d6450
@@ -0,0 +1 @@
+obj-$(CONFIG_FIREWALL_CONTROLLERS) += firewall.o
drivers/bus/stm32/firewall.c new file +11 -0
new file mode 100644
index 000000000000..95f716cf926f
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) STMicroelectronics 2020 - All Rights Reserved
+ * Author: Benjamin Gaignard <[email protected]> for STMicroelectronics.
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/list.h>

drivers/bus/stm32/firewall.c line 21

Quoted 10 lines
drivers/bus/stm32/firewall.c new file +10 -0
+#include <linux/of.h>
+#include <linux/slab.h>
+
+#include "firewall.h"
+
+/* Mutex taken to protect firewall_list */
+static DEFINE_MUTEX(firewall_list_mutex);
+
+/* Global list of firewall control devices */
+static LIST_HEAD(firewall_list);

Why is that needed? Why can't you just walk the list of devices on this "bus/class" if you really wanted to?

Quoted 6 lines
Quoted 3 lines

Along those lines, why is this going around the driver model and ignoring it? Shouldn't this be a bus and you have devices attached to it of the specific type?

This part of the series is only a a set of common functions and bindings that I plan to reuse for futur STM32 SoCs.
The 'real' bus implementation is in patch 4.

Then you don't need a "fake" list of devices in this patch, do you? Why not just create the real bus and then have people use it, otherwise this sequence of review is really complicated as you must be deleting this code. Right? :)

Do it correct the first time please.

thanks,

greg k-h

#6 lore raw

PATCH v3 3/5 dt-bindings: bus: Add STM32 ETZPC firewall controller

In reply to Benjamin Gaignard

Document STM32 ETZPC firewall controller bindings

---
 .../bindings/bus/stm32/st,stm32-etzpc.yaml         | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/stm32/st,stm32-etzpc.yaml
Documentation/devicetree/bindings/bus/stm32/st,stm32-etzpc.yaml new file +46 -0
new file mode 100644
index 000000000000..d92865fda40c
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/stm32/st,stm32-etzpc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STM32 Extended TrustZone Protection controller
+
+maintainers:
+  - Benjamin Gaignard <[email protected]>
+
+description: STMicroelectronics's STM32 firewall bus controller implementation
+
+allOf:
+  - $ref: "firewall-provider.yaml#"
+  - $ref: /schemas/simple-bus.yaml#
+
+properties:
+  compatible:
+    contains:
+      enum:
+        - st,stm32-etzpc-bus
+
+  reg:
+   maxItems: 1
+
+  '#firewall-cells':
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - '#firewall-cells'
+
+examples:
+  - |
+    soc@5c007000 {
+      compatible = "st,stm32-etzpc-bus", "simple-bus";
+      reg = <0x5c007000 0x400>;
+      #firewall-cells = <2>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+      ranges;
+    };
+
+...
Signature · 1 line
2.15.0
#7 lore raw

PATCH v3 4/5 bus: stm32: Add stm32 ETZPC firewall bus controller

In reply to Benjamin Gaignard

Add STM32 Extended TrustZone Protection bus controller. For each of device-tree nodes it will check and apply firewall configuration. If it doesn't match the device will not be probed by platform bus.

A device could be configured to be accessible by trusted world, co-processor or non-secure world.

---
 drivers/bus/stm32/Kconfig                   |   8 ++
 drivers/bus/stm32/Makefile                  |   1 +
 drivers/bus/stm32/stm32-etzpc.c             | 160 ++++++++++++++++++++++++++++
 include/dt-bindings/bus/stm32/stm32-etzpc.h |  90 ++++++++++++++++
 4 files changed, 259 insertions(+)
 create mode 100644 drivers/bus/stm32/stm32-etzpc.c
 create mode 100644 include/dt-bindings/bus/stm32/stm32-etzpc.h
drivers/bus/stm32/Kconfig +8 -0
index 57221e833e2d..5dc6e2504de5 100644
@@ -1,3 +1,11 @@
 config FIREWALL_CONTROLLERS
 	bool "Support of bus firewall controllers"
 	depends on OF
+
+config STM32_ETZPC
+	bool "STM32 ETZPC bus controller"
+	depends on MACH_STM32MP157
+	select FIREWALL_CONTROLLERS
+	help
+	  Select y to enable STM32 Extended TrustZone Protection
+	  Controller (ETZPC)
drivers/bus/stm32/Makefile +1 -0
index eb6b978d6450..d42e99b5865e 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_FIREWALL_CONTROLLERS) += firewall.o
+obj-$(CONFIG_STM32_ETZPC) += stm32-etzpc.o
drivers/bus/stm32/stm32-etzpc.c new file +160 -0

160 lines not on this page · raw message

include/dt-bindings/bus/stm32/stm32-etzpc.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.15.0
#8 lore raw

PATCH v3 5/5 ARM: dts: stm32: Use ETZPC firewall bus

In reply to Benjamin Gaignard

Allow STM32 ETZPC to check firewall configuration before populating the platform bus.

---
 arch/arm/boot/dts/stm32mp151.dtsi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp151.dtsi +5 -2
index 3ea05ba48215..0290eb6f3c35 100644
@@ -4,6 +4,7 @@
  * Author: Ludovic Barre <[email protected]> for STMicroelectronics.
  */
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/bus/stm32/stm32-etzpc.h>
 #include <dt-bindings/clock/stm32mp1-clks.h>
 #include <dt-bindings/reset/stm32mp1-resets.h>
 
@@ -110,8 +111,10 @@
 		status = "disabled";
 	};
 
-	soc {
-		compatible = "simple-bus";
+	etzpc_bus: soc@5c007000 {
+		compatible = "st,stm32-etzpc-bus", "simple-bus";
+		reg = <0x5c007000 0x400>;
+		#firewall-cells = <2>;
 		#address-cells = <1>;
 		#size-cells = <1>;
 		interrupt-parent = <&intc>;
Signature · 1 line
2.15.0