* [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge
@ 2025-04-01 15:43 Laurentiu Mihalcea
2025-04-01 15:43 ` [PATCH v4 1/6] dt-bindings: bus: add documentation " Laurentiu Mihalcea
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:43 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
The AIPSTZ bridge offers some security-related configurations which can
be used to restrict master access to certain peripherals on the bridge.
Normally, this could be done from a secure environment such as ATF before
Linux boots but the configuration of AIPSTZ5 is lost each time the power
domain is powered off and then powered on. Because of this, it has to be
configured each time the power domain is turned on and before any master
tries to access the peripherals (e.g: AP, CM7, DSP, on i.MX8MP).
The child-parent relationship between the bridge and its peripherals
should guarantee that the bridge is configured before the AP attempts
to access the IPs.
Other masters should use the 'access-controllers' property to enforce
a dependency between their device and the bridge device (see the DSP,
for example).
The initial version of the series can be found at [1]. The new version
should provide better management of the device dependencies.
[1]: https://lore.kernel.org/linux-arm-kernel/20241119130726.2761726-1-daniel.baluta@nxp.com/
---
Changes in v4:
* AIPS5 node now only contains a single memory region: that of the AC
(just like in V2). 'reg-names' property is dropped.
* AIPS5 node now uses 'ranges' property to restrict the size of the bus
(1:1 mapping)
* change the number of AC cells from 0 to 3
* add binding headers
* link to v3: https://lore.kernel.org/lkml/20250324162556.30972-1-laurentiumihalcea111@gmail.com/
Changes in v3:
* make '#address-cells' and '#size-cells' constants and equal to 1 in the
binding. The bus is 32-bit.
* add child node in the example DT snippet.
* the 'aips5' DT node now contains 2 memory regions: that of the
peripherals accessible via this bridge and that of the access controller.
* link to v2: https://lore.kernel.org/lkml/20250226165314.34205-1-laurentiumihalcea111@gmail.com/
Changes in v2:
* adress Frank Li's comments
* pick up some A-b/R-b's
* don't use "simple-bus" as the second compatible. As per Krzysztof's
comment, AIPSTZ is not a "simple-bus".
* link to v1: https://lore.kernel.org/lkml/20250221191909.31874-1-laurentiumihalcea111@gmail.com/
---
Laurentiu Mihalcea (6):
dt-bindings: bus: add documentation for the IMX AIPSTZ bridge
dt-bindings: dsp: fsl,dsp: document 'access-controllers' property
bus: add driver for IMX AIPSTZ bridge
arm64: dts: imx8mp: convert 'aips5' to 'aipstz5'
arm64: dts: imx8mp: add aipstz master ID definitions
arm64: dts: imx8mp: make 'dsp' node depend on 'aips5'
.../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++
.../devicetree/bindings/dsp/fsl,dsp.yaml | 3 +
arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 25 +++++
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 12 +-
drivers/bus/Kconfig | 6 +
drivers/bus/Makefile | 1 +
drivers/bus/imx-aipstz.c | 92 ++++++++++++++++
include/dt-bindings/bus/imx-aipstz.h | 25 +++++
8 files changed, 264 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
create mode 100644 drivers/bus/imx-aipstz.c
create mode 100644 include/dt-bindings/bus/imx-aipstz.h
--
2.34.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 1/6] dt-bindings: bus: add documentation for the IMX AIPSTZ bridge
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
@ 2025-04-01 15:43 ` Laurentiu Mihalcea
2025-04-01 21:30 ` Frank Li
2025-04-02 6:52 ` Krzysztof Kozlowski
2025-04-01 15:44 ` [PATCH v4 2/6] dt-bindings: dsp: fsl,dsp: document 'access-controllers' property Laurentiu Mihalcea
` (4 subsequent siblings)
5 siblings, 2 replies; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:43 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Add documentation for IMX AIPSTZ bridge.
Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
.../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++
include/dt-bindings/bus/imx-aipstz.h | 25 +++++
2 files changed, 129 insertions(+)
create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
create mode 100644 include/dt-bindings/bus/imx-aipstz.h
diff --git a/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml b/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
new file mode 100644
index 000000000000..13b7fb39d6ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
@@ -0,0 +1,104 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/fsl,imx8mp-aipstz.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Secure AHB to IP Slave bus (AIPSTZ) bridge
+
+description:
+ The secure AIPS bridge (AIPSTZ) acts as a bridge for AHB masters issuing
+ transactions to IP Slave peripherals. Additionally, this module offers access
+ control configurations meant to restrict which peripherals a master can
+ access.
+
+maintainers:
+ - Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
+
+properties:
+ compatible:
+ const: fsl,imx8mp-aipstz
+
+ reg:
+ maxItems: 1
+
+ power-domains:
+ maxItems: 1
+
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 1
+
+ "#access-controller-cells":
+ const: 3
+ description:
+ The first cell consists of the consumer type (master or peripheral).
+ The second cell consists of the consumer ID.
+ The third cell consists of the configuration value.
+
+ ranges: true
+
+# borrowed from simple-bus.yaml, no additional requirements for children
+patternProperties:
+ "@(0|[1-9a-f][0-9a-f]*)$":
+ type: object
+ additionalProperties: true
+ properties:
+ reg:
+ items:
+ minItems: 2
+ maxItems: 4
+ minItems: 1
+ maxItems: 1024
+ ranges:
+ oneOf:
+ - items:
+ minItems: 3
+ maxItems: 7
+ minItems: 1
+ maxItems: 1024
+ - $ref: /schemas/types.yaml#/definitions/flag
+ anyOf:
+ - required:
+ - reg
+ - required:
+ - ranges
+
+required:
+ - compatible
+ - reg
+ - power-domains
+ - "#address-cells"
+ - "#size-cells"
+ - "#access-controller-cells"
+ - ranges
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/imx8mp-clock.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ bus@30df0000 {
+ compatible = "fsl,imx8mp-aipstz";
+ reg = <0x30df0000 0x10000>;
+ power-domains = <&pgc_audio>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ #access-controller-cells = <3>;
+ ranges = <0x30c00000 0x30c00000 0x400000>;
+
+ dma-controller@30e00000 {
+ compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma";
+ reg = <0x30e00000 0x10000>;
+ #dma-cells = <3>;
+ clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SDMA3_ROOT>,
+ <&clk IMX8MP_CLK_AUDIO_ROOT>;
+ clock-names = "ipg", "ahb";
+ interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+ };
+ };
diff --git a/include/dt-bindings/bus/imx-aipstz.h b/include/dt-bindings/bus/imx-aipstz.h
new file mode 100644
index 000000000000..b81b4654e00f
--- /dev/null
+++ b/include/dt-bindings/bus/imx-aipstz.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef _DT_BINDINGS_BUS_IMX_AIPSTZ_H
+#define _DT_BINDINGS_BUS_IMX_AIPSTZ_H
+
+/* consumer type - master or peripheral */
+#define IMX_AIPSTZ_MASTER 0x0
+#define IMX_AIPSTZ_PERIPH 0x1
+
+/* master configuration options */
+#define IMX_AIPSTZ_MPL 0x1
+#define IMX_AIPSTZ_MTW 0x2
+#define IMX_AIPSTZ_MTR 0x4
+#define IMX_AIPSTZ_MBW 0x8
+
+/* peripheral configuration options */
+#define IMX_AIPSTZ_TP 0x1
+#define IMX_AIPSTZ_WP 0x2
+#define IMX_AIPSTZ_SP 0x4
+#define IMX_AIPSTZ_BW 0x8
+
+#endif /* _DT_BINDINGS_BUS_IMX_AIPSTZ_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 2/6] dt-bindings: dsp: fsl,dsp: document 'access-controllers' property
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
2025-04-01 15:43 ` [PATCH v4 1/6] dt-bindings: bus: add documentation " Laurentiu Mihalcea
@ 2025-04-01 15:44 ` Laurentiu Mihalcea
2025-04-01 15:44 ` [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge Laurentiu Mihalcea
` (3 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:44 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Some DSP instances may have their access to certain peripherals
conditioned by a bus access controller such as the one from the
AIPSTZ bridge.
Add the optional 'access-controllers' property, which may be used
in such cases.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
index b8693e4b4b0d..e610b7636a08 100644
--- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
+++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
@@ -91,6 +91,9 @@ properties:
- const: runstall
- const: softreset
+ access-controllers:
+ maxItems: 1
+
required:
- compatible
- reg
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
2025-04-01 15:43 ` [PATCH v4 1/6] dt-bindings: bus: add documentation " Laurentiu Mihalcea
2025-04-01 15:44 ` [PATCH v4 2/6] dt-bindings: dsp: fsl,dsp: document 'access-controllers' property Laurentiu Mihalcea
@ 2025-04-01 15:44 ` Laurentiu Mihalcea
2025-04-03 8:30 ` Alexander Stein
2025-04-01 15:44 ` [PATCH v4 4/6] arm64: dts: imx8mp: convert 'aips5' to 'aipstz5' Laurentiu Mihalcea
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:44 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
The secure AHB to IP Slave (AIPSTZ) bus bridge provides access control
configurations meant to restrict access to certain peripherals.
Some of the configurations include:
1) Marking masters as trusted for R/W. Based on this
(and the configuration of the accessed peripheral), the bridge
may choose to abort the R/W transactions issued by certain
masters.
2) Allowing/disallowing write accesses to peripherals.
Add driver for this IP. Since there's currently no framework for
access controllers (and since there's currently no need for having
flexibility w.r.t the configurations) all this driver does is it
applies a relaxed, "default" configuration, in which all masters
are trusted for R/W.
Note that some instances of this IP (e.g: AIPSTZ5 on i.MX8MP) may be tied
to a power domain and may lose their configuration when the domain is
powered off. This is why the configuration has to be restored when the
domain is powered on.
Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
drivers/bus/Kconfig | 6 +++
drivers/bus/Makefile | 1 +
drivers/bus/imx-aipstz.c | 92 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+)
create mode 100644 drivers/bus/imx-aipstz.c
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index ff669a8ccad9..fe7600283e70 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -87,6 +87,12 @@ config HISILICON_LPC
Driver to enable I/O access to devices attached to the Low Pin
Count bus on the HiSilicon Hip06/7 SoC.
+config IMX_AIPSTZ
+ tristate "Support for IMX Secure AHB to IP Slave bus (AIPSTZ) bridge"
+ depends on ARCH_MXC
+ help
+ Enable support for IMX AIPSTZ bridge.
+
config IMX_WEIM
bool "Freescale EIM DRIVER"
depends on ARCH_MXC || COMPILE_TEST
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index cddd4984d6af..8e693fe8a03a 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
obj-$(CONFIG_BT1_APB) += bt1-apb.o
obj-$(CONFIG_BT1_AXI) += bt1-axi.o
+obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o
obj-$(CONFIG_IMX_WEIM) += imx-weim.o
obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o
obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o
diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
new file mode 100644
index 000000000000..44db40dae71b
--- /dev/null
+++ b/drivers/bus/imx-aipstz.c
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2025 NXP
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+
+#define IMX_AIPSTZ_MPR0 0x0
+
+struct imx_aipstz_config {
+ u32 mpr0;
+};
+
+static void imx_aipstz_apply_default(void __iomem *base,
+ const struct imx_aipstz_config *default_cfg)
+{
+ writel(default_cfg->mpr0, base + IMX_AIPSTZ_MPR0);
+}
+
+static int imx_aipstz_probe(struct platform_device *pdev)
+{
+ const struct imx_aipstz_config *default_cfg;
+ void __iomem *base;
+
+ base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
+ if (IS_ERR(base))
+ return dev_err_probe(&pdev->dev, -ENOMEM,
+ "failed to get/ioremap AC memory\n");
+
+ default_cfg = of_device_get_match_data(&pdev->dev);
+
+ imx_aipstz_apply_default(base, default_cfg);
+
+ dev_set_drvdata(&pdev->dev, base);
+
+ pm_runtime_set_active(&pdev->dev);
+ devm_pm_runtime_enable(&pdev->dev);
+
+ return devm_of_platform_populate(&pdev->dev);
+}
+
+static int imx_aipstz_runtime_resume(struct device *dev)
+{
+ const struct imx_aipstz_config *default_cfg;
+ void __iomem *base;
+
+ base = dev_get_drvdata(dev);
+ default_cfg = of_device_get_match_data(dev);
+
+ /* restore potentially lost configuration during domain power-off */
+ imx_aipstz_apply_default(base, default_cfg);
+
+ return 0;
+}
+
+static const struct dev_pm_ops imx_aipstz_pm_ops = {
+ RUNTIME_PM_OPS(NULL, imx_aipstz_runtime_resume, NULL)
+ SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+};
+
+/*
+ * following configuration is equivalent to:
+ * masters 0-7 => trusted for R/W + use AHB's HPROT[1] to det. privilege
+ */
+static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = {
+ .mpr0 = 0x77777777,
+};
+
+static const struct of_device_id imx_aipstz_of_ids[] = {
+ { .compatible = "fsl,imx8mp-aipstz", .data = &imx8mp_aipstz_default_cfg },
+ { }
+};
+MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids);
+
+static struct platform_driver imx_aipstz_of_driver = {
+ .probe = imx_aipstz_probe,
+ .driver = {
+ .name = "imx-aipstz",
+ .of_match_table = imx_aipstz_of_ids,
+ .pm = pm_ptr(&imx_aipstz_pm_ops),
+ },
+};
+module_platform_driver(imx_aipstz_of_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("IMX secure AHB to IP Slave bus (AIPSTZ) bridge driver");
+MODULE_AUTHOR("Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>");
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 4/6] arm64: dts: imx8mp: convert 'aips5' to 'aipstz5'
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
` (2 preceding siblings ...)
2025-04-01 15:44 ` [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge Laurentiu Mihalcea
@ 2025-04-01 15:44 ` Laurentiu Mihalcea
2025-04-01 21:21 ` Frank Li
2025-04-01 15:44 ` [PATCH v4 5/6] arm64: dts: imx8mp: add aipstz master ID definitions Laurentiu Mihalcea
2025-04-01 15:44 ` [PATCH v4 6/6] arm64: dts: imx8mp: make 'dsp' node depend on 'aips5' Laurentiu Mihalcea
5 siblings, 1 reply; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:44 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
AIPS5 is actually AIPSTZ5 as it offers some security-related
configurations. Since these configurations need to be applied before
accessing any of the peripherals on the bus, it's better to make AIPSTZ5
be their parent instead of keeping AIPS5 and adding a child node for
AIPSTZ5. Also, because of the security configurations, the address space
of the bus has to be changed to that of the configuration registers.
Finally, since AIPSTZ5 belongs to the AUDIOMIX power domain, add the
missing 'power-domains' property. The domain needs to be powered on before
attempting to configure the security-related registers.
The DT node name is not changed to avoid potential issues with DTs in
which this node is referenced.
Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index ce6793b2d57e..aa7940c65f2d 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -1399,12 +1399,14 @@ eqos: ethernet@30bf0000 {
};
};
- aips5: bus@30c00000 {
- compatible = "fsl,aips-bus", "simple-bus";
- reg = <0x30c00000 0x400000>;
+ aips5: bus@30df0000 {
+ compatible = "fsl,imx8mp-aipstz";
+ reg = <0x30df0000 0x10000>;
+ power-domains = <&pgc_audio>;
#address-cells = <1>;
#size-cells = <1>;
- ranges;
+ #access-controller-cells = <3>;
+ ranges = <0x30c00000 0x30c00000 0x400000>;
spba-bus@30c00000 {
compatible = "fsl,spba-bus", "simple-bus";
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 5/6] arm64: dts: imx8mp: add aipstz master ID definitions
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
` (3 preceding siblings ...)
2025-04-01 15:44 ` [PATCH v4 4/6] arm64: dts: imx8mp: convert 'aips5' to 'aipstz5' Laurentiu Mihalcea
@ 2025-04-01 15:44 ` Laurentiu Mihalcea
2025-04-01 21:20 ` Frank Li
2025-04-01 15:44 ` [PATCH v4 6/6] arm64: dts: imx8mp: make 'dsp' node depend on 'aips5' Laurentiu Mihalcea
5 siblings, 1 reply; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:44 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Add header file with master ID definitions for i.MX8MP's AIPSTZ.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 25 +++++++++++++++++++
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 +
2 files changed, 26 insertions(+)
create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h b/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
new file mode 100644
index 000000000000..23725cdef23b
--- /dev/null
+++ b/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef __IMX8MP_AIPSTZ_H
+#define __IMX8MP_AIPSTZ_H
+
+#include <dt-bindings/bus/imx-aipstz.h>
+
+/* master ID definitions */
+#define IMX8MP_AIPSTZ_EDMA 0 /* AUDIOMIX EDMA */
+#define IMX8MP_AIPSTZ_CA53 1 /* Cortex-A53 cluster */
+#define IMX8MP_AIPSTZ_SDMA2 3 /* AUDIOMIX SDMA2 */
+#define IMX8MP_AIPSTZ_SDMA3 3 /* AUDIOMIX SDMA3 */
+#define IMX8MP_AIPSTZ_HIFI4 5 /* HIFI4 DSP */
+#define IMX8MP_AIPSTZ_CM7 6 /* Cortex-M7 */
+
+/* helper macros */
+#define IMX8MP_AIPSTZ_HIFI4_T_RW_PL \
+ IMX_AIPSTZ_MASTER \
+ IMX8MP_AIPSTZ_HIFI4 \
+ (IMX_AIPSTZ_MPL | IMX_AIPSTZ_MTW | IMX_AIPSTZ_MTR)
+
+#endif /* __IMX8MP_AIPSTZ_H */
diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index aa7940c65f2d..ebbc99f9ceba 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -12,6 +12,7 @@
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/thermal/thermal.h>
+#include "imx8mp-aipstz.h"
#include "imx8mp-pinfunc.h"
/ {
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 6/6] arm64: dts: imx8mp: make 'dsp' node depend on 'aips5'
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
` (4 preceding siblings ...)
2025-04-01 15:44 ` [PATCH v4 5/6] arm64: dts: imx8mp: add aipstz master ID definitions Laurentiu Mihalcea
@ 2025-04-01 15:44 ` Laurentiu Mihalcea
2025-04-01 21:18 ` Frank Li
5 siblings, 1 reply; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-01 15:44 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
The DSP needs to access peripherals on AIPSTZ5 (to communicate with
the AP using AUDIOMIX MU, for instance). To do so, the security-related
registers of the bridge have to be configured before the DSP is started.
Enforce a dependency on AIPSTZ5 by adding the 'access-controllers'
property to the 'dsp' node.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index ebbc99f9ceba..f0f0ff5edea6 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -2425,6 +2425,7 @@ dsp: dsp@3b6e8000 {
mboxes = <&mu2 2 0>, <&mu2 2 1>,
<&mu2 3 0>, <&mu2 3 1>;
memory-region = <&dsp_reserved>;
+ access-controllers = <&aips5 IMX8MP_AIPSTZ_HIFI4_T_RW_PL>;
status = "disabled";
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v4 6/6] arm64: dts: imx8mp: make 'dsp' node depend on 'aips5'
2025-04-01 15:44 ` [PATCH v4 6/6] arm64: dts: imx8mp: make 'dsp' node depend on 'aips5' Laurentiu Mihalcea
@ 2025-04-01 21:18 ` Frank Li
0 siblings, 0 replies; 14+ messages in thread
From: Frank Li @ 2025-04-01 21:18 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Marco Felsch, Marc Kleine-Budde, Pengutronix Kernel Team,
devicetree, imx, linux-arm-kernel, linux-kernel
On Tue, Apr 01, 2025 at 11:44:04AM -0400, Laurentiu Mihalcea wrote:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> The DSP needs to access peripherals on AIPSTZ5 (to communicate with
> the AP using AUDIOMIX MU, for instance). To do so, the security-related
> registers of the bridge have to be configured before the DSP is started.
> Enforce a dependency on AIPSTZ5 by adding the 'access-controllers'
> property to the 'dsp' node.
>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> index ebbc99f9ceba..f0f0ff5edea6 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> @@ -2425,6 +2425,7 @@ dsp: dsp@3b6e8000 {
> mboxes = <&mu2 2 0>, <&mu2 2 1>,
> <&mu2 3 0>, <&mu2 3 1>;
> memory-region = <&dsp_reserved>;
> + access-controllers = <&aips5 IMX8MP_AIPSTZ_HIFI4_T_RW_PL>;
> status = "disabled";
> };
> };
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 5/6] arm64: dts: imx8mp: add aipstz master ID definitions
2025-04-01 15:44 ` [PATCH v4 5/6] arm64: dts: imx8mp: add aipstz master ID definitions Laurentiu Mihalcea
@ 2025-04-01 21:20 ` Frank Li
0 siblings, 0 replies; 14+ messages in thread
From: Frank Li @ 2025-04-01 21:20 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Marco Felsch, Marc Kleine-Budde, Pengutronix Kernel Team,
devicetree, imx, linux-arm-kernel, linux-kernel
On Tue, Apr 01, 2025 at 11:44:03AM -0400, Laurentiu Mihalcea wrote:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> Add header file with master ID definitions for i.MX8MP's AIPSTZ.
>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 25 +++++++++++++++++++
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 +
> 2 files changed, 26 insertions(+)
> create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h b/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
> new file mode 100644
> index 000000000000..23725cdef23b
> --- /dev/null
> +++ b/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#ifndef __IMX8MP_AIPSTZ_H
> +#define __IMX8MP_AIPSTZ_H
> +
> +#include <dt-bindings/bus/imx-aipstz.h>
> +
> +/* master ID definitions */
> +#define IMX8MP_AIPSTZ_EDMA 0 /* AUDIOMIX EDMA */
> +#define IMX8MP_AIPSTZ_CA53 1 /* Cortex-A53 cluster */
> +#define IMX8MP_AIPSTZ_SDMA2 3 /* AUDIOMIX SDMA2 */
> +#define IMX8MP_AIPSTZ_SDMA3 3 /* AUDIOMIX SDMA3 */
> +#define IMX8MP_AIPSTZ_HIFI4 5 /* HIFI4 DSP */
> +#define IMX8MP_AIPSTZ_CM7 6 /* Cortex-M7 */
> +
> +/* helper macros */
> +#define IMX8MP_AIPSTZ_HIFI4_T_RW_PL \
> + IMX_AIPSTZ_MASTER \
> + IMX8MP_AIPSTZ_HIFI4 \
> + (IMX_AIPSTZ_MPL | IMX_AIPSTZ_MTW | IMX_AIPSTZ_MTR)
> +
> +#endif /* __IMX8MP_AIPSTZ_H */
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> index aa7940c65f2d..ebbc99f9ceba 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> @@ -12,6 +12,7 @@
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> #include <dt-bindings/thermal/thermal.h>
>
> +#include "imx8mp-aipstz.h"
> #include "imx8mp-pinfunc.h"
>
> / {
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 4/6] arm64: dts: imx8mp: convert 'aips5' to 'aipstz5'
2025-04-01 15:44 ` [PATCH v4 4/6] arm64: dts: imx8mp: convert 'aips5' to 'aipstz5' Laurentiu Mihalcea
@ 2025-04-01 21:21 ` Frank Li
0 siblings, 0 replies; 14+ messages in thread
From: Frank Li @ 2025-04-01 21:21 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Marco Felsch, Marc Kleine-Budde, Pengutronix Kernel Team,
devicetree, imx, linux-arm-kernel, linux-kernel
On Tue, Apr 01, 2025 at 11:44:02AM -0400, Laurentiu Mihalcea wrote:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> AIPS5 is actually AIPSTZ5 as it offers some security-related
> configurations. Since these configurations need to be applied before
> accessing any of the peripherals on the bus, it's better to make AIPSTZ5
> be their parent instead of keeping AIPS5 and adding a child node for
> AIPSTZ5. Also, because of the security configurations, the address space
> of the bus has to be changed to that of the configuration registers.
>
> Finally, since AIPSTZ5 belongs to the AUDIOMIX power domain, add the
> missing 'power-domains' property. The domain needs to be powered on before
> attempting to configure the security-related registers.
>
> The DT node name is not changed to avoid potential issues with DTs in
> which this node is referenced.
>
> Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> index ce6793b2d57e..aa7940c65f2d 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> @@ -1399,12 +1399,14 @@ eqos: ethernet@30bf0000 {
> };
> };
>
> - aips5: bus@30c00000 {
> - compatible = "fsl,aips-bus", "simple-bus";
> - reg = <0x30c00000 0x400000>;
> + aips5: bus@30df0000 {
> + compatible = "fsl,imx8mp-aipstz";
> + reg = <0x30df0000 0x10000>;
> + power-domains = <&pgc_audio>;
> #address-cells = <1>;
> #size-cells = <1>;
> - ranges;
> + #access-controller-cells = <3>;
> + ranges = <0x30c00000 0x30c00000 0x400000>;
>
> spba-bus@30c00000 {
> compatible = "fsl,spba-bus", "simple-bus";
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 1/6] dt-bindings: bus: add documentation for the IMX AIPSTZ bridge
2025-04-01 15:43 ` [PATCH v4 1/6] dt-bindings: bus: add documentation " Laurentiu Mihalcea
@ 2025-04-01 21:30 ` Frank Li
2025-04-02 6:52 ` Krzysztof Kozlowski
1 sibling, 0 replies; 14+ messages in thread
From: Frank Li @ 2025-04-01 21:30 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Marco Felsch, Marc Kleine-Budde, Pengutronix Kernel Team,
devicetree, imx, linux-arm-kernel, linux-kernel
On Tue, Apr 01, 2025 at 11:43:59AM -0400, Laurentiu Mihalcea wrote:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Subject suggest
"dt-bindings: bus: add i.MX AIPSTZ bridge support" because dt-binding
already indicate it is document.
>
> Add documentation for IMX AIPSTZ bridge.
>
> Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> ---
> .../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++
> include/dt-bindings/bus/imx-aipstz.h | 25 +++++
> 2 files changed, 129 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
> create mode 100644 include/dt-bindings/bus/imx-aipstz.h
>
> diff --git a/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml b/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
> new file mode 100644
> index 000000000000..13b7fb39d6ac
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml
> @@ -0,0 +1,104 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/bus/fsl,imx8mp-aipstz.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Secure AHB to IP Slave bus (AIPSTZ) bridge
> +
> +description:
> + The secure AIPS bridge (AIPSTZ) acts as a bridge for AHB masters issuing
> + transactions to IP Slave peripherals. Additionally, this module offers access
> + control configurations meant to restrict which peripherals a master can
> + access.
> +
> +maintainers:
> + - Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> +
> +properties:
> + compatible:
> + const: fsl,imx8mp-aipstz
> +
> + reg:
> + maxItems: 1
> +
> + power-domains:
> + maxItems: 1
> +
> + "#address-cells":
> + const: 1
> +
> + "#size-cells":
> + const: 1
> +
> + "#access-controller-cells":
> + const: 3
> + description:
> + The first cell consists of the consumer type (master or peripheral).
> + The second cell consists of the consumer ID.
> + The third cell consists of the configuration value.
items:
- description: the consumer type (master or peripheral).
- description: the consumer ID
- description: the configuration value.
> +
> + ranges: true
> +
> +# borrowed from simple-bus.yaml, no additional requirements for children
> +patternProperties:
> + "@(0|[1-9a-f][0-9a-f]*)$":
> + type: object
> + additionalProperties: true
> + properties:
> + reg:
> + items:
> + minItems: 2
> + maxItems: 4
> + minItems: 1
> + maxItems: 1024
> + ranges:
> + oneOf:
> + - items:
> + minItems: 3
> + maxItems: 7
> + minItems: 1
> + maxItems: 1024
> + - $ref: /schemas/types.yaml#/definitions/flag
> + anyOf:
> + - required:
> + - reg
> + - required:
> + - ranges
> +
> +required:
> + - compatible
> + - reg
> + - power-domains
> + - "#address-cells"
> + - "#size-cells"
> + - "#access-controller-cells"
> + - ranges
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/imx8mp-clock.h>
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> + bus@30df0000 {
> + compatible = "fsl,imx8mp-aipstz";
> + reg = <0x30df0000 0x10000>;
> + power-domains = <&pgc_audio>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + #access-controller-cells = <3>;
> + ranges = <0x30c00000 0x30c00000 0x400000>;
generally, ranges just after reg
> +
> + dma-controller@30e00000 {
> + compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma";
> + reg = <0x30e00000 0x10000>;
> + #dma-cells = <3>;
> + clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SDMA3_ROOT>,
> + <&clk IMX8MP_CLK_AUDIO_ROOT>;
> + clock-names = "ipg", "ahb";
> + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
Does it need access-controllers here?
Frank
> + fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
> + };
> + };
> diff --git a/include/dt-bindings/bus/imx-aipstz.h b/include/dt-bindings/bus/imx-aipstz.h
> new file mode 100644
> index 000000000000..b81b4654e00f
> --- /dev/null
> +++ b/include/dt-bindings/bus/imx-aipstz.h
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#ifndef _DT_BINDINGS_BUS_IMX_AIPSTZ_H
> +#define _DT_BINDINGS_BUS_IMX_AIPSTZ_H
> +
> +/* consumer type - master or peripheral */
> +#define IMX_AIPSTZ_MASTER 0x0
> +#define IMX_AIPSTZ_PERIPH 0x1
> +
> +/* master configuration options */
> +#define IMX_AIPSTZ_MPL 0x1
> +#define IMX_AIPSTZ_MTW 0x2
> +#define IMX_AIPSTZ_MTR 0x4
> +#define IMX_AIPSTZ_MBW 0x8
> +
> +/* peripheral configuration options */
> +#define IMX_AIPSTZ_TP 0x1
> +#define IMX_AIPSTZ_WP 0x2
> +#define IMX_AIPSTZ_SP 0x4
> +#define IMX_AIPSTZ_BW 0x8
> +
> +#endif /* _DT_BINDINGS_BUS_IMX_AIPSTZ_H */
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 1/6] dt-bindings: bus: add documentation for the IMX AIPSTZ bridge
2025-04-01 15:43 ` [PATCH v4 1/6] dt-bindings: bus: add documentation " Laurentiu Mihalcea
2025-04-01 21:30 ` Frank Li
@ 2025-04-02 6:52 ` Krzysztof Kozlowski
1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-02 6:52 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde,
Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel
On Tue, Apr 01, 2025 at 11:43:59AM -0400, Laurentiu Mihalcea wrote:
> +examples:
> + - |
> + #include <dt-bindings/clock/imx8mp-clock.h>
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> + bus@30df0000 {
> + compatible = "fsl,imx8mp-aipstz";
> + reg = <0x30df0000 0x10000>;
> + power-domains = <&pgc_audio>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + #access-controller-cells = <3>;
> + ranges = <0x30c00000 0x30c00000 0x400000>;
> +
> + dma-controller@30e00000 {
> + compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma";
> + reg = <0x30e00000 0x10000>;
> + #dma-cells = <3>;
> + clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SDMA3_ROOT>,
> + <&clk IMX8MP_CLK_AUDIO_ROOT>;
> + clock-names = "ipg", "ahb";
> + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
> + fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
> + };
> + };
> diff --git a/include/dt-bindings/bus/imx-aipstz.h b/include/dt-bindings/bus/imx-aipstz.h
> new file mode 100644
> index 000000000000..b81b4654e00f
> --- /dev/null
> +++ b/include/dt-bindings/bus/imx-aipstz.h
Filename matching compatible, if this stays.
But more important, I do not see this being used - neither here in
example nor in the driver, so not a binding.
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#ifndef _DT_BINDINGS_BUS_IMX_AIPSTZ_H
> +#define _DT_BINDINGS_BUS_IMX_AIPSTZ_H
> +
> +/* consumer type - master or peripheral */
> +#define IMX_AIPSTZ_MASTER 0x0
> +#define IMX_AIPSTZ_PERIPH 0x1
> +
> +/* master configuration options */
> +#define IMX_AIPSTZ_MPL 0x1
> +#define IMX_AIPSTZ_MTW 0x2
> +#define IMX_AIPSTZ_MTR 0x4
> +#define IMX_AIPSTZ_MBW 0x8
IDs are not hex values. What do you exactly represent here?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge
2025-04-01 15:44 ` [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge Laurentiu Mihalcea
@ 2025-04-03 8:30 ` Alexander Stein
2025-04-04 13:59 ` Laurentiu Mihalcea
0 siblings, 1 reply; 14+ messages in thread
From: Alexander Stein @ 2025-04-03 8:30 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Daniel Baluta, Shengjiu Wang,
Frank Li, Marco Felsch, Marc Kleine-Budde, linux-arm-kernel
Cc: Pengutronix Kernel Team, devicetree, imx, linux-arm-kernel,
linux-kernel, Laurentiu Mihalcea
Hi,
Am Dienstag, 1. April 2025, 17:44:01 CEST schrieb Laurentiu Mihalcea:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> The secure AHB to IP Slave (AIPSTZ) bus bridge provides access control
> configurations meant to restrict access to certain peripherals.
> Some of the configurations include:
>
> 1) Marking masters as trusted for R/W. Based on this
> (and the configuration of the accessed peripheral), the bridge
> may choose to abort the R/W transactions issued by certain
> masters.
>
> 2) Allowing/disallowing write accesses to peripherals.
>
> Add driver for this IP. Since there's currently no framework for
> access controllers (and since there's currently no need for having
> flexibility w.r.t the configurations) all this driver does is it
> applies a relaxed, "default" configuration, in which all masters
> are trusted for R/W.
>
> Note that some instances of this IP (e.g: AIPSTZ5 on i.MX8MP) may be tied
> to a power domain and may lose their configuration when the domain is
> powered off. This is why the configuration has to be restored when the
> domain is powered on.
>
> Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> ---
> drivers/bus/Kconfig | 6 +++
> drivers/bus/Makefile | 1 +
> drivers/bus/imx-aipstz.c | 92 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 99 insertions(+)
> create mode 100644 drivers/bus/imx-aipstz.c
>
> diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
> index ff669a8ccad9..fe7600283e70 100644
> --- a/drivers/bus/Kconfig
> +++ b/drivers/bus/Kconfig
> @@ -87,6 +87,12 @@ config HISILICON_LPC
> Driver to enable I/O access to devices attached to the Low Pin
> Count bus on the HiSilicon Hip06/7 SoC.
>
> +config IMX_AIPSTZ
> + tristate "Support for IMX Secure AHB to IP Slave bus (AIPSTZ) bridge"
> + depends on ARCH_MXC
> + help
> + Enable support for IMX AIPSTZ bridge.
> +
> config IMX_WEIM
> bool "Freescale EIM DRIVER"
> depends on ARCH_MXC || COMPILE_TEST
> diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
> index cddd4984d6af..8e693fe8a03a 100644
> --- a/drivers/bus/Makefile
> +++ b/drivers/bus/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
>
> obj-$(CONFIG_BT1_APB) += bt1-apb.o
> obj-$(CONFIG_BT1_AXI) += bt1-axi.o
> +obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o
> obj-$(CONFIG_IMX_WEIM) += imx-weim.o
> obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o
> obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o
> diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
> new file mode 100644
> index 000000000000..44db40dae71b
> --- /dev/null
> +++ b/drivers/bus/imx-aipstz.c
> @@ -0,0 +1,92 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/regmap.h>
> +
> +#define IMX_AIPSTZ_MPR0 0x0
> +
> +struct imx_aipstz_config {
> + u32 mpr0;
> +};
> +
> +static void imx_aipstz_apply_default(void __iomem *base,
> + const struct imx_aipstz_config *default_cfg)
> +{
> + writel(default_cfg->mpr0, base + IMX_AIPSTZ_MPR0);
> +}
> +
> +static int imx_aipstz_probe(struct platform_device *pdev)
> +{
> + const struct imx_aipstz_config *default_cfg;
> + void __iomem *base;
> +
> + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
> + if (IS_ERR(base))
> + return dev_err_probe(&pdev->dev, -ENOMEM,
> + "failed to get/ioremap AC memory\n");
> +
> + default_cfg = of_device_get_match_data(&pdev->dev);
Shouldn't you use the configuration setup by trusted firmware (TF-A)?
> +
> + imx_aipstz_apply_default(base, default_cfg);
> +
> + dev_set_drvdata(&pdev->dev, base);
> +
> + pm_runtime_set_active(&pdev->dev);
> + devm_pm_runtime_enable(&pdev->dev);
> +
> + return devm_of_platform_populate(&pdev->dev);
> +}
> +
> +static int imx_aipstz_runtime_resume(struct device *dev)
> +{
> + const struct imx_aipstz_config *default_cfg;
> + void __iomem *base;
> +
> + base = dev_get_drvdata(dev);
> + default_cfg = of_device_get_match_data(dev);
> +
> + /* restore potentially lost configuration during domain power-off */
> + imx_aipstz_apply_default(base, default_cfg);
Shouldn't you store the configuration at suspend and restore that one
instead of this fixed one?
What's going to happen if trusted firmware decides that Cortex-A53 domain
is not allowed to access AIPSTZ?
Best regards
Alexander
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops imx_aipstz_pm_ops = {
> + RUNTIME_PM_OPS(NULL, imx_aipstz_runtime_resume, NULL)
> + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> +};
> +
> +/*
> + * following configuration is equivalent to:
> + * masters 0-7 => trusted for R/W + use AHB's HPROT[1] to det. privilege
> + */
> +static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = {
> + .mpr0 = 0x77777777,
> +};
> +
> +static const struct of_device_id imx_aipstz_of_ids[] = {
> + { .compatible = "fsl,imx8mp-aipstz", .data = &imx8mp_aipstz_default_cfg },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids);
> +
> +static struct platform_driver imx_aipstz_of_driver = {
> + .probe = imx_aipstz_probe,
> + .driver = {
> + .name = "imx-aipstz",
> + .of_match_table = imx_aipstz_of_ids,
> + .pm = pm_ptr(&imx_aipstz_pm_ops),
> + },
> +};
> +module_platform_driver(imx_aipstz_of_driver);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("IMX secure AHB to IP Slave bus (AIPSTZ) bridge driver");
> +MODULE_AUTHOR("Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>");
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge
2025-04-03 8:30 ` Alexander Stein
@ 2025-04-04 13:59 ` Laurentiu Mihalcea
0 siblings, 0 replies; 14+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-04 13:59 UTC (permalink / raw)
To: Alexander Stein, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Fabio Estevam, Daniel Baluta,
Shengjiu Wang, Frank Li, Marco Felsch, Marc Kleine-Budde,
linux-arm-kernel
Cc: Pengutronix Kernel Team, devicetree, imx, linux-kernel
On 4/3/2025 11:30 AM, Alexander Stein wrote:
> Hi,
>
> Am Dienstag, 1. April 2025, 17:44:01 CEST schrieb Laurentiu Mihalcea:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>>
>> The secure AHB to IP Slave (AIPSTZ) bus bridge provides access control
>> configurations meant to restrict access to certain peripherals.
>> Some of the configurations include:
>>
>> 1) Marking masters as trusted for R/W. Based on this
>> (and the configuration of the accessed peripheral), the bridge
>> may choose to abort the R/W transactions issued by certain
>> masters.
>>
>> 2) Allowing/disallowing write accesses to peripherals.
>>
>> Add driver for this IP. Since there's currently no framework for
>> access controllers (and since there's currently no need for having
>> flexibility w.r.t the configurations) all this driver does is it
>> applies a relaxed, "default" configuration, in which all masters
>> are trusted for R/W.
>>
>> Note that some instances of this IP (e.g: AIPSTZ5 on i.MX8MP) may be tied
>> to a power domain and may lose their configuration when the domain is
>> powered off. This is why the configuration has to be restored when the
>> domain is powered on.
>>
>> Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com>
>> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
>> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>> ---
>> drivers/bus/Kconfig | 6 +++
>> drivers/bus/Makefile | 1 +
>> drivers/bus/imx-aipstz.c | 92 ++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 99 insertions(+)
>> create mode 100644 drivers/bus/imx-aipstz.c
>>
>> diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
>> index ff669a8ccad9..fe7600283e70 100644
>> --- a/drivers/bus/Kconfig
>> +++ b/drivers/bus/Kconfig
>> @@ -87,6 +87,12 @@ config HISILICON_LPC
>> Driver to enable I/O access to devices attached to the Low Pin
>> Count bus on the HiSilicon Hip06/7 SoC.
>>
>> +config IMX_AIPSTZ
>> + tristate "Support for IMX Secure AHB to IP Slave bus (AIPSTZ) bridge"
>> + depends on ARCH_MXC
>> + help
>> + Enable support for IMX AIPSTZ bridge.
>> +
>> config IMX_WEIM
>> bool "Freescale EIM DRIVER"
>> depends on ARCH_MXC || COMPILE_TEST
>> diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
>> index cddd4984d6af..8e693fe8a03a 100644
>> --- a/drivers/bus/Makefile
>> +++ b/drivers/bus/Makefile
>> @@ -15,6 +15,7 @@ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
>>
>> obj-$(CONFIG_BT1_APB) += bt1-apb.o
>> obj-$(CONFIG_BT1_AXI) += bt1-axi.o
>> +obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o
>> obj-$(CONFIG_IMX_WEIM) += imx-weim.o
>> obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o
>> obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o
>> diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
>> new file mode 100644
>> index 000000000000..44db40dae71b
>> --- /dev/null
>> +++ b/drivers/bus/imx-aipstz.c
>> @@ -0,0 +1,92 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright 2025 NXP
>> + */
>> +
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/of_platform.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/pm_runtime.h>
>> +#include <linux/regmap.h>
>> +
>> +#define IMX_AIPSTZ_MPR0 0x0
>> +
>> +struct imx_aipstz_config {
>> + u32 mpr0;
>> +};
>> +
>> +static void imx_aipstz_apply_default(void __iomem *base,
>> + const struct imx_aipstz_config *default_cfg)
>> +{
>> + writel(default_cfg->mpr0, base + IMX_AIPSTZ_MPR0);
>> +}
>> +
>> +static int imx_aipstz_probe(struct platform_device *pdev)
>> +{
>> + const struct imx_aipstz_config *default_cfg;
>> + void __iomem *base;
>> +
>> + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
>> + if (IS_ERR(base))
>> + return dev_err_probe(&pdev->dev, -ENOMEM,
>> + "failed to get/ioremap AC memory\n");
>> +
>> + default_cfg = of_device_get_match_data(&pdev->dev);
> Shouldn't you use the configuration setup by trusted firmware (TF-A)?
not sure I see the value in doing that? the TF-A configuration will be overriden
anyways if an AC API is ever introduced in Linux. Also, for AIPSTZ5, you'd need to:
1) Make sure the AUDIOMIX domain is not power cycled before latching on to the
TF-A configuration otherwise you'll lose it.
2) Add an extra step in which you actually configure the bridge's AC from TF-A since
it's not ATM.
I'm not sure why you'd want to do that when you can just set the configuration directly
from Linux?
>
>> +
>> + imx_aipstz_apply_default(base, default_cfg);
>> +
>> + dev_set_drvdata(&pdev->dev, base);
>> +
>> + pm_runtime_set_active(&pdev->dev);
>> + devm_pm_runtime_enable(&pdev->dev);
>> +
>> + return devm_of_platform_populate(&pdev->dev);
>> +}
>> +
>> +static int imx_aipstz_runtime_resume(struct device *dev)
>> +{
>> + const struct imx_aipstz_config *default_cfg;
>> + void __iomem *base;
>> +
>> + base = dev_get_drvdata(dev);
>> + default_cfg = of_device_get_match_data(dev);
>> +
>> + /* restore potentially lost configuration during domain power-off */
>> + imx_aipstz_apply_default(base, default_cfg);
> Shouldn't you store the configuration at suspend and restore that one
> instead of this fixed one?
you're only using the fixed configuration here and you're not modifying it anywhere
so no need to save it during suspend.
>
> What's going to happen if trusted firmware decides that Cortex-A53 domain
> is not allowed to access AIPSTZ?
then you'll get a bus fault and will have to model AIPSTZ as just AIPS via the devicetree
(like we do for AIPSTZ1-AIPSTZ4 right now)
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-04-04 14:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 15:43 [PATCH v4 0/6] imx8mp: add support for the IMX AIPSTZ bridge Laurentiu Mihalcea
2025-04-01 15:43 ` [PATCH v4 1/6] dt-bindings: bus: add documentation " Laurentiu Mihalcea
2025-04-01 21:30 ` Frank Li
2025-04-02 6:52 ` Krzysztof Kozlowski
2025-04-01 15:44 ` [PATCH v4 2/6] dt-bindings: dsp: fsl,dsp: document 'access-controllers' property Laurentiu Mihalcea
2025-04-01 15:44 ` [PATCH v4 3/6] bus: add driver for IMX AIPSTZ bridge Laurentiu Mihalcea
2025-04-03 8:30 ` Alexander Stein
2025-04-04 13:59 ` Laurentiu Mihalcea
2025-04-01 15:44 ` [PATCH v4 4/6] arm64: dts: imx8mp: convert 'aips5' to 'aipstz5' Laurentiu Mihalcea
2025-04-01 21:21 ` Frank Li
2025-04-01 15:44 ` [PATCH v4 5/6] arm64: dts: imx8mp: add aipstz master ID definitions Laurentiu Mihalcea
2025-04-01 21:20 ` Frank Li
2025-04-01 15:44 ` [PATCH v4 6/6] arm64: dts: imx8mp: make 'dsp' node depend on 'aips5' Laurentiu Mihalcea
2025-04-01 21:18 ` Frank Li
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).