[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<AM9PR04MB86047886B5191D94C3E68C4C95C22@AM9PR04MB8604.eurprd04.prod.outlook.com>
Date: Fri, 14 Jun 2024 09:05:49 +0000
From: Pankaj Gupta <pankaj.gupta@....com>
To: Sascha Hauer <s.hauer@...gutronix.de>
CC: Jonathan Corbet <corbet@....net>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>, Conor Dooley
<conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>, Pengutronix Kernel
Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>
Subject: RE: [EXT] Re: [PATCH v2 4/5] firmware: imx: add driver for NXP
EdgeLock Enclave
> -----Original Message-----
> From: Sascha Hauer <s.hauer@...gutronix.de>
> Sent: Friday, May 24, 2024 5:56 PM
> To: Pankaj Gupta <pankaj.gupta@....com>
> Cc: Jonathan Corbet <corbet@....net>; Rob Herring <robh+dt@...nel.org>;
> Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>; Conor Dooley
> <conor+dt@...nel.org>; Shawn Guo <shawnguo@...nel.org>; Pengutronix
> Kernel Team <kernel@...gutronix.de>; Fabio Estevam
> <festevam@...il.com>; Rob Herring <robh@...nel.org>; Krzysztof
> Kozlowski <krzk+dt@...nel.org>; linux-doc@...r.kernel.org; linux-
> kernel@...r.kernel.org; devicetree@...r.kernel.org; imx@...ts.linux.dev;
> linux-arm-kernel@...ts.infradead.org
> Subject: Re: [EXT] Re: [PATCH v2 4/5] firmware: imx: add driver for NXP
> EdgeLock Enclave
>
> 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
>
>
> On Fri, May 24, 2024 at 12:08:14PM +0000, Pankaj Gupta wrote:
> >
> >
> > > -----Original Message-----
> > > From: Sascha Hauer <s.hauer@...gutronix.de>
> > > Sent: Friday, May 24, 2024 4:04 PM
> > > To: Pankaj Gupta <pankaj.gupta@....com>
> > > Cc: Jonathan Corbet <corbet@....net>; Rob Herring
> > > <robh+dt@...nel.org>; Krzysztof Kozlowski
> > > <krzysztof.kozlowski+dt@...aro.org>; Conor Dooley
> > > <conor+dt@...nel.org>; Shawn Guo <shawnguo@...nel.org>;
> Pengutronix
> > > Kernel Team <kernel@...gutronix.de>; Fabio Estevam
> > > <festevam@...il.com>; Rob Herring <robh@...nel.org>; Krzysztof
> > > Kozlowski <krzk+dt@...nel.org>; linux-doc@...r.kernel.org; linux-
> > > kernel@...r.kernel.org; devicetree@...r.kernel.org;
> > > imx@...ts.linux.dev; linux-arm-kernel@...ts.infradead.org
> > > Subject: [EXT] Re: [PATCH v2 4/5] firmware: imx: add driver for NXP
> > > EdgeLock Enclave
> > >
> > > 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
> > >
> > >
> > > On Thu, May 23, 2024 at 04:19:35PM +0530, Pankaj Gupta wrote:
> > > > NXP hardware IP(s) for secure-enclaves like Edgelock Enclave(ELE),
> > > > are embedded in the SoC to support the features like HSM, SHE &
> > > > V2X, using message based communication interface.
> > > >
> > > > The secure enclave FW communicates on a dedicated messaging
> > > > unit(MU) based interface(s) with application core, where kernel is
> running.
> > > > It exists on specific i.MX processors. e.g. i.MX8ULP, i.MX93.
> > > >
> > > > This patch adds the driver for communication interface to
> > > > secure-enclave, for exchanging messages with NXP secure enclave HW
> > > > IP(s) like EdgeLock Enclave (ELE) from Kernel-space, used by
> > > > kernel management layers like
> > > > - DM-Crypt.
> > > >
> > > > Signed-off-by: Pankaj Gupta <pankaj.gupta@....com>
> > > > ---
> > > > drivers/firmware/imx/Kconfig | 12 +
> > > > drivers/firmware/imx/Makefile | 2 +
> > > > drivers/firmware/imx/ele_base_msg.c | 286 +++++++++++++++++++
> > > > drivers/firmware/imx/ele_base_msg.h | 92 +++++++
> > > > drivers/firmware/imx/ele_common.c | 239 ++++++++++++++++
> > > > drivers/firmware/imx/ele_common.h | 43 +++
> > > > drivers/firmware/imx/se_ctrl.c | 531
> > > ++++++++++++++++++++++++++++++++++++
> > > > drivers/firmware/imx/se_ctrl.h | 99 +++++++
> > > > include/linux/firmware/imx/se_api.h | 14 +
> > > > 9 files changed, 1318 insertions(+)
> > > >
> > >
> > > > +static int se_probe_if_cleanup(struct platform_device *pdev) {
> > > > + struct device *dev = &pdev->dev;
> > > > + struct se_if_priv *priv;
> > > > + int ret = 0;
> > > > +
> > > > + priv = dev_get_drvdata(dev);
> > > > + if (!priv) {
> > > > + ret = 0;
> > > > + dev_dbg(dev, "SE-MU Priv data is NULL;");
> > > > + return ret;
> > > > + }
> > > > +
> > > > + if (priv->tx_chan)
> > > > + mbox_free_channel(priv->tx_chan);
> > > > + if (priv->rx_chan)
> > > > + mbox_free_channel(priv->rx_chan);
> > > > +
> > > > + /* free the buffer in se remove, previously allocated
> > > > + * in se probe to store encrypted IMEM
> > > > + */
> > > > + if (priv->imem.buf) {
> > > > + dmam_free_coherent(dev,
> > > > + ELE_IMEM_SIZE,
> > > > + priv->imem.buf,
> > > > + priv->imem.phyaddr);
> > > > + priv->imem.buf = NULL;
> > > > + }
> > > > +
> > > > + if (priv->flags & RESERVED_DMA_POOL) {
> > > > + of_reserved_mem_device_release(dev);
> > >
> > > You can call this unconditionally, no need to keep track if you
> > > called
> > > of_reserved_mem_device_init() successfully.
> >
> > But it will not be called for each SoC.
> > The memory is not reserved for i.MX95 platforms.
> > This is required.
>
> Again: You can call this unconditionally. Look at the code,
> of_reserved_mem_device_release() won't do anything if you haven't called
> of_reserved_mem_device_init() before.
Agree. Accepted and will removed in v3.
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 |
> http://www.p/
> engutronix.de%2F&data=05%7C02%7Cpankaj.gupta%40nxp.com%7Cead7b9
> 3ccacb404124bf08dc7beca6b2%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> 0%7C0%7C638521503534570049%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi
> MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%
> 7C%7C%7C&sdata=U0BX68CpPzJg%2B9IytihYTcmivJhfn7xbfIQpMp0R8o0%3D
> &reserved=0 |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists