Thread (24 messages) 24 messages, 5 authors, 2024-07-19

RE: [EXT] Re: [PATCH v3 5/5] firmware: imx: adds miscdev

From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: 2024-06-19 09:02:29
Also in: imx, linux-arm-kernel, linux-devicetree, lkml

-----Original Message-----
From: Randy Dunlap <redacted>
Sent: Wednesday, June 19, 2024 3:09 AM
To: Pankaj Gupta <pankaj.gupta@nxp.com>; Jonathan Corbet
[off-list ref]; Rob Herring [off-list ref]; Krzysztof Kozlowski
[off-list ref]; Conor Dooley [off-list ref]; Shawn Guo
[off-list ref]; Sascha Hauer [off-list ref];
Pengutronix Kernel Team [off-list ref]; Fabio Estevam
[off-list ref]; Rob Herring [off-list ref]; Krzysztof
Kozlowski [off-list ref]
Cc: linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
devicetree@vger.kernel.org; imx@lists.linux.dev; linux-arm-
kernel@lists.infradead.org
Subject: [EXT] Re: [PATCH v3 5/5] firmware: imx: adds miscdev

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


Sorry, I missed one comment here:


On 6/18/24 2:28 PM, Randy Dunlap wrote:
quoted
Hi--

On 6/17/24 12:29 AM, Pankaj Gupta wrote:
quoted
Adds the driver for communication interface to secure-enclave, for
exchanging messages with NXP secure enclave HW IP(s) like EdgeLock
Enclave from:
- User-Space Applications via character driver.

ABI documentation for the NXP secure-enclave driver.

User-space library using this driver:
- i.MX Secure Enclave library:
  -- URL:
https://git/
hub.com%2Fnxp-imx%2Fimx-secure-
enclave.git&data=05%7C02%7Cpankaj.gupt
quoted
quoted
a%40nxp.com%7C5a42a8d6ea17423104e408dc8fdf1a0a%7C686ea1d3bc2b4c6f
a92c
quoted
quoted
d99c5c301635%7C0%7C0%7C638543435571166030%7CUnknown%7CTWFpbG
Zsb3d8eyJ
quoted
quoted
WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C
0%7
quoted
quoted
C%7C%7C&sdata=vLyxSGFLArjDy5s2ebW%2Fw6EZI22QHWoKqHvrov15JI0%3D&
reserv
quoted
quoted
ed=0,
- i.MX Secure Middle-Ware:
  -- URL:
https://git/
hub.com%2Fnxp-imx%2Fimx-
smw.git&data=05%7C02%7Cpankaj.gupta%40nxp.com
quoted
quoted
%7C5a42a8d6ea17423104e408dc8fdf1a0a%7C686ea1d3bc2b4c6fa92cd99c5
c30163
quoted
quoted
5%7C0%7C0%7C638543435571176586%7CUnknown%7CTWFpbGZsb3d8eyJWIj
oiMC4wLj
quoted
quoted
AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7
C&sda
quoted
quoted
ta=QFrkeMwm1yT1s2gyjmFHkVGhV%2BegAFKx84b5mmFsTOY%3D&reserved=0
quoted
quoted
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
---
 Documentation/ABI/testing/se-cdev |  42 +++
drivers/firmware/imx/ele_common.c | 153 ++++++++-
 drivers/firmware/imx/ele_common.h |   4 +
 drivers/firmware/imx/se_ctrl.c    | 694
++++++++++++++++++++++++++++++++++++++
quoted
quoted
 drivers/firmware/imx/se_ctrl.h    |  49 +++
 include/uapi/linux/se_ioctl.h     |  94 ++++++
 6 files changed, 1034 insertions(+), 2 deletions(-)
diff --git a/Documentation/ABI/testing/se-cdev
b/Documentation/ABI/testing/se-cdev
new file mode 100644
index 000000000000..699525af6b86
--- /dev/null
+++ b/Documentation/ABI/testing/se-cdev
@@ -0,0 +1,42 @@
+What:               /dev/<se>_mu[0-9]+_ch[0-9]+
+Date:               May 2024
+KernelVersion:      6.8
+Contact:    linux-imx@nxp.com, pankaj.gupta@nxp.com
+Description:
+            NXP offers multiple hardware IP(s) for  secure-enclaves
+like EdgeLock-
                                                 for secure enclaves
quoted
+            Enclave(ELE), SECO. The character device
+ file-descriptors
                                                       file
descriptors

and what is SECO?
quoted
+            /dev/<se>_mu*_ch* are the interface between user-space
+ NXP's secure-
                                                          userspace        secure
quoted
+            enclave shared-library and the kernel driver.
                      shared library
quoted
+
+            The ioctl(2)-based ABI is defined and documented in
+            [include]<linux/firmware/imx/ele_mu_ioctl.h>
+             ioctl(s) are used primarily for:
+                    - shared memory management
+                    - allocation of I/O buffers
+                    - get mu info
                      - getting mu info
quoted
+                    - setting a dev-ctx as receiver that is slave to
+ fw
Documentation/process/coding-style.rst says not to introduce new uses of the
word "slave":

For symbol names and documentation, avoid introducing new usage of 'master
/ slave' (or 'slave' independent of 'master') and 'blacklist / whitelist'.
Accepted.

-                       - setting a dev-ctx as receiver that is slave to fw
+                       - setting a dev-ctx as receiver to receive all the commands from FW
Recommended replacements for 'master / slave' are:
    '{primary,main} / {secondary,replica,subordinate}'
    '{initiator,requester} / {target,responder}'
    '{controller,host} / {device,worker,proxy}'
    'leader / follower'
    'director / performer'

quoted
quoted
+                    - get SoC info
                      - getting SoC info
quoted
+
+            The following file operations are supported:
+
+            open(2)
+              Currently the only useful flags are O_RDWR.
+
+            read(2)
+              Every read() from the opened character device context is waiting on
+              wakeup_intruptible, that gets set by the registered
+ mailbox callback
                typo in that name?
              or is it something that this patch series introduces?
quoted
+              function; indicating a message received from the
+ firmware on message-
                function,
quoted
+              unit.
+
+            write(2)
+              Every write() to the opened character device context needs to
acquire
quoted
quoted
+              mailbox_lock, before sending message on to the message unit.
                mailbox_lock before
quoted
+
+            close(2)
+              Stops and free up the I/O contexts that was associated
                          frees up                 that were associated
quoted
+              with the file descriptor.
+
+Users:
https://github.c/
om%2Fnxp-imx%2Fimx-secure-
enclave.git&data=05%7C02%7Cpankaj.gupta%40nxp.com%7C5a42a8d6ea17423
104e408dc8fdf1a0a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63
8543435571183041%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAi
LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=
VNnIyu2RKFHaWh6aRo9aHEtjSSdI1gvzP%2BMy1%2BGggt4%3D&reserved=0,
quoted
quoted
+
https://github.c/
om%2Fnxp-imx%2Fimx-
smw.git&data=05%7C02%7Cpankaj.gupta%40nxp.com%7C5a42a8d6ea1742310
4e408dc8fdf1a0a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6385
43435571187283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=23
Y%2FOKyv2%2BSGuPbGyekpBlCDHYlwiAA8sriLXydEgFw%3D&reserved=0
quoted
quoted
+            crypto/skcipher,
+            drivers/nvmem/imx-ocotp-ele.c
--
~Randy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help