Skip to contentSkip to conversation

*** firmware: imx: NXP Edgelock Enclave MUAP Driver ***

PATCH Superseded Pankaj Gupta 4 participants 15 messages Apr 19, 2023 – Jun 30, 2023

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover *** firmware: imx: NXP Edgelock Enclave MUAP Driver ***

v2 Changes:

- Fixed Kernel Test Bot issues.
- Removed ".../devicetree/bindings/mailbox/fsl,muap.txt"

v1:

The Messaging Unit module enables two processing elements within the SoC to communicate and coordinate by passing messages (e.g., data, status and control) through its interfaces.

The NXP i.MX EdgeLock Enclave Message Unit (ELE-MUAP) is specifically targeted for use between application core and Edgelocke Enclave. It allows to send messages to the EL Enclave using a shared mailbox.

Patch-set add the ELE-MU kernel driver for exchanging messages with i.MX NXP ELE IP; both from:
- User-Space Applications via character driver.
- Kernel-space, used by kernel management layers like DM-Crypt.

Pankaj Gupta (7):
doc: device tree binding addition for ele MU
arm64: dts: imx93-11x11-evk: added ele-mu
arm64: dts: imx93-11x11-evk: reserved mem-ranges to constrain ele-mu
dma-range
arm64: dts: imx8ulp-evk: added ele-mu
arm64: dts: imx8ulp-evk: reserved mem-ranges to constrain ele-mu
dma-range
firmware: imx: add ELE MU driver support
MAINTAINERS: Added maintainer details

 .../bindings/arm/freescale/fsl,ele_mu.yaml    |  139 ++
 MAINTAINERS                                   |    7 +
 arch/arm64/boot/dts/freescale/imx8ulp-evk.dts |   15 +
 arch/arm64/boot/dts/freescale/imx8ulp.dtsi    |   13 +-
 .../boot/dts/freescale/imx93-11x11-evk.dts    |   15 +
 arch/arm64/boot/dts/freescale/imx93.dtsi      |   11 +-
 drivers/firmware/imx/Kconfig                  |   11 +
 drivers/firmware/imx/Makefile                 |    2 +
 drivers/firmware/imx/ele_base_msg.c           |  378 +++++
 drivers/firmware/imx/ele_mu.c                 | 1285 +++++++++++++++++
 drivers/firmware/imx/ele_mu.h                 |  174 +++
 include/linux/firmware/imx/ele_base_msg.h     |   67 +
 include/linux/firmware/imx/ele_mu_ioctl.h     |   52 +
 13 files changed, 2167 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml
 create mode 100644 drivers/firmware/imx/ele_base_msg.c
 create mode 100644 drivers/firmware/imx/ele_mu.c
 create mode 100644 drivers/firmware/imx/ele_mu.h
 create mode 100644 include/linux/firmware/imx/ele_base_msg.h
 create mode 100644 include/linux/firmware/imx/ele_mu_ioctl.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/7 doc: device tree binding addition for ele MU

Documentation update with addition of new device tree for NXP ele-mu (Edgelock Enclave Message Unit), driver.

---
 .../bindings/arm/freescale/fsl,ele_mu.yaml    | 139 ++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +139 -0
new file mode 100644
index 000000000000..8c4cc32f62ab
@@ -0,0 +1,139 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/freescale/fsl,ele_mu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX EdgeLock Enclave MUAP driver
+
+maintainers:
+  - Pankaj Gupta <[email protected]>
+
+description: |
+
+  NXP i.MX EdgeLock Enclave Message Unit Driver.
+  The Messaging Unit module enables two processing elements within the SoC to
+  communicate and coordinate by passing messages (e.g., data, status and control)
+  through its interfaces.
+
+  The NXP i.MX EdgeLock Enclave Message Unit (ELE-MUAP) is specifically targeted
+  for use between application core and Edgelocke Enclave. It allows to send
+  messages to the EL Enclave using a shared mailbox.
+
+  The messages must follow the protocol defined.
+
+                                     Non-Secure           +   Secure
+                                                          |
+                                                          |
+                   +---------+      +-------------+       |
+                   | ele_mu.c+<---->+imx-mailbox.c|       |
+                   |         |      |  mailbox.c  +<-->+------+    +------+
+                   +---+-----+      +-------------+    | MU X +<-->+ ELE |
+                       |                               +------+    +------+
+                       +----------------+                 |
+                       |                |                 |
+                       v                v                 |
+                   logical           logical              |
+                   receiver          waiter               |
+                      +                 +                 |
+                      |                 |                 |
+                      |                 |                 |
+                      |            +----+------+          |
+                      |            |           |          |
+                      |            |           |          |
+               device_ctx     device_ctx     device_ctx   |
+                                                          |
+                 User 0        User 1       User Y        |
+                 +------+      +------+     +------+      |
+                 |misc.c|      |misc.c|     |misc.c|      |
+  kernel space   +------+      +------+     +------+      |
+                                                          |
+  +------------------------------------------------------ |
+                     |             |           |          |
+  userspace     /dev/ele_muXch0    |           |          |
+                           /dev/ele_muXch1     |          |
+                                         /dev/ele_muXchY  |
+                                                          |
+
+  When a user sends a command to the ELE, it registers its device_ctx as
+  waiter of a response from ELE.
+
+  A user can be registered as receiver of command from the ELE.
+  Create char devices in /dev as channels of the form /dev/ele_muXchY with X
+  the id of the driver and Y for each users. It allows to send and receive
+  messages to the NXP EdgeLock Enclave IP on NXP SoC, where current possible
+  value, i.e., supported SoC(s) are imx8ulp, imx93.
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-ele
+      - fsl,imx93-ele
+
+  mboxes:
+    description:
+      List of <&phandle type channel> - 4 channels for TX, 4 channels for RX,
+      1 channel for TXDB
+    maxItems: 9
+
+  mbox-names:
+    items:
+      - const: tx
+      - const: rx
+
+  fsl,ele_mu_did:
+    description:
+      Owner of message-unit, is identified via Domain ID or did.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [0, 1, 2, 3, 4, 5, 6, 7]
+
+  fsl,ele_mu_id:
+    description:
+      Identifier to the message-unit among the multiple message-unit that exists on SoC.
+      It is used to create the channels, default to 2
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [0, 1, 2, 3]
+
+  fsl,ele_max_users:
+    description:
+      Number of misclleneous devices to be created, default to 4
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+  fsl,cmd_tag:
+    description:
+      Tag in message header for commands on this MU, default to 0x17
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint8
+      - enum: [0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e]
+
+  fsl,rsp_tag:
+    description:
+      Tag in message header for responses on this MU, default to 0xe1
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint8
+      - enum: [0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8]
+
+required:
+  - compatible
+  - mboxes
+  - mbox-names
+
+additionalProperties: false
+
+examples:
+  - |
+    ele_mu: ele_mu {
+      compatible = "fsl,imx93-ele";
+      mbox-names = "tx", "rx";
+      mboxes = <&s4muap 2 0
+          &s4muap 3 0>;
+
+      fsl,ele_mu_id = <1>;
+      fsl,ele_max_users = <4>;
+      fsl,cmd_tag = /bits/ 8 <0x17>;
+      fsl,rsp_tag = /bits/ 8 <0xe1>;
+    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/7] doc: device tree binding addition for ele MU

Quoted 2 lines · Pankaj Gupta

Documentation update with addition of new device tree for NXP ele-mu (Edgelock Enclave Message Unit), driver.

Your patchset is sent with wrong clock. Fix your system because now it goes before all other patchsets...

Use subject prefixes matching the subsystem (which you can get for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching).

Subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml

Quoted 12 lines
---
 .../bindings/arm/freescale/fsl,ele_mu.yaml    | 139 ++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +0 -0
new file mode 100644
index 000000000000..8c4cc32f62ab

Underscores are not allowed.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 7

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

Drop driver.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 13

Quoted 6 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +6 -0
+
+maintainers:
+  - Pankaj Gupta <[email protected]>
+
+description: |
+

Drop stray blank line

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 14

Quoted 1 line
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +1 -0
+  NXP i.MX EdgeLock Enclave Message Unit Driver.

Drop driver and rephrase it to describe hardware.

Quoted 58 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +58 -0
+  The Messaging Unit module enables two processing elements within the SoC to
+  communicate and coordinate by passing messages (e.g., data, status and control)
+  through its interfaces.
+
+  The NXP i.MX EdgeLock Enclave Message Unit (ELE-MUAP) is specifically targeted
+  for use between application core and Edgelocke Enclave. It allows to send
+  messages to the EL Enclave using a shared mailbox.
+
+  The messages must follow the protocol defined.
+
+                                     Non-Secure           +   Secure
+                                                          |
+                                                          |
+                   +---------+      +-------------+       |
+                   | ele_mu.c+<---->+imx-mailbox.c|       |
+                   |         |      |  mailbox.c  +<-->+------+    +------+
+                   +---+-----+      +-------------+    | MU X +<-->+ ELE |
+                       |                               +------+    +------+
+                       +----------------+                 |
+                       |                |                 |
+                       v                v                 |
+                   logical           logical              |
+                   receiver          waiter               |
+                      +                 +                 |
+                      |                 |                 |
+                      |                 |                 |
+                      |            +----+------+          |
+                      |            |           |          |
+                      |            |           |          |
+               device_ctx     device_ctx     device_ctx   |
+                                                          |
+                 User 0        User 1       User Y        |
+                 +------+      +------+     +------+      |
+                 |misc.c|      |misc.c|     |misc.c|      |
+  kernel space   +------+      +------+     +------+      |
+                                                          |
+  +------------------------------------------------------ |
+                     |             |           |          |
+  userspace     /dev/ele_muXch0    |           |          |
+                           /dev/ele_muXch1     |          |
+                                         /dev/ele_muXchY  |
+                                                          |
+
+  When a user sends a command to the ELE, it registers its device_ctx as
+  waiter of a response from ELE.
+
+  A user can be registered as receiver of command from the ELE.
+  Create char devices in /dev as channels of the form /dev/ele_muXchY with X
+  the id of the driver and Y for each users. It allows to send and receive
+  messages to the NXP EdgeLock Enclave IP on NXP SoC, where current possible
+  value, i.e., supported SoC(s) are imx8ulp, imx93.
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx-ele
+      - fsl,imx93-ele
+

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 82

Quoted 10 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +10 -0
+  mboxes:
+    description:
+      List of <&phandle type channel> - 4 channels for TX, 4 channels for RX,
+      1 channel for TXDB
+    maxItems: 9
+
+  mbox-names:
+    items:
+      - const: tx
+      - const: rx

This does not make sense. You have 9 items, not two. Unless you want some customization.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 84

Quoted 2 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +2 -0
+
+  fsl,ele_mu_did:

Underscores are not allowed.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 87

Quoted 3 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +3 -0
+    description:
+      Owner of message-unit, is identified via Domain ID or did.
+    allOf:

That's not how they this is written. Drop allOf. Please start from example-schema.

Anyway, half of the properties here do not look like hardware properties. You need to explain why these are board specific.

Quoted 11 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +11 -0
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [0, 1, 2, 3, 4, 5, 6, 7]
+
+  fsl,ele_mu_id:
+    description:
+      Identifier to the message-unit among the multiple message-unit that exists on SoC.
+      It is used to create the channels, default to 2
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [0, 1, 2, 3]
+

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 108

Quoted 10 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +10 -0
+  fsl,ele_max_users:
+    description:
+      Number of misclleneous devices to be created, default to 4
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+  fsl,cmd_tag:
+    description:
+      Tag in message header for commands on this MU, default to 0x17

Don't repeat constraints in free form text. Use default:

Quoted 11 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +11 -0
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint8
+      - enum: [0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e]
+
+  fsl,rsp_tag:
+    description:
+      Tag in message header for responses on this MU, default to 0xe1
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint8
+      - enum: [0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8]
+

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 129

Quoted 10 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +10 -0
+required:
+  - compatible
+  - mboxes
+  - mbox-names
+
+additionalProperties: false
+
+examples:
+  - |
+    ele_mu: ele_mu {

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Also, underscores are not allowed iin node names.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 133

Quoted 4 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +4 -0
+      compatible = "fsl,imx93-ele";
+      mbox-names = "tx", "rx";
+      mboxes = <&s4muap 2 0
+          &s4muap 3 0>;

Fix indentation and number of items. These should be separate phandles, not one phandle.

Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml line 139

Quoted 6 lines
Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml new file +6 -0
+
+      fsl,ele_mu_id = <1>;
+      fsl,ele_max_users = <4>;
+      fsl,cmd_tag = /bits/ 8 <0x17>;
+      fsl,rsp_tag = /bits/ 8 <0xe1>;
+    };

Best regards,
Krzysztof

maintainer
#3 lore raw

Re: [PATCH v2 1/7] doc: device tree binding addition for ele MU

In reply to Pankaj Gupta
Quoted 9 lines · Pankaj Gupta

Documentation update with addition of new device tree for NXP ele-mu (Edgelock Enclave Message Unit), driver.

---
 .../bindings/arm/freescale/fsl,ele_mu.yaml    | 139 ++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.example.dtb: ele_mu: mboxes: [[4294967295, 2, 0], [4294967295, 3, 0]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#4 lore raw

PATCH v2 2/7 arm64: dts: imx93-11x11-evk: added ele-mu

In reply to Pankaj Gupta

adde support for ele-mu for imx93-11x11-evk.

---
 arch/arm64/boot/dts/freescale/imx93.dtsi | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx93.dtsi +10 -1
index 41efd97dd6d6..ffb7cb8ed228 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright 2022 NXP
+ * Copyright 2022-2022 NXP
  */
 
 #include <dt-bindings/clock/imx93-clock.h>
@@ -741,5 +741,14 @@ media_blk_ctrl: system-controller@4ac10000 {
 			#power-domain-cells = <1>;
 			status = "disabled";
 		};
+		ele_mu: ele-mu {
+			compatible = "fsl,imx93-ele";
+			mboxes = <&s4muap 0 0 &s4muap 1 0>;
+			mbox-names = "tx", "rx";
+			fsl,ele_mu_did = <3>;
+			fsl,ele_mu_id = <2>;
+			fsl,ele_mu_max_users = <4>;
+			status = "okay";
+		};
 	};
 };
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v2 2/7] arm64: dts: imx93-11x11-evk: added ele-mu

Quoted 1 line · Pankaj Gupta

adde support for ele-mu for imx93-11x11-evk.

Typo, missing capital letter.

Quoted 11 lines
---
 arch/arm64/boot/dts/freescale/imx93.dtsi | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx93.dtsi +0 -0
index 41efd97dd6d6..ffb7cb8ed228 100644

arch/arm64/boot/dts/freescale/imx93.dtsi line 3

Quoted 4 lines
arch/arm64/boot/dts/freescale/imx93.dtsi +1 -1
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright 2022 NXP
+ * Copyright 2022-2022 NXP

?

arch/arm64/boot/dts/freescale/imx93.dtsi media_blk_ctrl: system-controller@4ac10000 { · line 743

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx93.dtsi +0 -0
  */
 
 #include <dt-bindings/clock/imx93-clock.h>
@@ -741,5 +741,14 @@ media_blk_ctrl: system-controller@4ac10000 {
 			#power-domain-cells = <1>;
 			status = "disabled";
 		};

Missing blank line.

arch/arm64/boot/dts/freescale/imx93.dtsi media_blk_ctrl: system-controller@4ac10000 { · line 744

Quoted 1 line
arch/arm64/boot/dts/freescale/imx93.dtsi +1 -0
+		ele_mu: ele-mu {

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

arch/arm64/boot/dts/freescale/imx93.dtsi media_blk_ctrl: system-controller@4ac10000 { · line 746

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx93.dtsi +2 -0
+			compatible = "fsl,imx93-ele";
+			mboxes = <&s4muap 0 0 &s4muap 1 0>;

Two phandles, not one.

arch/arm64/boot/dts/freescale/imx93.dtsi media_blk_ctrl: system-controller@4ac10000 { · line 751

Quoted 5 lines
arch/arm64/boot/dts/freescale/imx93.dtsi +5 -0
+			mbox-names = "tx", "rx";
+			fsl,ele_mu_did = <3>;
+			fsl,ele_mu_id = <2>;
+			fsl,ele_mu_max_users = <4>;
+			status = "okay";

Why do you need it?

Run your patches through internal review to fix such obvious mistakes. There is entire NXP to help you, instead of relying on us to fix trivial code style.

arch/arm64/boot/dts/freescale/imx93.dtsi media_blk_ctrl: system-controller@4ac10000 { · line 754

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx93.dtsi +1 -0
+		};
 	};
 };

Best regards,
Krzysztof

#6 lore raw

PATCH v2 3/7 arm64: dts: imx93-11x11-evk: reserved mem-ranges to constrain ele-mu dma-range

In reply to Pankaj Gupta

EdgeLock Enclave are has a hardware limitation of restricted access to the DDR memory range:
- 0x80000000 0x9FFFFFFF

ELE-MU driver requireis 1MB of memory. In this patch the we are reserving 1MB of ddr memory region from the lower 32-bit range.

---
 arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts +15 -0
index fefb93487291..bb090300829e 100644
@@ -7,6 +7,10 @@
 
 #include "imx93.dtsi"
 
+&ele_mu {
+	memory-region = <&ele_reserved>;
+};
+
 / {
 	model = "NXP i.MX93 11X11 EVK board";
 	compatible = "fsl,imx93-11x11-evk", "fsl,imx93";
@@ -22,6 +26,17 @@ reg_vref_1v8: regulator-adc-vref {
 		regulator-max-microvolt = <1800000>;
 	};
 
+	reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+		ele_reserved: ele-reserved@a4120000 {
+			compatible = "shared-dma-pool";
+			reg = <0 0xa4120000 0 0x100000>;
+			no-map;
+		};
+	};
+
 	reg_usdhc2_vmmc: regulator-usdhc2 {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
Signature · 1 line
2.34.1
#7 lore raw

PATCH v2 4/7 arm64: dts: imx8ulp-evk: added ele-mu

In reply to Pankaj Gupta

added support for ele-mu for imx8ulp-evk.

---
 arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8ulp.dtsi +12 -1
index 32193a43ff49..2ab240258a67 100644
@@ -113,7 +113,7 @@ sosc: clock-sosc {
 		#clock-cells = <0>;
 	};
 
-	sram@2201f000 {
+	sram0: sram@2201f000 {
 		compatible = "mmio-sram";
 		reg = <0x0 0x2201f000 0x0 0x1000>;
 
@@ -160,6 +160,17 @@ s4muap: mailbox@27020000 {
 			#mbox-cells = <2>;
 		};
 
+		ele_mu: ele-mu {
+			compatible = "fsl,imx-ele";
+			mboxes = <&s4muap 0 0 &s4muap 1 0>;
+			mbox-names = "tx", "rx";
+			fsl,ele_mu_did = <7>;
+			fsl,ele_mu_id = <2>;
+			fsl,ele_mu_max_users = <4>;
+			status = "okay";
+			sram-pool = <&sram0>;
+		};
+
 		per_bridge3: bus@29000000 {
 			compatible = "simple-bus";
 			reg = <0x29000000 0x800000>;
Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 5/7 arm64: dts: imx8ulp-evk: reserved mem-ranges to constrain ele-mu dma-range

In reply to Pankaj Gupta

EdgeLock Enclave are has a hardware limitation of restricted access to the DDR memory range:
- 0x90000000 - 0xAFFFFFFF

ELE-MU driver requireis 1MB of memory. In this patch the we are reserving 1MB of ddr memory region from the lower 32-bit range.

---
 arch/arm64/boot/dts/freescale/imx8ulp-evk.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/freescale/imx8ulp-evk.dts +15 -0
index f1c6d933a17c..d2a39e9aa951 100644
@@ -19,6 +19,17 @@ memory@80000000 {
 		device_type = "memory";
 		reg = <0x0 0x80000000 0 0x80000000>;
 	};
+	reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		ele_reserved: ele-reserved@90000000 {
+			compatible = "shared-dma-pool";
+			reg = <0 0x90000000 0 0x100000>;
+			no-map;
+		};
+	};
 
 	clock_ext_rmii: clock-ext-rmii {
 		compatible = "fixed-clock";
@@ -53,6 +64,10 @@ &usdhc0 {
 	status = "okay";
 };
 
+&ele_mu {
+	memory-region = <&ele_reserved>;
+};
+
 &fec {
 	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&pinctrl_enet>;
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 6/7 firmware: imx: add ELE MU driver support

In reply to Pankaj Gupta

The Edgelock Enclave Message Unit (ELE MU), is a message based communication channel, to communicated with ELE Firmware.

This runs on a dedicated MU present between application core and ELE H/W IP. It exists on some i.MX processors. e.g. i.MX8ULP, i.MX93

This patch implements the mail-box based communication with ELE firmware.

---
 drivers/firmware/imx/Kconfig              |   11 +
 drivers/firmware/imx/Makefile             |    2 +
 drivers/firmware/imx/ele_base_msg.c       |  378 ++++++
 drivers/firmware/imx/ele_mu.c             | 1285 +++++++++++++++++++++
 drivers/firmware/imx/ele_mu.h             |  174 +++
 include/linux/firmware/imx/ele_base_msg.h |   67 ++
 include/linux/firmware/imx/ele_mu_ioctl.h |   52 +
 7 files changed, 1969 insertions(+)
 create mode 100644 drivers/firmware/imx/ele_base_msg.c
 create mode 100644 drivers/firmware/imx/ele_mu.c
 create mode 100644 drivers/firmware/imx/ele_mu.h
 create mode 100644 include/linux/firmware/imx/ele_base_msg.h
 create mode 100644 include/linux/firmware/imx/ele_mu_ioctl.h
drivers/firmware/imx/Kconfig +11 -0
index c027d99f2a59..eef6c6a8b61d 100644
@@ -28,3 +28,14 @@ config IMX_SCU_PD
 	depends on IMX_SCU
 	help
 	  The System Controller Firmware (SCFW) based power domain driver.
+
+config IMX_EL_ENCLAVE
+	tristate "i.MX Embedded EdgeLock Enclave support."
+	depends on IMX_MBOX && ARCH_MXC && ARM64
+	default m if ARCH_MXC
+
+	help
+	  It is possible to use APIs exposed by the iMX EdgeLock Enclave like base, HSM &
+	  SHE using the SAB protocol via the shared Messaging Unit. This driver exposes
+	  these interfaces via a set of file descriptors allowing to configure shared
+	  memory, send and receive messages.
drivers/firmware/imx/Makefile +2 -0
index b76acbade2a0..886385e79bf2 100644
@@ -2,3 +2,5 @@
 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_PD)	+= scu-pd.o
+el_enclave-objs			= ele_mu.o ele_base_msg.o
+obj-${CONFIG_IMX_EL_ENCLAVE}	+= el_enclave.o
drivers/firmware/imx/ele_base_msg.c new file +378 -0

378 lines not on this page · raw message

drivers/firmware/imx/ele_mu.c new file +1285 -0

1,285 lines not on this page · raw message

drivers/firmware/imx/ele_mu.h new file +174 -0

174 lines not on this page · raw message

include/linux/firmware/imx/ele_base_msg.h new file +67 -0

67 lines not on this page · raw message

include/linux/firmware/imx/ele_mu_ioctl.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.34.1
#10 lore raw

PATCH v2 7/7 MAINTAINERS: Added maintainer details

In reply to Pankaj Gupta

MAINTAINERS: Added maintainer details for ele-mu driver.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 0e64787aace8..59201de85009 100644
@@ -8103,6 +8103,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/crypto/fsl-sec4.txt
 F:	drivers/crypto/caam/
 
+NXP Edgelock Enclave MU DRIVER
+M:	Pankaj Gupta <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml
+F:	drivers/firmware/imx/
+
 FREESCALE COLDFIRE M5441X MMC DRIVER
 M:	Angelo Dureghello <[email protected]>
 L:	[email protected]
Signature · 7 lines
2.34.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#11 lore raw

Re: [PATCH v2 7/7] MAINTAINERS: Added maintainer details

Quoted 12 lines · Pankaj Gupta

MAINTAINERS: Added maintainer details for ele-mu driver.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +0 -0
index 0e64787aace8..59201de85009 100644

MAINTAINERS S: Maintained · line 8106

Quoted 4 lines
MAINTAINERS +1 -0
@@ -8103,6 +8103,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/crypto/fsl-sec4.txt
 F:	drivers/crypto/caam/
 
+NXP Edgelock Enclave MU DRIVER

Fix the order. Open the file, read the beginning about ordering.

Best regards,
Krzysztof

#12 lore raw
In reply to Pankaj Gupta
Quoted 4 lines · Pankaj Gupta

v2 Changes:

- Fixed Kernel Test Bot issues.
- Removed ".../devicetree/bindings/mailbox/fsl,muap.txt"

Drop some weird *** from subject. There is no reason to make it extra, extra bold font.

Best regards,
Krzysztof

#13 lore raw
In reply to Pankaj Gupta
Quoted 12 lines · Pankaj Gupta

v2 Changes:

- Fixed Kernel Test Bot issues.
- Removed ".../devicetree/bindings/mailbox/fsl,muap.txt"

v1:

The Messaging Unit module enables two processing elements within the SoC to communicate and coordinate by passing messages (e.g., data, status and control) through its interfaces.

Quoted 8 lines

The NXP i.MX EdgeLock Enclave Message Unit (ELE-MUAP) is specifically targeted for use between application core and Edgelocke Enclave. It allows to send messages to the EL Enclave using a shared mailbox.

Patch-set add the ELE-MU kernel driver for exchanging messages with i.MX NXP ELE IP; both from:
- User-Space Applications via character driver.
- Kernel-space, used by kernel management layers like DM-Crypt.

What's wrong with existing NXP MU driver?

#14 lore raw

Hi Daniel,

As discussed already on your query, answering to this, for everybody:

There is no existing NXP MU driver, that is up-streamed.
ele-mu driver is using(dependent on) the underline IMX_MBOX, driver you might be referring to.

Thanks.

Regards
Pankaj

Quoted 41 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Monday, April 24, 2023 7:38 PM
To: Pankaj Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <linux- [email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Gaurav Jain <[email protected]>; Sahil Malhotra <[email protected]>; Aisheng Dong <[email protected]>; Varun Sethi <[email protected]>
Subject: [EXT] Re: [PATCH v2 0/7] *** firmware: imx: NXP Edgelock Enclave MUAP Driver ***

Caution: EXT Email

Quoted 12 lines · Pankaj Gupta

v2 Changes:

- Fixed Kernel Test Bot issues.
- Removed ".../devicetree/bindings/mailbox/fsl,muap.txt"

v1:

The Messaging Unit module enables two processing elements within the SoC to communicate and coordinate by passing messages (e.g., data, status and control) through its interfaces.

Quoted 8 lines

The NXP i.MX EdgeLock Enclave Message Unit (ELE-MUAP) is specifically targeted for use between application core and Edgelocke Enclave. It allows to send messages to the EL Enclave using a shared mailbox.

Patch-set add the ELE-MU kernel driver for exchanging messages with i.MX NXP ELE IP; both from:
- User-Space Applications via character driver.
- Kernel-space, used by kernel management layers like DM-Crypt.

What's wrong with existing NXP MU driver?