Skip to content

Commit dc26ea3

Browse files
committed
Merge tag 'stm32-bus-firewall-for-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32 into soc/drivers
STM32 Firewall bus for v7.1, round 1 Highlights: ---------- Stm32 SoCs embed debug peripherals such as Coresight. These peripherals can monitor the activity of the cores. Because of that, they can be used only if some features in the debug configuration are enabled. Else, errors or firewall exceptions can be observed. Similarly to the ETZPC(on stm32mp1x platforms) or the RIFSC(on stm32mp2x platforms), debug-related peripherals access can be assessed at bus level to prevent these issues from happening. The debug configuration can only be accessed by the secure world. That means that a service must be implemented in the secure world for the kernel to check the firewall configuration. On OpenSTLinux, it is done through a Debug access PTA in OP-TEE [1]. To represent the debug peripherals present on a dedicated debug bus, create a debug bus node in the device tree and the associated driver that will interact with this PTA. Plus some fixes. * tag 'stm32-bus-firewall-for-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32: pinctrl: stm32: add firewall checks before probing the HDP driver drivers: bus: add the stm32 debug bus driver bus: stm32_firewall: add stm32_firewall_get_grant_all_access() API bus: stm32_firewall: allow check on different firewall controllers dt-bindings: bus: document the stm32 debug bus dt-bindings: pinctrl: document access-controllers property for stm32 HDP dt-bindings: document access-controllers property for coresight peripherals bus: rifsc: fix RIF configuration check for peripherals bus: rifsc: Replace snprintf("%s") with strscpy bus: stm32_firewall: Simplify with scoped for each OF child loop bus: firewall: move stm32_firewall header file in include folder Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 720d813 + 348741a commit dc26ea3

18 files changed

Lines changed: 472 additions & 53 deletions

Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ properties:
128128
"#address-cells":
129129
const: 1
130130

131+
access-controllers:
132+
maxItems: 1
133+
131134
patternProperties:
132135
'^trig-conns@([0-9]+)$':
133136
type: object

Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ properties:
7878
description: Output connection to CoreSight Trace bus
7979
$ref: /schemas/graph.yaml#/properties/port
8080

81+
access-controllers:
82+
maxItems: 1
83+
8184
required:
8285
- compatible
8386
- reg

Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ properties:
118118
description: Output connection from the ETM to CoreSight Trace bus.
119119
$ref: /schemas/graph.yaml#/properties/port
120120

121+
access-controllers:
122+
maxItems: 1
123+
121124
required:
122125
- compatible
123126
- clocks

Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ properties:
7373
description: Output connection to the CoreSight Trace bus.
7474
$ref: /schemas/graph.yaml#/properties/port
7575

76+
access-controllers:
77+
maxItems: 1
78+
7679
required:
7780
- compatible
7881
- reg

Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ properties:
128128
- const: tracedata
129129
- const: metadata
130130

131+
access-controllers:
132+
maxItems: 1
133+
131134
required:
132135
- compatible
133136
- reg

Documentation/devicetree/bindings/arm/arm,coresight-tpiu.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ properties:
7070
description: Input connection from the CoreSight Trace bus.
7171
$ref: /schemas/graph.yaml#/properties/port
7272

73+
access-controllers:
74+
maxItems: 1
75+
7376
required:
7477
- compatible
7578
- reg
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/bus/st,stm32mp131-dbg-bus.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: STM32 Coresight bus
8+
9+
maintainers:
10+
- Gatien Chevallier <gatien.chevallier@foss.st.com>
11+
12+
description:
13+
The STM32 debug bus is in charge of checking the debug configuration
14+
of the platform before probing the peripheral drivers that rely on the debug
15+
domain.
16+
17+
properties:
18+
compatible:
19+
items:
20+
- enum:
21+
- st,stm32mp131-dbg-bus
22+
- st,stm32mp151-dbg-bus
23+
24+
"#address-cells":
25+
const: 1
26+
27+
"#size-cells":
28+
const: 1
29+
30+
ranges:
31+
minItems: 1
32+
maxItems: 2
33+
34+
"#access-controller-cells":
35+
const: 1
36+
description:
37+
Contains the debug profile necessary to access the peripheral.
38+
39+
patternProperties:
40+
"@[0-9a-f]+$":
41+
description: Debug related peripherals
42+
type: object
43+
44+
additionalProperties: true
45+
46+
required:
47+
- access-controllers
48+
49+
required:
50+
- "#access-controller-cells"
51+
- "#address-cells"
52+
- "#size-cells"
53+
- compatible
54+
- ranges
55+
56+
additionalProperties: false
57+
58+
examples:
59+
- |
60+
#include <dt-bindings/clock/stm32mp1-clks.h>
61+
62+
dbg_bus: bus@50080000 {
63+
compatible = "st,stm32mp131-dbg-bus";
64+
#address-cells = <1>;
65+
#size-cells = <1>;
66+
#access-controller-cells = <1>;
67+
ranges = <0x50080000 0x50080000 0x3f80000>;
68+
69+
cti@50094000 {
70+
compatible = "arm,coresight-cti", "arm,primecell";
71+
reg = <0x50094000 0x1000>;
72+
clocks = <&rcc CK_DBG>;
73+
clock-names = "apb_pclk";
74+
access-controllers = <&dbg_bus 0>;
75+
};
76+
};

Documentation/devicetree/bindings/pinctrl/st,stm32-hdp.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ properties:
2727
clocks:
2828
maxItems: 1
2929

30+
access-controllers:
31+
minItems: 1
32+
items:
33+
- description: debug configuration access controller
34+
- description: access controller that manages the HDP as a peripheral
35+
3036
patternProperties:
3137
"^hdp[0-7]-pins$":
3238
type: object

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25009,6 +25009,7 @@ F: drivers/hwmon/pmbus/stef48h28.c
2500925009
ST STM32 FIREWALL
2501025010
M: Gatien Chevallier <gatien.chevallier@foss.st.com>
2501125011
S: Maintained
25012+
F: drivers/bus/stm32_dbg_bus.c
2501225013
F: drivers/bus/stm32_etzpc.c
2501325014
F: drivers/bus/stm32_firewall.c
2501425015
F: drivers/bus/stm32_rifsc.c

drivers/bus/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ config QCOM_SSC_BLOCK_BUS
169169
i2c/spi/uart controllers, a hexagon core, and a clock controller
170170
which provides clocks for the above.
171171

172+
config STM32_DBG_BUS
173+
tristate "OP-TEE based debug access bus"
174+
depends on OPTEE && STM32_FIREWALL
175+
depends on ARCH_STM32 || COMPILE_TEST
176+
help
177+
Select this to get the support for the OP-TEE based STM32 debug bus
178+
driver that is used to handle debug-related peripherals on STM32
179+
platforms when the debug configuration is not accessible by the
180+
normal world.
181+
172182
config STM32_FIREWALL
173183
bool "STM32 Firewall framework"
174184
depends on (ARCH_STM32 || COMPILE_TEST) && OF

0 commit comments

Comments
 (0)