From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012006.outbound.protection.outlook.com [52.101.66.6])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C6DC28F50F;
	Wed,  3 Dec 2025 06:49:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.6
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744555; cv=fail; b=uyaPe5kNINILbdYmc94taw9O6JZSIYj+UghQuKqF7lKf+q0Jd8pcHSkEt7rYm37I7h3mA/ND86v2cEKKJAH/gdvW2GFOA+EqnhQe1ar8xJg2RtFEQ0GXsS7kMMPxXH4/KxeknhY35hS4IRPOqLyHw+3qg3sbDRvCpwAFZij//N0=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744555; c=relaxed/simple;
	bh=Q1VJZtoM6gswB5Vqcs1ZKYbmHNVwp6lovh3Kn7bl2Ng=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=F6NlCxkLLwIwrZ1bSGlOUWaoz/06j39MSRY0cuSoyMZPqdsIk0dC5Rkd3EWoBh58QuzajIia+YdfRffPAyxJpYmaZWZ8stlPDS8Jk13uw037yxWBXEqW7KnW1hiyeHSDDzkCoSwR1Lq9+EdteEub4juKvancwHW2ryzTIR/fgKw=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=cU01uBDz; arc=fail smtp.client-ip=52.101.66.6
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="cU01uBDz"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=GwnbTziM8xVhb3nF6pOoCYy9f8ddACdG3PaBPhggZjFTkY1R0X2Zqglky4DyPcEDJzTgrxSh7laF/pPMmDYw69V6ozSXeJBgCarFIcKGyfCEUTSe7OkV3K6pie6M6qb6onUT9J8gDKodOwo7KGmeuUoczlncFa+b8eay4BY9H47Gu8wCyK3iZCTB0MPH1DWZ2OZyDSm1fpc5bbOxyKj4IGMB9syZLp3+pUMzDrBFgASXb4KnSJ35ZV7hBeTPQvjFxpUinAueMMnst5YoIHyUBzWUK3agI9IOTnhDetbR1p6jQB4DkJxBEkvWqyAr1H4RQOfmyfz5LxzENZo+SHFiHA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=QYMZZA78I0WVPIqhfF6Nqj8t/8T3kxfjIUB7j+zgWzc=;
 b=xGiaZtuwXsaE/QfdDnZFnsu0C/mTAiMlpjbc8K7QtK0SJgG/j/9vXyJlGAchSs4PpNjBg41PYHyuDGhaRf99VrWdUlZTrta5jl7C0TKbiEQ/hC20IM42PcEY9gObPwNIT1a+6O1Ow9STxNlDuzZXbUBh/jW6J5ETf597Mn4ATverAs3bPx7zVmCteacE+rOlkFzAQHmx/MkBf/XBf9HSFC0dwax6hD1MY9GlSp65La+E5Avq+zFRYinTkPaVgoQRgiwGdSSfUH/9XmK4iXvk/w54clOzD9VxalXiA+4yUt5ObFBaJprKgg42b3QYxXJ0fBa6a/NLC8ZwOVVTSQJbvA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=QYMZZA78I0WVPIqhfF6Nqj8t/8T3kxfjIUB7j+zgWzc=;
 b=cU01uBDzNbyP3cdfkWTeEq9ecM6BjG0D6IaB/+cElAIf9FM/KcxnwO91L238+m+tO7dU1l4h1WIKl6HPctMmNQA//hP0spC8b7x/Iek8CK924xGA4HrJnJF0ENwg45qWZtTvdM0PbwEkwtZh2D9mnAyXRIts4jGwE96qHhheEAGnqyrySdZUaw+KY+M5MiP01ysiCIMpMlMhs34ephf12ZpNjsOJGcgYPDPFiurRiwvdHPKW1M3Wlz8Ev46HVd+FWv7BPnJQBkcpQkmI06fmYhL/n0R+rTNUV+J15XyFFYjoo3JZH1mrvxpfcORcOhdjWxvj6nu7pgG/WFw+BNjxpw==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:10 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:10 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:06 +0530
Subject: [PATCH v20 1/7] Documentation/firmware: add imx/se to
 other_interfaces
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-1-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=7358;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=Q1VJZtoM6gswB5Vqcs1ZKYbmHNVwp6lovh3Kn7bl2Ng=;
 b=N4qK3vXT8sK9TJEkMevNLBXFpjxgQ2fSh4cXc/xT5PsR/BPN09E0Xbjw8C+XDQ/NzpP+WwMps
 9P27OsB+AQrAN06qcnscTviIMHgdImvh/Aj3LrNWlxPpW37rbbloAIY
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: 8597b462-efa8-4b1f-4e65-08de32380fe2
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?QStHR2FQbWMydVVaMkhlNzdMQW1qUUZRMy9aOTY3eU9ISVFzV0lLNldMN0sy?=
 =?utf-8?B?MVplZ05hczYxVFYvTHpYSGxkVG84QThrZVlINjVDUWQyVnRRZnVNVXNsa1Va?=
 =?utf-8?B?bE82MTZUNG1lanhPNzVoRUpkaFlzeTZaRmlBVFA5UDU2T29iUmxKMS9wVWM0?=
 =?utf-8?B?Rng4aUhLdnRqaGRzSHlod2htd3VZZiswdSthVEVDak8yYkJ1SWxOUHdqTlJC?=
 =?utf-8?B?N2RBd0g3YXg4ekUrRFVaamJvcVp0bUtZVDFnT0F4dTg5YkVGck8yM0NodUcw?=
 =?utf-8?B?TE1nWTF3aGVtNmxHYnpHMVNGc1NSUEpYdlIrYWdSYjZGZ0N0emw3TDZ5Tjdr?=
 =?utf-8?B?enJ4NzM2ZmtrRGhnaEFob2F4Zm9hRnJBOUpoMytXd016TmlITmxLbVBhZlhu?=
 =?utf-8?B?dnZJSkJVNzRGYUwrQmxISkF1S0FNM2pDb2pIelU3SnYveFNhL1RnT1Z1aGJa?=
 =?utf-8?B?R3FmNk5UalR2TXc0VlNPaGNlOGFLb3orbW1pUWNjK2oxTGVRZjBIMHBaY3hZ?=
 =?utf-8?B?VjYrT2Vtc05NODFVMkhsUWlid3diMHI0VjFGRVc5ZzVlWUdhWnY5QkEyanhL?=
 =?utf-8?B?YVJuanRRZUU4N2MyVjZQUVF0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TFSdnIy?=
 =?utf-8?B?Q1pjT1g3UDJaNURoa3BiaG9MYjBDL2RkSWFxNHl6TDJnZGdIZ2R5UHVuWWxV?=
 =?utf-8?B?Qld3eXBTRzg0RUZ5THQyZHFuSVhtajc1RXd5WkhsT1p0bTc5SUROZnA3Smxk?=
 =?utf-8?B?VUxBUFJnUmg0SkNOOEc2L21IRlFDWm11OTdOeS90bmFtRUtrNUI4RWh5R3cz?=
 =?utf-8?B?ZWlIOTdjeGx2ZXMzTzlQc1J1OGhJTm9oV2labGE5eEM4ZmgzUzNMZGdudGZ5?=
 =?utf-8?B?eFk2RE1SdzBjY051QmFLbktNY3JOTU1UR05VVFpYbnYvWHo1dE9PRE1LNTli?=
 =?utf-8?B?b0hQdURsTVlkd0ViNU1wcGdIZThUbGliMFhWYkJ1WSsyaTh0V0hoRVFKUFU5?=
 =?utf-8?B?MU1LU1MyZWJSNDFXeHhJZUZLMEVUT1RvTkpXOU0vNGV2ZGYzVUxSTjVWUXcv?=
 =?utf-8?B?eGpXdTR2UjRPNTZGZytxK0E2bW4zTlFGeldQNk8vWEVTeGpXUGJrSHJTSlkv?=
 =?utf-8?B?M2U1ZUoyRXo1dHo3a1N2ZkV4NThqN2ZaTlZDYzJzT3hSUWtvZ0s4azEvZzRy?=
 =?utf-8?Q?FsLwXE?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?UVlGL1dOSC90REpHTlBJMmE5NjF6bU52RC9EdUhTa1RUb1pFZTBvZDYwOTRh?=
 =?utf-8?B?SFJDbE0rWUZyOUtBYTVkM3M4dWJnVkdVRjlQNU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kZXR21MQkYvNktqem8xTDU3cVgrQjdZbExZVCtM?=
 =?utf-8?B?R2FHL3IrU1F2cHU5aDluUUREWVZ1WUpadEIwdzFWcm9mRmQ4RWxrRENFNWdu?=
 =?utf-8?B?Tkx6dm52YmVUNm5YQ2dGS0dhVC90VGJQWmFsS0k3eGU0Q0ZHVWFRVnJrcXRN?=
 =?utf-8?B?U2hLTjVkMDdzNkRzZFJFdmpjUkV2SUoyK1prMitNdXlBZmhUN1J3TDQ4VUg2?=
 =?utf-8?B?M240NlZqUmo3dTJlN1dDbEJaYjlDSUxJa015eHZWeVVkYXBqWEZrOUtabzJT?=
 =?utf-8?Q?b149YUMWFw8malBHKCBSzozJW?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 8597b462-efa8-4b1f-4e65-08de32380fe2
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:10.0054
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: F764bsZJpxDs5T5eFnUiAdUEYvZAhM32/fS7wJHseNvcr+l7yScLkRJBI8oFaehqLEOp/os8P9pma5eLhlffnQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

Documents i.MX SoC's Service layer and C_DEV driver for selected SoC(s)
that contains the NXP hardware IP(s) for Secure Enclaves(se) like:
- NXP EdgeLock Enclave on i.MX93 & i.MX8ULP

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
---
 .../driver-api/firmware/other_interfaces.rst       | 131 +++++++++++++++++++++
 1 file changed, 131 insertions(+)

diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst
index 06ac89adaafb..2a7d7100fdd4 100644
--- a/Documentation/driver-api/firmware/other_interfaces.rst
+++ b/Documentation/driver-api/firmware/other_interfaces.rst
@@ -49,3 +49,134 @@ of the requests on to a secure monitor (EL3).
 
 .. kernel-doc:: drivers/firmware/stratix10-svc.c
    :export:
+
+NXP Secure Enclave Firmware Interface
+=====================================
+
+Introduction
+------------
+The NXP's i.MX HW IP like EdgeLock Enclave, V2X etc., creates an embedded secure
+enclave within the SoC boundary to enable features like
+ - Hardware Security Module (HSM)
+ - Security Hardware Extension (SHE)
+ - Vehicular to Anything (V2X)
+
+Each of the above feature is enabled through dedicated NXP H/W IP on the SoC.
+On a single SoC, multiple hardware IP (or can say more than one secure enclave)
+can exist.
+
+NXP SoCs enabled with the such secure enclaves(SEs) IPs are:
+i.MX93, i.MX8ULP
+
+To communicate with one or more co-existing SE(s) on SoC, there is/are dedicated
+messaging units(MU) per SE. Each co-existing SE can have one or multiple exclusive
+MUs, dedicated to itself. None of the MU is shared between two SEs. Communication
+of the MU is realized using the mailbox driver. Each secure enclave can cater to
+multiple clients by virtue of these exclusive MUs. Also, they can distinguish
+transactions originating from these clients based on the MU used and core security
+state. The communication between the clients and secure enclaves is in form of
+command/response mechanism. Each client could expose specific set of secure enclave
+features to the higher layers, based on the commands supported by that client. For
+example, the secure enclave could simultaneously support an OPTEE TA and Linux
+middleware as clients. Each of these clients can expose specific set of secure
+enclave features based on the command set supported by them.
+
+NXP Secure Enclave(SE) Interface
+--------------------------------
+Although MU(s) is/are not shared between SE(s). But for SoC like i.MX95 which has
+multiple SE(s) like HSM, V2X-HSM, V2X-SHE; all the SE(s) and their interfaces 'se-if'
+that is/are dedicated to a particular SE will be enumerated and provisioned using the
+single compatible node("fsl,imx95-se").
+
+Each 'se-if' comprise of twp layers:
+- (C_DEV Layer) User-Space software-access interface.
+- (Service Layer) OS-level software-access interface.
+
+::
+   +--------------------------------------------+
+   |            Character Device(C_DEV)         |
+   |                                            |
+   |   +---------+ +---------+     +---------+  |
+   |   | misc #1 | | misc #2 | ... | misc #n |  |
+   |   |  dev    | |  dev    |     | dev     |  |
+   |   +---------+ +---------+     +---------+  |
+   |        +-------------------------+         |
+   |        | Misc. Dev Synchr. Logic |         |
+   |        +-------------------------+         |
+   |                                            |
+   +--------------------------------------------+
+
+   +--------------------------------------------+
+   |               Service Layer                |
+   |                                            |
+   |      +-----------------------------+       |
+   |      | Message Serialization Logic |       |
+   |      +-----------------------------+       |
+   |          +---------------+                 |
+   |          |  imx-mailbox  |                 |
+   |          |   mailbox.c   |                 |
+   |          +---------------+                 |
+   |                                            |
+   +--------------------------------------------+
+
+- service layer:
+  This layer is responsible for ensuring the communication protocol that is defined
+  for communication with firmware.
+
+  FW Communication protocol ensures two things:
+  - Serializing the messages to be sent over an MU.
+
+  - FW can handle one command message at a time.
+
+- c_dev:
+  This layer offers character device contexts, created as '/dev/<se>_mux_chx'.
+  Using these multiple device contexts that are getting multiplexed over a single MU,
+  userspace application(s) can call fops like write/read to send the command message,
+  and read back the command response message to/from Firmware.
+  fops like read & write use the above defined service layer API(s) to communicate with
+  Firmware.
+
+  Misc-device(/dev/<se>_mux_chn) synchronization protocol:
+::
+
+                                Non-Secure               +   Secure
+                                                         |
+                                                         |
+                  +---------+      +-------------+       |
+                  | se_fw.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 firmware, it registers its device_ctx
+as waiter of a response from firmware.
+
+Enclave's Firmware owns the storage management, over Linux filesystem.
+For this c_dev provisions a dedicated slave device called "receiver".
+
+.. kernel-doc:: drivers/firmware/imx/se_fw.c
+   :export:

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012006.outbound.protection.outlook.com [52.101.66.6])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E758A299952;
	Wed,  3 Dec 2025 06:49:15 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.6
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744557; cv=fail; b=lOjTV3SeTdS/f/XW/On/U5wTtwU9W6jRyn2YSzCZBVx0HNTnACIk03PZav99s6S8bFJILi3UgOPTM7bJoh26MGqm372S7d2YYJorT2qOyyGhBycg8/CxZELnI0g/GoFLaDI7pH3hNC553TXwiLYZeRB0xRJ7pGkXkmGF4tsxLHA=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744557; c=relaxed/simple;
	bh=tOtSXomq2KH+8clEacb9RWYs1iYcwyaRAGNdBtHVSY4=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=W3W4vwnL1sRiySB9V7vRCqenp9bM/jTp9elD+MLVWnuM+D2+Fw1JTV1Ll/u+KP2GRnP3UpAgQ5MMQkcODJpIBOJa+sAP/4K9hTwVn9QEMylKj8nHocEv0FkRQ0V5skRBhe9F+41ZFAtdqLlTYgb2bj+67oQrSG6EOJ6LYGfeCnE=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=AGa0RwLq; arc=fail smtp.client-ip=52.101.66.6
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="AGa0RwLq"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=JUCPXEFD4XzgxPD/pMt4kzqMEBL+nqYpbiuyXadD0/4AU/aPbsnlChk5QHwMbVSZw9cZsmhcJBYyTJh/9ekXfK8G2oYszko2C/a9eyKS6951RMmL+i8Pj34OW1yrHpiLIJ7XhRstXoOBg45SqA5ocOOD7eRtDCdA2VWi+mbqS5CM0LHLa5zg6AzwIuKDx/xqipzCmrRlkto6+AG/EJcYUHLXC5JigmNIEOeSaD/NSylZpYJK2Ej41LrFl+NZrqrK5iAyqlfwKNyK3ui7a4pJmKE2nv3vRKh1Ld/sb0WIrQ2lCOW9RYnNvQLIGGHPPmSZwfDKQYMcBfOCyiBsT6toDg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=Q9LQ6U97DJmOvAnP/Hm3/sLsl0YOZft52i2nAtpwopw=;
 b=hWZtMIT8VNy9ITwYN5NqOhpz3kZx3jo1Q3QIB+hDWHsmzKBE23fzojpSRuzm7usXfoXDIpBclUJJmOUw451mirfqcPj2krQc9xEQpoO/5TWNiY+JMYIYTAKW5gKi6VqN86YzFWLcGqD2l1oL783lgrGzE6j1uL25maY1kxDMe8vMcTXL6bwJgt4Llq6l5HMFdbnGio058jkZqXJRV2pz99PmYBOajaDt0zeX4EWsFLwHlNo/OScIUqhYN+dIwKlQdTL7+4qrl6RX2SDmIHoK7lAE/Bv2UTgOAQsMv3ItNslrVBJxiu9ePBF8WVM2A6wvEQYpbUFikhl+6Jl7m2LUFg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=Q9LQ6U97DJmOvAnP/Hm3/sLsl0YOZft52i2nAtpwopw=;
 b=AGa0RwLqF+7sytybHdMAX0tEK63wnZCeDaAwlGjIeGKOtjHTabbWblfUyPaS7901kdw8uKjxojHmZ/Dzo+oYGV7cWJcjGpRKiKdLLpC3ImBzjy/pd0U4QUby8GRgWuyXGPsM3PI+9DFCHks3CplpZzMuFnlgg3iffk/MhKq6OAP5JQ0pGV7toRA7WgKIAD2PM1E54/Wjcy/m210HuYDbxS1zxBH3nW64IL0rQM3KEH+EXLQ1et3YqQS1s9o19R1ajJ4w1pZYZdpUncljPNbSXuQDCg4Iec2l0EPrMQsRUoc608GqSaDI1+cZADxbg2UzO1u352/IzN930TK3aLQ7uA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:14 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:14 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:07 +0530
Subject: [PATCH v20 2/7] dt-bindings: arm: fsl: add imx-se-fw binding doc
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-2-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=3201;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=tOtSXomq2KH+8clEacb9RWYs1iYcwyaRAGNdBtHVSY4=;
 b=5BoDvwaSV0TGq22FNmV3R9ERkiMg9zh5A83l6kRQzUnf8uST0ox/JeI5wg3hvV+lEFh+vPCAf
 OTXTaiPxI2BAmYg4jsb0tzJSq5sDxWXbO1ylGAZWlZZG3PADPRSCCXV
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: e0498705-4cc0-45d7-6da4-08de32381256
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?RHRHRHFNVjhJTE43VFpkeVVYQ3J1SkJoczhCVjQ1WFVrS2wxRVoydEhjU0hl?=
 =?utf-8?B?RUNGMXd6MFFoVFdFK3M3RHhXWHBjaFE1aEE1bWJFbjZBYTBCeitJeHFCaDhz?=
 =?utf-8?B?L083dnpzNlNsTEQ3OFB6Yi9LeDhRVDAxTjhVQktFaXZHRktrNHg2ZUs4cGMw?=
 =?utf-8?B?cjV4MnV3TjY4d2dGREpJcUk3L2VmUkpHYjNxRmsvNzYzVWhqMVRpMzV1c0dz?=
 =?utf-8?B?bEVoY2FxZGVlSFJEeHpxajRUM1hERTJ6aXZzdnJqZ2xOeTZEV0x3WnBkbElG?=
 =?utf-8?B?aFhFMUNkZS9XbVhmVkRVeVc2ZWtOUmdWeFkvKzl0SFdJVUdqZmlZNzZ0N0RI?=
 =?utf-8?B?eS9IL2hMSmtlei9iZXhITjFoY3J3QzBxKzNaZ09jaWdCRjZtaWE1YzV1TUx0?=
 =?utf-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nlDMzA3ZFMrd3JDYVVhOUlmY0JaY3BUdVFpWkMv?=
 =?utf-8?B?UEEzMktoTDlQMFVxbVpsMTU3SmpuVU5BQzlNN2V0TUlxa1VIS2ZTTUp2azBF?=
 =?utf-8?B?ampiaXk2d2lQWW1xYlFmREJ5bGdhNXN2UTFkcGcyODErL0JnOXJ5NzBqSE9E?=
 =?utf-8?B?R1QwOC8xS0pUQkNnOC9uRGt2b0g1STN0RHBPNCtCS3AyWXZkOEkyNjVSeTJK?=
 =?utf-8?B?WStCTm1taFNkaGZMOWdLSE1SU2lXc00xa2g5RjhzLzF5blJYV29EMm5ZdUI1?=
 =?utf-8?B?ZE5LZ0JSOElDaG8vKzg0ZCs5OFJEMGM1emRIK1JUeU9yZEovZmhQaitRQnhi?=
 =?utf-8?B?VlNrc0JMcEFYWkxSbHN1RmlRcGErc2Zsc2tDUm9YSzJSV0c3dE1WRGhNU0Yv?=
 =?utf-8?B?eUdIUHlEbHA5VFdiNjJlNnRHR1Z0K1FyUElaUlZ0aVlyUllkWWNtaXA5YXNs?=
 =?utf-8?B?SWRvUXpDaHEzY1dFeUhSWmNla3RJUXlQZFF4Z01QNHlGcktTVGQwaWxHVTFG?=
 =?utf-8?B?N01iTTZZZjJxTW8wWkZiUkhtMUViSERzaDFTS0tkWFpFU0pXaHpieVpQSkVW?=
 =?utf-8?B?KytaNXpXSE1SOThjY0F4UXFqVlJqYStRcTZGbzU5bUo4d0dwRHNHQjFZQngx?=
 =?utf-8?B?RTFvVEw0WlFwSzhBRm5kYkVlRytVV0xxcXpXV2QvYi8va01iOWlCYWZtcVFD?=
 =?utf-8?B?dkYzUitiaW93PT0=?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X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dQ?=
 =?utf-8?B?SlRsUkNFUDhwb2tGN3k3ZmsyMm5Dc0VMVzM4VS9zRStwVFhYZEJ3aG84MFZh?=
 =?utf-8?B?RXVUR0JBQVFTclA1YnNoMmlPUHBQQnN3ZmlUSTVOZ3ZtMFpqNzNYaVhsM1p5?=
 =?utf-8?B?YXlKSzNZSVB2STdidFJLTmIwS1hMWUFJUk5DMys1VXVZSEs4YkFWTjlHVXU1?=
 =?utf-8?B?SE1NR1VFWGRFZzlDVTV5UGJCNlJUbndHb0dxUGlHMlRwWHgyREh6c3h0T1pH?=
 =?utf-8?B?SXc2ckxKUFRTcy94bFJTS01YT3VnRFJyV0RoYzJLZ2pJNmdrU1k5YWNpTi9Y?=
 =?utf-8?B?SU9KaVgySGFxeTJscC9WakNZMkthdlFsbVFXMDFrZk9wVEw5RW9pWEtHNFE3?=
 =?utf-8?B?WndRTGYySlhMQW9tQzVRZkt6QTBIYmdsemM2TGtHakRLbE4vU2RwT2t3bS92?=
 =?utf-8?Q?tCkTUZZBub8PNGfVkurnfdVu+?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e0498705-4cc0-45d7-6da4-08de32381256
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:14.1368
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: X7FAVLVhTHFufVacpebwhNVXogqa+k65TR9Mz/PI5ayFuywwcKBzpirxstVvI0nzLE8ojnV2undXVSXyqMql8Q==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

The NXP security hardware IP(s) like: i.MX EdgeLock Enclave, V2X etc.,
creates an embedded secure enclave within the SoC boundary to enable
features like:
- HSM
- SHE
- V2X

Secure-Enclave(s) communication interface are typically via message
unit, i.e., based on mailbox linux kernel driver. This driver enables
communication ensuring well defined message sequence protocol between
Application Core and enclave's firmware.

Driver configures multiple misc-device on the MU, for multiple
user-space applications, to be able to communicate over single MU.

It exists on some i.MX processors. e.g. i.MX8ULP, i.MX93 etc.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
---
 .../devicetree/bindings/firmware/fsl,imx-se.yaml   | 91 ++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/Documentation/devicetree/bindings/firmware/fsl,imx-se.yaml b/Documentation/devicetree/bindings/firmware/fsl,imx-se.yaml
new file mode 100644
index 000000000000..fa81adbf9b80
--- /dev/null
+++ b/Documentation/devicetree/bindings/firmware/fsl,imx-se.yaml
@@ -0,0 +1,91 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/fsl,imx-se.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX HW Secure Enclave(s) EdgeLock Enclave
+
+maintainers:
+  - Pankaj Gupta <pankaj.gupta@nxp.com>
+
+description: |
+  NXP's SoC may contain one or multiple embedded secure-enclave HW
+  IP(s) like i.MX EdgeLock Enclave, V2X etc. These NXP's HW IP(s)
+  enables features like
+    - Hardware Security Module (HSM),
+    - Security Hardware Extension (SHE), and
+    - Vehicular to Anything (V2X)
+
+  Communication interface to the secure-enclaves(se) is based on the
+  messaging unit(s).
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8ulp-se-ele-hsm
+      - fsl,imx93-se-ele-hsm
+      - fsl,imx95-se-ele-hsm
+
+  mboxes:
+    items:
+      - description: mailbox phandle to send message to se firmware
+      - description: mailbox phandle to receive message from se firmware
+
+  mbox-names:
+    items:
+      - const: tx
+      - const: rx
+
+  memory-region:
+    maxItems: 1
+
+  sram:
+    maxItems: 1
+
+required:
+  - compatible
+  - mboxes
+  - mbox-names
+
+allOf:
+  # memory-region
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - fsl,imx8ulp-se-ele-hsm
+              - fsl,imx93-se-ele-hsm
+    then:
+      required:
+        - memory-region
+    else:
+      properties:
+        memory-region: false
+
+  # sram
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - fsl,imx8ulp-se-ele-hsm
+    then:
+      required:
+        - sram
+
+    else:
+      properties:
+        sram: false
+
+additionalProperties: false
+
+examples:
+  - |
+    secure-enclave {
+      compatible = "fsl,imx95-se-ele-hsm";
+      mboxes = <&ele_mu0 0 0>, <&ele_mu0 1 0>;
+      mbox-names = "tx", "rx";
+    };
+...

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012006.outbound.protection.outlook.com [52.101.66.6])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD51329827E;
	Wed,  3 Dec 2025 06:49:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.6
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744553; cv=fail; b=nNuVDJVzih66/OEqnJw36OK1764+A1H6ND3DxhD4cJBY+1q1UfxFLE6bl9F8An7ykYyjTFRxxid2B2rwzgXd7R2cBAg8X0yxKaHUgfOF+xgLyzEFJmwFJa2sSlJtNgOH1luKOnJDQETa5/kr7ubQJrRP3T+X16u8+hVb28ikIFA=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744553; c=relaxed/simple;
	bh=52pTQZPgpEmjlYhIsjEbwIGVvopHtBepG3jw77QQycI=;
	h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=BuOMX537sUKRg4BWXFN7U1jnZXt2iOVjlsuBIm1RvC/olZtyPxwg85bpFu0/UXoJsNiMXcqNVM1y04QC2ddkb8n0a9sFaVwuiO1iWE3+pp9ez6JeuGr1eu2EBHCCSStm+mgY2pylLZDToP6oz73dTPFjqhtQAP/QeLk5n9u/Q0U=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=e3uGOi/q; arc=fail smtp.client-ip=52.101.66.6
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="e3uGOi/q"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=XeqgFnPUamvivDdbqE086bnBcLWw7rDpmADnx7WkfsWlx3PvjmEO+vvt3ulbVfl6ZxXbNVloZCl2oC0F+tjgBwqhWLMx+RXZiXMitxRjUttifjVD6UboyezLKY5EF6pWb4zMDQzPmaXsL9N8u7Lt2hbAHdEbvA7tysw3ggpYUUD4Xw1tlJk+rjtLlFONOr3Gw5lm9/kJOhqUT3IYF4dH2GudGy3FrmFBBxBJiY1cvEVrcBPRS+w/ziWuM8LmdNcKP+7yvQxNOGo2sShadCLTnxzQC+31MJMGkSjaBdzB4/XoglhOZXSN8wvfgcOBQpk6t8523aJmxQ84GNR/xskxTA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=m/OdQZwzU/zCOqIJDKllnqAVbCrHZVWLy1ngYw7z3dk=;
 b=FCQHrdrACqKUdTs+h6GXNk+RgHc9ITMhUESDFAEk5zHCM1NlN12LfltSEcEa984VXjcnFmpSsf8tFP9JI754ukitqW3U7QUQTAwwPx4+uSFZZcVW6FsaionW6jG+4t6VvoEPclrw6FIkrNArOjXGU7YBh3gpw7oqINL/aPGRIuy8qZ5MwpGkk37sXRWF/tb/NbnBLFcthj82Xa8ZmJDLJATpSbMEv2TqZ96Rkv1WxVEj1U/5x1wK4vhvySwBVni/VLqduV3JwAuChzSgajidz0/NZUZhOIB8EJyMZnQJqzGvuj/RqM1Pmtrq2nmFXeeNS0Ddu/zJdWoHefhxcGFlhw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=m/OdQZwzU/zCOqIJDKllnqAVbCrHZVWLy1ngYw7z3dk=;
 b=e3uGOi/qQKEb3vUj43xuu3w0BSmqKFA6U7tZOHXIsbIo5eTsdnTHzUCGsdnnMzNjRWHlgTQ/1RpBV/gsz3kHYD8AK8ruNBE+h602k+HqRiIoZNSbNDjNdFxuImDN3DI2Y2SDuZZSelVFXSlveov8El5gGyQtN4aswmgoQCYnIThxPEz8sDh+DzQ6qtSjRkI8fjcjypHivrFzwkv3GSVYft5NvTjvfwTxruBoP+NM22eM9t1J3eG3v1mpT5Wm9iKLuHpiPiyAJcCRhaDKPvNrza+JbIXAiEI7Ojy3JC7XDLn9MXvLHqDYPRbnr1Lr5tnKSAb8JiRSZNgDTRYrCT/MGA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:06 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:05 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Subject: [PATCH v20 0/7] firmware: imx: driver for NXP secure-enclave
Date: Wed, 03 Dec 2025 12:18:05 +0530
Message-Id: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
X-B4-Tracking: v=1; b=H4sIACXdL2kC/13TwY7cIAwG4FdZ5dxUtsEY76nvUfVAgHRz2JnVp
 IqmWs27F0bVBjgG5bMN/HxOe75teZ9eXz6nWz62fbteygfBt5cpvoXL7zxvqSxMBGSBQebt/T7
 vZXWdgwVgBjUpuqn8/3HL63Z/Fvv5q3y/bfuf6+3vs/aBdfV/FYSmyoEzzCSRgxOr6NKPy/3je
 7y+T7XGQY0j0zoqrqA1odfARntnTuewnfowxQVJ5FMOHG3onT2dALfO1n6UACCjDzjMyY1Dah0
 X51wQVTDBC/XONY4654rLmVwxi6dxTjmdgm2dPM9lTRQWseRs7/yXQ8Buf744RbbGl6aSTO+0d
 a51Wtya/Boggs1h6R3CCbEftMQA5mUFB97EqLIO8owMEvWRqZmBKNlxkpBl7PkVGgYcZE1N5Fz
 asWWBOEhzSlO6tLLmRmN0ZavJJRylbSR1gcOaHCJUa70aysONIJ/SQi9rdrIxnmKOKQAO0rVSO
 1nTUx6Fzbwai5IHKY2k7jpRnmfrGZkDQxp7+lM67HvWBEX1RnEJ1o4vGfWUOpxQzVDCLFkdRER
 /ysfj8Q+U+jqDpQQAAA==
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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, Frank Li <Frank.Li@nxp.com>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=31535;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=52pTQZPgpEmjlYhIsjEbwIGVvopHtBepG3jw77QQycI=;
 b=ct89J+dbd3nV4j7vfs5ekgSaqwRVZHcDNlu4gBuGinvNiSbcMNHYSwyo58ZswG6sMXGQwhBwV
 zAXt3oysY6xCUCdR8V8xCq77mp0yFAE4KrlK6NutDkwGbMJrALTvTOG
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: db703fcf-91e3-4f5d-4336-08de32380d4c
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?QjExZE0vYVVBZDBRWWlNTHU1NDNBb1kxU2RqRHd6NXppLzdHRUJDZlBHajgr?=
 =?utf-8?B?a3BsWk5YYi9LWEVCZDNxT3RjUVlibkhWZFNLL3NqRzBoMXFueFZaWHhwd1pv?=
 =?utf-8?B?aXJFb0N2dittdVBjZDVTcmZuamExL1JJM3NuM0g2YXIvUVpXRDVHeDhWNnhl?=
 =?utf-8?B?VWx6VnBsTTJ3M0dlZzNXdzNmM3puNEE1SGlkUWxVemRoZUdkR0MxRlYwaE42?=
 =?utf-8?B?ZEgwdjhBSm8wYTV1anJteVMrMzh4Z2ZRbkRMQmxKL0J4SytpWGo0Y3k5OW05?=
 =?utf-8?B?Ulo3R1BDNlJXUXl3SUpCK0RGMk1HRCsxUEQwT3FBRVpaQnNjRHp4SmpwMjZu?=
 =?utf-8?B?NThFYW9EdSsvTHNjTVdNZXNUSFBXUUU5OVh1T21nNExRUVRTNzJ2RDVQNkt3?=
 =?utf-8?B?VjNtS1ZDcjF5QndxZVVoTGJBUGx0NDVkWFdSMld6enB0R3RjUUo0bVd0bDQ0?=
 =?utf-8?B?ZS9NQUloUXpoSE9kZVpIMlkrRjVmL0pQZEZIZi9lbXhVVTlJMFZnaUFYYTho?=
 =?utf-8?B?SmJ6M0hxMGFieEQ0V2k5WU93cVp5VVFvUlNuYy9ER3M3NG5WdUl6ZnB2YVMy?=
 =?utf-8?B?Y2o2MGtGaHFiejkvbGlmcGVqdmJFaEtoelpZb2lqcHkwYi9vdE9ZRVI0RkhF?=
 =?utf-8?B?RzFmSmlINXg3SmlyWGhFRWZQVFVG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reTN3aG41bWFK?=
 =?utf-8?B?M08xZ2tncEYrZ0lQekZRcm90U3BFY21qVVRBeDhSZE5PdERuakU0NDRuQ3M1?=
 =?utf-8?B?REhVVFQxK3YzOW91cngyOFpOZWhEb216RGFMWjVYTUJLVElYSWlXN3JYazBC?=
 =?utf-8?B?eG9ZbEgxeUJ2MUdZK3N4RTZYUGpUdjEwcWRnLzVzVTJlQml3UVIvckR4dndB?=
 =?utf-8?B?MTZIclVXL0pzUk5BWmYyb0pyakNFT3c0a0RZQTRUOUNHa29mU0FqUnZzTzVC?=
 =?utf-8?B?M0Q4SEZFOFBUL0tIR1ZYYWRaK0RLbll1VWJ4bWxzOGtjeTBBZVMxL1k5VWRt?=
 =?utf-8?B?UTdjUE5UVjM2QWJXbEE5eWt3bXZkbmFqSEhRRmRHbnZqcjFoYUZMeE9TZ1N4?=
 =?utf-8?B?M1ZxS1VrcHo1OWFNc1dYVHAreXM4TWI4VUQvcERFUnZZOGpLNmtTR3RwQm1z?=
 =?utf-8?B?bGxvYmwxckExWEwxSjRCZWQ5YTVwMkNRQVNxU3NWRTJjN0Y5RytkQ2xnQzBZ?=
 =?utf-8?B?QVc3WVhxc0xscThzclNaQmgvRkJqSDd6UnA3dz09?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?SENKVUxHa0xvckhkZlpWK3BSWGZTcjMwdTlvRGVhbUMvSGh4SkhPeTBDVDVw?=
 =?utf-8?B?b2xsbXFXSmlaMVZBMGxTZzBVYVorWTF3U3kxek1kU2pScEpXWmJKYjlWeXFx?=
 =?utf-8?B?WEVPN1V1Tk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Zmxja3M0RXZSdWRY?=
 =?utf-8?B?bDZlU3I3UE9RQ0hKR3ZZazRXUFJRY0YrWGMydVBCWEhUNi9zQSsvS1JRNlB4?=
 =?utf-8?B?M29reEhGcDZzVXdWRUI2QnVhNHdhcm8zS01ZeUQ1WHZ2eWtsK1VubUhkSW1O?=
 =?utf-8?B?cnNYbEZyOGZYMGhkcGhoY2k4RlJwMDFLZXY1RGZOTS9IWGNGYlVUczFkaElG?=
 =?utf-8?B?RW45akVpbWJsbWtONkRKdTFnWTdlYURlT2xkSVNBSmN5eE5vSENhYWFzQWRn?=
 =?utf-8?Q?MGUFV1v+9sBCqFdyAj7u6JHu7?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: db703fcf-91e3-4f5d-4336-08de32380d4c
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:05.9254
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: g9PM2t6lbNAhuQskfNlgWqKMnyB++IvX7ghywMSoMxMYZVAY/odfO+UNA+LbseuYEdTnQZPxhYGCe8bPa8BHKQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

The NXP's i.MX EdgeLock Enclave, a HW IP creating an embedded secure
enclave within the SoC boundary to enable features like
- HSM
- SHE
- V2X

Communicates via message unit with linux kernel. This driver is
enables communication ensuring well defined message sequence protocol
between Application Core and enclave's firmware.

Driver configures multiple misc-device on the MU, for multiple
user-space applications can communicate on single MU.

It exists on some i.MX processors. e.g. i.MX8ULP, i.MX93 etc.

-------
Changes in v20:
5/7:
- adds a func "se_chk_tx_msg_hdr", to check the validity of the in-coming message from usersapce.

1/2, 2/7, 3/7, 4/7, 6/7 & 7/7
- No changes

Reference:
- Link to v19: https://lore.kernel.org/r/20250927-imx-se-if-v19-0-d1e7e960c118@nxp.com

Changes in v19:

1/7
- Added 9 lines to the Introduction from line 73-82.

3/7
-  Update the commit message for " For i.MX9x SoC(s) there is at least one
dedicated ELE MU(s) for each world - Linux(one or more) and OP-TEE OS (one or
more), that needs to be shared between them.."

Reference:
- Link to v18: https://lore.kernel.org/r/20250619-imx-se-if-v18-0-c98391ba446d@nxp.com

Changes in v18:

1/7
- Wrap both diagrams above in literal code block by using double-colon

3/7 & 5/7
- Collected Frank's R-b tag.

2/7, 4/7, 6/7 & 7/7
- No changes

Reference:
- Link to v17: https://lore.kernel.org/r/20250426-imx-se-if-v17-0-0c85155a50d1@nxp.com

Changes in v17:
- Changes to 3/7 & 5/7: to wrap code text at 80 character whereever possible.

Reference:
- Link to v16: https://lore.kernel.org/r/20250409-imx-se-if-v16-0-5394e5f3417e@nxp.com

Changes in v16:
- commit 3/7 and 4/7 are moved to end commits making them as 6/7 and 7/7 respectively.
- No change in 1/7 & 2/7.

7/7
- Collected Frank's R-b tag.

6/7
- commit message is updated to wrap at 75 characters.

5/7
- func add_b_desc_to_pending_list, removed the initialization of b_desc to
  NULL.
- variable timeout in func ele_msg_rcv(), is renamed to timeout_ms.
- struct se_if_priv, member variable se_rcv_msg_timeout, is renamed to
  se_rcv_msg_timeout_ms.
- in func load_firmware, move the label exit after dma_free_coherent.

4/7
- commit message is updated to wrap at 75 characters.

3/7
- ele_debug_dump, updated the assignment of keep_logging.
- ele_fw_authenticate function definition is updated to take two address
  as arguments.

Reference:
- Link to v15: https://lore.kernel.org/r/20250407-imx-se-if-v15-0-e3382cecda01@nxp.com

Changes in v15:
- Patch 3/6 is split into two:
  - 3/7: arm64: dts: imx8ulp-evk: add reserved memory property
  - 4/7: arm64: dts: imx8ulp: add nxp secure enclave firmware
- No change in 1/7 & 2/7.

7/7
- removed the se_intance_id structure member variable.
- replace variable name from wait to timeout.
- used 'goto' to follow the common exit path calling "release_firmware(fw);" in case of error path.
- removed TBD string.
- Used ARRAY_SIZE(pending_lists).
- moved init_device_context after init_misc_device_context.
- defined err as long to avoid force convert in func
- added se_rcv_msg_timeout to priv, to control probe/suspend/resume per interface.

6/7
- removed the se_intance_id structure member variable.
- Added dev_ctx to the structure se_clbk_handle, too.
- Collected Frank's R-b tag.

5/7
- removed the se_intance_id structure member variable.
- since added se_if_probe_cleanup to devm, se_if_remove() is redundant. hence removed it.
- rename se_add_msg_chksum to se_get_msg_chksum
- added check if msg-size is 4 byte aligned.
- Fixed multiline comments.
- ele_debug_dump api is updated as part of comment disposition like single setting of flag "keep_logging" & adding if (ret).
- moved dev_err to dev_dbg, for imem save/restore functions.
- moved func get_se_if_name, from 7/7 to here.

3/7
- Updated the commit message.
- split the current patch into two:
  -- 3/7 for board dts, and
  -- 4/7 for chip dts

Reference:
- Link to v14: https://lore.kernel.org/r/20250327-imx-se-if-v14-0-2219448932e4@nxp.com

Changes in v14:

- Patch 5/5 is split into two:
  - firmware: drivers: imx: adds miscdev
  - Introduce dev-ctx dedicated to private.
    -- Base patch before enabling misc-device context, to have the send-receive path, based on device context.
- No change in 1/6 & 2/6.
- Copied change logs from individual commits.

6/6
- moved definition of func se_load_firmware, from 4/6 patch to this patch.
- split init_device_context to init_misc_device_context.
- Different value of se_rcv_msg_timeout is required to be set. Receiving the response of 4K RSA operation can to take upto 3 minutes.
  This long value cannot be set during Linux: boot-up and suspend-resume.
  Hence, it will be set to default small-value during Linux: boot-up and suspend-resume.
- func se_dev_ctx_cpy_out_data(), in either case: do_cpy true or false, the clean-up needs to be done and it is implemented like wise.
  Once do_cpy is false, no need to continue copy to user buffer. But continue to do clean-up. hence cannot return.
  And every dev-ctx operation is done after taking the lock. Hence, two operations with same dev-ctx is not possible in parallel.
- func "init_device_context", for 0th misc dev_ctx, which is created at the time of probe, the device memory management is required. hence there is a difference.
- func "init_device_context", dev_er is replaced with return dev_err_probe.
- func "init_device_context", devm_add_action is replaced by devm_add_action_reset.
- removed type-cast from func se_ioctl_get_se_soc_info_handler().
- used scoped_cond_guard(mutex, _intr, return -EBUSY, &<mutex_lock>)
- combined dev_err & dev_dbg to one dev_err in se_if_fops_read().
- removed the structure member "se_shared_mem_mgmt->secure_mem".

4/6
- trimmed the ele_fetch_soc_info.
- removed the function ptr "se_info->se_fetch_soc_info" and replaced with ele_fetch_soc_info.
- moved definition of func se_load_firmware, to 6/6 patch.
- Different SoC, different ways to fetch soc_info. Generic function declaration for ele_fetch_soc_info() is needed. Hence wrapping ele_get_info() in it.
- Updated Kconfig help text for assertive tone.
- func ele_debug_dump is updated, to remove constructing the format string.
- removed the macro usage for SOC_ID_MASK.
- used low case hex number.
- Condition will never occur, where msg_len satisfy the following condition "msg_len % 4 != 0". Err msg is added if it occurs.
- Function description is added to se_add_msg_crc.
- timeout is added to function ele_msg_rcv, in 5/5 patch.
- local variable "header" is initialized with "tx_msg" and replaced "return err" with "return tx_msg_sz" in func ele_msg_send().
- replace function name from "exception_for_size" to "check_hdr_exception_for_sz"
- replaced "return ret > 0 ? 0 : -1;" with "return ret > 0 ? 0 : ret;" in func "se_save_imem_state".
- func "se_restore_imem_state", to return if the condition is false to proceed.
- removed casting by (void *).
- removed devm_kasprintf and done direct allocatiion for attr->soc_id = "i.MX8ULP" & attr->soc_id = "i.MX8ULP", & attr->family.
- Followed Reverse christmas tree order, whereever missing.
- There is no return if ele_fw_authenticate fails. Execution flow continue forward and execute the fucn dma_free_coherent().
- The loop is not for retry. The loop is needed to load secondary fw followed by loading primary fw, first. This is the case when ELE also got reset.
- dev_err_probe is corrected in func "se_if_request_channel".

3/6
-

Reference:
- Link to v13: https://lore.kernel.org/r/20250311-imx-se-if-v13-0-9cc6d8fd6d1c@nxp.com

Changes in v13:

5/5
- Updated the commit message for imperative mood.
- Remove the usage of macros- NODE_NAME, GET_ASCII_TO_U8, GET_IDX_FROM_DEV_NODE_NAME.
- Clean-up the return path by replacing "ret = -<err>; return ret;" with "return -<err>;"
- Clean-up the return path by replacing "ret = -<err>; goto exit;" with "return -<err>;"
- Removed goto statements from the entire driver, where there is no common code at function's exit.
- Fixes the check-patch erros reported with flag "--strict"
- Replaced devm_add_action, with devm_add_action_or_reset
- Removed the un-necesary and obvious code comments.
- Removed dev_probe_err at the exit of function se_if_probe().

4/5
- Clean-up the return path by replacing "ret = -<err>; return ret;" with "return -<err>;"
- Clean-up the return path by replacing "ret = -<err>; goto exit;" with "return -<err>;"
- Removed goto statements from the entire driver, where there is no common code at function's exit.
- fixes the check-patch erros reported with flag "--strict"
- removed the un-necesary and obvious code comments.
- variable received msg timeout to be different at boot-up & suspend/resume and send/recv ioctlis.

3/5
- compatible string is modified from "fsl,imx8ulp-se" to "fsl,imx8ulp-se-ele-hsm".
- updated the alias name.

2/5
- compatible string is modified from "fsl,imx8ulp-se" to "fsl,imx8ulp-se-ele-hsm".
- compatible string is modified from "fsl,imx93-se" to "fsl,imx93-se-ele-hsm".
- compatible string is modified from "fsl,imx95-se" to "fsl,imx95-se-ele-hsm".
- Mis-understood the +1 from Conor. Hence dropped the Reviewed-by tag.
- Collected Rob's R-b tag on v7 (https://lore.kernel.org/all/172589152997.4184616.5889493628960272898.robh@kernel.org/)

1/5
- No change

Reference:
- Link to v12: https://lore.kernel.org/r/20250120-imx-se-if-v12-0-c5ec9754570c@nxp.com

Changes in v12:

5/5
- increased the wait-timeout.

4/5
- rename flag "handle_susp_resm" to "imem_mgmt"
- moved the buffer allocation ot load_fw->imem.buf, to se_probe_if.
- setting imem state at initialization.

3/5
- No change

2/5
- No change

1/5
- No change

Reference:
- Link to v11: https://lore.kernel.org/r/20241220-imx-se-if-v11-0-0c7e65d7ae7b@nxp.com

Changes in v11:

5/5
- devname is constructed by concatinating get_se_if_name(se_if_id) & se_if_instance_id.
- ele_rcv_msg(), is updated to add the wait_interruptible_timeout for the non-NVM-Daemon message exchanges, such that in case of no response from FW,
  Linux donot hangs.
- added a new helper function get_se_if_name(), to return the secure-enclave interface owner's name string.
- added a new helper function get_se_soc_id(), to return the secure-enclave's SoC id.

4/5
- moved the se_if_node_info member "soc_register", to the struct "se_if_node_info_list"; as soc registration done once, not per interface.
- moved the se_if_node_info member "se_fetch_soc_info", to the struct "se_if_node_info_list"; as soc info fetching is done once, not per interface.
- Added two member variable se_if_id and se_if_instance_id to struct se_if_defines.
- removed the member "se_name" from struct "se_if_node_info". Rather, it will constructed by concatinating get_se_if_name(se_if_id) & se_if_instance_id.
- moved the static global variable "se_version", to the newly created structure "struct se_var_info".
- moved the member "struct se_fw_load_info load_fw" of "se_if_node_info_list", to the newly created structure "struct se_var_info".
- Replaced RUNTIME_PM_OPS with SET_SYSTEM_SLEEP_PM_OPS, in power-managment ops.

3/5
- No change

2/5
- No change

1/5
- No change

Reference:
- Link to v10: https://lore.kernel.org/r/20241104-imx-se-if-v10-0-bf06083cc97f@nxp.com

v10: firmware: imx: driver for NXP secure-enclave

Changes in v10:
5/5
- replaced the u8, u16, u32, u64, with __u8, __u16, __u32, __u64 in
  'include/uapi/linux/se_ioctl.h'.

4/5
- No change

3/5
- No change

2/5
- No change

1/5
- No change

Reference:
- Link to v9: https://lore.kernel.org/r/20241016-imx-se-if-v9-0-fd8fa0c04eab@nxp.com

Changes in v9:

4/5
- change se_if_remove function signature, required after rebase to v6.12-rc1.
- move the info->macros to a structure "struct se_if_defines if_defs".
- Removed "info" from "struct se_if_defines if_defs".
- Moved "mem_pool" from "struct se_if_defines if_defs" to "priv".
- Fetching "info" using container-of.

5/5
- Fetching "info" using container-of.
- Fixed issue reported by sparse.

Reference:
- Link to v8: https://lore.kernel.org/r/20241015-imx-se-if-v8-0-915438e267d3@nxp.com

Changes in v8:

5/5
- Remove the check for SE_IF_CTX_OPENED.
- replaced dev_ctx->priv-dev, priv->dev, whereever possible.
- func "if_misc_deregister" moved before func "init_device_context".
- func "init_device_context" before func "se_ioctl_cmd_snd_rcv_rsp_handler".
- func "se_if_fops_write" and "se_if_fops_read", are moved after func "se_ioctl_get_mu_info".
- non static functions "se_dev_ctx_cpy_out_data, se_dev_ctx_shared_mem_cleanup & init_device_context" are moved static and local scope.
- Removed back & forth between the two structs "struct se_if_device_ctx *dev_ctx" and "struct se_shared_mem_mgmt_info *se_shared_mem_mgmt"
- removed the NULL check for bdesc.
- fops_open, is corrected for acquiring the fops_lock.
- Fops_close, mutex unlock is removed. Infact check for waiting_rsp_clbk_hdl.dev_ctx, is removed.
- sema_init(&dev_ctx->fops_lock, 1);, replaced with Mutex.
- structure member se_notify, is removed.

4/5
- removed initializing err to zero in func ele_fetch_soc_info(),
- replaced 'return 0', with 'goto exit', if the condition (!priv->mem_pool) is true.
- replaced "struct *dev" with "struct se_if_priv *priv", in base_message API(s) and others.
- Created a separate structure "struct se_if_defines" to maintain interface's fixed values like cmd_tag, rsp_tag, success_tag etc.
- removed the macros "WORD_SZ", "SOC_VER_MASK", "DEFAULT_IMX_SOC_VER", "RESERVED_DMA_POOL".
- Added handling for "ctrl+c", by postponing the interrupt, till the response to the "command in flight" is received.
- Removed the mutext lock "se_if_lock".
- furnction prototype for "se_save_imem_state" and "se_restore_imem_state", is changed to pass "imem" by reference.
- Added a new structure "struct se_fw_load_info", dedicated to contain FW loading relevant info. It is a member of struct info_list.
- split "imem_mgmt_file_in_rfs" into two "prim_fw_nm_in_rfs" and "seco_fw_nm_in_rfs", to be part of "struct se_fw_load_info".
- moved the function "se_load_firmware" prior to func "if_mbox_free_channel".
- function "se_load_firmware" is updated to use "request_firmware", instead of "request_firmware_no_wait".
- function "se_load_firmware" is updated to load "primary" fw image, if the imem_state is not BAD. Then load the "secondary FW" image.
- Added a new mutex_lock in the function "se_load_firmware", for ensuring FW loading done once, when there are multiple application are in play.
- instead of "wait_queue_head_t wq", used "sruct completion".
- add devm_add_action with action as se_if_probe_cleanup.

Reference:
- Link to v7: https://lore.kernel.org/r/20240904-imx-se-if-v7-0-5afd2ab74264@nxp.com

Changes in v7:

5/5
- struct se_clbk_handle, is added with a member struct se_if_device_ctx *dev_ctx.
- func call to ele_miscdev_msg_rcv() & ele_miscdev_msg_send(), are removed.
- func se_ioctl_cmd_snd_rcv_rsp_handler(), is modified to remove the func call to ele_miscdev_msg_rcv() & ele_miscdev_msg_send()
- func se_ioctl_cmd_snd_rcv_rsp_handler is callig func ele_msg_send_rcv(), instead.
- Mutext "se_cmd_if_lock", handling is removed from this patch.
- func ele_miscdev_msg_send() is replaced with func ele_msg_send(), in fops_write.
- func ele_miscdev_msg_rcv() is replaced with func ele_msg_rcv(), in fops_read.
- fops_open is modified to create the new dev_ctx instance (using func init_device_context()), which is not registered as miscdev.
- Only one dev_ctx is registered as miscdev and its reference is stored in the struct se_if_priv, as priv_dev_ctx.
- Separate func cleanup_se_shared_mem() & func init_se_shared_mem(), for shared memory handling part of struct dev_ctx.
- Input param for func(s) ele_msg_rcv(), ele_msg_send() & ele_msg_send_rcv(), is replaced from struct se_if_priv to struct se_if_device_ctx.

4/5
- A new structure is defined name struct "se_clbk_handle", to contain members processed in mailbox call-back function.
- "struct se_if_priv" is modified to contain the two structures of "se_clbk_handle" - waiting_rsp_clbk_hdl & cmd_receiver_clbk_hdl.
- func ele_msg_rcv() is modified to take a new additional input reference param "struct se_clbk_handle *se_clbk_hdl".
- func ele_msg_send() is modified to take a new additional input tx_msg_sz.
- func ele_msg_send_rcv(), is modified to take 2 more inputs - tx_msg_sz & exp_rx_msg_sz.
- func se_val_rsp_hdr_n_status(), is modified to take input of rx_msg buffer, instead of header value, as input param.
- each caller of the func ele_msg_send_rcv(), is sending these two additional input params.
- func se_if_callback(), is modified to work on two structures of "se_clbk_handle" - waiting_rsp_clbk_hdl & cmd_receiver_clbk_hdl.
- Variable "max_dev_ctx", is removed from info & priv struture, as well its usage.
- New member variable "se_img_file_to_load", is added to structure "priv".
- Other member variables - rx_msg(ptr), rx_msg_sz, completion done & list of dev_ctxs, is removed from priv struture, along with their usage.
- func se_resume(), updated to wakeup the two "wq", part of "struct se_clbk_handle": priv->waiting_rsp_clbk_hdl & priv->cmd_receiver_clbk_hdl.

3/5
- Node name is changed from senclave-firmware@0 to "secure-enclave"

2/5
- Node name is changed to "secure-enclave".

Reference:
- Link to v6: https://lore.kernel.org/r/20240722-imx-se-if-v6-0-ee26a87b824a@nxp.com

Changes in v6:

5/5
- replaced scope_gaurd with gaurd.

4/5
- replaced scope_gaurd with gaurd.
- remove reading the regs property from dtb.
- Added NULL check for priv data fetched from device, as a sanity check, for ele_base_msg apis)

3/5
- replace firmware with senclave-firmware.

2/5
- replace firmware with senclave-firmware.
- drop description for mbox
- Replaced "items:" with maxItems:1 for "memory-region"
- Replaced "items:" with maxItems:1 for "sram"
- remove regs property.
- remove "$nodename"

Reference:
- Link to v5: https://lore.kernel.org/r/20240712-imx-se-if-v5-0-66a79903a872@nxp.com

Changes in v5:

2/5
- updated the description of mboxes
- updated the description & items for mbox-names.
- updated the description of memory-region
- move "additional properties: false" after allOf block.
- removed other example except one.

4/5
- Corrected the indentation in Kconfig.
- info members:mbox_tx_name & mbox_rx_name, are replaced with macros.

5/5
- Replaced "for  secure enclaves", with "for secure enclaves"
- Replaced "user space" with "userspace".
- End the line "[include]<linux/firmware/imx/ele_mu_ioctl.h>" with a period.

Reference:
- Link to v4: https://lore.kernel.org/r/20240705-imx-se-if-v4-0-52d000e18a1d@nxp.com

Changes in v4:

1/5
a. Removed - from EdgeLock Enclave.

b. Removed , after "Each of the above feature,"

c. replace "can exists" with "can exist".

d.
-messaging units(MU) per SE. Each co-existing 'se' can have one or multiple exclusive
-MU(s), dedicated to itself. None of the MU is shared between two SEs.
+messaging units(MU) per SE. Each co-existing SE can have one or multiple exclusive
+MUs, dedicated to itself. None of the MU is shared between two SEs.
 Communication of the MU is realized using the Linux mailbox driver.

e.
-All those SE interfaces 'se-if' that is/are dedicated to a particular SE, will be
-enumerated and provisioned under the very single 'SE' node.
+Although MU(s) is/are not shared between SE(s). But for SoC like i.MX95 which has
+multiple SE(s) like HSM, V2X-HSM, V2X-SHE; all the SE(s) and their interfaces 'se-if'
+that is/are dedicated to a particular SE will be enumerated and provisioned using the
+single compatible node("fsl,imx95-se").

f. Removed ",". Replaced for "Each 'se-if'," with "Each se-if'.

g. removed ","
-  This layer is responsible for ensuring the communication protocol, that is defined
+  This layer is responsible for ensuring the communication protocol that is defined

h. removed "-"
-  - FW can handle one command-message at a time.
+  - FW can handle one command message at a time.

i.
-  Using these multiple device contexts, that are getting multiplexed over a single MU,
-  user-space application(s) can call fops like write/read to send the command-message,
-  and read back the command-response-message to/from Firmware.
-  fops like read & write uses the above defined service layer API(s) to communicate with
+  Using these multiple device contexts that are getting multiplexed over a single MU,
+  userspace application(s) can call fops like write/read to send the command message,
+  and read back the command response message to/from Firmware.
+  fops like read & write use the above defined service layer API(s) to communicate with
   Firmware.

j. Uppercase for word "Linux".

2/5
a. Rephrased the description to remove list of phandles.

b. Moved required before allOf:
+required:
+  - compatible
+  - reg
+  - mboxes
+  - mbox-names
+
+additionalProperties: false
+
 allOf:

c. replaced not: required: with properties: <property-name>: false.
   # memory-region
-      not:
-        required:
-          - memory-region
+      properties:
+        memory-region: false

   # sram
-    else:
-      not:
-        required:
-          - sram

d. Reduced examples. keeping example of i.MX95.
e. node-name is changed to "firmware@<hex>"

3/5
- node name changed to "firmware@<hex>".

4/5
- used sizeof(*s_info)
- return early, rather than doing goto exit, in ele_get_info().
- Use upper_32_bits() and lower_32_bits()
- use rx_msg here instead of priv->rx_msg
- Moved the status check to validate_rsp_hdr. Rename the function to "se_val_rsp_hdr_n_status"
- typecasting removed header = (struct se_msg_hdr *) msg;
- Converted the API name with prefix imx_ele_* or imx_se_*, to ele_* and se_*, respectively.
- Removed the functions definition & declaration for: free_phybuf_mem_pool() & get_phybuf_mem_pool()
- removed the mbox_free_channel() calls from clean-up.
- Flag "priv->flags" is removed.
- Converted the int se_if_probe_cleanup() to void se_if_probe_cleanup().
- Replaced NULL initialization of structure members: priv->cmd_receiver_dev & priv->waiting_rsp_dev , with comments.
- Removed the function's declaration get_phy_buf_mem_pool1

5/5
Changes to Documentation/ABI/testing/se-cdev.
a. Removed "-" from "secure-enclave" and "file-descriptor".

b. Removed "-" from "shared-library"

c. Replaced "get" with "getting".

d. Added description for the new IOCTL "send command and receive command response"

e. Replaced "wakeup_intruptible" with "wait_event_interruptible"

f. Removed ";"

g. Removd "," from "mailbox_lock,"

h. Replaced "free" with "frees"

i. In mailbox callback function, checking the buffer size before
copying.

Reference:
- Link to v3: https://lore.kernel.org/r/20240617-imx-se-if-v3-0-a7d28dea5c4a@nxp.com

Changes in v3:
5/5:
- Initialize tx_msg with NULL.
- memdup_user() returns an error pointer, not NULL. correct it by adding check for err_ptr.
- new IOCTL is added to send & recieve the message.
- replaced the while loop till list is empty, with list_for_each_entry.
- replaced __list_del_entry, with list_del.
- Removed the dev_err message from copy to user.
- Removed the casting of void *.
- corrected the typcasting in copy to user.
- removed un-necessary goto statement.
- Removed dead code for clean-up of memory.
- Removed un-mapping of secured memory
- Passing se_if_priv structure to init_device_context.
- Updated the below check to replace io.length with round_up(io.length).
	if (shared_mem->size < shared_mem->pos|| io.length >= shared_mem->size - shared_mem->pos)
- Created a function to cleanup the list of shared memory buffers.
- Used list_for_each_entry_safe(). created a separate functions: se_dev_ctx_cpy_out_data() & se_dev_ctx_shared_mem_cleanup()

4/5
- Changed the compatible string to replace "-ele", to "-se".
- Declaration of imx_se_node_info, is done as const in the whole file
- Remove the unused macros from ele_base_msg.h
- Remove the function declaration get_phy_buf_mem_pool1, from the header file.
- Replace the use of dmam_alloc_coherent to dma_alloc_coherent
- Check for function pointer, before calling the fucntion pointer in imx_fetch_se_soc_info
- Removed the unused flag for SE_MU_IO_FLAGS_USE_SEC_MEM.
-  Removed the unused macros WORD_SZ
- instead of struct device *dev, struct se_if_priv *priv, is used as argument to the funtions:se_save_imem_state, se_restore_imem_state, imx_fetch_se_soc_info
- Removed ret from validate_rsp_hdr.
- changed the prefix of the funtion: plat_add_msg_crc and plat_fill_cmd_msg_hdr.
- indentation correction for info structures.
- remove the check for priv not null from se_if_probe_cleanup
- Removed the casting of void *.
- se_load_firmware function is corrected for not freeing the buffer when allocation fails.
- Checking if get_imx_se_node_info() can return NULL, in se_if_probe()
- imem.size has type u32. return value from se_save_imem_state() will be assigned to imem.size in case of success only.
- removed the flag un-setting in case of failure. priv->flags &= (~RESERVED_DMA_POOL);
- removed the function call for devm_of_platform_populate(dev);
- Checking for not-NULL,  before calling the funtion pointer se_fetch_soc_info.
- Removed the checking for reserved memory flag, before freeing up the reserved memory, in se_probe_if_cleanup.

3/5
- Changed the compatible string to replace "-ele", to "-se".

2/5
- to fix the warning error, replaced the "-ele" & "-v2x" in compatible string, to "-se".
- Added an example for ele@0 for compatible string "fsl,imx95-se"

Reference
- Link to v2: https://lore.kernel.org/r/20240523-imx-se-if-v2-0-5a6fd189a539@nxp.com

Changes in v2:

4/4
- Split this patch into two: 1. base driver & 2. Miscdev
- Initialize the return variable "err" as 0, before calling 'return err', in the file ele_common.c
- Fix the usage of un-iniitialized pointer variable, by initializing them with NULL, in ele_base_msg.c.
- Fix initializing the ret variable, to return the correct error code in case of issue.
- replaced dmam_alloc_coherent with dma_alloc_coherent.
- Replace the use of ELE_GET_INFO_READ_SZ, with sizeof(soc_info).
- Replaced -1 with -EPERM
- Removed the safety check on func-input param, in ele_get_info().
- fix the assigning data[1] with lower 32 address, rather than zero, for ele_fw_authenticate API.
- Correctly initializing the function's return error code, for file  ele_base_msg.c.
- replaced 'return' with 'goto'.
- Use length in bytes.
- Corrected the structure se_msg_hdr.
- Moved setting of rx_msg  to priv, into the function imx_ele_msg_send_rcv
- Will add lockdep_assert_held, to receive path, in v2.
- corrected the spacing at "ret  = validate_rsp_hdr"
- FIELD_GET() used for RES_STATUS
- Re-write the structure soc_info, matching the information provided in response to this api.
- The "|" goes to the end of the previous line.
- Moved the locking and unlocking of the command lock to the caller of the function.
- removed the safety check for device private data.
- Structure memory reference, used to read message header.
- In the interrupt call back function, remove assigning waiting_rsp_dev to NULL, in case of response message rcv from FW.
- do while removed.
- replaced BIT(1) for RESERVED_DMA_POOL, to BIT(0)
- The backslash is removed while assigning the file name with absolute path to structure variable.fw_name_in_rfs =.
- Update the 'if' condition by removing "idx < 0".
- mbox_request_channel_byname() uses a "char" for the name not a u8. Corrected.
- devm managed resources, are not cleaned now, in function se_probe_if_cleanup
- Used dev_err_probe().
- Used %pe to print error string.
- remove "__maybe_unused" for "struct platform_device *enum_plat_dev __maybe_unused;"
- used FIELD_GET(), for  RES_STATUS. Removed the use of MSG_TAG, MSG_COMMAND, MSG_SIZE, MSG_VER.
- Depricated the used of member of struct se_if_priv, bool no_dev_ctx_used;
- Moved the text explaing the synchronization logic via mutexes, from patch 1/4 to se_ctrl.h.
- removed the type casting of info_list = (struct imx_se_node_info_list *) device_get_match_data(dev->parent);
- Used static variable priv->soc_rev in the se_ctrl.c, replaced the following condition: if (info_list->soc_rev) to if (priv->soc_rev) for checking if this flow is already executed or not.
- imx_fetch_soc_info will return failure if the get_info function fails.
- Removed devm_free from imx_fetch_soc_info too.

3/3
- Made changes to move all the properties to parent node, without any child node.

2/4
- Use Hex pattern string.
- Move the properties to parent node, with no child node.
- Add i.MX95-ele to compatible nodes to fix the warning "/example-2/v2x: failed to match any schema with compatible: ['fsl,imx95-v2x']"

1/1
- Corrected the spelling from creats to creates.
- drop the braces around the plural 's' for interfaces
- written se in upper case SE.
- Replace "multiple message(s)" with messages.
- Removed too much details about locks.

Testing
- make CHECK_DTBS=y freescale/imx8ulp-evk.dtb;
- make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8  dt_binding_check DT_SCHEMA_FILES=fsl,imx-se.yaml
- make C=1 CHECK=scripts/coccicheck drivers/firmware/imx/*.* W=1 > r.txt
- ./scripts/checkpatch.pl --git <>..HEAD
- Tested the Image and .dtb, on the i.MX8ULP.

Reference
- Link to v1: https://lore.kernel.org/r/20240510-imx-se-if-v1-0-27c5a674916d@nxp.com

---
Pankaj Gupta (7):
      Documentation/firmware: add imx/se to other_interfaces
      dt-bindings: arm: fsl: add imx-se-fw binding doc
      firmware: imx: add driver for NXP EdgeLock Enclave
      firmware: imx: device context dedicated to priv
      firmware: drivers: imx: adds miscdev
      arm64: dts: imx8ulp: add secure enclave node
      arm64: dts: imx8ulp-evk: add reserved memory property

 Documentation/ABI/testing/se-cdev                  |   43 +
 .../devicetree/bindings/firmware/fsl,imx-se.yaml   |   91 ++
 .../driver-api/firmware/other_interfaces.rst       |  131 +++
 arch/arm64/boot/dts/freescale/imx8ulp-evk.dts      |   12 +-
 arch/arm64/boot/dts/freescale/imx8ulp.dtsi         |   11 +-
 drivers/firmware/imx/Kconfig                       |   13 +
 drivers/firmware/imx/Makefile                      |    2 +
 drivers/firmware/imx/ele_base_msg.c                |  297 +++++
 drivers/firmware/imx/ele_base_msg.h                |  115 ++
 drivers/firmware/imx/ele_common.c                  |  371 +++++++
 drivers/firmware/imx/ele_common.h                  |   51 +
 drivers/firmware/imx/se_ctrl.c                     | 1153 ++++++++++++++++++++
 drivers/firmware/imx/se_ctrl.h                     |  128 +++
 include/linux/firmware/imx/se_api.h                |   14 +
 include/uapi/linux/se_ioctl.h                      |   97 ++
 15 files changed, 2526 insertions(+), 3 deletions(-)
---
base-commit: 4a26e7032d7d57c998598c08a034872d6f0d3945
change-id: 20240507-imx-se-if-a40055093dc6

Best regards,
-- 
Pankaj Gupta <pankaj.gupta@nxp.com>


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010038.outbound.protection.outlook.com [52.101.84.38])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C67E299952;
	Wed,  3 Dec 2025 06:49:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.38
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744569; cv=fail; b=mitLKRg7l7Vp5dMS3O88mYHZPaf9oxUfQ7+DFYjMLC8OqK+UXT7zvnWiKsc4Lb4qXaHFpc1CjhYFMg8UfFUCzzunf5hs1ci5DiOllv2zjyY8hAGOjcy/TIpVvpEhy4apL9HFO5Fan5DlctmBeoju/oieTY0fG5z7pkLvFsyeMxs=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744569; c=relaxed/simple;
	bh=4w5tTIYti7iA3GrGZlldgwVR5QrapQ+PywNOE5b9rOc=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=iELBQj+uBB1OcOuI8Vz1EMVqBfjfizUBBt5ckUKEuHYAfmZD2BPYibXNDGL3Ij/mJTLHNPffdKzKlRwO/pO1gqJ2DN+dzRag72YUe0swE42w23Zmm3SpreioAoO+qEHaFG3EQQgtAKxLsykOpenCgbiB7KYgI+PcLjdOo+rPzj8=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=doCQQQk7; arc=fail smtp.client-ip=52.101.84.38
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="doCQQQk7"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=eDufFWfdwP+/bn6iUE3u6NNU3AcxNMdoUzevjie7IArJxKPKh/oWBADDVgDMxTkYI/nQvRufLjV+ZV6UR40tX759iPrAWOoTi7xX30GO1F2iz4lPry5fn+j95noWorORnI/UG77G7+2ORAdD8EP8VM36rXNvT1kxdiTX4n1AmaK0OlsYhF76B3q3Ti/IW8FrqPHAxUsdueQ5i/7jN5QmHuieh2vEzz9ZBBhsMzYNizK6zZlfL0jNwbnZbwrTjmVaxxooPZmqSZV5howTFM9hBM4KXLvtY9r6gm+XvPWQIjkriO6Tmo9yt2S6+fM0GFuPvnvHS8ZKzlcWo6GYgFNd4A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=xQHp2yZsK+e2ioy8wswR6PSZqIAIAMOeejkSV5M/CS8=;
 b=FwQZZe070kxMn+0yxTIZqGnK327Td3uq+waDevUo32bp/R4htknM0yxzVwREGTEM11E9jb6s6J7cmzTkQHgSdJ9crQoBh87JbWYdHzst8ZiCZNoqoGsuxo6dYp49J3Zs3DSFVpDQ9iN3jgEJD1sNnGbK5jIfMoUhy5CZVIVETz9dzwnBqoiHsRfjAvmqfqQpvlzMX+uA4qwp6AQLP1uipMLkWw8AsJEJHRMawrkXguvTFW9+T3+GxzHYTfPTszCss6Ou4FjQn/CRfQKIchAw5pF3Z1Ca59IDJoagwEQ8bI/HoTtkcMOoIb2jcRF1onlxpqixLn4PQFplWpn4RP78ow==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=xQHp2yZsK+e2ioy8wswR6PSZqIAIAMOeejkSV5M/CS8=;
 b=doCQQQk7nuL90w/O2iQDrtYRg4vBOaWAZf/ziB8X66pDb1BfYcnqrZNwusj9NCyKxB1FQ3lCpBXShb0JT66anZoQT6jFqSFy/I5yHb9QYc2sGKVI7elnRjk0f7ZrirpHBdW5fKBlLAv3adPQhVOn3clw0FMRh9aVk9R17Klg4JktbJvvqKGM6dgcWsGBRxPeSnPMwcEi+zYUotXF2pRzCMKZETqcRxDMoNxbw4cjpb2JdscjEQ2ZXgHV687HkgO54Hv01jRdhN2uPDzeGtDBvMPFbgmKn2XPmUITLokgboDUUKROM9Rq121wNh7Nv4kemPqvX57XFOUaPpPQIz2txg==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:23 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:23 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:09 +0530
Subject: [PATCH v20 4/7] firmware: imx: device context dedicated to priv
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-4-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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, Frank Li <Frank.Li@nxp.com>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=11122;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=4w5tTIYti7iA3GrGZlldgwVR5QrapQ+PywNOE5b9rOc=;
 b=Jn5tb1bCsetTXbYuJxFT1BWiABKpOZHPhsU9/E9u6II4tzjzD66p+a1med9lbIIXVTMSbLe0V
 aD6jGebxn7mD2j9t2zPeY33VAG9/4n/w64c/P2eNltnG41pPflQY7HI
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: 3c723648-3d1d-4d53-3068-08de323817e1
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?UlVpeFRNZGsyZVFLYng3S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tKa3BkRUdPRERy?=
 =?utf-8?B?djFhUmZPa01XVzRnb21qc0l2Tk85cGZ4OGQ0NlNXcis2WVdTejRCU1FWTTJO?=
 =?utf-8?B?dVN5b2doS1RpMVhxWjk0YXk3eTRMc1R5Z0RCOTd6WnlsdFpaWHhjVzNsakRn?=
 =?utf-8?B?ckVZbFNSWjZSMCs5THRGODErck1ybHFtMVVvS0NaMTB2VFptNWtWQ2x0L0Uv?=
 =?utf-8?B?enhiVmdHeWk0b3RHU1J4SFhuU0FlT005bHF3VE1Eb1J6clhpdzZLd3FBUDlk?=
 =?utf-8?B?QkhOTEJzM0lndy9ZV25pOHp6cUtlN3ozZ1dubEhsK2xnM2M3bEU3UjhsZ0dJ?=
 =?utf-8?Q?/OzEOj?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?ai9kUnNGNVVhTXZidHF0UmJvYnlVc2N3ODl1WlJZN1NVOS9tOWp2N3A5TDJZ?=
 =?utf-8?B?bEExOFVQNTl0eTJyN2g3ZzdvN1UvbHpIL09EK25ZWjZLd2d2VlNieWpsdHlE?=
 =?utf-8?B?K21wd25FdU5jTmN4ZmRPM2lldTFRQlhTK3NlK3RrV245cUF1UnlwaXRFTUFO?=
 =?utf-8?B?YStoMHdJeUdGYWhnNHVYRjVlZkNwWmNXMks4YXJSNGdCZkdXR1hkUyt6VmZP?=
 =?utf-8?B?bm9vd0N2WnBvb3Fpd3JnYlcrbVR0NGJMWlNvcktBKzltN2crWmhnMVRJOENp?=
 =?utf-8?B?KzJIb2FJQ1hEOXNrRmRDYTRuNnMzNnBRck9OUXNa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amZHZGhtMThabGRYbWJEbFE1ckdGWmt5dWRqS092N2xhMmVlV3l6?=
 =?utf-8?Q?D3ev5NDSQ6vVaITdLN6OQfbax?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 3c723648-3d1d-4d53-3068-08de323817e1
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:23.4397
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: aMe1QiRid3yhHYJ+LEu1cCXubUtVxgHh2aE6zCYiCkxDCw0NAG5wG7HupJgaPlonI5PIkoNTYTH5jn7ZQHRtuw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

Add priv_dev_ctx to prepare enabling misc-device context based send-receive
path, to communicate with FW.

No functionality change.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/firmware/imx/ele_base_msg.c | 14 +++++-----
 drivers/firmware/imx/ele_common.c   | 51 +++++++++++++++++++++----------------
 drivers/firmware/imx/ele_common.h   |  8 +++---
 drivers/firmware/imx/se_ctrl.c      | 29 +++++++++++++++++++++
 drivers/firmware/imx/se_ctrl.h      |  9 +++++++
 5 files changed, 78 insertions(+), 33 deletions(-)

diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
index a070acbd895c..b233729dd13d 100644
--- a/drivers/firmware/imx/ele_base_msg.c
+++ b/drivers/firmware/imx/ele_base_msg.c
@@ -59,8 +59,8 @@ int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info)
 	tx_msg->data[0] = upper_32_bits(get_info_addr);
 	tx_msg->data[1] = lower_32_bits(get_info_addr);
 	tx_msg->data[2] = sizeof(*s_info);
-	ret = ele_msg_send_rcv(priv, tx_msg, ELE_GET_INFO_REQ_MSG_SZ, rx_msg,
-			       ELE_GET_INFO_RSP_MSG_SZ);
+	ret = ele_msg_send_rcv(priv->priv_dev_ctx, tx_msg, ELE_GET_INFO_REQ_MSG_SZ,
+			       rx_msg, ELE_GET_INFO_RSP_MSG_SZ);
 	if (ret < 0)
 		goto exit;
 
@@ -109,8 +109,8 @@ int ele_ping(struct se_if_priv *priv)
 		return ret;
 	}
 
-	ret = ele_msg_send_rcv(priv, tx_msg, ELE_PING_REQ_SZ, rx_msg,
-			       ELE_PING_RSP_SZ);
+	ret = ele_msg_send_rcv(priv->priv_dev_ctx, tx_msg, ELE_PING_REQ_SZ,
+			       rx_msg, ELE_PING_RSP_SZ);
 	if (ret < 0)
 		return ret;
 
@@ -154,7 +154,7 @@ int ele_service_swap(struct se_if_priv *priv,
 	if (!tx_msg->data[4])
 		return -EINVAL;
 
-	ret = ele_msg_send_rcv(priv, tx_msg, ELE_SERVICE_SWAP_REQ_MSG_SZ,
+	ret = ele_msg_send_rcv(priv->priv_dev_ctx, tx_msg, ELE_SERVICE_SWAP_REQ_MSG_SZ,
 			       rx_msg, ELE_SERVICE_SWAP_RSP_MSG_SZ);
 	if (ret < 0)
 		return ret;
@@ -199,7 +199,7 @@ int ele_fw_authenticate(struct se_if_priv *priv, phys_addr_t contnr_addr,
 	tx_msg->data[1] = upper_32_bits(contnr_addr);
 	tx_msg->data[2] = img_addr;
 
-	ret = ele_msg_send_rcv(priv, tx_msg, ELE_FW_AUTH_REQ_SZ, rx_msg,
+	ret = ele_msg_send_rcv(priv->priv_dev_ctx, tx_msg, ELE_FW_AUTH_REQ_SZ, rx_msg,
 			       ELE_FW_AUTH_RSP_MSG_SZ);
 	if (ret < 0)
 		return ret;
@@ -238,7 +238,7 @@ int ele_debug_dump(struct se_if_priv *priv)
 	do {
 		memset(rx_msg, 0x0, ELE_DEBUG_DUMP_RSP_SZ);
 
-		ret = ele_msg_send_rcv(priv, tx_msg, ELE_DEBUG_DUMP_REQ_SZ,
+		ret = ele_msg_send_rcv(priv->priv_dev_ctx, tx_msg, ELE_DEBUG_DUMP_REQ_SZ,
 				       rx_msg, ELE_DEBUG_DUMP_RSP_SZ);
 		if (ret < 0)
 			return ret;
diff --git a/drivers/firmware/imx/ele_common.c b/drivers/firmware/imx/ele_common.c
index 748eb09474d7..f26fb4d55a9a 100644
--- a/drivers/firmware/imx/ele_common.c
+++ b/drivers/firmware/imx/ele_common.c
@@ -42,7 +42,7 @@ u32 se_get_msg_chksum(u32 *msg, u32 msg_len)
 	return chksum;
 }
 
-int ele_msg_rcv(struct se_if_priv *priv, struct se_clbk_handle *se_clbk_hdl)
+int ele_msg_rcv(struct se_if_device_ctx *dev_ctx, struct se_clbk_handle *se_clbk_hdl)
 {
 	unsigned long timeout;
 	int ret;
@@ -52,8 +52,8 @@ int ele_msg_rcv(struct se_if_priv *priv, struct se_clbk_handle *se_clbk_hdl)
 
 		ret = wait_for_completion_interruptible_timeout(&se_clbk_hdl->done, timeout);
 		if (ret == -ERESTARTSYS) {
-			if (priv->waiting_rsp_clbk_hdl.rx_msg) {
-				priv->waiting_rsp_clbk_hdl.signal_rcvd = true;
+			if (dev_ctx->priv->waiting_rsp_clbk_hdl.dev_ctx) {
+				dev_ctx->priv->waiting_rsp_clbk_hdl.signal_rcvd = true;
 				continue;
 			}
 			ret = -EINTR;
@@ -66,7 +66,7 @@ int ele_msg_rcv(struct se_if_priv *priv, struct se_clbk_handle *se_clbk_hdl)
 	return ret;
 }
 
-int ele_msg_send(struct se_if_priv *priv,
+int ele_msg_send(struct se_if_device_ctx *dev_ctx,
 		 void *tx_msg,
 		 int tx_msg_sz)
 {
@@ -78,15 +78,16 @@ int ele_msg_send(struct se_if_priv *priv,
 	 * carried in the message.
 	 */
 	if (header->size << 2 != tx_msg_sz) {
-		dev_err(priv->dev,
-			"User buf hdr: 0x%x, sz mismatced with input-sz (%d != %d).",
-			*(u32 *)header, header->size << 2, tx_msg_sz);
+		dev_err(dev_ctx->priv->dev,
+			"%s: User buf hdr: 0x%x, sz mismatced with input-sz (%d != %d).",
+			dev_ctx->devname, *(u32 *)header, header->size << 2, tx_msg_sz);
 		return -EINVAL;
 	}
 
-	err = mbox_send_message(priv->tx_chan, tx_msg);
+	err = mbox_send_message(dev_ctx->priv->tx_chan, tx_msg);
 	if (err < 0) {
-		dev_err(priv->dev, "Error: mbox_send_message failure.\n");
+		dev_err(dev_ctx->priv->dev,
+			"%s: Error: mbox_send_message failure.", dev_ctx->devname);
 		return err;
 	}
 
@@ -94,27 +95,31 @@ int ele_msg_send(struct se_if_priv *priv,
 }
 
 /* API used for send/receive blocking call. */
-int ele_msg_send_rcv(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz,
-		     void *rx_msg, int exp_rx_msg_sz)
+int ele_msg_send_rcv(struct se_if_device_ctx *dev_ctx, void *tx_msg,
+		     int tx_msg_sz, void *rx_msg, int exp_rx_msg_sz)
 {
+	struct se_if_priv *priv = dev_ctx->priv;
 	int err;
 
 	guard(mutex)(&priv->se_if_cmd_lock);
 
+	priv->waiting_rsp_clbk_hdl.dev_ctx = dev_ctx;
 	priv->waiting_rsp_clbk_hdl.rx_msg_sz = exp_rx_msg_sz;
 	priv->waiting_rsp_clbk_hdl.rx_msg = rx_msg;
 
-	err = ele_msg_send(priv, tx_msg, tx_msg_sz);
+	err = ele_msg_send(dev_ctx, tx_msg, tx_msg_sz);
 	if (err < 0)
 		return err;
 
-	err = ele_msg_rcv(priv, &priv->waiting_rsp_clbk_hdl);
+	err = ele_msg_rcv(dev_ctx, &priv->waiting_rsp_clbk_hdl);
 
 	if (priv->waiting_rsp_clbk_hdl.signal_rcvd) {
 		err = -EINTR;
 		priv->waiting_rsp_clbk_hdl.signal_rcvd = false;
-		dev_err(priv->dev, "Err[0x%x]:Interrupted by signal.\n", err);
+		dev_err(priv->dev, "%s: Err[0x%x]:Interrupted by signal.",
+			dev_ctx->devname, err);
 	}
+	priv->waiting_rsp_clbk_hdl.dev_ctx = NULL;
 
 	return err;
 }
@@ -159,8 +164,8 @@ void se_if_rx_callback(struct mbox_client *mbox_cl, void *msg)
 	/* Incoming command: wake up the receiver if any. */
 	if (header->tag == priv->if_defs->cmd_tag) {
 		se_clbk_hdl = &priv->cmd_receiver_clbk_hdl;
-		dev_dbg(dev, "Selecting cmd receiver for mesg header:0x%x.",
-			*(u32 *)header);
+		dev_dbg(dev, "Selecting cmd receiver:%s for mesg header:0x%x.",
+			se_clbk_hdl->dev_ctx->devname,  *(u32 *)header);
 
 		/*
 		 * Pre-allocated buffer of MAX_NVM_MSG_LEN
@@ -169,8 +174,9 @@ void se_if_rx_callback(struct mbox_client *mbox_cl, void *msg)
 		 */
 		if (rx_msg_sz > MAX_NVM_MSG_LEN) {
 			dev_err(dev,
-				"CMD-RCVER NVM: hdr(0x%x) with different sz(%d != %d).\n",
-				*(u32 *)header, rx_msg_sz, se_clbk_hdl->rx_msg_sz);
+				"%s: CMD-RCVER NVM: hdr(0x%x) with different sz(%d != %d).\n",
+				se_clbk_hdl->dev_ctx->devname, *(u32 *)header,
+				rx_msg_sz, se_clbk_hdl->rx_msg_sz);
 
 			se_clbk_hdl->rx_msg_sz = MAX_NVM_MSG_LEN;
 		}
@@ -178,14 +184,15 @@ void se_if_rx_callback(struct mbox_client *mbox_cl, void *msg)
 
 	} else if (header->tag == priv->if_defs->rsp_tag) {
 		se_clbk_hdl = &priv->waiting_rsp_clbk_hdl;
-		dev_dbg(dev, "Selecting resp waiter for mesg header:0x%x.",
-			*(u32 *)header);
+		dev_dbg(dev, "Selecting resp waiter:%s for mesg header:0x%x.",
+			se_clbk_hdl->dev_ctx->devname, *(u32 *)header);
 
 		if (rx_msg_sz != se_clbk_hdl->rx_msg_sz &&
 		    check_hdr_exception_for_sz(priv, header)) {
 			dev_err(dev,
-				"Rsp to CMD: hdr(0x%x) with different sz(%d != %d).\n",
-				*(u32 *)header, rx_msg_sz, se_clbk_hdl->rx_msg_sz);
+				"%s: Rsp to CMD: hdr(0x%x) with different sz(%d != %d).\n",
+				se_clbk_hdl->dev_ctx->devname, *(u32 *)header,
+				rx_msg_sz, se_clbk_hdl->rx_msg_sz);
 
 			se_clbk_hdl->rx_msg_sz = min(rx_msg_sz, se_clbk_hdl->rx_msg_sz);
 		}
diff --git a/drivers/firmware/imx/ele_common.h b/drivers/firmware/imx/ele_common.h
index 96e987ef6f88..5bac14439d7d 100644
--- a/drivers/firmware/imx/ele_common.h
+++ b/drivers/firmware/imx/ele_common.h
@@ -14,12 +14,12 @@
 
 u32 se_get_msg_chksum(u32 *msg, u32 msg_len);
 
-int ele_msg_rcv(struct se_if_priv *priv, struct se_clbk_handle *se_clbk_hdl);
+int ele_msg_rcv(struct se_if_device_ctx *dev_ctx, struct se_clbk_handle *se_clbk_hdl);
 
-int ele_msg_send(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz);
+int ele_msg_send(struct se_if_device_ctx *dev_ctx, void *tx_msg, int tx_msg_sz);
 
-int ele_msg_send_rcv(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz,
-		     void *rx_msg, int exp_rx_msg_sz);
+int ele_msg_send_rcv(struct se_if_device_ctx *dev_ctx, void *tx_msg,
+		     int tx_msg_sz, void *rx_msg, int exp_rx_msg_sz);
 
 void se_if_rx_callback(struct mbox_client *mbox_cl, void *msg);
 
diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
index 5f978c97da4a..40544cbc70ca 100644
--- a/drivers/firmware/imx/se_ctrl.c
+++ b/drivers/firmware/imx/se_ctrl.c
@@ -203,6 +203,29 @@ static int get_se_soc_info(struct se_if_priv *priv, const struct se_soc_info *se
 	return 0;
 }
 
+static int init_misc_device_context(struct se_if_priv *priv, int ch_id,
+				    struct se_if_device_ctx **new_dev_ctx)
+{
+	struct se_if_device_ctx *dev_ctx;
+	int ret = 0;
+
+	dev_ctx = devm_kzalloc(priv->dev, sizeof(*dev_ctx), GFP_KERNEL);
+
+	if (!dev_ctx)
+		return -ENOMEM;
+
+	dev_ctx->devname = devm_kasprintf(priv->dev, GFP_KERNEL, "%s0_ch%d",
+					  get_se_if_name(priv->if_defs->se_if_type),
+					  ch_id);
+	if (!dev_ctx->devname)
+		return -ENOMEM;
+
+	dev_ctx->priv = priv;
+	*new_dev_ctx = dev_ctx;
+
+	return ret;
+}
+
 /* interface for managed res to free a mailbox channel */
 static void if_mbox_free_channel(void *mbox_chan)
 {
@@ -325,6 +348,12 @@ static int se_if_probe(struct platform_device *pdev)
 					    "Failed to init reserved memory region.");
 	}
 
+	ret = init_misc_device_context(priv, 0, &priv->priv_dev_ctx);
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "Failed[0x%x] to create device contexts.",
+				     ret);
+
 	if (if_node->if_defs.se_if_type == SE_TYPE_ID_HSM) {
 		ret = get_se_soc_info(priv, se_info);
 		if (ret)
diff --git a/drivers/firmware/imx/se_ctrl.h b/drivers/firmware/imx/se_ctrl.h
index b15c4022a46c..b5e7705e2f26 100644
--- a/drivers/firmware/imx/se_ctrl.h
+++ b/drivers/firmware/imx/se_ctrl.h
@@ -19,6 +19,7 @@
 #define MESSAGING_VERSION_7		0x7
 
 struct se_clbk_handle {
+	struct se_if_device_ctx *dev_ctx;
 	struct completion done;
 	bool signal_rcvd;
 	u32 rx_msg_sz;
@@ -36,6 +37,12 @@ struct se_imem_buf {
 	u32 state;
 };
 
+/* Private struct for each char device instance. */
+struct se_if_device_ctx {
+	struct se_if_priv *priv;
+	const char *devname;
+};
+
 /* Header of the messages exchange with the EdgeLock Enclave */
 struct se_msg_hdr {
 	u8 ver;
@@ -80,6 +87,8 @@ struct se_if_priv {
 
 	struct gen_pool *mem_pool;
 	const struct se_if_defines *if_defs;
+
+	struct se_if_device_ctx *priv_dev_ctx;
 };
 
 char *get_se_if_name(u8 se_if_id);

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010038.outbound.protection.outlook.com [52.101.84.38])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD7FA28F50F;
	Wed,  3 Dec 2025 06:49:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.38
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744566; cv=fail; b=CUbkjant9l6CZg3b3sOC9tOktRPZkOmM2u5F1nZNBSA3B4uyPpb5sLyrJ4ExrldIbCdy7QoOz9CMG/opoOzI+i7+TRbgQMupgnbTW222bsPXXuz2fV2VW5hdV7aG9yMaYbv/ls5tz6+9rcsmju8OF7LzMqfbWk2wZThp1RRWz28=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744566; c=relaxed/simple;
	bh=hiqYWGPT0X1VCyA09a5n4+XcdNjpcRmZyk8hGulj+Xg=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=AGwDlbxAz5uURx0U1i714fFL3F6Y3YeL8Fzm+2EZegXqPnufnnI51r85ALKMbnh72zUA9bLDwlJt9OE0Nnl3EcxZ+BlThp+Cr4tktWSN57TNjDVR+pWCnupHf79Ni9zS7r00RHPHLiB+7c5Tfmsr6nG43qrkgs5Azd+TMeblKGI=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=GS0X72zM; arc=fail smtp.client-ip=52.101.84.38
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="GS0X72zM"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=fxTXfst4pMpJrKjF4pM/d8Jv97PTeNaLPAcDx5EzfJWR75+l3qpvNWys1OH41sEaPRPWKRyE6Uy27Dzd1x3G7nEnz7wf06mPRuLr41MoINnIYDRJpk85xFYpHuzzVODoCvn1kRpyfL2LOqsesnKXW+ToUIVAPpLgMJHk3NgUOO/5NsxkAIG0Cb8XIlDyvWLrJcD7jocTDXE+etX/0wZsrkOA9wERh4AZcRGAsoSixhSFAYsilMr2bbgJZ6SXAoWU66Q89LXXFv+ILLHwEu931WTGGn2jEG76g1hegD1yRpUlEElo4pzAqaD64k6qXHP9YRUPhYkQ0ne6xXKGrudHYg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=9nqUIxdIgOhCPeySS922Y14vzS4QvdQ+PnWPv9/e0ls=;
 b=WshUej1kTMnoTprj5TYgcJrdEoifSJnDsqNlDkAuJKB+kfRTkgwwn6FOS/gRcNZea1cthkcZLnijJFfplqrQWLuyFbELJSgAshO3dqyNkq3vaYwBY6eLUs/k+Y+KQqW/zxDus4Vzh0GDlGkoZdBLEukPT0QxZNczGgaReyN9DJTNpaQNru8WHHdrKQLaDCEv+OU7mb1M3S/4M6TE5ouiCTnQ5gb5ebFg0/zHOFR7y9Tcu7ijt3IACpF5qQTPgOJrfk2JuplKk29cmtQNjK7UeVDLMO82OzOmb6065ZTl5BurVj/Gb3BoZ2fLyZMMNtGq6CIRZTp/Tug+IK7yn7VS8g==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=9nqUIxdIgOhCPeySS922Y14vzS4QvdQ+PnWPv9/e0ls=;
 b=GS0X72zMH+b0GkR7nEb3szMcSEHji3C2/KfLtN8WaJg3Y+eMp5g6lL1wvgtcUn7oK+m2KbqQq3spiPjzQehMIDvHb4W+0Y/lwRJR3yyf1vMoR4mfZXBiD9UN8R27K86XSMhsHjtc5byEthN1oy3UqhrtvbBxHX4ChX8eua/7N5uX4yd7Kb0SOXsfHAFx4Ymmt+hyxgtuwyYGs3MCs4/+J/ZAI+kjyWiOis3GwCWm79GwDPqnGZhSW6a8S9o+snSm7dziGKn5CTaaPQYyoF8McOPQJAPAcEFEDnJkcaxXBqr4NGRRp2+WIPHKvQOaM8rK93yuBBWfTegEyKzy7SsAJw==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:19 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:19 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:08 +0530
Subject: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock Enclave
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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, Frank Li <Frank.Li@nxp.com>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=37140;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=hiqYWGPT0X1VCyA09a5n4+XcdNjpcRmZyk8hGulj+Xg=;
 b=1PtEGvKjnucgg1HL4yuLHivalgOHjBALBgwI7r/vhGXgC4BLU5913nD97Dh5tDSHCwiIexHqg
 Pp7OyNUEWnVAk7nTj/q/pcR3AJTy3AILYqmn8f+s0PldsP2Mfj7fI/A
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: 4729f547-55ce-4da9-c660-08de32381531
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?bDlVV2g2K2dTRzFtQVlHVVpiek52R0E0NTdBZTBTSzJHTW9TWEM5ZHJlUThk?=
 =?utf-8?B?cjRmMGQycXpzaTFQRTZDcVBrSENzR1F0RWRsVE1lWThJUWRhUWNjWjFKdzNi?=
 =?utf-8?B?ckhkTVNLdkhiN0JBMGVJSkl4YlFhQkxGaG0xTDVLa1B3OXVNRjg3QXNaMGtS?=
 =?utf-8?B?ODNGSTNURnN0d2NsNlFQZXdxT0xTQWZOWHdBWkdBaERwdE5ZbHNaeFFSK2JW?=
 =?utf-8?B?dXFTVVJRaTR5RVJFYzhvVmF1ZmpOYnFJMm9oNjNSTXlvMHdGRmxZa2J1VzlF?=
 =?utf-8?B?ZzFhZHFlK2pYNmI5TE5yRXE0bFNhcUVxcVRhZGpiWDdQeTd6NTF2Sk1jRjdL?=
 =?utf-8?B?TXlYOExnTDhpQjJ3bUV6QnF6c0krc1FYY0wzZVN3WGtJTmhLSHFxSTFiZmYx?=
 =?utf-8?B?dWNkK0h5UnQvY2NVUW8zQXl5OC80QUg3NnVxeTdhcVV2aVJDN1d6VDY3MmFD?=
 =?utf-8?B?Tnd4eElqME9vZWVBaWVWbkR3YTM4WDJCWkozaS8yRUJSNTJneExLc0VaWXNP?=
 =?utf-8?B?YS9ubFFjUjdJUVhuOFlWaUt6NnhncEJlS2FkOW9BdCs2ZzVVelk4RWxSblNq?=
 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9RYXdjTkVIU1NuMHFnd2gxbWxYU0t2cHl5eW1Oc0VGNDFDQk9YczdXVzg2?=
 =?utf-8?B?K0hJa1F1UFVtS2JwQjYzenNqY2tRSlBwMlZtOW9HMWFrb1RlSUZhU0lHUjNi?=
 =?utf-8?B?YzFTVExWVG85ZzdJWVhPank0WExEREVuLytIMXNmWi80Sm00VjIvTmY2MFM1?=
 =?utf-8?B?SVFMcjdvTFRHS1NBOGJjZ0FWYnZjcDJBcnlKL2JsVGhpa0dnN0h0dkRseVg5?=
 =?utf-8?B?NlBpaW11WWdpdDNNWjRKaC9jNVZsMnB4V3o4bkl1bnVhM0s5T2xGQkdFUnZs?=
 =?utf-8?B?Ly9McC9UeDJhZnBLS0Qybmc2WHJRSHBhMFBnajFJdnU4UmplWi8zOW1TMWtG?=
 =?utf-8?B?NG1VYnA1UUpYODhZT2lPVUZnVHJaVFRhNHRsbUVDRm5Db0tEdmxjbjY3dmEw?=
 =?utf-8?B?QzVmMC9YaENuUEZsMS9HcmZqRjBFLzJnOG9xWnJXc3pSMk9zMkoydEw2cW5Y?=
 =?utf-8?B?Q3F5NUFscFFuUWQrVU9uN2lsVERwcDdrdFF6WmxNbnZNcVAwTnFFZ2NDSFh2?=
 =?utf-8?B?UXpXVllEU2RiRmdDSHNrbk4zMUtWNVNKRE5saHRVK1F3T2R5MzhUbFdaRFA3?=
 =?utf-8?Q?IzNSj+?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?bUxrTG9vZWJvZXVoRW1OVnZVN2hGL2JnbGg3OEpPa0xiZ0orQnpuUUxqaVds?=
 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9tTVI5Lzk1T0dRb2dNNVlP?=
 =?utf-8?B?STRQQUNRU2hwakFGN2FmdFhvQmF1bFYwUGt0bUJzUnlac3d0MFpuVmw1YkF5?=
 =?utf-8?B?M051Y2RhZmhFZHZVMU5xQ1RvV280TEVTQnpDSWVYNHFoQ1N2RlRBNGU4ZHhE?=
 =?utf-8?B?ejhHQzVudXVjMnpBZW0xdlJyUTFZaDdSaTdsOCtpNEVOa1dQNGhiNlVlTjZo?=
 =?utf-8?B?Tk9iV3lCN052YnNnU2VmWm9zazBEZTNWd3dWblFqeEVNd3hMZisxRG1qSXkw?=
 =?utf-8?B?VGZ3MkdOdVpkZWpLb0lXU1ZLamlJdWsrMitoSitTT3ZpYVRHLy9XSnhoNWdJ?=
 =?utf-8?Q?b3ZAaE+4ghm3vn1Gpzw53JNjT?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 4729f547-55ce-4da9-c660-08de32381531
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:19.0863
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: ptRbWS8pkQppGprR5LLrSJAYoR+YVbPWIKOnOjmoOHv/HPxKPynMuFlvoiMK/nff8IQ3MXeOT7lktyxLNr4rig==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

Add driver for enabling MU based communication interface to secure-enclave.

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 with Linux over single or multiple
dedicated messaging unit(MU) based interface(s).
Exists on i.MX SoC(s) like i.MX8ULP, i.MX93, i.MX95 etc.

For i.MX9x SoC(s) there is at least one dedicated ELE MU(s) for each
world - Linux(one or more) and OPTEE-OS (one or more).

Other dependent kernel drivers will be:
- NVMEM: that supports non-volatile devices like EFUSES,
         managed by NXP's secure-enclave.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/firmware/imx/Kconfig        |  13 ++
 drivers/firmware/imx/Makefile       |   2 +
 drivers/firmware/imx/ele_base_msg.c | 269 ++++++++++++++++++++++++
 drivers/firmware/imx/ele_base_msg.h |  95 +++++++++
 drivers/firmware/imx/ele_common.c   | 333 ++++++++++++++++++++++++++++++
 drivers/firmware/imx/ele_common.h   |  45 ++++
 drivers/firmware/imx/se_ctrl.c      | 401 ++++++++++++++++++++++++++++++++++++
 drivers/firmware/imx/se_ctrl.h      |  86 ++++++++
 include/linux/firmware/imx/se_api.h |  14 ++
 9 files changed, 1258 insertions(+)

diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
index 127ad752acf8..5fe96299b704 100644
--- a/drivers/firmware/imx/Kconfig
+++ b/drivers/firmware/imx/Kconfig
@@ -55,3 +55,16 @@ config IMX_SCMI_MISC_DRV
 	  core that could provide misc functions such as board control.
 
 	  This driver can also be built as a module.
+
+config IMX_SEC_ENCLAVE
+	tristate "i.MX Embedded Secure Enclave - EdgeLock Enclave Firmware driver."
+	depends on IMX_MBOX && ARCH_MXC && ARM64
+	select FW_LOADER
+	default m if ARCH_MXC
+
+	help
+	  Exposes APIs supported by the iMX Secure Enclave HW IP called:
+	  - EdgeLock Enclave Firmware (for i.MX8ULP, i.MX93),
+	    like base, HSM, V2X & 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.
diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
index 3bbaffa6e347..4412b15846b1 100644
--- a/drivers/firmware/imx/Makefile
+++ b/drivers/firmware/imx/Makefile
@@ -4,3 +4,5 @@ obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
 obj-${CONFIG_IMX_SCMI_CPU_DRV}	+= sm-cpu.o
 obj-${CONFIG_IMX_SCMI_MISC_DRV}	+= sm-misc.o
 obj-${CONFIG_IMX_SCMI_LMM_DRV}	+= sm-lmm.o
+sec_enclave-objs		= se_ctrl.o ele_common.o ele_base_msg.o
+obj-${CONFIG_IMX_SEC_ENCLAVE}	+= sec_enclave.o
diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
new file mode 100644
index 000000000000..a070acbd895c
--- /dev/null
+++ b/drivers/firmware/imx/ele_base_msg.c
@@ -0,0 +1,269 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+#include <linux/types.h>
+
+#include <linux/completion.h>
+#include <linux/dma-mapping.h>
+#include <linux/genalloc.h>
+
+#include "ele_base_msg.h"
+#include "ele_common.h"
+
+#define FW_DBG_DUMP_FIXED_STR		"ELE"
+
+int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info)
+{
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_api_msg *rx_msg __free(kfree) = NULL;
+	dma_addr_t get_info_addr = 0;
+	u32 *get_info_data = NULL;
+	int ret = 0;
+
+	if (!priv)
+		return -EINVAL;
+
+	memset(s_info, 0x0, sizeof(*s_info));
+
+	tx_msg = kzalloc(ELE_GET_INFO_REQ_MSG_SZ, GFP_KERNEL);
+	if (!tx_msg)
+		return -ENOMEM;
+
+	rx_msg = kzalloc(ELE_GET_INFO_RSP_MSG_SZ, GFP_KERNEL);
+	if (!rx_msg)
+		return -ENOMEM;
+
+	if (priv->mem_pool)
+		get_info_data = gen_pool_dma_alloc(priv->mem_pool,
+						   ELE_GET_INFO_BUFF_SZ,
+						   &get_info_addr);
+	else
+		get_info_data = dma_alloc_coherent(priv->dev,
+						   ELE_GET_INFO_BUFF_SZ,
+						   &get_info_addr,
+						   GFP_KERNEL);
+	if (!get_info_data) {
+		dev_dbg(priv->dev,
+			"%s: Failed to allocate get_info_addr.", __func__);
+		return -ENOMEM;
+	}
+
+	ret = se_fill_cmd_msg_hdr(priv, (struct se_msg_hdr *)&tx_msg->header,
+				  ELE_GET_INFO_REQ, ELE_GET_INFO_REQ_MSG_SZ,
+				  true);
+	if (ret)
+		goto exit;
+
+	tx_msg->data[0] = upper_32_bits(get_info_addr);
+	tx_msg->data[1] = lower_32_bits(get_info_addr);
+	tx_msg->data[2] = sizeof(*s_info);
+	ret = ele_msg_send_rcv(priv, tx_msg, ELE_GET_INFO_REQ_MSG_SZ, rx_msg,
+			       ELE_GET_INFO_RSP_MSG_SZ);
+	if (ret < 0)
+		goto exit;
+
+	ret = se_val_rsp_hdr_n_status(priv, rx_msg, ELE_GET_INFO_REQ,
+				      ELE_GET_INFO_RSP_MSG_SZ, true);
+
+	memcpy(s_info, get_info_data, sizeof(*s_info));
+
+exit:
+	if (priv->mem_pool)
+		gen_pool_free(priv->mem_pool, (u64)get_info_data,
+			      ELE_GET_INFO_BUFF_SZ);
+	else
+		dma_free_coherent(priv->dev, ELE_GET_INFO_BUFF_SZ,
+				  get_info_data, get_info_addr);
+
+	return ret;
+}
+
+int ele_fetch_soc_info(struct se_if_priv *priv, void *data)
+{
+	return ele_get_info(priv, data);
+}
+
+int ele_ping(struct se_if_priv *priv)
+{
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_api_msg *rx_msg __free(kfree) = NULL;
+	int ret = 0;
+
+	if (!priv)
+		return -EINVAL;
+
+	tx_msg = kzalloc(ELE_PING_REQ_SZ, GFP_KERNEL);
+	if (!tx_msg)
+		return -ENOMEM;
+
+	rx_msg = kzalloc(ELE_PING_RSP_SZ, GFP_KERNEL);
+	if (!rx_msg)
+		return -ENOMEM;
+
+	ret = se_fill_cmd_msg_hdr(priv, (struct se_msg_hdr *)&tx_msg->header,
+				  ELE_PING_REQ, ELE_PING_REQ_SZ, true);
+	if (ret) {
+		dev_err(priv->dev, "Error: se_fill_cmd_msg_hdr failed.");
+		return ret;
+	}
+
+	ret = ele_msg_send_rcv(priv, tx_msg, ELE_PING_REQ_SZ, rx_msg,
+			       ELE_PING_RSP_SZ);
+	if (ret < 0)
+		return ret;
+
+	ret = se_val_rsp_hdr_n_status(priv, rx_msg, ELE_PING_REQ,
+				      ELE_PING_RSP_SZ, true);
+
+	return ret;
+}
+
+int ele_service_swap(struct se_if_priv *priv,
+		     phys_addr_t addr,
+		     u32 addr_size, u16 flag)
+{
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_api_msg *rx_msg __free(kfree) = NULL;
+	int ret = 0;
+
+	if (!priv)
+		return -EINVAL;
+
+	tx_msg = kzalloc(ELE_SERVICE_SWAP_REQ_MSG_SZ, GFP_KERNEL);
+	if (!tx_msg)
+		return -ENOMEM;
+
+	rx_msg = kzalloc(ELE_SERVICE_SWAP_RSP_MSG_SZ, GFP_KERNEL);
+	if (!rx_msg)
+		return -ENOMEM;
+
+	ret = se_fill_cmd_msg_hdr(priv, (struct se_msg_hdr *)&tx_msg->header,
+				  ELE_SERVICE_SWAP_REQ,
+				  ELE_SERVICE_SWAP_REQ_MSG_SZ, true);
+	if (ret)
+		return ret;
+
+	tx_msg->data[0] = flag;
+	tx_msg->data[1] = addr_size;
+	tx_msg->data[2] = ELE_NONE_VAL;
+	tx_msg->data[3] = lower_32_bits(addr);
+	tx_msg->data[4] = se_get_msg_chksum((u32 *)&tx_msg[0],
+					    ELE_SERVICE_SWAP_REQ_MSG_SZ);
+	if (!tx_msg->data[4])
+		return -EINVAL;
+
+	ret = ele_msg_send_rcv(priv, tx_msg, ELE_SERVICE_SWAP_REQ_MSG_SZ,
+			       rx_msg, ELE_SERVICE_SWAP_RSP_MSG_SZ);
+	if (ret < 0)
+		return ret;
+
+	ret = se_val_rsp_hdr_n_status(priv, rx_msg, ELE_SERVICE_SWAP_REQ,
+				      ELE_SERVICE_SWAP_RSP_MSG_SZ, true);
+	if (ret)
+		return ret;
+
+	if (flag == ELE_IMEM_EXPORT)
+		ret = rx_msg->data[1];
+	else
+		ret = 0;
+
+	return ret;
+}
+
+int ele_fw_authenticate(struct se_if_priv *priv, phys_addr_t contnr_addr,
+			phys_addr_t img_addr)
+{
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_api_msg *rx_msg __free(kfree) = NULL;
+	int ret = 0;
+
+	if (!priv)
+		return -EINVAL;
+
+	tx_msg = kzalloc(ELE_FW_AUTH_REQ_SZ, GFP_KERNEL);
+	if (!tx_msg)
+		return -ENOMEM;
+
+	rx_msg = kzalloc(ELE_FW_AUTH_RSP_MSG_SZ, GFP_KERNEL);
+	if (!rx_msg)
+		return -ENOMEM;
+
+	ret = se_fill_cmd_msg_hdr(priv, (struct se_msg_hdr *)&tx_msg->header,
+				  ELE_FW_AUTH_REQ, ELE_FW_AUTH_REQ_SZ, true);
+	if (ret)
+		return ret;
+
+	tx_msg->data[0] = lower_32_bits(contnr_addr);
+	tx_msg->data[1] = upper_32_bits(contnr_addr);
+	tx_msg->data[2] = img_addr;
+
+	ret = ele_msg_send_rcv(priv, tx_msg, ELE_FW_AUTH_REQ_SZ, rx_msg,
+			       ELE_FW_AUTH_RSP_MSG_SZ);
+	if (ret < 0)
+		return ret;
+
+	ret = se_val_rsp_hdr_n_status(priv, rx_msg, ELE_FW_AUTH_REQ,
+				      ELE_FW_AUTH_RSP_MSG_SZ, true);
+	return ret;
+}
+
+int ele_debug_dump(struct se_if_priv *priv)
+{
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_api_msg *rx_msg __free(kfree) = NULL;
+	bool keep_logging;
+	int msg_ex_cnt;
+	int ret = 0;
+	int i;
+
+	if (!priv)
+		return -EINVAL;
+
+	tx_msg = kzalloc(ELE_DEBUG_DUMP_REQ_SZ, GFP_KERNEL);
+	if (!tx_msg)
+		return -ENOMEM;
+
+	rx_msg = kzalloc(ELE_DEBUG_DUMP_RSP_SZ, GFP_KERNEL);
+	if (!rx_msg)
+		return -ENOMEM;
+
+	ret = se_fill_cmd_msg_hdr(priv, &tx_msg->header, ELE_DEBUG_DUMP_REQ,
+				  ELE_DEBUG_DUMP_REQ_SZ, true);
+	if (ret)
+		return ret;
+
+	msg_ex_cnt = 0;
+	do {
+		memset(rx_msg, 0x0, ELE_DEBUG_DUMP_RSP_SZ);
+
+		ret = ele_msg_send_rcv(priv, tx_msg, ELE_DEBUG_DUMP_REQ_SZ,
+				       rx_msg, ELE_DEBUG_DUMP_RSP_SZ);
+		if (ret < 0)
+			return ret;
+
+		ret = se_val_rsp_hdr_n_status(priv, rx_msg, ELE_DEBUG_DUMP_REQ,
+					      ELE_DEBUG_DUMP_RSP_SZ, true);
+		if (ret) {
+			dev_err(priv->dev, "Dump_Debug_Buffer Error: %x.", ret);
+			break;
+		}
+		keep_logging = (rx_msg->header.size >= (ELE_DEBUG_DUMP_RSP_SZ >> 2) &&
+				msg_ex_cnt < ELE_MAX_DBG_DMP_PKT);
+
+		rx_msg->header.size -= 2;
+
+		if (rx_msg->header.size > 4)
+			rx_msg->header.size--;
+
+		for (i = 0; i < rx_msg->header.size; i += 2)
+			dev_info(priv->dev, "%s%02x_%02x: 0x%08x 0x%08x",
+				 FW_DBG_DUMP_FIXED_STR,	msg_ex_cnt, i,
+				 rx_msg->data[i + 1], rx_msg->data[i + 2]);
+
+		msg_ex_cnt++;
+	} while (keep_logging);
+
+	return ret;
+}
diff --git a/drivers/firmware/imx/ele_base_msg.h b/drivers/firmware/imx/ele_base_msg.h
new file mode 100644
index 000000000000..8e5b015e99a2
--- /dev/null
+++ b/drivers/firmware/imx/ele_base_msg.h
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2025 NXP
+ *
+ * Header file for the EdgeLock Enclave Base API(s).
+ */
+
+#ifndef ELE_BASE_MSG_H
+#define ELE_BASE_MSG_H
+
+#include <linux/device.h>
+#include <linux/types.h>
+
+#include "se_ctrl.h"
+
+#define ELE_NONE_VAL			0x0
+
+#define ELE_GET_INFO_REQ		0xda
+#define ELE_GET_INFO_REQ_MSG_SZ		0x10
+#define ELE_GET_INFO_RSP_MSG_SZ		0x08
+
+#define MAX_UID_SIZE                     (16)
+#define DEV_GETINFO_ROM_PATCH_SHA_SZ     (32)
+#define DEV_GETINFO_FW_SHA_SZ            (32)
+#define DEV_GETINFO_OEM_SRKH_SZ          (64)
+#define DEV_GETINFO_MIN_VER_MASK	0xff
+#define DEV_GETINFO_MAJ_VER_MASK	0xff00
+#define ELE_DEV_INFO_EXTRA_SZ		0x60
+
+struct dev_info {
+	u8  cmd;
+	u8  ver;
+	u16 length;
+	u16 soc_id;
+	u16 soc_rev;
+	u16 lmda_val;
+	u8  ssm_state;
+	u8  dev_atts_api_ver;
+	u8  uid[MAX_UID_SIZE];
+	u8  sha_rom_patch[DEV_GETINFO_ROM_PATCH_SHA_SZ];
+	u8  sha_fw[DEV_GETINFO_FW_SHA_SZ];
+};
+
+struct dev_addn_info {
+	u8  oem_srkh[DEV_GETINFO_OEM_SRKH_SZ];
+	u8  trng_state;
+	u8  csal_state;
+	u8  imem_state;
+	u8  reserved2;
+};
+
+struct ele_dev_info {
+	struct dev_info d_info;
+	struct dev_addn_info d_addn_info;
+};
+
+#define ELE_GET_INFO_BUFF_SZ		(sizeof(struct ele_dev_info) \
+						+ ELE_DEV_INFO_EXTRA_SZ)
+
+#define GET_SERIAL_NUM_FROM_UID(x, uid_word_sz) \
+	(((u64)(((u32 *)(x))[(uid_word_sz) - 1]) << 32) | ((u32 *)(x))[0])
+
+#define ELE_MAX_DBG_DMP_PKT		50
+#define ELE_DEBUG_DUMP_REQ		0x21
+#define ELE_DEBUG_DUMP_REQ_SZ		0x4
+#define ELE_DEBUG_DUMP_RSP_SZ		0x5c
+
+#define ELE_PING_REQ			0x01
+#define ELE_PING_REQ_SZ			0x04
+#define ELE_PING_RSP_SZ			0x08
+
+#define ELE_SERVICE_SWAP_REQ		0xdf
+#define ELE_SERVICE_SWAP_REQ_MSG_SZ	0x18
+#define ELE_SERVICE_SWAP_RSP_MSG_SZ	0x0c
+#define ELE_IMEM_SIZE			0x10000
+#define ELE_IMEM_STATE_OK		0xca
+#define ELE_IMEM_STATE_BAD		0xfe
+#define ELE_IMEM_STATE_WORD		0x27
+#define ELE_IMEM_STATE_MASK		0x00ff0000
+#define ELE_IMEM_EXPORT			0x1
+#define ELE_IMEM_IMPORT			0x2
+
+#define ELE_FW_AUTH_REQ			0x02
+#define ELE_FW_AUTH_REQ_SZ		0x10
+#define ELE_FW_AUTH_RSP_MSG_SZ		0x08
+
+int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info);
+int ele_fetch_soc_info(struct se_if_priv *priv, void *data);
+int ele_ping(struct se_if_priv *priv);
+int ele_service_swap(struct se_if_priv *priv, phys_addr_t addr,
+		     u32 addr_size, u16 flag);
+int ele_fw_authenticate(struct se_if_priv *priv, phys_addr_t contnr_addr,
+			phys_addr_t img_addr);
+int ele_debug_dump(struct se_if_priv *priv);
+#endif
diff --git a/drivers/firmware/imx/ele_common.c b/drivers/firmware/imx/ele_common.c
new file mode 100644
index 000000000000..748eb09474d7
--- /dev/null
+++ b/drivers/firmware/imx/ele_common.c
@@ -0,0 +1,333 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+#include "ele_base_msg.h"
+#include "ele_common.h"
+
+/*
+ * se_get_msg_chksum() - to calculate checksum word by word.
+ *
+ * @msg : reference to the input msg-data.
+ * @msg_len : reference to the input msg-data length in bytes.
+ *            Includes extra 4 bytes (or 1 words) chksum.
+ *
+ * This function returns the checksum calculated by ORing word by word.
+ *
+ * Return:
+ *  0: if the input length is not 4 byte aligned, or num of words < 5.
+ *  chksum: calculated word by word.
+ */
+u32 se_get_msg_chksum(u32 *msg, u32 msg_len)
+{
+	u32 nb_words = msg_len / (u32)sizeof(u32);
+	u32 chksum = 0;
+	u32 i;
+
+	if (nb_words < 5)
+		return chksum;
+
+	if (msg_len % SE_MSG_WORD_SZ) {
+		pr_err("Msg-len is not 4-byte aligned.");
+		return chksum;
+	}
+
+	/* nb_words include one checksum word, so skip it. */
+	nb_words--;
+
+	for (i = 0; i < nb_words; i++)
+		chksum ^= *(msg + i);
+
+	return chksum;
+}
+
+int ele_msg_rcv(struct se_if_priv *priv, struct se_clbk_handle *se_clbk_hdl)
+{
+	unsigned long timeout;
+	int ret;
+
+	do {
+		timeout = MAX_SCHEDULE_TIMEOUT;
+
+		ret = wait_for_completion_interruptible_timeout(&se_clbk_hdl->done, timeout);
+		if (ret == -ERESTARTSYS) {
+			if (priv->waiting_rsp_clbk_hdl.rx_msg) {
+				priv->waiting_rsp_clbk_hdl.signal_rcvd = true;
+				continue;
+			}
+			ret = -EINTR;
+			break;
+		}
+		ret = se_clbk_hdl->rx_msg_sz;
+		break;
+	} while (ret < 0);
+
+	return ret;
+}
+
+int ele_msg_send(struct se_if_priv *priv,
+		 void *tx_msg,
+		 int tx_msg_sz)
+{
+	struct se_msg_hdr *header = tx_msg;
+	int err;
+
+	/*
+	 * Check that the size passed as argument matches the size
+	 * carried in the message.
+	 */
+	if (header->size << 2 != tx_msg_sz) {
+		dev_err(priv->dev,
+			"User buf hdr: 0x%x, sz mismatced with input-sz (%d != %d).",
+			*(u32 *)header, header->size << 2, tx_msg_sz);
+		return -EINVAL;
+	}
+
+	err = mbox_send_message(priv->tx_chan, tx_msg);
+	if (err < 0) {
+		dev_err(priv->dev, "Error: mbox_send_message failure.\n");
+		return err;
+	}
+
+	return tx_msg_sz;
+}
+
+/* API used for send/receive blocking call. */
+int ele_msg_send_rcv(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz,
+		     void *rx_msg, int exp_rx_msg_sz)
+{
+	int err;
+
+	guard(mutex)(&priv->se_if_cmd_lock);
+
+	priv->waiting_rsp_clbk_hdl.rx_msg_sz = exp_rx_msg_sz;
+	priv->waiting_rsp_clbk_hdl.rx_msg = rx_msg;
+
+	err = ele_msg_send(priv, tx_msg, tx_msg_sz);
+	if (err < 0)
+		return err;
+
+	err = ele_msg_rcv(priv, &priv->waiting_rsp_clbk_hdl);
+
+	if (priv->waiting_rsp_clbk_hdl.signal_rcvd) {
+		err = -EINTR;
+		priv->waiting_rsp_clbk_hdl.signal_rcvd = false;
+		dev_err(priv->dev, "Err[0x%x]:Interrupted by signal.\n", err);
+	}
+
+	return err;
+}
+
+static bool check_hdr_exception_for_sz(struct se_if_priv *priv,
+				       struct se_msg_hdr *header)
+{
+	/*
+	 * List of API(s) header that can be accepte variable length
+	 * response buffer.
+	 */
+	if (header->command == ELE_DEBUG_DUMP_REQ &&
+	    header->ver == priv->if_defs->base_api_ver &&
+	    header->size >= 0 && header->size <= ELE_DEBUG_DUMP_RSP_SZ)
+		return true;
+
+	return false;
+}
+
+/*
+ * Callback called by mailbox FW, when data is received.
+ */
+void se_if_rx_callback(struct mbox_client *mbox_cl, void *msg)
+{
+	struct se_clbk_handle *se_clbk_hdl;
+	struct device *dev = mbox_cl->dev;
+	struct se_msg_hdr *header;
+	struct se_if_priv *priv;
+	u32 rx_msg_sz;
+
+	priv = dev_get_drvdata(dev);
+
+	/* The function can be called with NULL msg */
+	if (!msg) {
+		dev_err(dev, "Message is invalid\n");
+		return;
+	}
+
+	header = msg;
+	rx_msg_sz = header->size << 2;
+
+	/* Incoming command: wake up the receiver if any. */
+	if (header->tag == priv->if_defs->cmd_tag) {
+		se_clbk_hdl = &priv->cmd_receiver_clbk_hdl;
+		dev_dbg(dev, "Selecting cmd receiver for mesg header:0x%x.",
+			*(u32 *)header);
+
+		/*
+		 * Pre-allocated buffer of MAX_NVM_MSG_LEN
+		 * as the NVM command are initiated by FW.
+		 * Size is revealed as part of this call function.
+		 */
+		if (rx_msg_sz > MAX_NVM_MSG_LEN) {
+			dev_err(dev,
+				"CMD-RCVER NVM: hdr(0x%x) with different sz(%d != %d).\n",
+				*(u32 *)header, rx_msg_sz, se_clbk_hdl->rx_msg_sz);
+
+			se_clbk_hdl->rx_msg_sz = MAX_NVM_MSG_LEN;
+		}
+		se_clbk_hdl->rx_msg_sz = rx_msg_sz;
+
+	} else if (header->tag == priv->if_defs->rsp_tag) {
+		se_clbk_hdl = &priv->waiting_rsp_clbk_hdl;
+		dev_dbg(dev, "Selecting resp waiter for mesg header:0x%x.",
+			*(u32 *)header);
+
+		if (rx_msg_sz != se_clbk_hdl->rx_msg_sz &&
+		    check_hdr_exception_for_sz(priv, header)) {
+			dev_err(dev,
+				"Rsp to CMD: hdr(0x%x) with different sz(%d != %d).\n",
+				*(u32 *)header, rx_msg_sz, se_clbk_hdl->rx_msg_sz);
+
+			se_clbk_hdl->rx_msg_sz = min(rx_msg_sz, se_clbk_hdl->rx_msg_sz);
+		}
+	} else {
+		dev_err(dev, "Failed to select a device for message: %.8x\n",
+			*((u32 *)header));
+		return;
+	}
+
+	memcpy(se_clbk_hdl->rx_msg, msg, se_clbk_hdl->rx_msg_sz);
+
+	/* Allow user to read */
+	complete(&se_clbk_hdl->done);
+}
+
+int se_val_rsp_hdr_n_status(struct se_if_priv *priv, struct se_api_msg *msg,
+			    u8 msg_id, u8 sz, bool is_base_api)
+{
+	struct se_msg_hdr *header = &msg->header;
+	u32 status;
+
+	if (header->tag != priv->if_defs->rsp_tag) {
+		dev_err(priv->dev, "MSG[0x%x] Hdr: Resp tag mismatch. (0x%x != 0x%x)",
+			msg_id, header->tag, priv->if_defs->rsp_tag);
+		return -EINVAL;
+	}
+
+	if (header->command != msg_id) {
+		dev_err(priv->dev, "MSG Header: Cmd id mismatch. (0x%x != 0x%x)",
+			header->command, msg_id);
+		return -EINVAL;
+	}
+
+	if ((sz % 4) || (header->size != (sz >> 2) &&
+			 !check_hdr_exception_for_sz(priv, header))) {
+		dev_err(priv->dev, "MSG[0x%x] Hdr: Cmd size mismatch. (0x%x != 0x%x)",
+			msg_id, header->size, (sz >> 2));
+		return -EINVAL;
+	}
+
+	if (is_base_api && header->ver != priv->if_defs->base_api_ver) {
+		dev_err(priv->dev,
+			"MSG[0x%x] Hdr: Base API Vers mismatch. (0x%x != 0x%x)",
+			msg_id, header->ver, priv->if_defs->base_api_ver);
+		return -EINVAL;
+	} else if (!is_base_api && header->ver != priv->if_defs->fw_api_ver) {
+		dev_err(priv->dev,
+			"MSG[0x%x] Hdr: FW API Vers mismatch. (0x%x != 0x%x)",
+			msg_id, header->ver, priv->if_defs->fw_api_ver);
+		return -EINVAL;
+	}
+
+	status = RES_STATUS(msg->data[0]);
+	if (status != priv->if_defs->success_tag) {
+		dev_err(priv->dev, "Command Id[%x], Response Failure = 0x%x",
+			header->command, status);
+		return -EPERM;
+	}
+
+	return 0;
+}
+
+int se_save_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem)
+{
+	struct ele_dev_info s_info = {0};
+	int ret;
+
+	ret = ele_get_info(priv, &s_info);
+	if (ret) {
+		dev_err(priv->dev, "Failed to get info from ELE.\n");
+		return ret;
+	}
+
+	/* Do not save the IMEM buffer, if the current IMEM state is BAD. */
+	if (s_info.d_addn_info.imem_state == ELE_IMEM_STATE_BAD)
+		return ret;
+
+	/*
+	 * EXPORT command will save encrypted IMEM to given address,
+	 * so later in resume, IMEM can be restored from the given
+	 * address.
+	 *
+	 * Size must be at least 64 kB.
+	 */
+	ret = ele_service_swap(priv, imem->phyaddr, ELE_IMEM_SIZE, ELE_IMEM_EXPORT);
+	if (ret < 0) {
+		dev_err(priv->dev, "Failed to export IMEM.");
+		imem->size = 0;
+	} else {
+		dev_dbg(priv->dev,
+			"Exported %d bytes of encrypted IMEM.",
+			ret);
+		imem->size = ret;
+	}
+
+	return ret > 0 ? 0 : ret;
+}
+
+int se_restore_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem)
+{
+	struct ele_dev_info s_info;
+	int ret;
+
+	/* get info from ELE */
+	ret = ele_get_info(priv, &s_info);
+	if (ret) {
+		dev_err(priv->dev, "Failed to get info from ELE.");
+		return ret;
+	}
+	imem->state = s_info.d_addn_info.imem_state;
+
+	/* Get IMEM state, if 0xFE then import IMEM if imem size is non-zero. */
+	if (s_info.d_addn_info.imem_state != ELE_IMEM_STATE_BAD || !imem->size)
+		return ret;
+
+	/*
+	 * IMPORT command will restore IMEM from the given
+	 * address, here size is the actual size returned by ELE
+	 * during the export operation
+	 */
+	ret = ele_service_swap(priv, imem->phyaddr, imem->size, ELE_IMEM_IMPORT);
+	if (ret) {
+		dev_err(priv->dev, "Failed to import IMEM");
+		return ret;
+	}
+
+	/*
+	 * After importing IMEM, check if IMEM state is equal to 0xCA
+	 * to ensure IMEM is fully loaded and
+	 * ELE functionality can be used.
+	 */
+	ret = ele_get_info(priv, &s_info);
+	if (ret) {
+		dev_err(priv->dev, "Failed to get info from ELE.");
+		return ret;
+	}
+	imem->state = s_info.d_addn_info.imem_state;
+
+	if (s_info.d_addn_info.imem_state == ELE_IMEM_STATE_OK)
+		dev_dbg(priv->dev, "Successfully restored IMEM.");
+	else
+		dev_err(priv->dev, "Failed to restore IMEM.");
+
+	return ret;
+}
diff --git a/drivers/firmware/imx/ele_common.h b/drivers/firmware/imx/ele_common.h
new file mode 100644
index 000000000000..96e987ef6f88
--- /dev/null
+++ b/drivers/firmware/imx/ele_common.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef __ELE_COMMON_H__
+#define __ELE_COMMON_H__
+
+#include "se_ctrl.h"
+
+#define ELE_SUCCESS_IND			0xD6
+
+#define IMX_ELE_FW_DIR                 "imx/ele/"
+
+u32 se_get_msg_chksum(u32 *msg, u32 msg_len);
+
+int ele_msg_rcv(struct se_if_priv *priv, struct se_clbk_handle *se_clbk_hdl);
+
+int ele_msg_send(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz);
+
+int ele_msg_send_rcv(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz,
+		     void *rx_msg, int exp_rx_msg_sz);
+
+void se_if_rx_callback(struct mbox_client *mbox_cl, void *msg);
+
+int se_val_rsp_hdr_n_status(struct se_if_priv *priv, struct se_api_msg *msg,
+			    u8 msg_id, u8 sz, bool is_base_api);
+
+/* Fill a command message header with a given command ID and length in bytes. */
+static inline int se_fill_cmd_msg_hdr(struct se_if_priv *priv, struct se_msg_hdr *hdr,
+				      u8 cmd, u32 len, bool is_base_api)
+{
+	hdr->tag = priv->if_defs->cmd_tag;
+	hdr->ver = (is_base_api) ? priv->if_defs->base_api_ver : priv->if_defs->fw_api_ver;
+	hdr->command = cmd;
+	hdr->size = len >> 2;
+
+	return 0;
+}
+
+int se_save_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem);
+
+int se_restore_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem);
+
+#endif /*__ELE_COMMON_H__ */
diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
new file mode 100644
index 000000000000..5f978c97da4a
--- /dev/null
+++ b/drivers/firmware/imx/se_ctrl.c
@@ -0,0 +1,401 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+#include <linux/completion.h>
+#include <linux/delay.h>
+#include <linux/dev_printk.h>
+#include <linux/dma-mapping.h>
+#include <linux/errno.h>
+#include <linux/export.h>
+#include <linux/firmware.h>
+#include <linux/firmware/imx/se_api.h>
+#include <linux/genalloc.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/miscdevice.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/sys_soc.h>
+
+#include "ele_base_msg.h"
+#include "ele_common.h"
+#include "se_ctrl.h"
+
+#define MAX_SOC_INFO_DATA_SZ		256
+#define MBOX_TX_NAME			"tx"
+#define MBOX_RX_NAME			"rx"
+
+#define SE_TYPE_STR_DBG			"dbg"
+#define SE_TYPE_STR_HSM			"hsm"
+
+#define SE_TYPE_ID_DBG			0x1
+#define SE_TYPE_ID_HSM			0x2
+
+struct se_fw_img_name {
+	const u8 *prim_fw_nm_in_rfs;
+	const u8 *seco_fw_nm_in_rfs;
+};
+
+struct se_fw_load_info {
+	const struct se_fw_img_name *se_fw_img_nm;
+	bool is_fw_tobe_loaded;
+	bool imem_mgmt;
+	struct se_imem_buf imem;
+};
+
+struct se_var_info {
+	u16 soc_rev;
+	struct se_fw_load_info load_fw;
+};
+
+/* contains fixed information */
+struct se_soc_info {
+	const u16 soc_id;
+	const bool soc_register;
+	const struct se_fw_img_name se_fw_img_nm;
+};
+
+struct se_if_node {
+	struct se_soc_info *se_info;
+	u8 *pool_name;
+	bool reserved_dma_ranges;
+	struct se_if_defines if_defs;
+};
+
+/* common for all the SoC. */
+static struct se_var_info var_se_info;
+
+static struct se_soc_info se_imx8ulp_info = {
+	.soc_id = SOC_ID_OF_IMX8ULP,
+	.soc_register = true,
+	.se_fw_img_nm = {
+		.prim_fw_nm_in_rfs = IMX_ELE_FW_DIR
+			"mx8ulpa2-ahab-container.img",
+		.seco_fw_nm_in_rfs = IMX_ELE_FW_DIR
+			"mx8ulpa2ext-ahab-container.img",
+	},
+};
+
+static struct se_if_node imx8ulp_se_ele_hsm = {
+	.se_info = &se_imx8ulp_info,
+	.pool_name = "sram",
+	.reserved_dma_ranges = true,
+	.if_defs = {
+		.se_if_type = SE_TYPE_ID_HSM,
+		.cmd_tag = 0x17,
+		.rsp_tag = 0xe1,
+		.success_tag = ELE_SUCCESS_IND,
+		.base_api_ver = MESSAGING_VERSION_6,
+		.fw_api_ver = MESSAGING_VERSION_7,
+	},
+};
+
+static struct se_soc_info se_imx93_info = {
+	.soc_id = SOC_ID_OF_IMX93,
+};
+
+static struct se_if_node imx93_se_ele_hsm = {
+	.se_info = &se_imx93_info,
+	.reserved_dma_ranges = true,
+	.if_defs = {
+		.se_if_type = SE_TYPE_ID_HSM,
+		.cmd_tag = 0x17,
+		.rsp_tag = 0xe1,
+		.success_tag = ELE_SUCCESS_IND,
+		.base_api_ver = MESSAGING_VERSION_6,
+		.fw_api_ver = MESSAGING_VERSION_7,
+	},
+};
+
+static const struct of_device_id se_match[] = {
+	{ .compatible = "fsl,imx8ulp-se-ele-hsm", .data = &imx8ulp_se_ele_hsm},
+	{ .compatible = "fsl,imx93-se-ele-hsm", .data = &imx93_se_ele_hsm},
+	{},
+};
+
+char *get_se_if_name(u8 se_if_id)
+{
+	switch (se_if_id) {
+	case SE_TYPE_ID_DBG: return SE_TYPE_STR_DBG;
+	case SE_TYPE_ID_HSM: return SE_TYPE_STR_HSM;
+	}
+
+	return NULL;
+}
+
+static struct se_fw_load_info *get_load_fw_instance(struct se_if_priv *priv)
+{
+	return &var_se_info.load_fw;
+}
+
+static int get_se_soc_info(struct se_if_priv *priv, const struct se_soc_info *se_info)
+{
+	struct se_fw_load_info *load_fw = get_load_fw_instance(priv);
+	struct soc_device_attribute *attr;
+	u8 data[MAX_SOC_INFO_DATA_SZ];
+	struct ele_dev_info *s_info;
+	struct soc_device *sdev;
+	int err = 0;
+
+	/*
+	 * This function should be called once.
+	 * Check if the se_soc_rev is zero to continue.
+	 */
+	if (var_se_info.soc_rev)
+		return err;
+
+	err = ele_fetch_soc_info(priv, &data);
+	if (err < 0)
+		return dev_err_probe(priv->dev, err, "Failed to fetch SoC Info.");
+	s_info = (void *)data;
+	var_se_info.soc_rev = s_info->d_info.soc_rev;
+	load_fw->imem.state = s_info->d_addn_info.imem_state;
+
+	if (!se_info->soc_register)
+		return 0;
+
+	attr = devm_kzalloc(priv->dev, sizeof(*attr), GFP_KERNEL);
+	if (!attr)
+		return -ENOMEM;
+
+	if (FIELD_GET(DEV_GETINFO_MIN_VER_MASK, var_se_info.soc_rev))
+		attr->revision = devm_kasprintf(priv->dev, GFP_KERNEL, "%x.%x",
+						FIELD_GET(DEV_GETINFO_MIN_VER_MASK,
+							  var_se_info.soc_rev),
+						FIELD_GET(DEV_GETINFO_MAJ_VER_MASK,
+							  var_se_info.soc_rev));
+	else
+		attr->revision = devm_kasprintf(priv->dev, GFP_KERNEL, "%x",
+						FIELD_GET(DEV_GETINFO_MAJ_VER_MASK,
+							  var_se_info.soc_rev));
+
+	switch (se_info->soc_id) {
+	case SOC_ID_OF_IMX8ULP:
+		attr->soc_id = "i.MX8ULP";
+		break;
+	case SOC_ID_OF_IMX93:
+		attr->soc_id = "i.MX93";
+		break;
+	}
+
+	err = of_property_read_string(of_root, "model", &attr->machine);
+	if (err)
+		return -EINVAL;
+
+	attr->family = "Freescale i.MX";
+
+	attr->serial_number = devm_kasprintf(priv->dev,
+					     GFP_KERNEL, "%016llX",
+					     GET_SERIAL_NUM_FROM_UID(s_info->d_info.uid,
+								     MAX_UID_SIZE >> 2));
+
+	sdev = soc_device_register(attr);
+	if (IS_ERR(sdev))
+		return PTR_ERR(sdev);
+
+	return 0;
+}
+
+/* interface for managed res to free a mailbox channel */
+static void if_mbox_free_channel(void *mbox_chan)
+{
+	mbox_free_channel(mbox_chan);
+}
+
+static int se_if_request_channel(struct device *dev, struct mbox_chan **chan,
+				 struct mbox_client *cl, const char *name)
+{
+	struct mbox_chan *t_chan;
+	int ret = 0;
+
+	t_chan = mbox_request_channel_byname(cl, name);
+	if (IS_ERR(t_chan))
+		return dev_err_probe(dev, PTR_ERR(t_chan),
+				     "Failed to request %s channel.", name);
+
+	ret = devm_add_action_or_reset(dev, if_mbox_free_channel, t_chan);
+	if (ret)
+		return dev_err_probe(dev, -EPERM,
+				     "Failed to add-action for removal of mbox: %s\n",
+				     name);
+	*chan = t_chan;
+
+	return ret;
+}
+
+static void se_if_probe_cleanup(void *plat_dev)
+{
+	struct platform_device *pdev = plat_dev;
+	struct se_fw_load_info *load_fw;
+	struct device *dev = &pdev->dev;
+	struct se_if_priv *priv;
+
+	priv = dev_get_drvdata(dev);
+	load_fw = get_load_fw_instance(priv);
+
+	/*
+	 * In se_if_request_channel(), passed the clean-up functional
+	 * pointer reference as action to devm_add_action_or_reset().
+	 * No need to free the mbox channels here.
+	 */
+
+	/*
+	 * free the buffer in se remove, previously allocated
+	 * in se probe to store encrypted IMEM
+	 */
+	if (load_fw && load_fw->imem.buf) {
+		dmam_free_coherent(dev, ELE_IMEM_SIZE, load_fw->imem.buf,
+				   load_fw->imem.phyaddr);
+		load_fw->imem.buf = NULL;
+	}
+
+	/*
+	 * No need to check, if reserved memory is allocated
+	 * before calling for its release. Or clearing the
+	 * un-set bit.
+	 */
+	of_reserved_mem_device_release(dev);
+}
+
+static int se_if_probe(struct platform_device *pdev)
+{
+	const struct se_soc_info *se_info;
+	const struct se_if_node *if_node;
+	struct se_fw_load_info *load_fw;
+	struct device *dev = &pdev->dev;
+	struct se_if_priv *priv;
+	int ret;
+
+	if_node = device_get_match_data(dev);
+	if (!if_node)
+		return -EINVAL;
+
+	se_info = if_node->se_info;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->dev = dev;
+	priv->if_defs = &if_node->if_defs;
+	dev_set_drvdata(dev, priv);
+
+	ret = devm_add_action_or_reset(dev, se_if_probe_cleanup, pdev);
+	if (ret)
+		return ret;
+
+	/* Mailbox client configuration */
+	priv->se_mb_cl.dev		= dev;
+	priv->se_mb_cl.tx_block		= false;
+	priv->se_mb_cl.knows_txdone	= true;
+	priv->se_mb_cl.rx_callback	= se_if_rx_callback;
+
+	ret = se_if_request_channel(dev, &priv->tx_chan, &priv->se_mb_cl, MBOX_TX_NAME);
+	if (ret)
+		return ret;
+
+	ret = se_if_request_channel(dev, &priv->rx_chan, &priv->se_mb_cl, MBOX_RX_NAME);
+	if (ret)
+		return ret;
+
+	mutex_init(&priv->se_if_cmd_lock);
+
+	init_completion(&priv->waiting_rsp_clbk_hdl.done);
+	init_completion(&priv->cmd_receiver_clbk_hdl.done);
+
+	if (if_node->pool_name) {
+		priv->mem_pool = of_gen_pool_get(dev->of_node, if_node->pool_name, 0);
+		if (!priv->mem_pool)
+			return dev_err_probe(dev, -ENOMEM,
+					     "Unable to get sram pool = %s.",
+					     if_node->pool_name);
+	}
+
+	if (if_node->reserved_dma_ranges) {
+		ret = of_reserved_mem_device_init(dev);
+		if (ret)
+			return dev_err_probe(dev, ret,
+					    "Failed to init reserved memory region.");
+	}
+
+	if (if_node->if_defs.se_if_type == SE_TYPE_ID_HSM) {
+		ret = get_se_soc_info(priv, se_info);
+		if (ret)
+			return dev_err_probe(dev, ret, "Failed to fetch SoC Info.");
+	}
+
+	/* By default, there is no pending FW to be loaded.*/
+	if (se_info->se_fw_img_nm.seco_fw_nm_in_rfs) {
+		load_fw = get_load_fw_instance(priv);
+		load_fw->se_fw_img_nm = &se_info->se_fw_img_nm;
+		load_fw->is_fw_tobe_loaded = true;
+
+		if (load_fw->se_fw_img_nm->prim_fw_nm_in_rfs) {
+			/* allocate buffer where SE store encrypted IMEM */
+			load_fw->imem.buf = dmam_alloc_coherent(priv->dev, ELE_IMEM_SIZE,
+								&load_fw->imem.phyaddr,
+								GFP_KERNEL);
+			if (!load_fw->imem.buf)
+				return dev_err_probe(dev, -ENOMEM,
+						     "dmam-alloc-failed: To store encr-IMEM.");
+			load_fw->imem_mgmt = true;
+		}
+	}
+	dev_info(dev, "i.MX secure-enclave: %s0 interface to firmware, configured.",
+		 get_se_if_name(priv->if_defs->se_if_type));
+
+	return ret;
+}
+
+static int se_suspend(struct device *dev)
+{
+	struct se_if_priv *priv = dev_get_drvdata(dev);
+	struct se_fw_load_info *load_fw;
+	int ret = 0;
+
+	load_fw = get_load_fw_instance(priv);
+
+	if (load_fw->imem_mgmt)
+		ret = se_save_imem_state(priv, &load_fw->imem);
+
+	return ret;
+}
+
+static int se_resume(struct device *dev)
+{
+	struct se_if_priv *priv = dev_get_drvdata(dev);
+	struct se_fw_load_info *load_fw;
+
+	load_fw = get_load_fw_instance(priv);
+
+	if (load_fw->imem_mgmt)
+		se_restore_imem_state(priv, &load_fw->imem);
+
+	return 0;
+}
+
+static const struct dev_pm_ops se_pm = {
+	SET_SYSTEM_SLEEP_PM_OPS(se_suspend, se_resume)
+};
+
+static struct platform_driver se_driver = {
+	.driver = {
+		.name = "fsl-se",
+		.of_match_table = se_match,
+		.pm = &se_pm,
+	},
+	.probe = se_if_probe,
+};
+MODULE_DEVICE_TABLE(of, se_match);
+
+module_platform_driver(se_driver);
+MODULE_AUTHOR("Pankaj Gupta <pankaj.gupta@nxp.com>");
+MODULE_DESCRIPTION("iMX Secure Enclave Driver.");
+MODULE_LICENSE("GPL");
diff --git a/drivers/firmware/imx/se_ctrl.h b/drivers/firmware/imx/se_ctrl.h
new file mode 100644
index 000000000000..b15c4022a46c
--- /dev/null
+++ b/drivers/firmware/imx/se_ctrl.h
@@ -0,0 +1,86 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef SE_MU_H
+#define SE_MU_H
+
+#include <linux/miscdevice.h>
+#include <linux/semaphore.h>
+#include <linux/mailbox_client.h>
+
+#define MAX_FW_LOAD_RETRIES		50
+#define SE_MSG_WORD_SZ			0x4
+
+#define RES_STATUS(x)			FIELD_GET(0x000000ff, x)
+#define MAX_NVM_MSG_LEN			(256)
+#define MESSAGING_VERSION_6		0x6
+#define MESSAGING_VERSION_7		0x7
+
+struct se_clbk_handle {
+	struct completion done;
+	bool signal_rcvd;
+	u32 rx_msg_sz;
+	/*
+	 * Assignment of the rx_msg buffer to held till the
+	 * received content as part callback function, is copied.
+	 */
+	struct se_api_msg *rx_msg;
+};
+
+struct se_imem_buf {
+	u8 *buf;
+	phys_addr_t phyaddr;
+	u32 size;
+	u32 state;
+};
+
+/* Header of the messages exchange with the EdgeLock Enclave */
+struct se_msg_hdr {
+	u8 ver;
+	u8 size;
+	u8 command;
+	u8 tag;
+}  __packed;
+
+#define SE_MU_HDR_SZ	4
+
+struct se_api_msg {
+	struct se_msg_hdr header;
+	u32 data[];
+};
+
+struct se_if_defines {
+	const u8 se_if_type;
+	u8 cmd_tag;
+	u8 rsp_tag;
+	u8 success_tag;
+	u8 base_api_ver;
+	u8 fw_api_ver;
+};
+
+struct se_if_priv {
+	struct device *dev;
+
+	struct se_clbk_handle cmd_receiver_clbk_hdl;
+	/*
+	 * Update to the waiting_rsp_dev, to be protected
+	 * under se_if_cmd_lock.
+	 */
+	struct se_clbk_handle waiting_rsp_clbk_hdl;
+	/*
+	 * prevent new command to be sent on the se interface while previous
+	 * command is still processing. (response is awaited)
+	 */
+	struct mutex se_if_cmd_lock;
+
+	struct mbox_client se_mb_cl;
+	struct mbox_chan *tx_chan, *rx_chan;
+
+	struct gen_pool *mem_pool;
+	const struct se_if_defines *if_defs;
+};
+
+char *get_se_if_name(u8 se_if_id);
+#endif
diff --git a/include/linux/firmware/imx/se_api.h b/include/linux/firmware/imx/se_api.h
new file mode 100644
index 000000000000..b1c4c9115d7b
--- /dev/null
+++ b/include/linux/firmware/imx/se_api.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef __SE_API_H__
+#define __SE_API_H__
+
+#include <linux/types.h>
+
+#define SOC_ID_OF_IMX8ULP		0x084d
+#define SOC_ID_OF_IMX93			0x9300
+
+#endif /* __SE_API_H__ */

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010047.outbound.protection.outlook.com [52.101.84.47])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C79C429B775;
	Wed,  3 Dec 2025 06:49:36 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.47
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744578; cv=fail; b=kA766zIqB73imAdccWZhos8N2BUMwVzhAi9AVCwnWeZINkD+edFilKmuyxMzIiXh8ZvbBAWp2QcSSuYj6hIKnqdFC/eeILEQZYtAh4zZjJlQi6nApEY2jgdZXkA5iVzNHslyC8nZiEc1IaeqimumVtleXxssqJBzOL0La/zs9/k=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744578; c=relaxed/simple;
	bh=7QEuAhxOIw0u2oO8DRHrZP/iK1N7H24f44E0a+y4C1Y=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=RgRGaBb3SvESR4wBrFUqO/YJ03wNHOj1EmF6YRVoJHR2+uuhyd3vt7na7pGEoZhi7jCl0H7CV6FjvL/2ntZ3jDxOoEMtiDObotPv17fp0L4bF4WpOq79YFbtnx3uMGGVQ7wO9Md9T1naIalDgDt2efNxIXm7BGXdvjxvEi9rcVM=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=UvE0iZz0; arc=fail smtp.client-ip=52.101.84.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="UvE0iZz0"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=K8tPrT4FYfTeXJgXbrzQ36yJ6a8Ke0ggAgp+iA9llynFmVo+vigByspycegQQvEUH/WGEo9A3nOE2omb/PLESpzEGnqz5Q2RuABYAptCLHm+v0EcbR5BNilfdg/IBODtFv63FLyqtDvkrmZDjdwrokOkURz0EV+WyPQwFztRuFqU5wddQbgTQ45/hthly7syFlyxRY5dY8dO8sfeAbLoW0YMGvsRM+EDCFLGxi7EpzR9X7pjyIsvt8cxOawpRlfgMo0zwV3AClox0n4bshemWbASZu39iuoLmf3SD/JB7QKkBS6/gYi834qlxzhKtSQghTpIAWsYkr8zIQ3N1OphvA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=XaQYmFXhZmj9KETYFrL1rTXvxZAHd+VSOAIQc0lwt8o=;
 b=Pp39J26nJjmMpsGtOSQfXRtlYphK3GjmSLpfz0eG/JdL0cLt9xOsAN11+6thDIRcxPpjOf94qACSkaoz973wAVtGHpUMP2+/V5muuh27U8clQqewtD7M7DUEMWU0TAXTXBV6yrI5QrSGQtsUz+pnkOk38pdP0aNR1exn8dNpdVZGNI3Mgh8QhJJI3gWzO03TbKkMqN1AUh5mLNxCcmDMciHVMkbRdaliOyVy596wqARUDeMgFYCyY44P6gJHYFrWYmGlhOAPBSHxfwy40OpGyuxk912p/BnU3bffGEVUwkq3flG+lNW2miNMjoxNuG6D4Jhd4+ft11LD3Fh0yWXJyQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=XaQYmFXhZmj9KETYFrL1rTXvxZAHd+VSOAIQc0lwt8o=;
 b=UvE0iZz0iQGKG4tg9y1sbFK6eAqAElO+qnmnlpyHQc3Qj9ks3FpX4ZuFkrySafRX9t37Vpgwrq9J606WHN6C5kFBXhv7BsN5T3Y0KaTg5FspIFJP6RnFRfgyblOGKVPJaAjjNcuZyo1gXbtDFFNPHyiQJLbvBzX/hFK01zrA/dGExcmJpvf39JEsWIsqH+jpkhErw1B1lfaOUG/fOCtjbD2F0L+Yv2RXbwwwOxt7pywUIPM8L/jHhTkAakIGL+UA0KrtJKf6ufT0K05tbvnvaCnHiv5QEJAaOJLW3KF8X0KyZaQRMJxTqVPy0rLweVn2p9JR5KJTfICwTdkrNgREVA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:32 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:32 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:11 +0530
Subject: [PATCH v20 6/7] arm64: dts: imx8ulp: add secure enclave node
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-6-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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, Frank Li <Frank.Li@nxp.com>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=1320;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=7QEuAhxOIw0u2oO8DRHrZP/iK1N7H24f44E0a+y4C1Y=;
 b=3o4TdG4nyKMFxgiIlwX/0iB7z2jxH2vj8IrfGCy3aUkUpkpqzppHIjWnFY3DywTC55t9VWBX4
 cs0oi1cHqroCn8SDWXMynT38GjNsOWldKfVTP5IQmuHFiLn19URstnQ
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: 2e64e6cf-081a-4355-a3f3-08de32381d36
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?Y3UzUUZZSUVGa3lSQUpTc3dlTTU2d0MzRTN2akRaUlRrck56YWtOdjh1dy9L?=
 =?ut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?utf-8?B?ZWpBdDg2ZjJwZ0RDQm1ldTh6MmtraTR1V1VIK0xuMnUvaTJsOXdheEMya0s5?=
 =?utf-8?B?WHNKVWFRMjMyc2l4eFM3Skk0SmRHNFhqVjlGQlVtaVZZbk50R2ZENTVwUjA4?=
 =?utf-8?B?YUpVdTlpTDV5cTNQQVZOMFYzYjlObnBQWkVGZCt5WVZ6TFBXMjh5NjFya0Q0?=
 =?utf-8?B?RzVBLzBCdEpJNVZwZ3FERVBpMUg5eHRrVHRFTFJ3bThZNTUvSWlXMlQxanVV?=
 =?utf-8?Q?fseQgG?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?bS8xeVJzV3prVjZjUlIveVp2VlJwaHg4ek1TcG1MbWdieTUrQ3Vsb3BxOFM5?=
 =?utf-8?B?TVhXaW1GdWJDYlU3TVlHdTNHcmlIeWRVTkUvSEFDWVpMN2hiUll1YmtDOTU4?=
 =?utf-8?B?TCtydlhCbE83c2pIZ0xjVEE0b2NuVGpROEpEVjA0Qk5MMjlBNWd4Qmxld0ZN?=
 =?utf-8?B?OVFZczNNdnZGdGNPWTY0RjZwc0txN0tGVVN2TFdKd2tPUTZqb21kc0FmM0dF?=
 =?utf-8?B?eDNqdjZXVXgzazhoem5GZUZleUluNElYQnF4SGZ1YjRIRndYM1ZUeHk0bEZx?=
 =?utf-8?B?aHk2aERxQ0Q2a29RanA2dUJ3c1ExZituNGZYZG9yYW16SWRGeEM1WjErVXR5?=
 =?utf-8?B?YVB1WXBVY3VGTWVwYkR6R3dnWWhpSGVrVjJsN0JCY05sNXlYUXlxU3l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Bw?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 2e64e6cf-081a-4355-a3f3-08de32381d36
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:32.3812
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: iFHngN3BAamorX/B0NiduMbsWkt+fWs2SiGnXOxt5c8iJKietMQfnsL7Qn0PRfd/wklxz+VM8PjA1XY0GlohRA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

Add support for NXP secure enclave called EdgeLock Enclave firmware (se-fw)
for imx8ulp-evk.

Add label sram0 for sram@2201f000 and add secure-enclave node

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi
index 13b01f3aa2a4..10a4779dd24c 100644
--- a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright 2021 NXP
+ * Copyright 2021, 2025 NXP
  */
 
 #include <dt-bindings/clock/imx8ulp-clock.h>
@@ -154,7 +154,7 @@ sosc: clock-sosc {
 		#clock-cells = <0>;
 	};
 
-	sram@2201f000 {
+	sram0: sram@2201f000 {
 		compatible = "mmio-sram";
 		reg = <0x0 0x2201f000 0x0 0x1000>;
 
@@ -186,6 +186,13 @@ scmi_sensor: protocol@15 {
 				#thermal-sensor-cells = <1>;
 			};
 		};
+
+		hsm0: secure-enclave {
+			 compatible = "fsl,imx8ulp-se-ele-hsm";
+			 mbox-names = "tx", "rx";
+			 mboxes = <&s4muap 0 0>, <&s4muap 1 0>;
+			 sram = <&sram0>;
+		 };
 	};
 
 	cm33: remoteproc-cm33 {

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010055.outbound.protection.outlook.com [52.101.84.55])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9188529E10C;
	Wed,  3 Dec 2025 06:49:40 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.55
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744582; cv=fail; b=izs0t8Uec6ZtLWDI2g+Ydf2EGbzNYd8h+PHa4HWmq8063O84GHeRlacziDhWWEZJMXyf4GK/v1f/biaNHhvTjplBbTG6+ULMxZGC/EyNlgKRWGnCfOkJxTCe+rFX2He6yknUCdH2EE8i89GDOGOhJdj3AnD3dWwD/b8EY6P1h20=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744582; c=relaxed/simple;
	bh=C+/byolstUK3qbG2fKo1MZ04D0IETXzzliSh+5Ny0lw=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=GSGL2sHsDZBoB/yTZdF96RTsj+pWRZAo+T8JWzpcpPozb2h72/vaXuYUmh3Xyx/YUPMkRYDxWsGB8YuPll09AkiDJS1p8f0JcpdW4F9X1OVfhv/LFNS68bgCj2isVqJatSquoMTN2lb7kqHDMEBkQWMTWnKCPpNfg+BU80jRdtU=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=LzQoi2ab; arc=fail smtp.client-ip=52.101.84.55
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="LzQoi2ab"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=ahruP8Zo0a2c5T4rXyVPCVufRWF30Xm+yxbyak5jOjNEvUCpXJ+LAzDDbER/kYpPR6wTjMROEEMIIUFtGRPXLH05dQrQNa4v+aqDGVM7yyi4ocfNrmNlP3sG/NsTqnJ904+RobtCqi1R4vNgaReqFYDHVG/JTaxkv2AWGIoFUsE/rdHAXHULqyWYI+GowcJpQgDlRtgJqZbSmtjpTWlKb6wGbhkFHsmMSn2ER9n/skpbiCfM0/XAO1NzhhZmEWLBUQmhaa5dXQ2BqvFu6Y2Ez0K1ZYLNHam3hr5vJukhr19gKFlggTi+WWBFij21PwoXueSdjzb4HaCvA59fu5oTjA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=twxCJtmU2KZ98rqCXb/Uh81mNSAdCjdLoHTNJdLz9Gg=;
 b=Hy3qzh2qFHe4dvFDjID/3cYu28lF+XOqvG3LAwSGF1wqdxsS1K9n/5+5hitl9uesu8m6CDnkdOczseODfrzdOJ5XTK6q+G+UIhDCmPOm0Y6qNtVYQDQsdFH1ViAeyowsMgqwv0PSVjU8wUUf1w/2hiec5J9fiKJ6dFC2BNF8Bd7mS6kpgH+fM6J9NGxoY7Fpje/1tf0oe7yuiZnn9mD4da/waZmtoydT8czA4rnKtXBjGIN7U1P0fj2pk+2w1QX2cUtf9f4izsMvs15xz0mDTb03GaTUhUPfhx81pFSdsljF1t9tE08zJwhXQVBhVHRzWnUZj9v/fsApKtd0XrWB/w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=twxCJtmU2KZ98rqCXb/Uh81mNSAdCjdLoHTNJdLz9Gg=;
 b=LzQoi2ab/owJWWWwbYcXOJaGnIoXEC8PvOt9DJHG1sNrK7bGtstcISoTAvDbE6dWf3+byBV0DhNL4dd/na7Br8iaK7pXmKpkaqq0lgRKsbMWxTvaNK1crH/DuDtqRQIx0d26s1b3LcWIw00SVvmfbm25JgyYi67iSfVVaIow+mSI/GAXABAas7u4BeeA3KnA3GIAuZak3AIy8NjTfwQKSByExnvSzFtC/CWQXItCwbyT31mFEGvZ43UElKgGCOONejlM/faj9oX8EjpcNB+jH/uB+CW7AemmBqOylaXAkB9a4AHXpzkVZzBigVoAbTqzs5D3nZeczGAS3m8aMfwdYA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:36 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:36 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:12 +0530
Subject: [PATCH v20 7/7] arm64: dts: imx8ulp-evk: add reserved memory
 property
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-7-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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, Frank Li <Frank.Li@nxp.com>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=1279;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=C+/byolstUK3qbG2fKo1MZ04D0IETXzzliSh+5Ny0lw=;
 b=dePRSY6U2cAhR7P/Nlz6XVzCpYQE3Y5cUpd94c7xGrQxmyyvfzJm3Bdwr0CWVKMUNGLPsnXPM
 3iIZgvC9jwkCXEMHqY4GSjv0+7lSBQhAaT4Q+AYuZqEN3z/Fi6oFMPU
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: a8961fbd-d00b-467e-8792-08de32381fc9
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?utf-8?B?OU4vNGRmbkVFZTdNcnY4TGV6VFMrcTBuQ1hMRTZoVDhiQ09OQjRkMUhwbjB0?=
 =?utf-8?B?TlhMV2ZXMm02d2lLS0g2SWkxNEVndkR5ZTRaWTJsb2ovOFRyaGhWNVRaYmN0?=
 =?utf-8?B?czV2S2tacTMrV2lsNHlxY1c2Y29yZHpDdm9EdFdFYUxWRDFVOHFnRmh1Vi9C?=
 =?utf-8?B?VE1yV09JRk16enVTenEyenlNakRJdzJnVjI3aUZqVTdWa2ErYnJ1aUtRNnhN?=
 =?utf-8?B?Uy9Ra0lYYVpxUU5uTFlMM1ZCUXFMcWZrdGt0djEvYzBvclo3dDNVTVh2M0oz?=
 =?utf-8?B?dEh1K2c3RXRyMkVFNU9SRnB6ZDNzOVp4YldNakExdDdjZmV4dDVyR2wvT0Jr?=
 =?utf-8?B?ajFVd2pDeEVkeWhXSGlPTXZPdCs4dDMvWkZ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04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?RXhmSTVoUG5wTUw2OXBUVStwelU4UHA5dkJiYnZ0WTBEbVZybWF4ekpMWGJZ?=
 =?utf-8?B?REo3eFNKT2Iwc0xhTUw0ZDNNZGxBMEQyOHQxL3kwZXRiOEdrMjRDbDA2NG5L?=
 =?utf-8?B?aGxMbm84QndtQjhaTWpxU3ovbXVpWU14OEZoR2xBa0VkL1VxK2R1V3pjRnRG?=
 =?utf-8?B?MWprOFFESHRWdHZQYVBBZWpKMmlZTGkvd09aYUM1dy9JbG01eDdmYk1zWUhD?=
 =?utf-8?B?OFU4dHppUlAwcGw5OG95WVVUNyt2UllhVFRPV0pGNjdLUHFwTVJlbGo1b1RO?=
 =?utf-8?B?REZhTlh1UHBwMnRZL2tYQ00vRXBONnQ4NjFxZGc4bmk0TlhlaVFSWjY2Wm03?=
 =?utf-8?B?ZlVCMGxOd0Q3dmRzc1JDZzZsTmZjUFg1SGc5T2FOQ0NyaTYwNjZ4UGpjanFW?=
 =?utf-8?B?ZUFVL0pjdElWSkZETW5UUzk2YU9GNVJEOHpMZmJpM3BFSEc5NjFFQlpjL05N?=
 =?utf-8?B?QlJCczV6bTZJUjdTTDRVeTl1QjVJandsSG82V0FZeElkMHUxbDVaSE5GZjBB?=
 =?utf-8?B?TlhpODUxLzlqdTU4WXhualpTaFBac1pzeUxoV1M4WndNR0x0RVhhc1ViZm5Q?=
 =?utf-8?B?dkF1elJpQUNEc3BZR3NwK05OOTBlSGRpUU56dTZIV0orTWRzL1B5alhXQWsv?=
 =?utf-8?B?c2ZDSkZEVnNmRUllQ05DdXIxanBHSEI4WWRnV0gwUnQ1WWNDVnhadFhTME5a?=
 =?utf-8?B?L0hrS3UvSUpY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QyZGlPVStSNnErQm1Z?=
 =?utf-8?B?Uy9TM3ZPZGlpUUMwVWl3S2ZTRFh3RXNKUTVFS0xLazJDT1U2QTJWUUo1cFo2?=
 =?utf-8?B?K21ObHkwL3hmR1d2S0o2SXBiTXlBSHlKR3dFeFBGWGlmNEVVV2doMm5MTGNo?=
 =?utf-8?B?Qm03Zm0xS2xDd2ZLL3RlMDZwVzJXcEc5a3NucW9MUDFFR2VDV21pWTZDZ0Ur?=
 =?utf-8?B?WGs0eWZ4cklkYWFEc2xkQzcxclFla25PNWplUW03dmxYWHFDdVVQWHVBbTI5?=
 =?utf-8?B?WVJUR1gzcGdpMXdjdVJTZ2JoL2xsaEUwOTZ0YkQrSWF6OWtVNWsvZ0VNYVky?=
 =?utf-8?B?UnNMTjVzU2VjaFhta3ZzNUYrNWNoRGtOKzZMNndYRzZmdENEd0FCZlhtTStD?=
 =?utf-8?B?QS9ZdUVQZWJjcGdRRnFHZUF4aENSRWc2STNRNUlSWU1NVDNXOVB4eXZGc0NP?=
 =?utf-8?B?WHhhYzU2QU5XQ3l4UHhHL1E0SnlHejVtVmI2OVptUk1Ubms1MENRUlpKb0l2?=
 =?utf-8?Q?9BlGsNsbgfXkYuzXAraHVF00d?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: a8961fbd-d00b-467e-8792-08de32381fc9
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:36.6843
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: TPMnPLpYKEops+k6Vs0Df+koJSej0dZaDUO5KH5AR1AivQGwsfai0S9L6k9L5BJo1Tq204V/HOHqoOxheysf5A==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

Reserve 1MB of DDR memory region due to EdgeLock Enclave's hardware
limitation restricting access to DDR addresses from 0x80000000
to 0xafffffff.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8ulp-evk.dts | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts b/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts
index 290a49bea2f7..10aaf02f8ea7 100644
--- a/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8ulp-evk.dts
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright 2021 NXP
+ * Copyright 2021, 2025 NXP
  */
 
 /dts-v1/;
@@ -37,6 +37,12 @@ linux,cma {
 			linux,cma-default;
 		};
 
+		ele_reserved: memory@90000000 {
+			compatible = "shared-dma-pool";
+			reg = <0 0x90000000 0 0x100000>;
+			no-map;
+		};
+
 		m33_reserved: noncacheable-section@a8600000 {
 			reg = <0 0xa8600000 0 0x1000000>;
 			no-map;
@@ -259,6 +265,10 @@ &usdhc0 {
 	status = "okay";
 };
 
+&hsm0 {
+	memory-region = <&ele_reserved>;
+};
+
 &fec {
 	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&pinctrl_enet>;

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011060.outbound.protection.outlook.com [40.107.130.60])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73E4B29D26C;
	Wed,  3 Dec 2025 06:49:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.60
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764744575; cv=fail; b=ccl2x67iGrABlrqcI/wXbcdegDpgu5cd6jgvNde1VB4+kcSLclMlP3XJPpW1WsC+fJvonOb4hSFlLPS9lgOdhmNSkmjGr4JUhnFRPD8H0VuQfB3Cc7RCzRrL7NP+dCFvz9LP/yIQxhjSR8bVK7oUK7coDMKaQH946GcAomrf4L4=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764744575; c=relaxed/simple;
	bh=dyTY8f42gqeHcpeSMjX8ZBehxsXgPnhSsLPdyrwKMr4=;
	h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:
	 To:Cc:MIME-Version; b=FTQyUwIogfwnPZAFpJ4RHkM/azsAiKlec0q1Qv/jLxZIj4w6svQGT3fhh/80ercos425RuBPvrLbx0aY+iAD3W+rDO8QbwTUy2j5j4MDZZ1AwlsQpYpkH/na3aCvaezVZ5NXzuKrwv9haGQQmXoTxua75WPv6TrsH6Orgam09e8=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jzAebDob; arc=fail smtp.client-ip=40.107.130.60
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jzAebDob"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=w2BwzeU0/qOd/3Kg2/CMSIF2rLkpLCKUAGVzcvCRUjuClu9NIJeL3q4lV2bYdN7eqeQMmmzO5DhqgnX9+hztplLnnG2OCDvZSRtQ0yjege2EvCR/zrinouz04Pz398EA71s9mshNgtGTG9m0XH7A4tzBf+7zEq7nAFUF0lr/fQcyfbkSBHlb3xK/qAdQUU/Xjlr+GoGMoRvMDn8itZerFXAIoMWni/n0qF1v903cqMOY4778UZixU45IAf7V28aI0iqY9Ubah8Y4cBJbCn642i6cfxt3xP1Ps9wrwYy8hiTcnxc1aCstyXi5OazYegv+bTKcKEcbClvc7tMAbjUcTQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=8SfA+PLd6tFtj0x70r4El0ypxg45D3tDinWqgADov4U=;
 b=lbxs7X9E4yKCZVpRBYwQM5BA+BO80vyfei78UDyxqnfNExgZ38NnlYPjY5htxGfoxkTDJuC3bdC3x15T6AeMicVsIADZfxe9kUYcIFVOERkS/MsZsxekxgXYggzzqEl3DJBl7jqMZvD4OhqRjIPVWgp7anjYNvrVwAz3LOvpWrA+CyX3JNYKen4a9RPAhSyIILbXTD9H770+BawkynlHtCxuhM5cy6G5aeoBsCHfQxlF4p9yhSbyw/XOVPq6oP8+X06InG2pf4e/+SEIZ4HJXvUHIeInwajh/fQ+ReL/efSaz+JbQ+oaO2qwUIR4GzEpmuLYlVoE5pujc3Z2lVfhRA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=8SfA+PLd6tFtj0x70r4El0ypxg45D3tDinWqgADov4U=;
 b=jzAebDobcJ01JSZ7ZQ2crIbo94l+2riBhVUjBke5PfhPYzciCyFzFRK2j7rf4tPkLY8eLIRNnd7KyMxj9JoSGloFRf1KF2txI4oYGmOwU0dSBLPM4GPBQsPnc6XJivNNAhP10iYU3A3MAj0mwK4I5+1IcYICUMTtJowZwWToYtep0bmtDTKbACD5o5+1evvpF+TEeXep0pNx9KUZwwSI9GDH70FUFfniyYj6DeDWV9G9XfTQTO8PFdTDBP0Wx7iEvvkmYM2Lf+4f7D4mX56KBqSSIocgXVl81hkmC/YbnBWR3hGWnbfNPr3Bgm/lPBR2FBgwWMUyJ/C0iGudT2yMKA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by VI0PR04MB10758.eurprd04.prod.outlook.com (2603:10a6:800:25c::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Wed, 3 Dec
 2025 06:49:28 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 06:49:28 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
Date: Wed, 03 Dec 2025 12:18:10 +0530
Subject: [PATCH v20 5/7] firmware: drivers: imx: adds miscdev
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20251203-imx-se-if-v20-5-a04a25c4255f@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
In-Reply-To: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
To: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, 
 Krzysztof Kozlowski <krzk+dt@kernel.org>, 
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, 
 Sascha Hauer <s.hauer@pengutronix.de>, 
 Pengutronix Kernel Team <kernel@pengutronix.de>, 
 Fabio Estevam <festevam@gmail.com>, Pankaj Gupta <pankaj.gupta@nxp.com>
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, Frank Li <Frank.Li@nxp.com>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1764744504; l=38557;
 i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id;
 bh=dyTY8f42gqeHcpeSMjX8ZBehxsXgPnhSsLPdyrwKMr4=;
 b=Z8UetgwijcNGYLKvnMu8G0RyvqyXpntq0zYCGbaG57enpQj+bw70q9HWKqbrZV6wiDPBp/d9I
 dRQoWayO1OaCZ6aZoY6vwWxitSZQhaUeqra1WMxOl9cNC7UgiLpAcm6
X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519;
 pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg=
X-ClientProxiedBy: SI2P153CA0020.APCP153.PROD.OUTLOOK.COM
 (2603:1096:4:190::19) To AM9PR04MB8604.eurprd04.prod.outlook.com
 (2603:10a6:20b:43b::21)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|VI0PR04MB10758:EE_
X-MS-Office365-Filtering-Correlation-Id: d6893d83-34ce-4631-199d-08de32381a8b
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BC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BKbmlMcmpBcFRuVjcxbGM5TXBrS1hy?=
 =?utf-8?B?V3lCTUtpM0NUYmYwMlVTQW1VTHo5WmVmamZST2FTQkJzMVFObCtKVXFNeklL?=
 =?utf-8?B?aWJSek9obFZnYVdJVTR4QzI2WjN2enYyZE96eGJTcVptemFmdjlidTVuRmE2?=
 =?utf-8?B?T2ZoM25GYTBSQjFLdGNNZ0RJSUFuQVNNUUQ5NUdZRUk5MmRxd0QyNXJkell5?=
 =?utf-8?B?M1NWdG44Q3dDOHM3OU0xbWdxK1VkSUdSUTFtQ0dIaFRJclpyYkx6UmZhSkpq?=
 =?utf-8?B?SUJhUWx0dE5IRVE3WG1VVmprM3lHSUFaUGc5UmdXOWpxWXFCOHhkcWQvcEhF?=
 =?utf-8?B?K2o1WW1pbDNXUFlKNDdXd2ZDRWEyK1BQSWNGcnBObFhJUlVpWEsyMDlYelp4?=
 =?utf-8?B?QmM1Nkw0YUF6eGxBdWZjYlJsL2J0SWtIckdEdz09?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(13003099007)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?utf-8?B?M3F6VHFwWlhSYkN6bTVPa1pCZjRTT2I0Nmp4SkJVZjNKaWIyWDdFZHduTXpO?=
 =?utf-8?B?dDFPbFRvdkNyT3B4UEdnK05wWW5BeExUakN5eFFUd21aeVVVTTNuMXRlQU9E?=
 =?utf-8?B?aHl2ekJYRk50SC8zYmZwbkNJVXRyOXJjOUFTc1c2UEZvaWt1LzRvcXRmU3Mx?=
 =?utf-8?B?cHlKN1lCbDJqTDVDOG80MkswUjRoTnV5TUFteU03YjdadFhzdXlhOC9QYllC?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nVFU4TmdJMVZwTk9jVURSYmVr?=
 =?utf-8?B?R01LcWJBanZ2cWsyM1drUmxIV3NVYVRyU0pXODRMODV0VzFjZm9OenprVjNI?=
 =?utf-8?B?d1oxTUdNQ1M4QjFHR0xFK0ZUZWlZY3lML0FPckRBbmZlMFVwNnViTnFiOXho?=
 =?utf-8?Q?duuwa7e0l1+mui0tzSq8YXne2?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d6893d83-34ce-4631-199d-08de32381a8b
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 06:49:28.0445
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: Z/tsDYu2I9XlrmwfooNg9ViCzd6ioYlQq+1fFZECKAHZJu1Ci3KILdo47Nb2t3jKWQUxTq+XjhrqEULSwgDo4g==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10758

Adds the driver for communication interface to secure-enclave, that
enables 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://github.com/nxp-imx/imx-secure-enclave.git,
- i.MX Secure Middle-Ware:
  -- URL: https://github.com/nxp-imx/imx-smw.git

Following checks are performed on the incoming msg-header,
to block exchanging invalid arbitrary commands:
- maximum allowed words,
- check if command-tag & response-tag are valid
- version,
- command id validation check, to allow limited base-line API(s)
  and restrict following:
  - exchanging power management commands.
  - reset requests.
  - BBSM configuration requests.
  - re-initializing the FW.
  - RNG init
  - CAAM resource release management
  - SE's internal memory management.
from user-space.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
changes from v19 to v20
- adds a func "se_chk_tx_msg_hdr", to check the validity of
  the in-coming message from usersapce.
---
 Documentation/ABI/testing/se-cdev   |  43 +++
 drivers/firmware/imx/ele_base_msg.c |  28 ++
 drivers/firmware/imx/ele_base_msg.h |  20 +
 drivers/firmware/imx/ele_common.c   |  37 +-
 drivers/firmware/imx/ele_common.h   |   6 +
 drivers/firmware/imx/se_ctrl.c      | 741 +++++++++++++++++++++++++++++++++++-
 drivers/firmware/imx/se_ctrl.h      |  33 ++
 include/uapi/linux/se_ioctl.h       |  97 +++++
 8 files changed, 993 insertions(+), 12 deletions(-)

diff --git a/Documentation/ABI/testing/se-cdev b/Documentation/ABI/testing/se-cdev
new file mode 100644
index 000000000000..dad39ffd245a
--- /dev/null
+++ b/Documentation/ABI/testing/se-cdev
@@ -0,0 +1,43 @@
+What:		/dev/<se>_mu[0-9]+_ch[0-9]+
+Date:		Mar 2025
+KernelVersion:	6.8
+Contact:	linux-imx@nxp.com, pankaj.gupta@nxp.com
+Description:
+		NXP offers multiple hardware IP(s) for secure enclaves like EdgeLock-
+		Enclave(ELE), SECO. The character device file descriptors
+		/dev/<se>_mu*_ch* are the interface between userspace NXP's secure-
+		enclave shared library and the kernel driver.
+
+		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
+			- getting mu info
+			- setting a dev-ctx as receiver to receive all the commands from FW
+			- getting SoC info
+			- send command and receive command response
+
+		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
+		  wait_event_interruptible, that gets set by the registered mailbox callback
+		  function, indicating a message received from the firmware on message-
+		  unit.
+
+		write(2)
+		  Every write() to the opened character device context needs to acquire
+		  mailbox_lock before sending message on to the message unit.
+
+		close(2)
+		  Stops and frees up the I/O contexts that were associated
+		  with the file descriptor.
+
+Users:		https://github.com/nxp-imx/imx-secure-enclave.git,
+		https://github.com/nxp-imx/imx-smw.git
+		crypto/skcipher,
+		drivers/nvmem/imx-ocotp-ele.c
diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
index b233729dd13d..ef1d89204ceb 100644
--- a/drivers/firmware/imx/ele_base_msg.c
+++ b/drivers/firmware/imx/ele_base_msg.c
@@ -14,6 +14,34 @@
 
 #define FW_DBG_DUMP_FIXED_STR		"ELE"
 
+int ele_uapi_allowed_base_cmd(struct se_if_priv *priv,
+			      struct se_msg_hdr *header)
+{
+	switch (header->command) {
+	case ELE_PING_REQ: return 0;
+	case ELE_DEBUG_DUMP_REQ: return 0;
+	case ELE_OEM_AUTH_CONTAINER_REQ: return 0;
+	case ELE_OEM_VERIFY_IMAGE_REQ: return 0;
+	case ELE_OEM_REL_CONTAINER_REQ: return 0;
+	case ELE_FW_LIFE_CYCLE_REQ: return 0;
+	case ELE_READ_FUSE_REQ: return 0;
+	case ELE_GET_FW_VERS_REQ: return 0;
+	case ELE_RETURN_LIFE_CYCLE_REQ: return 0;
+	case ELE_GET_EVENT_REQ: return 0;
+	case ELE_COMMIT_REQ: return 0;
+	case ELE_GEN_KEY_BLOB_REQ: return 0;
+	case ELE_GET_FW_STATUS_REQ: return 0;
+	case ELE_XIP_DECRYPT_REQ: return 0;
+	case ELE_WRITE_FUSE: return 0;
+	case ELE_GET_INFO_REQ: return 0;
+	case ELE_DEV_ATTEST_REQ: return 0;
+	case ELE_WRITE_SHADOW_FUSE_REQ: return 0;
+	case ELE_READ_SHADOW_FUSE_REQ: return 0;
+	default:
+		return -EACCES;
+	}
+}
+
 int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info)
 {
 	struct se_api_msg *tx_msg __free(kfree) = NULL;
diff --git a/drivers/firmware/imx/ele_base_msg.h b/drivers/firmware/imx/ele_base_msg.h
index 8e5b015e99a2..f8fabac331fd 100644
--- a/drivers/firmware/imx/ele_base_msg.h
+++ b/drivers/firmware/imx/ele_base_msg.h
@@ -15,6 +15,24 @@
 
 #define ELE_NONE_VAL			0x0
 
+
+#define ELE_OEM_AUTH_CONTAINER_REQ	0x87
+#define ELE_OEM_VERIFY_IMAGE_REQ	0x88
+#define ELE_OEM_REL_CONTAINER_REQ	0x89
+#define ELE_FW_LIFE_CYCLE_REQ		0x95
+#define ELE_READ_FUSE_REQ		0x97
+#define ELE_GET_FW_VERS_REQ		0x9d
+#define ELE_RETURN_LIFE_CYCLE_REQ	0xa0
+#define ELE_GET_EVENT_REQ		0xa2
+#define ELE_COMMIT_REQ			0xa8
+#define ELE_GEN_KEY_BLOB_REQ		0xaf
+#define ELE_GET_FW_STATUS_REQ		0xc5
+#define ELE_XIP_DECRYPT_REQ		0xc6
+#define ELE_WRITE_FUSE                  0xd6
+#define ELE_DEV_ATTEST_REQ              0xdb
+#define ELE_WRITE_SHADOW_FUSE_REQ       0xf2
+#define ELE_READ_SHADOW_FUSE_REQ        0xf3
+
 #define ELE_GET_INFO_REQ		0xda
 #define ELE_GET_INFO_REQ_MSG_SZ		0x10
 #define ELE_GET_INFO_RSP_MSG_SZ		0x08
@@ -92,4 +110,6 @@ int ele_service_swap(struct se_if_priv *priv, phys_addr_t addr,
 int ele_fw_authenticate(struct se_if_priv *priv, phys_addr_t contnr_addr,
 			phys_addr_t img_addr);
 int ele_debug_dump(struct se_if_priv *priv);
+int ele_uapi_allowed_base_cmd(struct se_if_priv *priv,
+			      struct se_msg_hdr *header);
 #endif
diff --git a/drivers/firmware/imx/ele_common.c b/drivers/firmware/imx/ele_common.c
index f26fb4d55a9a..a6801c5ae4a8 100644
--- a/drivers/firmware/imx/ele_common.c
+++ b/drivers/firmware/imx/ele_common.c
@@ -6,6 +6,23 @@
 #include "ele_base_msg.h"
 #include "ele_common.h"
 
+int se_chk_tx_msg_hdr(struct se_if_priv *priv, struct se_msg_hdr *header)
+{
+	if (!header->size || header->size > MAX_WORD_SIZE)
+		return -EINVAL;
+
+	if (header->tag != priv->if_defs->cmd_tag &&
+	    header->tag != priv->if_defs->rsp_tag)
+		return -EINVAL;
+
+	if (header->ver == priv->if_defs->base_api_ver)
+		return ele_uapi_allowed_base_cmd(priv, header);
+	else if (header->ver == priv->if_defs->fw_api_ver)
+		return 0;
+
+	return -EINVAL;
+}
+
 /*
  * se_get_msg_chksum() - to calculate checksum word by word.
  *
@@ -42,15 +59,22 @@ u32 se_get_msg_chksum(u32 *msg, u32 msg_len)
 	return chksum;
 }
 
+void set_se_rcv_msg_timeout(struct se_if_priv *priv, u32 timeout_ms)
+{
+	priv->se_rcv_msg_timeout_ms = timeout_ms;
+}
+
 int ele_msg_rcv(struct se_if_device_ctx *dev_ctx, struct se_clbk_handle *se_clbk_hdl)
 {
-	unsigned long timeout;
+	unsigned long timeout_ms;
 	int ret;
 
 	do {
-		timeout = MAX_SCHEDULE_TIMEOUT;
+		timeout_ms = MAX_SCHEDULE_TIMEOUT;
+		if (dev_ctx->priv->cmd_receiver_clbk_hdl.dev_ctx != dev_ctx)
+			timeout_ms = msecs_to_jiffies(dev_ctx->priv->se_rcv_msg_timeout_ms);
 
-		ret = wait_for_completion_interruptible_timeout(&se_clbk_hdl->done, timeout);
+		ret = wait_for_completion_interruptible_timeout(&se_clbk_hdl->done, timeout_ms);
 		if (ret == -ERESTARTSYS) {
 			if (dev_ctx->priv->waiting_rsp_clbk_hdl.dev_ctx) {
 				dev_ctx->priv->waiting_rsp_clbk_hdl.signal_rcvd = true;
@@ -59,6 +83,13 @@ int ele_msg_rcv(struct se_if_device_ctx *dev_ctx, struct se_clbk_handle *se_clbk
 			ret = -EINTR;
 			break;
 		}
+		if (ret == 0) {
+			ret = -ETIMEDOUT;
+			dev_err(dev_ctx->priv->dev,
+				"Fatal Error: SE interface: %s0, hangs indefinitely.\n",
+				get_se_if_name(dev_ctx->priv->if_defs->se_if_type));
+			break;
+		}
 		ret = se_clbk_hdl->rx_msg_sz;
 		break;
 	} while (ret < 0);
diff --git a/drivers/firmware/imx/ele_common.h b/drivers/firmware/imx/ele_common.h
index 5bac14439d7d..bdc13d1b715d 100644
--- a/drivers/firmware/imx/ele_common.h
+++ b/drivers/firmware/imx/ele_common.h
@@ -12,6 +12,11 @@
 
 #define IMX_ELE_FW_DIR                 "imx/ele/"
 
+#define MAX_WORD_SIZE			0x20
+#define SE_RCV_MSG_DEFAULT_TIMEOUT	5000
+#define SE_RCV_MSG_LONG_TIMEOUT		5000000
+
+void set_se_rcv_msg_timeout(struct se_if_priv *priv, u32 val);
 u32 se_get_msg_chksum(u32 *msg, u32 msg_len);
 
 int ele_msg_rcv(struct se_if_device_ctx *dev_ctx, struct se_clbk_handle *se_clbk_hdl);
@@ -42,4 +47,5 @@ int se_save_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem);
 
 int se_restore_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem);
 
+int se_chk_tx_msg_hdr(struct se_if_priv *priv, struct se_msg_hdr *header);
 #endif /*__ELE_COMMON_H__ */
diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
index 40544cbc70ca..b8070be57d15 100644
--- a/drivers/firmware/imx/se_ctrl.c
+++ b/drivers/firmware/imx/se_ctrl.c
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/sys_soc.h>
+#include <uapi/linux/se_ioctl.h>
 
 #include "ele_base_msg.h"
 #include "ele_common.h"
@@ -32,12 +33,6 @@
 #define MBOX_TX_NAME			"tx"
 #define MBOX_RX_NAME			"rx"
 
-#define SE_TYPE_STR_DBG			"dbg"
-#define SE_TYPE_STR_HSM			"hsm"
-
-#define SE_TYPE_ID_DBG			0x1
-#define SE_TYPE_ID_HSM			0x2
-
 struct se_fw_img_name {
 	const u8 *prim_fw_nm_in_rfs;
 	const u8 *seco_fw_nm_in_rfs;
@@ -130,6 +125,13 @@ char *get_se_if_name(u8 se_if_id)
 	return NULL;
 }
 
+static u32 get_se_soc_id(struct se_if_priv *priv)
+{
+	const struct se_soc_info *se_info = device_get_match_data(priv->dev);
+
+	return se_info->soc_id;
+}
+
 static struct se_fw_load_info *get_load_fw_instance(struct se_if_priv *priv)
 {
 	return &var_se_info.load_fw;
@@ -203,8 +205,213 @@ static int get_se_soc_info(struct se_if_priv *priv, const struct se_soc_info *se
 	return 0;
 }
 
+static int load_firmware(struct se_if_priv *priv, const u8 *se_img_file_to_load)
+{
+	const struct firmware *fw = NULL;
+	phys_addr_t se_fw_phyaddr;
+	u8 *se_fw_buf;
+	int ret;
+
+	if (!se_img_file_to_load) {
+		dev_err(priv->dev, "FW image is not provided.");
+		return -EINVAL;
+	}
+	ret = request_firmware(&fw, se_img_file_to_load, priv->dev);
+	if (ret)
+		return ret;
+
+	dev_info(priv->dev, "loading firmware %s.", se_img_file_to_load);
+
+	/* allocate buffer to store the SE FW */
+	se_fw_buf = dma_alloc_coherent(priv->dev, fw->size, &se_fw_phyaddr, GFP_KERNEL);
+	if (!se_fw_buf) {
+		ret = -ENOMEM;
+		goto exit;
+	}
+
+	memcpy(se_fw_buf, fw->data, fw->size);
+	ret = ele_fw_authenticate(priv, se_fw_phyaddr, se_fw_phyaddr);
+	if (ret < 0) {
+		dev_err(priv->dev,
+			"Error %pe: Authenticate & load SE firmware %s.",
+			ERR_PTR(ret), se_img_file_to_load);
+		ret = -EPERM;
+	}
+	dma_free_coherent(priv->dev, fw->size, se_fw_buf, se_fw_phyaddr);
+exit:
+	release_firmware(fw);
+
+	return ret;
+}
+
+static int se_load_firmware(struct se_if_priv *priv)
+{
+	struct se_fw_load_info *load_fw = get_load_fw_instance(priv);
+	int ret = 0;
+
+	if (!load_fw->is_fw_tobe_loaded)
+		return 0;
+
+	if (load_fw->imem.state == ELE_IMEM_STATE_BAD) {
+		ret = load_firmware(priv, load_fw->se_fw_img_nm->prim_fw_nm_in_rfs);
+		if (ret) {
+			dev_err(priv->dev, "Failed to load boot firmware.");
+			return -EPERM;
+		}
+	}
+
+	ret = load_firmware(priv, load_fw->se_fw_img_nm->seco_fw_nm_in_rfs);
+	if (ret) {
+		dev_err(priv->dev, "Failed to load runtime firmware.");
+		return -EPERM;
+	}
+
+	load_fw->is_fw_tobe_loaded = false;
+
+	return ret;
+}
+
+static int init_se_shared_mem(struct se_if_device_ctx *dev_ctx)
+{
+	struct se_shared_mem_mgmt_info *se_shared_mem_mgmt = &dev_ctx->se_shared_mem_mgmt;
+	struct se_if_priv *priv = dev_ctx->priv;
+
+	INIT_LIST_HEAD(&se_shared_mem_mgmt->pending_out);
+	INIT_LIST_HEAD(&se_shared_mem_mgmt->pending_in);
+
+	/*
+	 * Allocate some memory for data exchanges with S40x.
+	 * This will be used for data not requiring secure memory.
+	 */
+	se_shared_mem_mgmt->non_secure_mem.ptr =
+			dma_alloc_coherent(priv->dev, MAX_DATA_SIZE_PER_USER,
+					   &se_shared_mem_mgmt->non_secure_mem.dma_addr,
+					   GFP_KERNEL);
+	if (!se_shared_mem_mgmt->non_secure_mem.ptr)
+		return -ENOMEM;
+
+	se_shared_mem_mgmt->non_secure_mem.size = MAX_DATA_SIZE_PER_USER;
+	se_shared_mem_mgmt->non_secure_mem.pos = 0;
+
+	return 0;
+}
+
+static void cleanup_se_shared_mem(struct se_if_device_ctx *dev_ctx)
+{
+	struct se_shared_mem_mgmt_info *se_shared_mem_mgmt = &dev_ctx->se_shared_mem_mgmt;
+	struct se_if_priv *priv = dev_ctx->priv;
+
+	/* Free non-secure shared buffer. */
+	dma_free_coherent(priv->dev, MAX_DATA_SIZE_PER_USER,
+			  se_shared_mem_mgmt->non_secure_mem.ptr,
+			  se_shared_mem_mgmt->non_secure_mem.dma_addr);
+
+	se_shared_mem_mgmt->non_secure_mem.ptr = NULL;
+	se_shared_mem_mgmt->non_secure_mem.dma_addr = 0;
+	se_shared_mem_mgmt->non_secure_mem.size = 0;
+	se_shared_mem_mgmt->non_secure_mem.pos = 0;
+}
+
+/* Need to copy the output data to user-device context.
+ */
+static int se_dev_ctx_cpy_out_data(struct se_if_device_ctx *dev_ctx)
+{
+	struct se_shared_mem_mgmt_info *se_shared_mem_mgmt = &dev_ctx->se_shared_mem_mgmt;
+	struct se_if_priv *priv = dev_ctx->priv;
+	struct se_buf_desc *b_desc, *temp;
+	bool do_cpy = true;
+
+	list_for_each_entry_safe(b_desc, temp, &se_shared_mem_mgmt->pending_out, link) {
+		if (b_desc->usr_buf_ptr && b_desc->shared_buf_ptr && do_cpy) {
+			dev_dbg(priv->dev, "Copying output data to user.");
+			if (do_cpy && copy_to_user(b_desc->usr_buf_ptr,
+						   b_desc->shared_buf_ptr,
+						   b_desc->size)) {
+				dev_err(priv->dev, "Failure copying output data to user.");
+				do_cpy = false;
+			}
+		}
+
+		if (b_desc->shared_buf_ptr)
+			memset(b_desc->shared_buf_ptr, 0, b_desc->size);
+
+		list_del(&b_desc->link);
+		kfree(b_desc);
+	}
+
+	return do_cpy ? 0 : -EFAULT;
+}
+
+/*
+ * Clean the used Shared Memory space,
+ * whether its Input Data copied from user buffers, or
+ * Data received from FW.
+ */
+static void se_dev_ctx_shared_mem_cleanup(struct se_if_device_ctx *dev_ctx)
+{
+	struct se_shared_mem_mgmt_info *se_shared_mem_mgmt = &dev_ctx->se_shared_mem_mgmt;
+	struct list_head *pending_lists[] = {&se_shared_mem_mgmt->pending_in,
+						&se_shared_mem_mgmt->pending_out};
+	struct se_buf_desc *b_desc, *temp;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(pending_lists); i++) {
+		list_for_each_entry_safe(b_desc, temp, pending_lists[i], link) {
+			if (b_desc->shared_buf_ptr)
+				memset(b_desc->shared_buf_ptr, 0, b_desc->size);
+
+			list_del(&b_desc->link);
+			kfree(b_desc);
+		}
+	}
+	se_shared_mem_mgmt->non_secure_mem.pos = 0;
+}
+
+static int add_b_desc_to_pending_list(void *shared_ptr_with_pos,
+				      struct se_ioctl_setup_iobuf *io,
+				      struct se_if_device_ctx *dev_ctx)
+{
+	struct se_shared_mem_mgmt_info *se_shared_mem_mgmt = &dev_ctx->se_shared_mem_mgmt;
+	struct se_buf_desc *b_desc;
+
+	b_desc = kzalloc(sizeof(*b_desc), GFP_KERNEL);
+	if (!b_desc)
+		return -ENOMEM;
+
+	b_desc->shared_buf_ptr = shared_ptr_with_pos;
+	b_desc->usr_buf_ptr = io->user_buf;
+	b_desc->size = io->length;
+
+	if (io->flags & SE_IO_BUF_FLAGS_IS_INPUT) {
+		/*
+		 * buffer is input:
+		 * add an entry in the "pending input buffers" list so
+		 * that copied data can be cleaned from shared memory
+		 * later.
+		 */
+		list_add_tail(&b_desc->link, &se_shared_mem_mgmt->pending_in);
+	} else {
+		/*
+		 * buffer is output:
+		 * add an entry in the "pending out buffers" list so data
+		 * can be copied to user space when receiving Secure-Enclave
+		 * response.
+		 */
+		list_add_tail(&b_desc->link, &se_shared_mem_mgmt->pending_out);
+	}
+
+	return 0;
+}
+
+/* interface for managed res to unregister a character device */
+static void if_misc_deregister(void *miscdevice)
+{
+	misc_deregister(miscdevice);
+}
+
 static int init_misc_device_context(struct se_if_priv *priv, int ch_id,
-				    struct se_if_device_ctx **new_dev_ctx)
+				    struct se_if_device_ctx **new_dev_ctx,
+				    const struct file_operations *se_if_fops)
 {
 	struct se_if_device_ctx *dev_ctx;
 	int ret = 0;
@@ -220,12 +427,517 @@ static int init_misc_device_context(struct se_if_priv *priv, int ch_id,
 	if (!dev_ctx->devname)
 		return -ENOMEM;
 
+	mutex_init(&dev_ctx->fops_lock);
+
 	dev_ctx->priv = priv;
 	*new_dev_ctx = dev_ctx;
 
+	dev_ctx->miscdev = devm_kzalloc(priv->dev, sizeof(*dev_ctx->miscdev), GFP_KERNEL);
+	if (!dev_ctx->miscdev) {
+		*new_dev_ctx = NULL;
+		return -ENOMEM;
+	}
+
+	dev_ctx->miscdev->name = dev_ctx->devname;
+	dev_ctx->miscdev->minor = MISC_DYNAMIC_MINOR;
+	dev_ctx->miscdev->fops = se_if_fops;
+	dev_ctx->miscdev->parent = priv->dev;
+	ret = misc_register(dev_ctx->miscdev);
+	if (ret)
+		return dev_err_probe(priv->dev, ret, "Failed to register misc device.");
+
+	ret = devm_add_action_or_reset(priv->dev, if_misc_deregister, dev_ctx->miscdev);
+	if (ret)
+		return dev_err_probe(priv->dev, ret,
+				     "Failed to add action to the misc-dev.");
 	return ret;
 }
 
+static int init_device_context(struct se_if_priv *priv, int ch_id,
+			       struct se_if_device_ctx **new_dev_ctx)
+{
+	struct se_if_device_ctx *dev_ctx;
+	int ret = 0;
+
+	dev_ctx = kzalloc(sizeof(*dev_ctx), GFP_KERNEL);
+
+	if (!dev_ctx)
+		return -ENOMEM;
+
+	dev_ctx->devname = kasprintf(GFP_KERNEL, "%s0_ch%d",
+				     get_se_if_name(priv->if_defs->se_if_type),
+				     ch_id);
+	if (!dev_ctx->devname) {
+		kfree(dev_ctx);
+		return -ENOMEM;
+	}
+
+	mutex_init(&dev_ctx->fops_lock);
+	dev_ctx->priv = priv;
+	*new_dev_ctx = dev_ctx;
+
+	list_add_tail(&dev_ctx->link, &priv->dev_ctx_list);
+	priv->active_devctx_count++;
+
+	ret = init_se_shared_mem(dev_ctx);
+	if (ret < 0) {
+		kfree(dev_ctx->devname);
+		kfree(dev_ctx);
+		*new_dev_ctx = NULL;
+	}
+
+	return ret;
+}
+
+static int se_ioctl_cmd_snd_rcv_rsp_handler(struct se_if_device_ctx *dev_ctx,
+					    u64 arg)
+{
+	struct se_ioctl_cmd_snd_rcv_rsp_info cmd_snd_rcv_rsp_info = {0};
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_api_msg *rx_msg __free(kfree) = NULL;
+	struct se_if_priv *priv = dev_ctx->priv;
+	int err = 0;
+
+	if (copy_from_user(&cmd_snd_rcv_rsp_info, (u8 __user *)arg,
+			   sizeof(cmd_snd_rcv_rsp_info))) {
+		dev_err(priv->dev,
+			"%s: Failed to copy cmd_snd_rcv_rsp_info from user.",
+			dev_ctx->devname);
+		err = -EFAULT;
+		goto exit;
+	}
+
+	if (cmd_snd_rcv_rsp_info.tx_buf_sz < SE_MU_HDR_SZ) {
+		dev_err(priv->dev, "%s: User buffer too small(%d < %d)",
+			dev_ctx->devname, cmd_snd_rcv_rsp_info.tx_buf_sz, SE_MU_HDR_SZ);
+		err = -ENOSPC;
+		goto exit;
+	}
+
+	err = se_chk_tx_msg_hdr(priv, (struct se_msg_hdr *)cmd_snd_rcv_rsp_info.tx_buf);
+	if (err)
+		goto exit;
+
+	rx_msg = kzalloc(cmd_snd_rcv_rsp_info.rx_buf_sz, GFP_KERNEL);
+	if (!rx_msg) {
+		err = -ENOMEM;
+		goto exit;
+	}
+
+	tx_msg = memdup_user(cmd_snd_rcv_rsp_info.tx_buf,
+			     cmd_snd_rcv_rsp_info.tx_buf_sz);
+	if (IS_ERR(tx_msg)) {
+		err = PTR_ERR(tx_msg);
+		goto exit;
+	}
+
+	if (tx_msg->header.tag != priv->if_defs->cmd_tag) {
+		err = -EINVAL;
+		goto exit;
+	}
+
+	if (tx_msg->header.ver == priv->if_defs->fw_api_ver &&
+	    get_load_fw_instance(priv)->is_fw_tobe_loaded) {
+		err = se_load_firmware(priv);
+		if (err) {
+			dev_err(priv->dev, "Could not send msg as FW is not loaded.");
+			err = -EPERM;
+			goto exit;
+		}
+	}
+	set_se_rcv_msg_timeout(priv, SE_RCV_MSG_LONG_TIMEOUT);
+
+	err = ele_msg_send_rcv(dev_ctx, tx_msg, cmd_snd_rcv_rsp_info.tx_buf_sz,
+			       rx_msg, cmd_snd_rcv_rsp_info.rx_buf_sz);
+	if (err < 0)
+		goto exit;
+
+	dev_dbg(priv->dev, "%s: %s %s.", dev_ctx->devname, __func__,
+		"message received, start transmit to user");
+
+	/* We may need to copy the output data to user before
+	 * delivering the completion message.
+	 */
+	err = se_dev_ctx_cpy_out_data(dev_ctx);
+	if (err < 0)
+		goto exit;
+
+	/* Copy data from the buffer */
+	print_hex_dump_debug("to user ", DUMP_PREFIX_OFFSET, 4, 4, rx_msg,
+			     cmd_snd_rcv_rsp_info.rx_buf_sz, false);
+
+	if (copy_to_user(cmd_snd_rcv_rsp_info.rx_buf, rx_msg,
+			 cmd_snd_rcv_rsp_info.rx_buf_sz)) {
+		dev_err(priv->dev, "%s: Failed to copy to user.", dev_ctx->devname);
+		err = -EFAULT;
+	}
+
+exit:
+
+	/* shared memory is allocated before this IOCTL */
+	se_dev_ctx_shared_mem_cleanup(dev_ctx);
+
+	if (copy_to_user((void __user *)arg, &cmd_snd_rcv_rsp_info,
+			 sizeof(cmd_snd_rcv_rsp_info))) {
+		dev_err(priv->dev, "%s: Failed to copy cmd_snd_rcv_rsp_info from user.",
+			dev_ctx->devname);
+		err = -EFAULT;
+	}
+
+	return err;
+}
+
+static int se_ioctl_get_mu_info(struct se_if_device_ctx *dev_ctx,
+				u64 arg)
+{
+	struct se_if_priv *priv = dev_ctx->priv;
+	struct se_ioctl_get_if_info if_info;
+	struct se_if_node *if_node;
+	int err = 0;
+
+	if_node = container_of(priv->if_defs, typeof(*if_node), if_defs);
+
+	if_info.se_if_id = 0;
+	if_info.interrupt_idx = 0;
+	if_info.tz = 0;
+	if_info.did = 0;
+	if_info.cmd_tag = priv->if_defs->cmd_tag;
+	if_info.rsp_tag = priv->if_defs->rsp_tag;
+	if_info.success_tag = priv->if_defs->success_tag;
+	if_info.base_api_ver = priv->if_defs->base_api_ver;
+	if_info.fw_api_ver = priv->if_defs->fw_api_ver;
+
+	dev_dbg(priv->dev, "%s: info [se_if_id: %d, irq_idx: %d, tz: 0x%x, did: 0x%x].",
+		dev_ctx->devname, if_info.se_if_id, if_info.interrupt_idx, if_info.tz,
+		if_info.did);
+
+	if (copy_to_user((u8 __user *)arg, &if_info, sizeof(if_info))) {
+		dev_err(priv->dev, "%s: Failed to copy mu info to user.",
+			dev_ctx->devname);
+		err = -EFAULT;
+	}
+
+	return err;
+}
+
+/*
+ * Copy a buffer of data to/from the user and return the address to use in
+ * messages
+ */
+static int se_ioctl_setup_iobuf_handler(struct se_if_device_ctx *dev_ctx,
+					u64 arg)
+{
+	struct se_shared_mem *shared_mem = NULL;
+	struct se_ioctl_setup_iobuf io = {0};
+	int err = 0;
+	u32 pos;
+
+	if (copy_from_user(&io, (u8 __user *)arg, sizeof(io))) {
+		dev_err(dev_ctx->priv->dev, "%s: Failed copy iobuf config from user.",
+			dev_ctx->devname);
+		return -EFAULT;
+	}
+
+	dev_dbg(dev_ctx->priv->dev, "%s: io [buf: %p(%d) flag: %x].", dev_ctx->devname,
+		io.user_buf, io.length, io.flags);
+
+	if (io.length == 0 || !io.user_buf) {
+		/*
+		 * Accept NULL pointers since some buffers are optional
+		 * in FW commands. In this case we should return 0 as
+		 * pointer to be embedded into the message.
+		 * Skip all data copy part of code below.
+		 */
+		io.ele_addr = 0;
+		goto copy;
+	}
+
+	/* No specific requirement for this buffer. */
+	shared_mem = &dev_ctx->se_shared_mem_mgmt.non_secure_mem;
+
+	/* Check there is enough space in the shared memory. */
+	dev_dbg(dev_ctx->priv->dev, "%s: req_size = %d, max_size= %d, curr_pos = %d",
+		dev_ctx->devname, round_up(io.length, 8u), shared_mem->size,
+		shared_mem->pos);
+
+	if (shared_mem->size < shared_mem->pos ||
+	    round_up(io.length, 8u) > (shared_mem->size - shared_mem->pos)) {
+		dev_err(dev_ctx->priv->dev, "%s: Not enough space in shared memory.",
+			dev_ctx->devname);
+		return -ENOMEM;
+	}
+
+	/* Allocate space in shared memory. 8 bytes aligned. */
+	pos = shared_mem->pos;
+	shared_mem->pos += round_up(io.length, 8u);
+	io.ele_addr = (u64)shared_mem->dma_addr + pos;
+
+	memset(shared_mem->ptr + pos, 0, io.length);
+	if ((io.flags & SE_IO_BUF_FLAGS_IS_INPUT) ||
+	    (io.flags & SE_IO_BUF_FLAGS_IS_IN_OUT)) {
+		/*
+		 * buffer is input:
+		 * copy data from user space to this allocated buffer.
+		 */
+		if (copy_from_user(shared_mem->ptr + pos, io.user_buf, io.length)) {
+			dev_err(dev_ctx->priv->dev,
+				"%s: Failed copy data to shared memory.",
+				dev_ctx->devname);
+			return -EFAULT;
+		}
+	}
+
+	err = add_b_desc_to_pending_list(shared_mem->ptr + pos, &io, dev_ctx);
+	if (err < 0)
+		dev_err(dev_ctx->priv->dev, "%s: Failed to allocate/link b_desc.",
+			dev_ctx->devname);
+
+copy:
+	/* Provide the EdgeLock Enclave address to user space only if success.*/
+	if (copy_to_user((u8 __user *)arg, &io, sizeof(io))) {
+		dev_err(dev_ctx->priv->dev, "%s: Failed to copy iobuff setup to user.",
+			dev_ctx->devname);
+		err = -EFAULT;
+	}
+
+	return err;
+}
+
+/* IOCTL to provide SoC information */
+static int se_ioctl_get_se_soc_info_handler(struct se_if_device_ctx *dev_ctx, u64 arg)
+{
+	struct se_ioctl_get_soc_info soc_info;
+	int err = -EINVAL;
+
+	soc_info.soc_id = get_se_soc_id(dev_ctx->priv);
+	soc_info.soc_rev = var_se_info.soc_rev;
+
+	err = copy_to_user((u8 __user *)arg, (u8 *)(&soc_info), sizeof(soc_info));
+	if (err) {
+		dev_err(dev_ctx->priv->dev, "%s: Failed to copy soc info to user.",
+			dev_ctx->devname);
+		err = -EFAULT;
+	}
+
+	return err;
+}
+
+/*
+ * File operations for user-space
+ */
+
+/* Write a message to the MU. */
+static ssize_t se_if_fops_write(struct file *fp, const char __user *buf,
+				size_t size, loff_t *ppos)
+{
+	struct se_if_device_ctx *dev_ctx = fp->private_data;
+	struct se_api_msg *tx_msg __free(kfree) = NULL;
+	struct se_if_priv *priv = dev_ctx->priv;
+	int err;
+
+	dev_dbg(priv->dev, "%s: write from buf (%p)%zu, ppos=%lld.", dev_ctx->devname,
+		buf, size, ((ppos) ? *ppos : 0));
+
+	scoped_cond_guard(mutex_intr, return -EBUSY, &dev_ctx->fops_lock) {
+		if (dev_ctx != priv->cmd_receiver_clbk_hdl.dev_ctx)
+			return -EINVAL;
+
+		err = se_chk_tx_msg_hdr(priv, (struct se_msg_hdr *)buf);
+		if (err)
+			return err;
+
+		if (size < SE_MU_HDR_SZ) {
+			dev_err(priv->dev, "%s: User buffer too small(%zu < %d).",
+				dev_ctx->devname, size, SE_MU_HDR_SZ);
+			return -ENOSPC;
+		}
+
+		tx_msg = memdup_user(buf, size);
+		if (IS_ERR(tx_msg))
+			return PTR_ERR(tx_msg);
+
+		print_hex_dump_debug("from user ", DUMP_PREFIX_OFFSET, 4, 4,
+				     tx_msg, size, false);
+
+		err = ele_msg_send(dev_ctx, tx_msg, size);
+
+		return err;
+	}
+}
+
+/*
+ * Read a message from the MU.
+ * Blocking until a message is available.
+ */
+static ssize_t se_if_fops_read(struct file *fp, char __user *buf, size_t size,
+			       loff_t *ppos)
+{
+	struct se_if_device_ctx *dev_ctx = fp->private_data;
+	struct se_if_priv *priv = dev_ctx->priv;
+	int err;
+
+	dev_dbg(priv->dev, "%s: read to buf %p(%zu), ppos=%lld.", dev_ctx->devname,
+		buf, size, ((ppos) ? *ppos : 0));
+
+	scoped_cond_guard(mutex_intr, return -EBUSY, &dev_ctx->fops_lock) {
+		if (dev_ctx != priv->cmd_receiver_clbk_hdl.dev_ctx) {
+			err = -EINVAL;
+			goto exit;
+		}
+
+		err = ele_msg_rcv(dev_ctx, &priv->cmd_receiver_clbk_hdl);
+		if (err < 0) {
+			dev_err(priv->dev, "%s: Err[0x%x]:Interrupted by signal."
+				"Current active dev-ctx count = %d.",
+				dev_ctx->devname, err, dev_ctx->priv->active_devctx_count);
+			goto exit;
+		}
+
+		/* We may need to copy the output data to user before
+		 * delivering the completion message.
+		 */
+		err = se_dev_ctx_cpy_out_data(dev_ctx);
+		if (err < 0)
+			goto exit;
+
+		/* Copy data from the buffer */
+		print_hex_dump_debug("to user ", DUMP_PREFIX_OFFSET, 4, 4,
+				     priv->cmd_receiver_clbk_hdl.rx_msg,
+				     priv->cmd_receiver_clbk_hdl.rx_msg_sz,
+				     false);
+
+		if (copy_to_user(buf, priv->cmd_receiver_clbk_hdl.rx_msg,
+				 priv->cmd_receiver_clbk_hdl.rx_msg_sz)) {
+			dev_err(priv->dev, "%s: Failed to copy to user.",
+				dev_ctx->devname);
+			err = -EFAULT;
+		} else {
+			err = priv->cmd_receiver_clbk_hdl.rx_msg_sz;
+		}
+exit:
+		priv->cmd_receiver_clbk_hdl.rx_msg_sz = 0;
+
+		se_dev_ctx_shared_mem_cleanup(dev_ctx);
+
+		return err;
+	}
+}
+
+/* Open a character device. */
+static int se_if_fops_open(struct inode *nd, struct file *fp)
+{
+	struct miscdevice *miscdev = fp->private_data;
+	struct se_if_device_ctx *misc_dev_ctx;
+	struct se_if_device_ctx *dev_ctx;
+	struct se_if_priv *priv;
+	int err = 0;
+
+	priv = dev_get_drvdata(miscdev->parent);
+	misc_dev_ctx = priv->priv_dev_ctx;
+
+	scoped_cond_guard(mutex_intr, return -EBUSY, &misc_dev_ctx->fops_lock) {
+		priv->dev_ctx_mono_count++;
+		err = init_device_context(priv,
+					  priv->dev_ctx_mono_count ?
+					  priv->dev_ctx_mono_count
+					  : priv->dev_ctx_mono_count++,
+					  &dev_ctx);
+		if (err)
+			dev_err(priv->dev, "Failed[0x%x] to create dev-ctx.", err);
+		else
+			fp->private_data = dev_ctx;
+
+		return err;
+	}
+}
+
+/* Close a character device. */
+static int se_if_fops_close(struct inode *nd, struct file *fp)
+{
+	struct se_if_device_ctx *dev_ctx = fp->private_data;
+	struct se_if_priv *priv = dev_ctx->priv;
+
+	scoped_cond_guard(mutex_intr, return -EBUSY, &dev_ctx->fops_lock) {
+		/* check if this device was registered as command receiver. */
+		if (priv->cmd_receiver_clbk_hdl.dev_ctx == dev_ctx) {
+			priv->cmd_receiver_clbk_hdl.dev_ctx = NULL;
+			kfree(priv->cmd_receiver_clbk_hdl.rx_msg);
+			priv->cmd_receiver_clbk_hdl.rx_msg = NULL;
+		}
+
+		se_dev_ctx_shared_mem_cleanup(dev_ctx);
+		cleanup_se_shared_mem(dev_ctx);
+
+		priv->active_devctx_count--;
+		list_del(&dev_ctx->link);
+
+		kfree(dev_ctx->devname);
+		kfree(dev_ctx);
+	}
+
+	return 0;
+}
+
+/* IOCTL entry point of a character device */
+static long se_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
+{
+	struct se_if_device_ctx *dev_ctx = fp->private_data;
+	struct se_if_priv *priv = dev_ctx->priv;
+	long err;
+
+	/* Prevent race during change of device context */
+	scoped_cond_guard(mutex_intr, return -EBUSY, &dev_ctx->fops_lock) {
+		switch (cmd) {
+		case SE_IOCTL_ENABLE_CMD_RCV:
+			if (!priv->cmd_receiver_clbk_hdl.dev_ctx) {
+				if (!priv->cmd_receiver_clbk_hdl.rx_msg) {
+					priv->cmd_receiver_clbk_hdl.rx_msg =
+						kzalloc(MAX_NVM_MSG_LEN,
+							GFP_KERNEL);
+					if (!priv->cmd_receiver_clbk_hdl.rx_msg) {
+						err = -ENOMEM;
+						break;
+					}
+				}
+				priv->cmd_receiver_clbk_hdl.rx_msg_sz = MAX_NVM_MSG_LEN;
+				priv->cmd_receiver_clbk_hdl.dev_ctx = dev_ctx;
+				err = 0;
+			} else {
+				err = -EBUSY;
+			}
+			break;
+		case SE_IOCTL_GET_MU_INFO:
+			err = se_ioctl_get_mu_info(dev_ctx, arg);
+			break;
+		case SE_IOCTL_SETUP_IOBUF:
+			err = se_ioctl_setup_iobuf_handler(dev_ctx, arg);
+			break;
+		case SE_IOCTL_GET_SOC_INFO:
+			err = se_ioctl_get_se_soc_info_handler(dev_ctx, arg);
+			break;
+		case SE_IOCTL_CMD_SEND_RCV_RSP:
+			err = se_ioctl_cmd_snd_rcv_rsp_handler(dev_ctx, arg);
+			break;
+		default:
+			err = -EINVAL;
+			dev_dbg(priv->dev, "%s: IOCTL %.8x not supported.",
+				dev_ctx->devname, cmd);
+		}
+	}
+
+	return err;
+}
+
+/* Char driver setup */
+static const struct file_operations se_if_fops = {
+	.open		= se_if_fops_open,
+	.owner		= THIS_MODULE,
+	.release	= se_if_fops_close,
+	.unlocked_ioctl = se_ioctl,
+	.read		= se_if_fops_read,
+	.write		= se_if_fops_write,
+};
+
 /* interface for managed res to free a mailbox channel */
 static void if_mbox_free_channel(void *mbox_chan)
 {
@@ -246,7 +958,7 @@ static int se_if_request_channel(struct device *dev, struct mbox_chan **chan,
 	ret = devm_add_action_or_reset(dev, if_mbox_free_channel, t_chan);
 	if (ret)
 		return dev_err_probe(dev, -EPERM,
-				     "Failed to add-action for removal of mbox: %s\n",
+				     "Failed to add-action for removal of mbox: %s.",
 				     name);
 	*chan = t_chan;
 
@@ -255,6 +967,7 @@ static int se_if_request_channel(struct device *dev, struct mbox_chan **chan,
 
 static void se_if_probe_cleanup(void *plat_dev)
 {
+	struct se_if_device_ctx *dev_ctx, *t_dev_ctx;
 	struct platform_device *pdev = plat_dev;
 	struct se_fw_load_info *load_fw;
 	struct device *dev = &pdev->dev;
@@ -279,6 +992,13 @@ static void se_if_probe_cleanup(void *plat_dev)
 		load_fw->imem.buf = NULL;
 	}
 
+	if (priv->dev_ctx_mono_count) {
+		list_for_each_entry_safe(dev_ctx, t_dev_ctx, &priv->dev_ctx_list, link) {
+			list_del(&dev_ctx->link);
+			priv->active_devctx_count--;
+		}
+	}
+
 	/*
 	 * No need to check, if reserved memory is allocated
 	 * before calling for its release. Or clearing the
@@ -319,6 +1039,7 @@ static int se_if_probe(struct platform_device *pdev)
 	priv->se_mb_cl.tx_block		= false;
 	priv->se_mb_cl.knows_txdone	= true;
 	priv->se_mb_cl.rx_callback	= se_if_rx_callback;
+	set_se_rcv_msg_timeout(priv, SE_RCV_MSG_DEFAULT_TIMEOUT);
 
 	ret = se_if_request_channel(dev, &priv->tx_chan, &priv->se_mb_cl, MBOX_TX_NAME);
 	if (ret)
@@ -340,6 +1061,7 @@ static int se_if_probe(struct platform_device *pdev)
 					     "Unable to get sram pool = %s.",
 					     if_node->pool_name);
 	}
+	INIT_LIST_HEAD(&priv->dev_ctx_list);
 
 	if (if_node->reserved_dma_ranges) {
 		ret = of_reserved_mem_device_init(dev);
@@ -348,7 +1070,7 @@ static int se_if_probe(struct platform_device *pdev)
 					    "Failed to init reserved memory region.");
 	}
 
-	ret = init_misc_device_context(priv, 0, &priv->priv_dev_ctx);
+	ret = init_misc_device_context(priv, 0, &priv->priv_dev_ctx, &se_if_fops);
 	if (ret)
 		return dev_err_probe(dev, ret,
 				     "Failed[0x%x] to create device contexts.",
@@ -389,6 +1111,7 @@ static int se_suspend(struct device *dev)
 	struct se_fw_load_info *load_fw;
 	int ret = 0;
 
+	set_se_rcv_msg_timeout(priv, SE_RCV_MSG_DEFAULT_TIMEOUT);
 	load_fw = get_load_fw_instance(priv);
 
 	if (load_fw->imem_mgmt)
diff --git a/drivers/firmware/imx/se_ctrl.h b/drivers/firmware/imx/se_ctrl.h
index b5e7705e2f26..5fcdcfe3e8e5 100644
--- a/drivers/firmware/imx/se_ctrl.h
+++ b/drivers/firmware/imx/se_ctrl.h
@@ -14,6 +14,7 @@
 #define SE_MSG_WORD_SZ			0x4
 
 #define RES_STATUS(x)			FIELD_GET(0x000000ff, x)
+#define MAX_DATA_SIZE_PER_USER		(65 * 1024)
 #define MAX_NVM_MSG_LEN			(256)
 #define MESSAGING_VERSION_6		0x6
 #define MESSAGING_VERSION_7		0x7
@@ -37,10 +38,38 @@ struct se_imem_buf {
 	u32 state;
 };
 
+struct se_buf_desc {
+	u8 *shared_buf_ptr;
+	void __user *usr_buf_ptr;
+	u32 size;
+	struct list_head link;
+};
+
+struct se_shared_mem {
+	dma_addr_t dma_addr;
+	u32 size;
+	u32 pos;
+	u8 *ptr;
+};
+
+struct se_shared_mem_mgmt_info {
+	struct list_head pending_in;
+	struct list_head pending_out;
+
+	struct se_shared_mem non_secure_mem;
+};
+
 /* Private struct for each char device instance. */
 struct se_if_device_ctx {
 	struct se_if_priv *priv;
+	struct miscdevice *miscdev;
 	const char *devname;
+
+	/* process one file operation at a time. */
+	struct mutex fops_lock;
+
+	struct se_shared_mem_mgmt_info se_shared_mem_mgmt;
+	struct list_head link;
 };
 
 /* Header of the messages exchange with the EdgeLock Enclave */
@@ -89,6 +118,10 @@ struct se_if_priv {
 	const struct se_if_defines *if_defs;
 
 	struct se_if_device_ctx *priv_dev_ctx;
+	struct list_head dev_ctx_list;
+	u32 active_devctx_count;
+	u32 dev_ctx_mono_count;
+	u32 se_rcv_msg_timeout_ms;
 };
 
 char *get_se_if_name(u8 se_if_id);
diff --git a/include/uapi/linux/se_ioctl.h b/include/uapi/linux/se_ioctl.h
new file mode 100644
index 000000000000..0c948bdc8c26
--- /dev/null
+++ b/include/uapi/linux/se_ioctl.h
@@ -0,0 +1,97 @@
+/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause*/
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef SE_IOCTL_H
+#define SE_IOCTL_H
+
+#include <linux/types.h>
+
+#define SE_TYPE_STR_DBG			"dbg"
+#define SE_TYPE_STR_HSM			"hsm"
+#define SE_TYPE_ID_UNKWN		0x0
+#define SE_TYPE_ID_DBG			0x1
+#define SE_TYPE_ID_HSM			0x2
+/* IOCTL definitions. */
+
+struct se_ioctl_setup_iobuf {
+	void __user *user_buf;
+	__u32 length;
+	__u32 flags;
+	__u64 ele_addr;
+};
+
+struct se_ioctl_shared_mem_cfg {
+	__u32 base_offset;
+	__u32 size;
+};
+
+struct se_ioctl_get_if_info {
+	__u8 se_if_id;
+	__u8 interrupt_idx;
+	__u8 tz;
+	__u8 did;
+	__u8 cmd_tag;
+	__u8 rsp_tag;
+	__u8 success_tag;
+	__u8 base_api_ver;
+	__u8 fw_api_ver;
+};
+
+struct se_ioctl_cmd_snd_rcv_rsp_info {
+	__u32 __user *tx_buf;
+	int tx_buf_sz;
+	__u32 __user *rx_buf;
+	int rx_buf_sz;
+};
+
+struct se_ioctl_get_soc_info {
+	__u16 soc_id;
+	__u16 soc_rev;
+};
+
+/* IO Buffer Flags */
+#define SE_IO_BUF_FLAGS_IS_OUTPUT	(0x00u)
+#define SE_IO_BUF_FLAGS_IS_INPUT	(0x01u)
+#define SE_IO_BUF_FLAGS_USE_SEC_MEM	(0x02u)
+#define SE_IO_BUF_FLAGS_USE_SHORT_ADDR	(0x04u)
+#define SE_IO_BUF_FLAGS_IS_IN_OUT	(0x10u)
+
+/* IOCTLS */
+#define SE_IOCTL			0x0A /* like MISC_MAJOR. */
+
+/*
+ * ioctl to designated the current fd as logical-reciever.
+ * This is ioctl is send when the nvm-daemon, a slave to the
+ * firmware is started by the user.
+ */
+#define SE_IOCTL_ENABLE_CMD_RCV	_IO(SE_IOCTL, 0x01)
+
+/*
+ * ioctl to get the buffer allocated from the memory, which is shared
+ * between kernel and FW.
+ * Post allocation, the kernel tagged the allocated memory with:
+ *  Output
+ *  Input
+ *  Input-Output
+ *  Short address
+ *  Secure-memory
+ */
+#define SE_IOCTL_SETUP_IOBUF	_IOWR(SE_IOCTL, 0x03, struct se_ioctl_setup_iobuf)
+
+/*
+ * ioctl to get the mu information, that is used to exchange message
+ * with FW, from user-spaced.
+ */
+#define SE_IOCTL_GET_MU_INFO	_IOR(SE_IOCTL, 0x04, struct se_ioctl_get_if_info)
+/*
+ * ioctl to get SoC Info from user-space.
+ */
+#define SE_IOCTL_GET_SOC_INFO      _IOR(SE_IOCTL, 0x06, struct se_ioctl_get_soc_info)
+
+/*
+ * ioctl to send command and receive response from user-space.
+ */
+#define SE_IOCTL_CMD_SEND_RCV_RSP _IOWR(SE_IOCTL, 0x07, struct se_ioctl_cmd_snd_rcv_rsp_info)
+#endif

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C65F1E1A17;
	Wed,  3 Dec 2025 07:20:56 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764746456; cv=none; b=RwiuyMpRgN0wGuEcSg5RymC9x4iBuG7O27iX1Ue3/e583y+2WElQHXgDH2XeLhsFDGpuPr7t0kJ1+u6JsuHFMdgPJiYuRynzc7abZt9kuQcSCheeWiLtYV/HhaQfhPYZ90KnmAaxFNk9PLFIk5golOrzdXpz3DatyLXelYwjPso=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764746456; c=relaxed/simple;
	bh=n2EyRpFeVYxE7vm8PuEZf1jmg9XZDoeUxffl4a+3DT4=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=W6+g4g0lgEqbFy1ToOJTsBtTiPCEYkU/WUrhcSPiT6aW0VMLqlqEgOLH5aN9d++GJZ6oVAfU5Fu4y0qHJh+kmwmGEsv19kZlvSDi3x5IbSnwU8v0zav3v2Jc8fT0kbFdOURRC1iCjvcCahBapoCW7yERgM/VTf9zQhWVuTbBdSQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JQbLP0/z; arc=none smtp.client-ip=10.30.226.201
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JQbLP0/z"
Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9FF3C4CEFB;
	Wed,  3 Dec 2025 07:20:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
	s=k20201202; t=1764746455;
	bh=n2EyRpFeVYxE7vm8PuEZf1jmg9XZDoeUxffl4a+3DT4=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
	b=JQbLP0/zsLkqeTNv/0Gv8wh4GM70+sEjyTZ2U6a1Xo8vhlb4xymxjFPTsChqWmVEY
	 yu6AKQ2j7FRC1VtU6Jjp3wsYCblzE9dyDwBjV+gwD5/brnBtOOABIMQ2kJ9XRj5yRC
	 4mUoGp6bnu0guhrDoHe5DfLiDji0otKK8V5B3ggiiBzisE4SJ58YrbzoR8PkFkFDzG
	 qRQTIKXH9TSNy8jFykBM9FHFOWz/cLbFpalS/WInMIcoHIKRunSPjL/OVlyHckRoUH
	 /6CjaTtN2xqS10+iGHYzYQdE42LbCUAqPXu9cyn4QS7UweD3u6AHWqppbvCDh8yq7T
	 jNK7+moarRyHw==
Message-ID: <1ee383c7-ccbc-4c90-adf3-bfbe87fb6765@kernel.org>
Date: Wed, 3 Dec 2025 08:20:50 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock
 Enclave
To: Pankaj Gupta <pankaj.gupta@nxp.com>, Jonathan Corbet <corbet@lwn.net>,
 Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>,
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
 Sascha Hauer <s.hauer@pengutronix.de>,
 Pengutronix Kernel Team <kernel@pengutronix.de>,
 Fabio Estevam <festevam@gmail.com>
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, Frank Li <Frank.Li@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
 <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
From: Krzysztof Kozlowski <krzk@kernel.org>
Content-Language: en-US
Autocrypt: addr=krzk@kernel.org; keydata=
 xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
 cFgcqTT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tem/
 JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu
 4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB
 YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
 qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
 RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
 Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
 H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
 dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
 AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
 jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
 zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
 XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 03/12/2025 07:48, Pankaj Gupta wrote:
> Add driver for enabling MU based communication interface to secure-enclave.
> 
> 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 with Linux over single or multiple
> dedicated messaging unit(MU) based interface(s).
> Exists on i.MX SoC(s) like i.MX8ULP, i.MX93, i.MX95 etc.
> 
> For i.MX9x SoC(s) there is at least one dedicated ELE MU(s) for each
> world - Linux(one or more) and OPTEE-OS (one or more).
> 
> Other dependent kernel drivers will be:
> - NVMEM: that supports non-volatile devices like EFUSES,
>          managed by NXP's secure-enclave.
> 
> Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
>  drivers/firmware/imx/Kconfig        |  13 ++
>  drivers/firmware/imx/Makefile       |   2 +
>  drivers/firmware/imx/ele_base_msg.c | 269 ++++++++++++++++++++++++
>  drivers/firmware/imx/ele_base_msg.h |  95 +++++++++
>  drivers/firmware/imx/ele_common.c   | 333 ++++++++++++++++++++++++++++++
>  drivers/firmware/imx/ele_common.h   |  45 ++++
>  drivers/firmware/imx/se_ctrl.c      | 401 ++++++++++++++++++++++++++++++++++++
>  drivers/firmware/imx/se_ctrl.h      |  86 ++++++++
>  include/linux/firmware/imx/se_api.h |  14 ++
>  9 files changed, 1258 insertions(+)
> 
> diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
> index 127ad752acf8..5fe96299b704 100644
> --- a/drivers/firmware/imx/Kconfig
> +++ b/drivers/firmware/imx/Kconfig
> @@ -55,3 +55,16 @@ config IMX_SCMI_MISC_DRV
>  	  core that could provide misc functions such as board control.
>  
>  	  This driver can also be built as a module.
> +
> +config IMX_SEC_ENCLAVE
> +	tristate "i.MX Embedded Secure Enclave - EdgeLock Enclave Firmware driver."
> +	depends on IMX_MBOX && ARCH_MXC && ARM64
> +	select FW_LOADER
> +	default m if ARCH_MXC
> +
> +	help
> +	  Exposes APIs supported by the iMX Secure Enclave HW IP called:
> +	  - EdgeLock Enclave Firmware (for i.MX8ULP, i.MX93),
> +	    like base, HSM, V2X & 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.
> diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
> index 3bbaffa6e347..4412b15846b1 100644
> --- a/drivers/firmware/imx/Makefile
> +++ b/drivers/firmware/imx/Makefile
> @@ -4,3 +4,5 @@ obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
>  obj-${CONFIG_IMX_SCMI_CPU_DRV}	+= sm-cpu.o
>  obj-${CONFIG_IMX_SCMI_MISC_DRV}	+= sm-misc.o
>  obj-${CONFIG_IMX_SCMI_LMM_DRV}	+= sm-lmm.o
> +sec_enclave-objs		= se_ctrl.o ele_common.o ele_base_msg.o
> +obj-${CONFIG_IMX_SEC_ENCLAVE}	+= sec_enclave.o
> diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
> new file mode 100644
> index 000000000000..a070acbd895c
> --- /dev/null
> +++ b/drivers/firmware/imx/ele_base_msg.c
> @@ -0,0 +1,269 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#include <linux/types.h>
> +
> +#include <linux/completion.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/genalloc.h>
> +
> +#include "ele_base_msg.h"
> +#include "ele_common.h"
> +
> +#define FW_DBG_DUMP_FIXED_STR		"ELE"
> +
> +int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info)
> +{
> +	struct se_api_msg *tx_msg __free(kfree) = NULL;
> +	struct se_api_msg *rx_msg __free(kfree) = NULL;

No, don't use this syntax. This is explicitly discouraged.

NAK

Best regards,
Krzysztof

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010069.outbound.protection.outlook.com [52.101.84.69])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 190F634404B;
	Wed,  3 Dec 2025 16:59:48 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.84.69
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764781192; cv=fail; b=rhj/GyNUbdGChgSOi4t+S300DVGXAJyXmwu8wsS47GOKVweQiq7wHxZafnuJEJ6F6ac1XZGSkSnGWuTbMbX2idFAIQ2Uw4O/jY/ueKxiu6fH6xIJs0ZT5aUDChmfyrXAeSHybEvwEdNDYRn9E4Cq7xfWEKb3a7hYSoHPi+KRy6k=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764781192; c=relaxed/simple;
	bh=nOfC+t+h1frzSEwYZCSAJmMCUSsZr4vR4otNrYaJmLU=;
	h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
	 Content-Disposition:In-Reply-To:MIME-Version; b=GbkFrQMZQA1V7xb8qVnZBO6lrZQ/STwVyH+7E1nXqLqsjoXLCaDfQUPtMtZ79pYvWGbRHGp7z0RvUpCOy7N2gdMjlkLVjb/JeRhT4K3KZFN4lkECbxvp7MxDephpJ3PQ1ALA5fxXFGV1hr7+8s12Cqx7SzyJ/UsXg1vfU3v9L7Y=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ApXxy3hJ; arc=fail smtp.client-ip=52.101.84.69
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ApXxy3hJ"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=imakeSCcoX1JoWRF2ZWba6Ch+lxo6ogRN5AszwwDIuvX6CDvP5flhSrbtcZ7uc6oeeBP4fjOTise5c6yuL0VWZ63G9OGtdKkCIPQQITwYF+ymWhDrkymTUpvCOjTPgx6WFAmm+Sc49azU7XTWyZXVkaKspwGG1veeG12VoQUs3ExK6nYO5k+ve75s31/UccxXsdoaJr269+HUJqSgk4ur6M7UfvjqGsG/lu1CxquM4Vvy91MMRwM6/hr4L7BzjK1AvhT6xfLlQwMJIFKqj4O/T/AWVgP2iDicTFkg/XFm0McWdn8/j7h3iZRnUQozvlrBC47tUMrhoojlKZaqUjwXg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=7bFEI1FkgGwLfSUdSuZ9AYPmDLhMqaH5vCIWEuRaKoU=;
 b=XIo67cgM0DUlVHGRwdOagZLZPiGawAIC0tgBZibPbgUv/5+S2NGp8+RKiwazS2ArBPPGzPRuD6aXnnDgYNBnKqxnd9v22O6x08OtuG5QshCmM8liYRLBLtR1uAhwhTcez4Y31KY0amFPNyGn/q6DVgg2lGpO4Ms7DKpHf+EX/3pxOBhzDEeemAKVBCk31AlA5WI5gvUAI5y/Wbiopr+T8Bk/ZfNj3bV9Jw/0foXQrITN/VOnaDsJk5mu/EZE1l+ehDqFW2DPNdkJ+IjGsq1R0HFF5sa+hhLZVIzLNj0AWsZcWOlAILQChCvtUj0yYNhi7v2fMBIgnFUZNHWi+teIZA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=7bFEI1FkgGwLfSUdSuZ9AYPmDLhMqaH5vCIWEuRaKoU=;
 b=ApXxy3hJgHMJqcPQUjlzaJjobtLFR6M9J+IQwMM70snR1IG6b/44TXpy4X0aOKoVjSMUdPdCrbYdIdzG55kkPAj32Uv+TwHS9AR22/l99o+l4hu6TRoVYPiUpe2aOBheCQecmnVObUaxtyglcUAd7kQIPmOCVpIoG46eJho8a2aGG5HsRDP8X4jnV9yiE7susvAw9D60f8LeftSJBCVqPqDfVK+kngYiFy7cvESH1a/JNuo3guM2y+my8FwKq0P6zDKlIGPGWcV9a+hJWBcw+g5eHm0bMlRMlpZhPt7CZW3EW0atTGYUEgLu5m+E2C2gyxY4A9yWzIG/xwWSFiydzg==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
Received: from DU2PR04MB8951.eurprd04.prod.outlook.com (2603:10a6:10:2e2::22)
 by DB9PR04MB9776.eurprd04.prod.outlook.com (2603:10a6:10:4f0::18) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.17; Wed, 3 Dec
 2025 16:59:42 +0000
Received: from DU2PR04MB8951.eurprd04.prod.outlook.com
 ([fe80::753c:468d:266:196]) by DU2PR04MB8951.eurprd04.prod.outlook.com
 ([fe80::753c:468d:266:196%4]) with mapi id 15.20.9366.012; Wed, 3 Dec 2025
 16:59:42 +0000
Date: Wed, 3 Dec 2025 11:59:33 -0500
From: Frank Li <Frank.li@nxp.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Pankaj Gupta <pankaj.gupta@nxp.com>, Jonathan Corbet <corbet@lwn.net>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>, 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: Re: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock
 Enclave
Message-ID: <aTBsdW0lpZSCVsgp@lizhi-Precision-Tower-5810>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
 <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
 <1ee383c7-ccbc-4c90-adf3-bfbe87fb6765@kernel.org>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1ee383c7-ccbc-4c90-adf3-bfbe87fb6765@kernel.org>
X-ClientProxiedBy: PH7P221CA0026.NAMP221.PROD.OUTLOOK.COM
 (2603:10b6:510:32a::21) To DU2PR04MB8951.eurprd04.prod.outlook.com
 (2603:10a6:10:2e2::22)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DU2PR04MB8951:EE_|DB9PR04MB9776:EE_
X-MS-Office365-Filtering-Correlation-Id: e7c1797e-e973-48a1-1337-08de328d5a36
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
	BCL:0;ARA:13230040|52116014|7416014|1800799024|19092799006|376014|366016|38350700014;
X-Microsoft-Antispam-Message-Info:
	=?us-ascii?Q?hVLuQ+HFGLRzD8X4pc3xhwhDfcm5k4I1HtauY7GzDpVGh9oPfWM0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ascii?Q?DUDUpC2E6qCVqtmn3UxXy+2QWMo3QRBbkNqfc3ECZIRgm9+yVoR3na1FKX21?=
 =?us-ascii?Q?oNWdytJfvDe5/OxxpbwGu90rnADDN4GoediCkp0Sv3n23wI5oqw5j2eAFO+/?=
 =?us-ascii?Q?dN4hU2mB0xUXejaSNTzaH8sp3tAQKL1FYT5+SsYxalaDpDJUNB6kAYRHm7Rx?=
 =?us-ascii?Q?A8AGO37TVfrrNLXLLuo0tFptEuTqVyRTCLVY5/KCq1siCPWkkTC6SQAjSOiB?=
 =?us-ascii?Q?8hjpPGa4VX8mM28PJHELgjhn60fmLd8DmaWBHhDf3fE55r92G3sXyzy8MGIq?=
 =?us-ascii?Q?QBm1pzhiP3Z3zJ+O0rGEX2fpSVpigQTXOGz57oE4HsIWS7toh1uPkToSj4Ab?=
 =?us-ascii?Q?cliXg4uQ93DFhmvcRgcos7A/mcKwersNiMbJOvqJOJbcqNlfQam6RDysCA8V?=
 =?us-ascii?Q?g4sHeI7t7JyJIYPdmw25jpHSRbbapT3fzo9p3inhtRjlObP5pUnNQswcpma+?=
 =?us-ascii?Q?7FPQ6xZFkHebsb8YH13ICyml0KwuiqIBe10eyT6v9Ph+xbJYZcsVlT0owkQ5?=
 =?us-ascii?Q?RrelEWe/sRfj+Fl1ev9mk4ioIAud2fSpWstHCKbQcne9kzoPSLjaSc0yLSYd?=
 =?us-ascii?Q?Bj5N7hmEDlJm1ozhQQElOQXO5k/Z9qmC1vj2?=
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8951.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(19092799006)(376014)(366016)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?us-ascii?Q?0KNj2D9xd6w1Elwc7DuF/K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RgXnjkKUBg9aaK5/1CWcdJhgmJ?=
 =?us-ascii?Q?ZKVpKNqBxualE0j00UBzEDpkAYXJJhbsM5f48YZWZS1699Z44mtS4w6ThJxd?=
 =?us-ascii?Q?mSfzdEvAOv7ThE1QS+BSAyeTywQUDeyvHh9r8ziFz01tHYLByg1nCAAS8IMP?=
 =?us-ascii?Q?xvWkqzkyw8xGs/eGgk6ke5yVik3H+ZyrYGTMoB+mklmoMI6FuNOUzDFhCh09?=
 =?us-ascii?Q?8rCyRclCxupvQCxtJyz7aDHBWDynuNBEUtPs1z2tMoqbinAzx3hxJCfSM1ja?=
 =?us-ascii?Q?gw35cNt3zZmY5qiWNs60+o9ZjK5ml2gB3dmczm/oUapTueVeWGppa1iPA0dj?=
 =?us-ascii?Q?jwjkb3dQl6/N3iNXVYoyWg2v7Gbun5PbCICq3jDONwREMePDVzYMFWG8x5Kd?=
 =?us-ascii?Q?eIZ158c4Xj0b5jrWaCN5gA0AH/W8Yn8yck1iEdb9z8uwtmnTU52xCh5rXbJV?=
 =?us-ascii?Q?U0aNnTe4WweY3cBTEzUknsLfVc18MZMPGPJYdTaD37I59+MFTZ9CwucQLUb6?=
 =?us-ascii?Q?ZFWZU/Tl99AzBP1sOQ3GJjVIWKiQ/Eaoevw6/E8FkG2XK2BujWxAIfty0R4A?=
 =?us-ascii?Q?T+coxLfpJzXzSb9kKq5Q/HTBJV7Fudh6i6scg0pPalnXT0iyj19Xtu9A4Oyv?=
 =?us-ascii?Q?16Q8tg109cC37EluALh2uYtrebsz1z+iMF1v8+4FjoafvLv+25urcmkOCSz5?=
 =?us-ascii?Q?qBzhBbcGmoRWigF1HZX/iKJ4tDjDQceMl9O1Zxix?=
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e7c1797e-e973-48a1-1337-08de328d5a36
X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8951.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2025 16:59:42.0526
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: +yC3LUajxKHhlFqz3uoxKsZnRtvbgutUT5uZ1bD3yHAeOsFNDTAxR/cFyDd23TK1m1aXkTPKIvJPh+5CNzaoNA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9776

On Wed, Dec 03, 2025 at 08:20:50AM +0100, Krzysztof Kozlowski wrote:
> On 03/12/2025 07:48, Pankaj Gupta wrote:
> > Add driver for enabling MU based communication interface to secure-enclave.
> >
> > 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 with Linux over single or multiple
> > dedicated messaging unit(MU) based interface(s).
> > Exists on i.MX SoC(s) like i.MX8ULP, i.MX93, i.MX95 etc.
> >
> > For i.MX9x SoC(s) there is at least one dedicated ELE MU(s) for each
> > world - Linux(one or more) and OPTEE-OS (one or more).
> >
> > Other dependent kernel drivers will be:
> > - NVMEM: that supports non-volatile devices like EFUSES,
> >          managed by NXP's secure-enclave.
> >
> > Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
> > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > ---
> >  drivers/firmware/imx/Kconfig        |  13 ++
> >  drivers/firmware/imx/Makefile       |   2 +
> >  drivers/firmware/imx/ele_base_msg.c | 269 ++++++++++++++++++++++++
> >  drivers/firmware/imx/ele_base_msg.h |  95 +++++++++
> >  drivers/firmware/imx/ele_common.c   | 333 ++++++++++++++++++++++++++++++
> >  drivers/firmware/imx/ele_common.h   |  45 ++++
> >  drivers/firmware/imx/se_ctrl.c      | 401 ++++++++++++++++++++++++++++++++++++
> >  drivers/firmware/imx/se_ctrl.h      |  86 ++++++++
> >  include/linux/firmware/imx/se_api.h |  14 ++
> >  9 files changed, 1258 insertions(+)
> >
> > diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
> > index 127ad752acf8..5fe96299b704 100644
> > --- a/drivers/firmware/imx/Kconfig
> > +++ b/drivers/firmware/imx/Kconfig
> > @@ -55,3 +55,16 @@ config IMX_SCMI_MISC_DRV
> >  	  core that could provide misc functions such as board control.
> >
> >  	  This driver can also be built as a module.
> > +
> > +config IMX_SEC_ENCLAVE
> > +	tristate "i.MX Embedded Secure Enclave - EdgeLock Enclave Firmware driver."
> > +	depends on IMX_MBOX && ARCH_MXC && ARM64
> > +	select FW_LOADER
> > +	default m if ARCH_MXC
> > +
> > +	help
> > +	  Exposes APIs supported by the iMX Secure Enclave HW IP called:
> > +	  - EdgeLock Enclave Firmware (for i.MX8ULP, i.MX93),
> > +	    like base, HSM, V2X & 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.
> > diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
> > index 3bbaffa6e347..4412b15846b1 100644
> > --- a/drivers/firmware/imx/Makefile
> > +++ b/drivers/firmware/imx/Makefile
> > @@ -4,3 +4,5 @@ obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
> >  obj-${CONFIG_IMX_SCMI_CPU_DRV}	+= sm-cpu.o
> >  obj-${CONFIG_IMX_SCMI_MISC_DRV}	+= sm-misc.o
> >  obj-${CONFIG_IMX_SCMI_LMM_DRV}	+= sm-lmm.o
> > +sec_enclave-objs		= se_ctrl.o ele_common.o ele_base_msg.o
> > +obj-${CONFIG_IMX_SEC_ENCLAVE}	+= sec_enclave.o
> > diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
> > new file mode 100644
> > index 000000000000..a070acbd895c
> > --- /dev/null
> > +++ b/drivers/firmware/imx/ele_base_msg.c
> > @@ -0,0 +1,269 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright 2025 NXP
> > + */
> > +
> > +#include <linux/types.h>
> > +
> > +#include <linux/completion.h>
> > +#include <linux/dma-mapping.h>
> > +#include <linux/genalloc.h>
> > +
> > +#include "ele_base_msg.h"
> > +#include "ele_common.h"
> > +
> > +#define FW_DBG_DUMP_FIXED_STR		"ELE"
> > +
> > +int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info)
> > +{
> > +	struct se_api_msg *tx_msg __free(kfree) = NULL;
> > +	struct se_api_msg *rx_msg __free(kfree) = NULL;
>
> No, don't use this syntax. This is explicitly discouraged.
>
> NAK

Add link for reference.

https://lore.kernel.org/all/CAHk-=whPZoi03ZwphxiW6cuWPtC3nyKYS8_BThgztCdgPWP1WA@mail.gmail.com/

Frank
>
> Best regards,
> Krzysztof

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D96EF33A6FB;
	Wed,  3 Dec 2025 17:42:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764783737; cv=none; b=QCAab0w72gd6svAYL6nBwXjyb2gAdp1COkt+HLnVmd7aWm2aBO8No/M2qT6qWNcj84znrJo5JrEpe8paeFVVH3+YbvIWZuPsPg4qpYjAfsSCJyakBwEfShy5mHYlbo+YiNgyvPuZk5V1unnT4sCZLO5Kf6zq+GEe7uYqURODgpI=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764783737; c=relaxed/simple;
	bh=0PFD8diImxz9iIbuzHPx6vv4/igLNrwgU6UG5S0Ue64=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=f0bLBKYTwIkGJhCtE3MXCwQqbIP/mX1t15rCzv7JsUwC+7Lm7etHGjHw6XFz9mXxInHShr2uBBWwBgJCCwNQiWDdDtilwr8VLRBPi86YTW6/UZGxNNvQwidsClFf9fAa5KqlDHPx3XFdkfrxHH8/OaHJqhHde1tuDgZMGjP8TrA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=miD/O73f; arc=none smtp.client-ip=10.30.226.201
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="miD/O73f"
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83A14C4CEF5;
	Wed,  3 Dec 2025 17:42:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
	s=k20201202; t=1764783736;
	bh=0PFD8diImxz9iIbuzHPx6vv4/igLNrwgU6UG5S0Ue64=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
	b=miD/O73fflM78imiiO7BcAz2xqJOUDcwGHSbdkxoM0weNUQAXdN9kDoG3FWGarMJr
	 oMoarFhsAsrDZGZVZBofKu/vz4iMH+Pa6QJLFU9WzO0js6PzzErSnaYgGFxTGhDLD/
	 HlZ+VER72MkNKb9bm+YhBSL7S3oH5vUKrDCPaCvvxfbjjNABRSb59iS7czt4I2OCWC
	 lJdX69w7JWqtLJzCzfdpAhXAWj5XvH3jlRU3QAQeuLpXqaDPln8WcHn+l89bV2MvvT
	 ytHFu7Axt6YIfW+9e3wWcY2kAVayX1GS8doiyTBKmu95QabXoCT9UC8ZYwmFilr2Ed
	 UeBILDnFqvCog==
Message-ID: <48d5895d-fde0-4795-8049-788fa3171fde@kernel.org>
Date: Wed, 3 Dec 2025 18:42:11 +0100
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock
 Enclave
To: Frank Li <Frank.li@nxp.com>
Cc: Pankaj Gupta <pankaj.gupta@nxp.com>, Jonathan Corbet <corbet@lwn.net>,
 Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>,
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
 Sascha Hauer <s.hauer@pengutronix.de>,
 Pengutronix Kernel Team <kernel@pengutronix.de>,
 Fabio Estevam <festevam@gmail.com>, linux-doc@vger.kernel.org,
 linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
 imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
 <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
 <1ee383c7-ccbc-4c90-adf3-bfbe87fb6765@kernel.org>
 <aTBsdW0lpZSCVsgp@lizhi-Precision-Tower-5810>
From: Krzysztof Kozlowski <krzk@kernel.org>
Content-Language: en-US
Autocrypt: addr=krzk@kernel.org; keydata=
 xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79
 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu
 JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH
 gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIy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0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v
 qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5
 RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg
 Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2
 H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB
 dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT
 AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu
 jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2
 zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw
 XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A=
In-Reply-To: <aTBsdW0lpZSCVsgp@lizhi-Precision-Tower-5810>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 03/12/2025 17:59, Frank Li wrote:
> On Wed, Dec 03, 2025 at 08:20:50AM +0100, Krzysztof Kozlowski wrote:
>> On 03/12/2025 07:48, Pankaj Gupta wrote:
>>> Add driver for enabling MU based communication interface to secure-enclave.
>>>
>>> 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 with Linux over single or multiple
>>> dedicated messaging unit(MU) based interface(s).
>>> Exists on i.MX SoC(s) like i.MX8ULP, i.MX93, i.MX95 etc.
>>>
>>> For i.MX9x SoC(s) there is at least one dedicated ELE MU(s) for each
>>> world - Linux(one or more) and OPTEE-OS (one or more).
>>>
>>> Other dependent kernel drivers will be:
>>> - NVMEM: that supports non-volatile devices like EFUSES,
>>>          managed by NXP's secure-enclave.
>>>
>>> Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
>>> Reviewed-by: Frank Li <Frank.Li@nxp.com>
>>> ---
>>>  drivers/firmware/imx/Kconfig        |  13 ++
>>>  drivers/firmware/imx/Makefile       |   2 +
>>>  drivers/firmware/imx/ele_base_msg.c | 269 ++++++++++++++++++++++++
>>>  drivers/firmware/imx/ele_base_msg.h |  95 +++++++++
>>>  drivers/firmware/imx/ele_common.c   | 333 ++++++++++++++++++++++++++++++
>>>  drivers/firmware/imx/ele_common.h   |  45 ++++
>>>  drivers/firmware/imx/se_ctrl.c      | 401 ++++++++++++++++++++++++++++++++++++
>>>  drivers/firmware/imx/se_ctrl.h      |  86 ++++++++
>>>  include/linux/firmware/imx/se_api.h |  14 ++
>>>  9 files changed, 1258 insertions(+)
>>>
>>> diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
>>> index 127ad752acf8..5fe96299b704 100644
>>> --- a/drivers/firmware/imx/Kconfig
>>> +++ b/drivers/firmware/imx/Kconfig
>>> @@ -55,3 +55,16 @@ config IMX_SCMI_MISC_DRV
>>>  	  core that could provide misc functions such as board control.
>>>
>>>  	  This driver can also be built as a module.
>>> +
>>> +config IMX_SEC_ENCLAVE
>>> +	tristate "i.MX Embedded Secure Enclave - EdgeLock Enclave Firmware driver."
>>> +	depends on IMX_MBOX && ARCH_MXC && ARM64
>>> +	select FW_LOADER
>>> +	default m if ARCH_MXC
>>> +
>>> +	help
>>> +	  Exposes APIs supported by the iMX Secure Enclave HW IP called:
>>> +	  - EdgeLock Enclave Firmware (for i.MX8ULP, i.MX93),
>>> +	    like base, HSM, V2X & 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.
>>> diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
>>> index 3bbaffa6e347..4412b15846b1 100644
>>> --- a/drivers/firmware/imx/Makefile
>>> +++ b/drivers/firmware/imx/Makefile
>>> @@ -4,3 +4,5 @@ obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
>>>  obj-${CONFIG_IMX_SCMI_CPU_DRV}	+= sm-cpu.o
>>>  obj-${CONFIG_IMX_SCMI_MISC_DRV}	+= sm-misc.o
>>>  obj-${CONFIG_IMX_SCMI_LMM_DRV}	+= sm-lmm.o
>>> +sec_enclave-objs		= se_ctrl.o ele_common.o ele_base_msg.o
>>> +obj-${CONFIG_IMX_SEC_ENCLAVE}	+= sec_enclave.o
>>> diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
>>> new file mode 100644
>>> index 000000000000..a070acbd895c
>>> --- /dev/null
>>> +++ b/drivers/firmware/imx/ele_base_msg.c
>>> @@ -0,0 +1,269 @@
>>> +// SPDX-License-Identifier: GPL-2.0+
>>> +/*
>>> + * Copyright 2025 NXP
>>> + */
>>> +
>>> +#include <linux/types.h>
>>> +
>>> +#include <linux/completion.h>
>>> +#include <linux/dma-mapping.h>
>>> +#include <linux/genalloc.h>
>>> +
>>> +#include "ele_base_msg.h"
>>> +#include "ele_common.h"
>>> +
>>> +#define FW_DBG_DUMP_FIXED_STR		"ELE"
>>> +
>>> +int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info)
>>> +{
>>> +	struct se_api_msg *tx_msg __free(kfree) = NULL;
>>> +	struct se_api_msg *rx_msg __free(kfree) = NULL;
>>
>> No, don't use this syntax. This is explicitly discouraged.
>>
>> NAK
> 
> Add link for reference.
> 
> https://lore.kernel.org/all/CAHk-=whPZoi03ZwphxiW6cuWPtC3nyKYS8_BThgztCdgPWP1WA@mail.gmail.com/

This is since beginning documented in kernel, so contributor could read
cleanup docs before using them. Above Linus remark is nothing new, he
already wrote it ~2 years ago.

Best regards,
Krzysztof

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22056398FA3;
	Wed,  3 Dec 2025 18:02:52 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764784974; cv=none; b=uL9Ve7UH34t5GuaUcTTVWA6iDL3LxO8DwRzYGcaRl64aqJ8O7UVhTqpFn0XhB5mhr+9Ie42kbOISadZFXFswX9Rgu74uitxs3aTyaH4b4oPY817mJEc43WbnC/x/YIm/qzz1Qts5DPKq6pa0pjM2TgO8yuzaiLlKlNs8H2x41Q4=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764784974; c=relaxed/simple;
	bh=LzZXmv9rm/Dq7yhuvhvRzxUVsCEsA2jTVnTclfEwJaE=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=PVWys1T2Y5TJROlF1YsR0s0Y9H1+qnREfCto2Gnk8Nc9Icc0r0c+/qET0InBW3ix4kMca4B4jn6CfyOJay6GQMuzz2+cTeGYfhojP5NTWoNic7ZS6fj6S8G37zj0HFv+TMjiM3r6UdUdFXGn1BPEpyyqftQ9xnkn0yjQ5hP9YwM=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qq2o0+OQ; arc=none smtp.client-ip=198.137.202.133
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qq2o0+OQ"
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding:
	Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:
	Message-ID:Sender:Reply-To:Content-ID:Content-Description;
	bh=sSj7FMQeqa2UUNYX+T5h0r4adaA2rYhnswTS7LJ4PLg=; b=qq2o0+OQASQPi8kqSd5Hh2C+n2
	t025LiGMZYo/6IgKwBAkFZlFEEfQVQRtxb4NhnbHdHRcs6MGZ+b2iXB3kKblRwnifsnCKN+tk9qJT
	6aT8dtcI23AnohMVw6YhBHWB0VT2H7QHZuXw9Wuv1AhnVGtedS49qEjOtR5vgMrRB2OV3ro5tnk9g
	UimYZ9nqpjdNrzASvDNjOyLxR2SCYcWhnt35LFz6qarFvKpgDsxWNUOXr8GZD7uaPIcaJ2lzdntQr
	nShXBXURx+uZOu9EwmaRLwKwQ7xNSKuNmSh21RjacXdMg17lORLMWRwqDg8pQ0plP9bIM1o0mBQXH
	5C4bG0vw==;
Received: from [50.53.43.113] (helo=[192.168.254.34])
	by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux))
	id 1vQrBi-00000006u6S-2Spi;
	Wed, 03 Dec 2025 18:02:50 +0000
Message-ID: <33d659bd-eba9-4b47-a374-32b6c763d640@infradead.org>
Date: Wed, 3 Dec 2025 10:02:49 -0800
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock
 Enclave
To: Pankaj Gupta <pankaj.gupta@nxp.com>, Jonathan Corbet <corbet@lwn.net>,
 Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>,
 Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
 Sascha Hauer <s.hauer@pengutronix.de>,
 Pengutronix Kernel Team <kernel@pengutronix.de>,
 Fabio Estevam <festevam@gmail.com>
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, Frank Li <Frank.Li@nxp.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
 <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
Content-Language: en-US
From: Randy Dunlap <rdunlap@infradead.org>
In-Reply-To: <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi--

On 12/2/25 10:48 PM, Pankaj Gupta wrote:
> diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
> index 127ad752acf8..5fe96299b704 100644
> --- a/drivers/firmware/imx/Kconfig
> +++ b/drivers/firmware/imx/Kconfig
> @@ -55,3 +55,16 @@ config IMX_SCMI_MISC_DRV
>  	  core that could provide misc functions such as board control.
>  
>  	  This driver can also be built as a module.
> +
> +config IMX_SEC_ENCLAVE
> +	tristate "i.MX Embedded Secure Enclave - EdgeLock Enclave Firmware driver."
> +	depends on IMX_MBOX && ARCH_MXC && ARM64

Is it possible to work COMPILE_TEST into this dependency?

> +	select FW_LOADER
> +	default m if ARCH_MXC
> +
> +	help
> +	  Exposes APIs supported by the iMX Secure Enclave HW IP called:
> +	  - EdgeLock Enclave Firmware (for i.MX8ULP, i.MX93),
> +	    like base, HSM, V2X & 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.

thanks.
-- 
~Randy


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EE5D23D7D8;
	Thu,  4 Dec 2025 04:28:54 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1764822535; cv=none; b=BIunnWQQ+Eq13+RE7E0Y2JrdLErOLdmH+xZ7axZnDOEoVSqFSCavyhmwk1LZaQJdUe4UuxRkLogUmHVK+sfeuGYpwoxQU/z1aZHNDfdYZyiAqkwsW497L22iGYPenN3vNEnbRYx9wnpJO3naaAzs811ZAGl9HFLBtGJ/l75exLY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1764822535; c=relaxed/simple;
	bh=fu4Otl1HGi7uqxldCp6FC+mJwbMpk4YSIaDzkvRP9rU=;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To; b=CL+lcHawyl7lXpP2iO2U15fDEFVNgp4yn7ZGe2Cs/Sgz17EYmvSRPMUtcFsh4fEcmidbEe52hTw5s5BeGvmbwedhJ4wxwNC0qfAxESg7yqb3Ra04vnfyyGov10qTKZ0c+/cCm8ckFYlKp5SUhRl198zW/jq450Itb3v6WJApnu4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aNF5vYvL; arc=none smtp.client-ip=198.175.65.13
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aNF5vYvL"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
  t=1764822534; x=1796358534;
  h=date:from:to:cc:subject:message-id:references:
   mime-version:in-reply-to;
  bh=fu4Otl1HGi7uqxldCp6FC+mJwbMpk4YSIaDzkvRP9rU=;
  b=aNF5vYvLDM4bQBNe9ff+Hr4F540rlGWo87OQXvyOuyPuR4N8fBsYCs95
   +Kaa+o2Rr7dH/tkIPV4weABtw1IHgriW1+SxhCN4J+dMGCulRm1F0ES3E
   HK8K+U2XU9KhCQDuwSDR9DjUiJNzzwSMyaT4dGgOQCeHq/UQAC5qQ2Bfm
   GGoNX8Q/HQWameLMN72rdIR2+xeKkOXwLLXIWCpsDChTWhL3DCOHVE5zn
   7t6anu96CK8KLl5X7U6jp+AKJ6hH/tAhCCgWJTzLFeovhXonQbmigOW+L
   5pL2ANXRKeZQSUrW+A/YlOO/HxKkU+wxmekPqYQ2WM22w76+g4fqeD8EN
   w==;
X-CSE-ConnectionGUID: tgQ6TQ+2QUm+SI41xvHiXw==
X-CSE-MsgGUID: afSvSFX7QsOrJh9g0Ry3Dw==
X-IronPort-AV: E=McAfee;i="6800,10657,11631"; a="77939819"
X-IronPort-AV: E=Sophos;i="6.20,247,1758610800"; 
   d="scan'208";a="77939819"
Received: from orviesa004.jf.intel.com ([10.64.159.144])
  by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2025 20:28:53 -0800
X-CSE-ConnectionGUID: emaq0chZQvCufN9+C+JBvA==
X-CSE-MsgGUID: 5T152UeURjmuiR2QhfUVmg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.20,247,1758610800"; 
   d="scan'208";a="199360138"
Received: from lkp-server01.sh.intel.com (HELO 4664bbef4914) ([10.239.97.150])
  by orviesa004.jf.intel.com with ESMTP; 03 Dec 2025 20:28:48 -0800
Received: from kbuild by 4664bbef4914 with local (Exim 4.98.2)
	(envelope-from <lkp@intel.com>)
	id 1vR0xR-00000000DRN-1pJI;
	Thu, 04 Dec 2025 04:28:45 +0000
Date: Thu, 4 Dec 2025 12:28:05 +0800
From: kernel test robot <lkp@intel.com>
To: Pankaj Gupta <pankaj.gupta@nxp.com>, Jonathan Corbet <corbet@lwn.net>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH v20 5/7] firmware: drivers: imx: adds miscdev
Message-ID: <202512041241.yDXC2vpg-lkp@intel.com>
References: <20251203-imx-se-if-v20-5-a04a25c4255f@nxp.com>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20251203-imx-se-if-v20-5-a04a25c4255f@nxp.com>

Hi Pankaj,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 4a26e7032d7d57c998598c08a034872d6f0d3945]

url:    https://github.com/intel-lab-lkp/linux/commits/Pankaj-Gupta/Documentation-firmware-add-imx-se-to-other_interfaces/20251203-145202
base:   4a26e7032d7d57c998598c08a034872d6f0d3945
patch link:    https://lore.kernel.org/r/20251203-imx-se-if-v20-5-a04a25c4255f%40nxp.com
patch subject: [PATCH v20 5/7] firmware: drivers: imx: adds miscdev
config: arm64-randconfig-r132-20251204 (https://download.01.org/0day-ci/archive/20251204/202512041241.yDXC2vpg-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 734a912d0f025559fcf76bde9aaaeb0383c1625a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251204/202512041241.yDXC2vpg-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512041241.yDXC2vpg-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/firmware/imx/se_ctrl.c:517:40: sparse: sparse: cast removes address space '__user' of expression
   drivers/firmware/imx/se_ctrl.c:745:48: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +517 drivers/firmware/imx/se_ctrl.c

   491	
   492	static int se_ioctl_cmd_snd_rcv_rsp_handler(struct se_if_device_ctx *dev_ctx,
   493						    u64 arg)
   494	{
   495		struct se_ioctl_cmd_snd_rcv_rsp_info cmd_snd_rcv_rsp_info = {0};
   496		struct se_api_msg *tx_msg __free(kfree) = NULL;
   497		struct se_api_msg *rx_msg __free(kfree) = NULL;
   498		struct se_if_priv *priv = dev_ctx->priv;
   499		int err = 0;
   500	
   501		if (copy_from_user(&cmd_snd_rcv_rsp_info, (u8 __user *)arg,
   502				   sizeof(cmd_snd_rcv_rsp_info))) {
   503			dev_err(priv->dev,
   504				"%s: Failed to copy cmd_snd_rcv_rsp_info from user.",
   505				dev_ctx->devname);
   506			err = -EFAULT;
   507			goto exit;
   508		}
   509	
   510		if (cmd_snd_rcv_rsp_info.tx_buf_sz < SE_MU_HDR_SZ) {
   511			dev_err(priv->dev, "%s: User buffer too small(%d < %d)",
   512				dev_ctx->devname, cmd_snd_rcv_rsp_info.tx_buf_sz, SE_MU_HDR_SZ);
   513			err = -ENOSPC;
   514			goto exit;
   515		}
   516	
 > 517		err = se_chk_tx_msg_hdr(priv, (struct se_msg_hdr *)cmd_snd_rcv_rsp_info.tx_buf);
   518		if (err)
   519			goto exit;
   520	
   521		rx_msg = kzalloc(cmd_snd_rcv_rsp_info.rx_buf_sz, GFP_KERNEL);
   522		if (!rx_msg) {
   523			err = -ENOMEM;
   524			goto exit;
   525		}
   526	
   527		tx_msg = memdup_user(cmd_snd_rcv_rsp_info.tx_buf,
   528				     cmd_snd_rcv_rsp_info.tx_buf_sz);
   529		if (IS_ERR(tx_msg)) {
   530			err = PTR_ERR(tx_msg);
   531			goto exit;
   532		}
   533	
   534		if (tx_msg->header.tag != priv->if_defs->cmd_tag) {
   535			err = -EINVAL;
   536			goto exit;
   537		}
   538	
   539		if (tx_msg->header.ver == priv->if_defs->fw_api_ver &&
   540		    get_load_fw_instance(priv)->is_fw_tobe_loaded) {
   541			err = se_load_firmware(priv);
   542			if (err) {
   543				dev_err(priv->dev, "Could not send msg as FW is not loaded.");
   544				err = -EPERM;
   545				goto exit;
   546			}
   547		}
   548		set_se_rcv_msg_timeout(priv, SE_RCV_MSG_LONG_TIMEOUT);
   549	
   550		err = ele_msg_send_rcv(dev_ctx, tx_msg, cmd_snd_rcv_rsp_info.tx_buf_sz,
   551				       rx_msg, cmd_snd_rcv_rsp_info.rx_buf_sz);
   552		if (err < 0)
   553			goto exit;
   554	
   555		dev_dbg(priv->dev, "%s: %s %s.", dev_ctx->devname, __func__,
   556			"message received, start transmit to user");
   557	
   558		/* We may need to copy the output data to user before
   559		 * delivering the completion message.
   560		 */
   561		err = se_dev_ctx_cpy_out_data(dev_ctx);
   562		if (err < 0)
   563			goto exit;
   564	
   565		/* Copy data from the buffer */
   566		print_hex_dump_debug("to user ", DUMP_PREFIX_OFFSET, 4, 4, rx_msg,
   567				     cmd_snd_rcv_rsp_info.rx_buf_sz, false);
   568	
   569		if (copy_to_user(cmd_snd_rcv_rsp_info.rx_buf, rx_msg,
   570				 cmd_snd_rcv_rsp_info.rx_buf_sz)) {
   571			dev_err(priv->dev, "%s: Failed to copy to user.", dev_ctx->devname);
   572			err = -EFAULT;
   573		}
   574	
   575	exit:
   576	
   577		/* shared memory is allocated before this IOCTL */
   578		se_dev_ctx_shared_mem_cleanup(dev_ctx);
   579	
   580		if (copy_to_user((void __user *)arg, &cmd_snd_rcv_rsp_info,
   581				 sizeof(cmd_snd_rcv_rsp_info))) {
   582			dev_err(priv->dev, "%s: Failed to copy cmd_snd_rcv_rsp_info from user.",
   583				dev_ctx->devname);
   584			err = -EFAULT;
   585		}
   586	
   587		return err;
   588	}
   589	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38E3C26A0DD
	for <linux-kernel@vger.kernel.org>; Tue,  9 Dec 2025 08:08:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1765267692; cv=none; b=RuWDPSktZMBPNxM6v9jX9doZOutMU31fuN5wAbxulLkijMzpomBP36GaXmHcs44/pC4YUr+sZbGJ5dh9n3fCPHHbnJ25NS00atuv1cmlJBpxBIIRtEepNy2EUeVZgv+KgEib/oK0ZkTUiHejtLdb/YAPpBLygnIBV2jyfVzHLWs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1765267692; c=relaxed/simple;
	bh=MJimUWyWCQryzeXq/CylmXxVGK1UyUx3ivCgZyvep+w=;
	h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To; b=p7dkvAb7Z/fXYdy1ih1IGRcgMuLwzyzm3nwfk/zfa9fxUAin4a7dhJDEunXTY49sE3Q7HyveJaYYyZwLgwZrEaC6F0zcVUMgRCV+mooVUmz/LWK/2YBLwn4qYi2Yas+KHtrNc5xkna4RWB6Y+dheoLChtuFMwqQpGWyw/1PlE1g=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=M2GiSIID; arc=none smtp.client-ip=209.85.128.44
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="M2GiSIID"
Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-47774d3536dso49945915e9.0
        for <linux-kernel@vger.kernel.org>; Tue, 09 Dec 2025 00:08:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=linaro.org; s=google; t=1765267688; x=1765872488; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:mime-version:message-id:subject:cc
         :to:from:date:from:to:cc:subject:date:message-id:reply-to;
        bh=i3HS3UZvHWNoRI4tSC4tCLlGjmvQB2LsBSbcqGJUth8=;
        b=M2GiSIIDr2rhoj8ED426w9EsEcGVJVVqPdIHFRxyImcg7EUXaEeep/tpqZfi+tIJcf
         CCecHotu3TmJKq30b/ZLn0pVd/0w9PmD+4l2mw4B5mR5udErtuC8VO/j0O0nXVlWzFx6
         vun1b3yVKz/cozP5NyFIDcUGr2I24564/1QtrfcgCGICbEGhAg1CR9QKxHbjWxobkeWN
         snUDBHavvME1Zr7hcmKYvPEuivQ4Ns5eB1rd7NWSK9QS23MUOroxeffiORuXo7tbDprf
         yb5Dc53ztEF7T4OTahQUp9mkUqT0tvvyR5TBlOZQVnzgUf0I1tWseAwZ6ekaSQt4kiqr
         4jhQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1765267688; x=1765872488;
        h=in-reply-to:content-disposition:mime-version:message-id:subject:cc
         :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to;
        bh=i3HS3UZvHWNoRI4tSC4tCLlGjmvQB2LsBSbcqGJUth8=;
        b=Zq0YI7oAA0MsLdZCzwgbVumOQUbuVkj8D8pk/CtW8gE6Tb8OBS8C3xRffZ4Ot/MYkU
         UF0G7+f6tewmwzAhSuYT02i/ukTIrs5Tp+fNF8qYrChE25L6sRfjpxcR0VVcw5Kf88Dg
         tdawEurmEfFLcknGZpn17evwLibQwcxVJRKKuB3eoJgZvKHTMu1lEnhDfOzPDxp9uQAN
         oNyASMP8CEyxnAv7z0Ho+8jIW7Qmki8qjmgcLUfee7jPrSQBGa9eo279ISM8t6ToUIzt
         tJAhs5dJs25vv0wK1H9O0mDZK+DuWImnnx++C/GkToHMPwSnu5ADePlojue4vPLJPK4W
         VPew==
X-Forwarded-Encrypted: i=1; AJvYcCVVAlVWaU387Qi0qYRKxrhYYoT0R1xVNT43uG34tK7jO2HOU9PEe9Hs4RJIEn0Q0fY7YfeHrI6p/p3xYEc=@vger.kernel.org
X-Gm-Message-State: AOJu0Yz4ULZQC2bzlZSG/bHghpiwRMXlgjt04KR/8+29LSsxu/1eJSjj
	hXuN77nWbiShGms9Q3CwzUdWwKNwotjB0ZMjmV30Lhk9SjDH/KD6AB4iXrjemsD36iU=
X-Gm-Gg: ASbGncsK7KlY+uUlsrWO3k6Xg8x+5bJpdJ12FAHp2Zb7BMHvHpYQn7O5ikY2n2aCfEM
	4g2MSboIUQ3uL0K7TQsUCidOEmflp48x5d3oOf12Min0gxOwAKztvH2dOigTllbCL3QdCX+6SGm
	7FvX+iUCr68qfslGbaKiI5lFLVVyeYxizlrwSFsEC7FUoV1fmO1FYNpjTIqzSltxe6cNDUVPF2N
	tk2fIcYfE6iVX4sfDWxdVFCX5sud6dRyU4RY/J24rSRhjgAh84c2ugJjYb9a+79rsct1gR0Yl2d
	B2aeK6fO/rN60hCXPawg8XgGF/hHem+nzxprp1RWscAH1do+j6yrwwREQqv/BeXZtLikgz8HIix
	wQ2jYJtkuss12lBg0izo3Hf57gVumjD1RjS6ySxdPunYLxxshOgaR6Gb67ymm/qv/OXl39Mmsla
	f9mw5jYvR+ew5Wnped
X-Google-Smtp-Source: AGHT+IGscc+SJZEm/TRqQYoD0TdId9MDDNWX4FpzSAzC9aFu5AY3yWeeq7XQ4gq/1MUrF2INsOS4mA==
X-Received: by 2002:a05:600d:844f:10b0:477:9d88:2da6 with SMTP id 5b1f17b1804b1-47a7f987e56mr5630745e9.0.1765267688376;
        Tue, 09 Dec 2025 00:08:08 -0800 (PST)
Received: from localhost ([196.207.164.177])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a7d397a2fsm12719515e9.5.2025.12.09.00.08.07
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 09 Dec 2025 00:08:07 -0800 (PST)
Date: Tue, 9 Dec 2025 11:08:04 +0300
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Pankaj Gupta <pankaj.gupta@nxp.com>,
	Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock
 Enclave
Message-ID: <202512091557.d5dOvFff-lkp@intel.com>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>

Hi Pankaj,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Pankaj-Gupta/Documentation-firmware-add-imx-se-to-other_interfaces/20251203-145202
base:   4a26e7032d7d57c998598c08a034872d6f0d3945
patch link:    https://lore.kernel.org/r/20251203-imx-se-if-v20-3-a04a25c4255f%40nxp.com
patch subject: [PATCH v20 3/7] firmware: imx: add driver for NXP EdgeLock Enclave
config: arm64-randconfig-r072-20251207 (https://download.01.org/0day-ci/archive/20251209/202512091557.d5dOvFff-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project a805147ac1ba123916de182babb0831fbb148756)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202512091557.d5dOvFff-lkp@intel.com/

smatch warnings:
drivers/firmware/imx/ele_common.c:264 se_save_imem_state() warn: missing error code? 'ret'
drivers/firmware/imx/ele_common.c:302 se_restore_imem_state() warn: missing error code? 'ret'

vim +/ret +264 drivers/firmware/imx/ele_common.c

a9e23a74789346 Pankaj Gupta 2025-12-03  251  int se_save_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem)
a9e23a74789346 Pankaj Gupta 2025-12-03  252  {
a9e23a74789346 Pankaj Gupta 2025-12-03  253  	struct ele_dev_info s_info = {0};
a9e23a74789346 Pankaj Gupta 2025-12-03  254  	int ret;
a9e23a74789346 Pankaj Gupta 2025-12-03  255  
a9e23a74789346 Pankaj Gupta 2025-12-03  256  	ret = ele_get_info(priv, &s_info);
a9e23a74789346 Pankaj Gupta 2025-12-03  257  	if (ret) {
a9e23a74789346 Pankaj Gupta 2025-12-03  258  		dev_err(priv->dev, "Failed to get info from ELE.\n");
a9e23a74789346 Pankaj Gupta 2025-12-03  259  		return ret;
a9e23a74789346 Pankaj Gupta 2025-12-03  260  	}
a9e23a74789346 Pankaj Gupta 2025-12-03  261  
a9e23a74789346 Pankaj Gupta 2025-12-03  262  	/* Do not save the IMEM buffer, if the current IMEM state is BAD. */
a9e23a74789346 Pankaj Gupta 2025-12-03  263  	if (s_info.d_addn_info.imem_state == ELE_IMEM_STATE_BAD)
a9e23a74789346 Pankaj Gupta 2025-12-03 @264  		return ret;

This returns success if the state is _BAD.

a9e23a74789346 Pankaj Gupta 2025-12-03  265  
a9e23a74789346 Pankaj Gupta 2025-12-03  266  	/*
a9e23a74789346 Pankaj Gupta 2025-12-03  267  	 * EXPORT command will save encrypted IMEM to given address,
a9e23a74789346 Pankaj Gupta 2025-12-03  268  	 * so later in resume, IMEM can be restored from the given
a9e23a74789346 Pankaj Gupta 2025-12-03  269  	 * address.
a9e23a74789346 Pankaj Gupta 2025-12-03  270  	 *
a9e23a74789346 Pankaj Gupta 2025-12-03  271  	 * Size must be at least 64 kB.
a9e23a74789346 Pankaj Gupta 2025-12-03  272  	 */
a9e23a74789346 Pankaj Gupta 2025-12-03  273  	ret = ele_service_swap(priv, imem->phyaddr, ELE_IMEM_SIZE, ELE_IMEM_EXPORT);
a9e23a74789346 Pankaj Gupta 2025-12-03  274  	if (ret < 0) {
a9e23a74789346 Pankaj Gupta 2025-12-03  275  		dev_err(priv->dev, "Failed to export IMEM.");
a9e23a74789346 Pankaj Gupta 2025-12-03  276  		imem->size = 0;
a9e23a74789346 Pankaj Gupta 2025-12-03  277  	} else {
a9e23a74789346 Pankaj Gupta 2025-12-03  278  		dev_dbg(priv->dev,
a9e23a74789346 Pankaj Gupta 2025-12-03  279  			"Exported %d bytes of encrypted IMEM.",
a9e23a74789346 Pankaj Gupta 2025-12-03  280  			ret);
a9e23a74789346 Pankaj Gupta 2025-12-03  281  		imem->size = ret;
a9e23a74789346 Pankaj Gupta 2025-12-03  282  	}
a9e23a74789346 Pankaj Gupta 2025-12-03  283  
a9e23a74789346 Pankaj Gupta 2025-12-03  284  	return ret > 0 ? 0 : ret;
a9e23a74789346 Pankaj Gupta 2025-12-03  285  }
a9e23a74789346 Pankaj Gupta 2025-12-03  286  
a9e23a74789346 Pankaj Gupta 2025-12-03  287  int se_restore_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem)
a9e23a74789346 Pankaj Gupta 2025-12-03  288  {
a9e23a74789346 Pankaj Gupta 2025-12-03  289  	struct ele_dev_info s_info;
a9e23a74789346 Pankaj Gupta 2025-12-03  290  	int ret;
a9e23a74789346 Pankaj Gupta 2025-12-03  291  
a9e23a74789346 Pankaj Gupta 2025-12-03  292  	/* get info from ELE */
a9e23a74789346 Pankaj Gupta 2025-12-03  293  	ret = ele_get_info(priv, &s_info);
a9e23a74789346 Pankaj Gupta 2025-12-03  294  	if (ret) {
a9e23a74789346 Pankaj Gupta 2025-12-03  295  		dev_err(priv->dev, "Failed to get info from ELE.");
a9e23a74789346 Pankaj Gupta 2025-12-03  296  		return ret;
a9e23a74789346 Pankaj Gupta 2025-12-03  297  	}
a9e23a74789346 Pankaj Gupta 2025-12-03  298  	imem->state = s_info.d_addn_info.imem_state;
a9e23a74789346 Pankaj Gupta 2025-12-03  299  
a9e23a74789346 Pankaj Gupta 2025-12-03  300  	/* Get IMEM state, if 0xFE then import IMEM if imem size is non-zero. */

I really can't understand this comment at all.  :(

a9e23a74789346 Pankaj Gupta 2025-12-03  301  	if (s_info.d_addn_info.imem_state != ELE_IMEM_STATE_BAD || !imem->size)
a9e23a74789346 Pankaj Gupta 2025-12-03 @302  		return ret;

This feels like returning zero is intentional, but please return a
literal zero.  s/return ret;/return 0;/.


-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011049.outbound.protection.outlook.com [40.107.130.49])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 511AB30FC22;
	Fri, 12 Dec 2025 09:04:31 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.49
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1765530274; cv=fail; b=Y+Fi17Xh7Oq3bb02d7QSESMb/xQjo033BCqkHE7MWbs6yjkBQNN5UvCs9EIz8i+rBTy9gZ8nyN9PbibjEHGHPJQ9E9Ev+HirqNSlJU0mpTzxK4WMh4WggVvE6q9HhRGxlUyULUGnBL7Bn0Zy/w+tb1Ze3RtnniDVdi0bGCoRrLI=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1765530274; c=relaxed/simple;
	bh=MiDK3mwB0+yfdZvGL7/A+Ugy3uG6IqmNTtSWAqIJnhk=;
	h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
	 Content-Type:MIME-Version; b=rxzoo5jnCBPBBPlj3aYtBsDwKb5iGB/OZ+Yp9nSvbUVsKcrT0FmLquOrq8EWFA4dVIEfJYRzKOAIbfE7Xh6glMm4ypPq1cgTbN6rlVe8FLfAuNowqwI+5ogQ3uSU0ZZ59FXEKNT9HjTEcYjV1gDWZG/SMs38mFM5ILwA7bvTtYs=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=NalVqpMA; arc=fail smtp.client-ip=40.107.130.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="NalVqpMA"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=sbuClwb8pCQjgKDVsD7++3mxwggKQeUrULu1EImuBo7wl2aze42b0sIOlw6QfhakHOz0VCR+hVXHQ8yOoKZKC2r4Hv/a1q6R5FO52xZxXSN6s1YVNE1MZIlalaxUQsUZxh18FgH8VjjWmJF80TtVfycy9dNi1A1HdeZGYL6yJNUGF2EPkt+MGvujOgsOV+mnFA7OJ/Y9Ke7X6PWsPVS5eF8SUrBHf1I2afzYaxl2xPsg6tMP/uoGaabDvgfseNocXo4HA4gyp5oc9nYrlDiLQkCSp+efuQdb0hjE0/dWnngbGldpXAOX8z6o+8ZqFVwtUUbImeyL9ctZeQukFNHZWQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=D4ZEr8hKK1+ltf0bp4opf4FIoti86GVhk9TSbX7KiJc=;
 b=Sc+c6W/XwSh2XbNhpbew0Pk4CMUdUisZZf4EBg9coal/oDssyV4E3GOARw6dj0aOxszVo2ESN4NVc1hWD1mjbOaL3R3FoO8k/OgHKp0E+hRHKBw52lRAoFWMO/Ea/wN6p9KrZ9dPnIBHfraNA+oFY3QF4F3ORUeJZd4XOZOpfy31J8/ToFVPIBb+UoMDIOFxxe/b9uPrDl6rhfKfgdhgvWHFvhKbzRiEeL6cWDQ0rj3eNOZvEaTsI8E+/2aC1x0HpduS5zjZu1TfmMYklpamm+bxs6rxtmhHOxJN/YGtfvo/wweY94kzbpmALPSHJrgwI23HJD+OPJmP1fl9O4KPfg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=D4ZEr8hKK1+ltf0bp4opf4FIoti86GVhk9TSbX7KiJc=;
 b=NalVqpMAcw/edx146KzIOT3L1YVFiT1Zujq4hHMe/xs7e2wP2sQGunafYjfVpjgqyDyiZ6TY4wBVoYrvsUQ9KY2/IVF+cFPAvlxU6m6X2mGFlq7hZefrHOfQBQaln7pxCEqN7KgSDelQQ+yRAsPygHbEowmm0J3Cctu2lFS0xUWWxa6hjWHsyITDNxfhIXqtT0JgZRChmBGIijfhzzUdLCRnmLRdvsNHwss/Jx1rBugo/fP7CD7dSkoJm3vq0GVpNOAEBJoOmc3GeJsNiB4LJZnhutDZ84mrRM6aV8oFYH67h4iF74ky+Ws+16+ejHsx+fttDhGjt3FsjrYVgrOQeA==
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by GV1PR04MB10524.eurprd04.prod.outlook.com (2603:10a6:150:1d0::5) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.8; Fri, 12 Dec
 2025 09:04:29 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9412.005; Fri, 12 Dec 2025
 09:04:29 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
To: Dan Carpenter <dan.carpenter@linaro.org>, "oe-kbuild@lists.linux.dev"
	<oe-kbuild@lists.linux.dev>, Jonathan Corbet <corbet@lwn.net>, Rob Herring
	<robh@kernel.org>, Krzysztof Kozlowski <krzk@kernel.org>, Conor Dooley
	<conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer
	<s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
CC: "lkp@intel.com" <lkp@intel.com>, "oe-kbuild-all@lists.linux.dev"
	<oe-kbuild-all@lists.linux.dev>, "linux-doc@vger.kernel.org"
	<linux-doc@vger.kernel.org>, "linux-kernel@vger.kernel.org"
	<linux-kernel@vger.kernel.org>, "devicetree@vger.kernel.org"
	<devicetree@vger.kernel.org>, "imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>, Frank Li <frank.li@nxp.com>
Subject: RE: [EXT] Re: [PATCH v20 3/7] firmware: imx: add driver for NXP
 EdgeLock Enclave
Thread-Topic: [EXT] Re: [PATCH v20 3/7] firmware: imx: add driver for NXP
 EdgeLock Enclave
Thread-Index: AQHcZCDyTcT7+LXTOkSolFAmviM5prUY/aEAgAOHvwA=
Date: Fri, 12 Dec 2025 09:04:29 +0000
Message-ID:
 <AM9PR04MB8604547F2631FF8CE8992AE595AEA@AM9PR04MB8604.eurprd04.prod.outlook.com>
References: <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
 <202512091557.d5dOvFff-lkp@intel.com>
In-Reply-To: <202512091557.d5dOvFff-lkp@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: AM9PR04MB8604:EE_|GV1PR04MB10524:EE_
x-ms-office365-filtering-correlation-id: 26dc6391-9bd7-4793-756f-08de395d7515
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|366016|1800799024|7416014|376014|19092799006|38070700021|921020;
x-microsoft-antispam-message-info:
 =?us-ascii?Q?EA2gYGw4I5qBTqmaous9NhTUYw00wX9IB2PqH6k0lYZLdXpM7A0iFX0zISwu?=
 =?us-ascii?Q?03UKMUJ7GEgxURO8i5gX18/k5Tp4X1FxePi88HdAHpnyJIBqNVsrLLs58aFo?=
 =?us-ascii?Q?mVJL9DcCyITkW5/GIP0uVmTCXRjgNQsq+yqwFRWOP1TeKmAOlfYxgINYzy81?=
 =?us-ascii?Q?stDGpLKRpTSZ1d0U+ulczlo2e0FximC12TVXKLF5DRma/9bdZcT6oBiKGJq2?=
 =?us-ascii?Q?zOD77PUeu6UtbobK4DgwizCCJsWLJGTKldIG/GpEU452z5AUsNOvmJ2+1Rvz?=
 =?us-ascii?Q?2SSqO4tqHarWR2dIDUJ1A7uGBubkgnnhJfIfBCqmoD+R0hQsUgsT1dqHVDTx?=
 =?us-ascii?Q?g05YHg7FCMDY/AMIxTgLVhsRcbkr2qdo7ZanyetuGrpNdE+w6qwxJ9jn9SiK?=
 =?us-ascii?Q?FiVHhpwrREQcjk8v588EnXFrUq9VP2TTSG9rRuvFAeLAhIvuM/GJOWIgAjVU?=
 =?us-ascii?Q?tnU9e5fxb2fip4bY69KzWmH1ZFp6GldUSj3WFXGAwOQghz5kweuA+hMgOzZP?=
 =?us-ascii?Q?yRxuANcy2AoxuUvU4FwNWQh5gJZQWgE/7T0UxWjzuaZG9xXJ9s6RwU5TShkH?=
 =?us-ascii?Q?h/dWjdYSzvPd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SioEWIM/p3k6RdiPKw/aX2669gwoQCUAaQON?=
 =?us-ascii?Q?6GqX/VYiLySyKARgXaMdD+bLtiWdu6zUX0dY75fr015EkF7Soe8a/IjZmg?=
 =?us-ascii?Q?=3D=3D?=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014)(19092799006)(38070700021)(921020);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?58T5DSDAPR8J0SZ665dXS6W8G/KEq4r3GczCFhPr+SQzqrPXWIa4e8ADbszQ?=
 =?us-ascii?Q?+KEHchV5SPrRAlCgDtrvI/QIJEt75HsrwzY8vufKcbztgz4Hm4Ax/gFzxj1d?=
 =?us-ascii?Q?fkt6+SXBZMSxvZAvaL+ISZdR5Zgw/uYrom6sTUrB0w/+qY2wrKKhTEXvICL3?=
 =?us-ascii?Q?G+J9UKc/srgpFagqffeh3qc8V+PnszG+Uv8cGf4L2CigHMmjeRVQ5eHmefsN?=
 =?us-ascii?Q?ErlCyPwyASYLIyUiO/i1cYo6VhA2iFfrBdFoDonsq80CEDqrkzCE+TxGqyAI?=
 =?us-ascii?Q?fd2wv+AEiFOtLYkQxesQxJv+hr+4WYyvEVQn7ZJvj3h2hxHxyWg3IXYUDelg?=
 =?us-ascii?Q?wZjkbev47pDW0Z+Dogdz0yteM9OUfwd8dJmXpAojM/94MjMZZlzX6b9BacCF?=
 =?us-ascii?Q?7Ywo4VcGptgS68sGUift8B59IajoFYOXZVaJiJnpiZZwS8YYSKHHmI8aMwIn?=
 =?us-ascii?Q?GHaYr/bh/hYMjmXdk23rkubRyM0QT/daTTHntJ1Wx3O28w2eWrumDsvv/7lp?=
 =?us-ascii?Q?o862GxvwdQ8VgTQDzPMRxiy9oDm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UwYJiqDaPx+/6TnmHHbvWmuxi?=
 =?us-ascii?Q?Nzz+++RrCpjL/ENWL8T8kvFjtST9AqiVcBULp+Wy2Ah6rBWimSTyINLK0PPg?=
 =?us-ascii?Q?ADNGBm3b4Hy+uSMHJfhRBAiwSei3oj2Cizq6FLzN1AbDj9GccQh2hoAP3s9I?=
 =?us-ascii?Q?c/BymOsfhLuSUPHvLLI=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 26dc6391-9bd7-4793-756f-08de395d7515
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2025 09:04:29.1783
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: gdPOgCshGovltD2RY1x67OWqNBqDa0mm9IquuuPw3OvmdeedOeWUlxu4/BoO25ip46hgTgS7uKObZcgJ3QskJw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10524

>=20
> smatch warnings:
> drivers/firmware/imx/ele_common.c:264 se_save_imem_state() warn:
> missing error code? 'ret'
> drivers/firmware/imx/ele_common.c:302 se_restore_imem_state() warn:
> missing error code? 'ret'
>=20

Accepted.
Will return -EIO;

> vim +/ret +264 drivers/firmware/imx/ele_common.c
>=20
> a9e23a74789346 Pankaj Gupta 2025-12-03  251  int
> se_save_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem)
> a9e23a74789346 Pankaj Gupta 2025-12-03  252  {
> a9e23a74789346 Pankaj Gupta 2025-12-03  253     struct ele_dev_info s_inf=
o =3D
> {0};
> a9e23a74789346 Pankaj Gupta 2025-12-03  254     int ret;
> a9e23a74789346 Pankaj Gupta 2025-12-03  255
> a9e23a74789346 Pankaj Gupta 2025-12-03  256     ret =3D ele_get_info(priv=
,
> &s_info);
> a9e23a74789346 Pankaj Gupta 2025-12-03  257     if (ret) {
> a9e23a74789346 Pankaj Gupta 2025-12-03  258             dev_err(priv->dev=
,
> "Failed to get info from ELE.\n");
> a9e23a74789346 Pankaj Gupta 2025-12-03  259             return ret;
> a9e23a74789346 Pankaj Gupta 2025-12-03  260     }
> a9e23a74789346 Pankaj Gupta 2025-12-03  261
> a9e23a74789346 Pankaj Gupta 2025-12-03  262     /* Do not save the IMEM
> buffer, if the current IMEM state is BAD. */
> a9e23a74789346 Pankaj Gupta 2025-12-03  263     if
> (s_info.d_addn_info.imem_state =3D=3D ELE_IMEM_STATE_BAD)
> a9e23a74789346 Pankaj Gupta 2025-12-03 @264             return ret;
>=20
> This returns success if the state is _BAD.
>=20
> a9e23a74789346 Pankaj Gupta 2025-12-03  265
> a9e23a74789346 Pankaj Gupta 2025-12-03  266     /*
> a9e23a74789346 Pankaj Gupta 2025-12-03  267      * EXPORT command will
> save encrypted IMEM to given address,
> a9e23a74789346 Pankaj Gupta 2025-12-03  268      * so later in resume, IM=
EM
> can be restored from the given
> a9e23a74789346 Pankaj Gupta 2025-12-03  269      * address.
> a9e23a74789346 Pankaj Gupta 2025-12-03  270      *
> a9e23a74789346 Pankaj Gupta 2025-12-03  271      * Size must be at least =
64
> kB.
> a9e23a74789346 Pankaj Gupta 2025-12-03  272      */
> a9e23a74789346 Pankaj Gupta 2025-12-03  273     ret =3D ele_service_swap(=
priv,
> imem->phyaddr, ELE_IMEM_SIZE, ELE_IMEM_EXPORT);
> a9e23a74789346 Pankaj Gupta 2025-12-03  274     if (ret < 0) {
> a9e23a74789346 Pankaj Gupta 2025-12-03  275             dev_err(priv->dev=
,
> "Failed to export IMEM.");
> a9e23a74789346 Pankaj Gupta 2025-12-03  276             imem->size =3D 0;
> a9e23a74789346 Pankaj Gupta 2025-12-03  277     } else {
> a9e23a74789346 Pankaj Gupta 2025-12-03  278             dev_dbg(priv->dev=
,
> a9e23a74789346 Pankaj Gupta 2025-12-03  279                     "Exported=
 %d
> bytes of encrypted IMEM.",
> a9e23a74789346 Pankaj Gupta 2025-12-03  280                     ret);
> a9e23a74789346 Pankaj Gupta 2025-12-03  281             imem->size =3D re=
t;
> a9e23a74789346 Pankaj Gupta 2025-12-03  282     }
> a9e23a74789346 Pankaj Gupta 2025-12-03  283
> a9e23a74789346 Pankaj Gupta 2025-12-03  284     return ret > 0 ? 0 : ret;
> a9e23a74789346 Pankaj Gupta 2025-12-03  285  }
> a9e23a74789346 Pankaj Gupta 2025-12-03  286
> a9e23a74789346 Pankaj Gupta 2025-12-03  287  int
> se_restore_imem_state(struct se_if_priv *priv, struct se_imem_buf *imem)
> a9e23a74789346 Pankaj Gupta 2025-12-03  288  {
> a9e23a74789346 Pankaj Gupta 2025-12-03  289     struct ele_dev_info s_inf=
o;
> a9e23a74789346 Pankaj Gupta 2025-12-03  290     int ret;
> a9e23a74789346 Pankaj Gupta 2025-12-03  291
> a9e23a74789346 Pankaj Gupta 2025-12-03  292     /* get info from ELE */
> a9e23a74789346 Pankaj Gupta 2025-12-03  293     ret =3D ele_get_info(priv=
,
> &s_info);
> a9e23a74789346 Pankaj Gupta 2025-12-03  294     if (ret) {
> a9e23a74789346 Pankaj Gupta 2025-12-03  295             dev_err(priv->dev=
,
> "Failed to get info from ELE.");
> a9e23a74789346 Pankaj Gupta 2025-12-03  296             return ret;
> a9e23a74789346 Pankaj Gupta 2025-12-03  297     }
> a9e23a74789346 Pankaj Gupta 2025-12-03  298     imem->state =3D
> s_info.d_addn_info.imem_state;
> a9e23a74789346 Pankaj Gupta 2025-12-03  299
> a9e23a74789346 Pankaj Gupta 2025-12-03  300     /* Get IMEM state, if 0xF=
E
> then import IMEM if imem size is non-zero. */
>=20
> I really can't understand this comment at all.  :(

Accepted.
Will update the this comment in V21, with the following:
-       /* Get IMEM state, if 0xFE then import IMEM if imem size is non-zer=
o. */
+       /* Check for the imem-state and imem-size before continue to
+        * restore imem state.
+        */

>=20
> a9e23a74789346 Pankaj Gupta 2025-12-03  301     if
> (s_info.d_addn_info.imem_state !=3D ELE_IMEM_STATE_BAD || !imem->size)
> a9e23a74789346 Pankaj Gupta 2025-12-03 @302             return ret;
>=20
> This feels like returning zero is intentional, but please return a litera=
l zero.
> s/return ret;/return 0;/.

Accepted. As mentioned above, will return -EIO;

>=20


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11011021.outbound.protection.outlook.com [52.101.65.21])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 659E2311973;
	Fri, 12 Dec 2025 09:05:35 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.21
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1765530337; cv=fail; b=VF76K/DYzl/yjzv7p/hgAkstiXDKJPWm8qcgUVY2PIi/Jg8AUQ3GuZmgTa3nX4GiyhKSkcYIwunLWJJX7JhBwrrACILhnEguDY7dOkdOHXO9rUBY7HoBS8DPi8enwiLOynW8U9tAq1O8m7C6UAy4d0+4lGkVLKJIa+YglEtM6FA=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1765530337; c=relaxed/simple;
	bh=+ePCYrT/7xtJexWiUON8tZ6z6TF/CEcj6p5vY7lEr+4=;
	h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
	 Content-Type:MIME-Version; b=fP1fjX9LOf4azHieTOngFKI9+dtAMdqS1mQq9hmMAJYoPuP7hVLLBJ1vPx8EFJY/0FCk3R2CQdWQX6E4GxHNkasV8F8KUFZpIiCzoWBYm0zzASvxVGvLXWUttXNGpQNa3MCd2CzVD5POoCLWPFu3Vyo0jrUZPXnzjDaZwpwXtTc=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=P5mP3I/t; arc=fail smtp.client-ip=52.101.65.21
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="P5mP3I/t"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=KzwG8ei71GLa7Wuv7gInkAu79qhAyGs+LUXUbGVMo/GhVvOYdTXkcJ23PRL6OcDNN0hvtjEWSnVxWwyek8RoJwWL8+Fl6UVJOFQHeJj4o7GAwhf2sZcvWKLij0C0poF+/YPFwTuVQzS5AGVEXA4+J3QwsjlKXZiSu38V2tKEmZ2M3/5RLXrx0kX7j+al5WChnpvb37heE+xSOEN9DiNVG39ZnBOtV4sYqDvKmEF3SbXX/JQz9APqvnRSJMeL3HdHy9+CASax9Zu6LMK2nK0E1lWw+Ik7ljEFyFIucHZhFWvqI2Wrypf6kDrXDxgIykDKiQk88n6O5W9mI5plz0eoOw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=+ePCYrT/7xtJexWiUON8tZ6z6TF/CEcj6p5vY7lEr+4=;
 b=dctblTsw150MUak1PiLqWaX8PY0+/qGKjZ+NsZVHsucukXUugQoMsJL6Nk/2dZxRc5+c/XXJ6zTKLUeBisfmiZY3AY9j+8Nsz2Zg+6SF4wYU4DKkhShz4VBUPF55ban9J/hzUtMfJLSOwPWwzstG9mQquRLaQq/W/Qz8OoA/JAbtnckrwETOjVUsT3Ff0O5k/9LkgUYYT+GLwc4ABhYMzf667cTIxsbwXWTt3DPEI2VeZikWTy31WbYNICrUPFvwcwaaP3p/uPsC3k1NT9RmKWR3xz1YHr5kuImb4UCEhzzdin3CE7unodKf/MOsbdZGC8ZNyuVnwMPI5/7ehcheNQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=+ePCYrT/7xtJexWiUON8tZ6z6TF/CEcj6p5vY7lEr+4=;
 b=P5mP3I/tBiyo5Kk8hx4sWSaqippiMOqfZdOTu84DbFDspPXILL/g4g3UO5K5IB3sQ+qI1Cxu/uOl8+hp9fjGOAe2h74iyzkUE+HsH5NAgkm0RcXz2ROtOTNhYD26OyU+BWgxgkLJFiAZv+BKLBlPeUxUBAtMZuFnnlj6dCs9kc6f9u4hcLsnglx8c8uEiQppbOt1xWTiDd6po9LI9w3QpgypLJI3qYr8epEVKBX94NAiNzecsHqREKk34unmAXC6ZKHTlfWjQ8h67+rXc5fQC2ZLs2/C/3++6G7yGX+ypIi2LdWCW4d72HiAzDY01MI6VCT8GWs+XuYXOWfokv2K/w==
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by GV1PR04MB10524.eurprd04.prod.outlook.com (2603:10a6:150:1d0::5) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.8; Fri, 12 Dec
 2025 09:05:29 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9412.005; Fri, 12 Dec 2025
 09:05:29 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
To: Randy Dunlap <rdunlap@infradead.org>, Jonathan Corbet <corbet@lwn.net>,
	Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, Sascha
 Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team
	<kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>
CC: "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>, Frank Li <frank.li@nxp.com>
Subject: RE: [EXT] Re: [PATCH v20 3/7] firmware: imx: add driver for NXP
 EdgeLock Enclave
Thread-Topic: [EXT] Re: [PATCH v20 3/7] firmware: imx: add driver for NXP
 EdgeLock Enclave
Thread-Index: AQHcZCDyTcT7+LXTOkSolFAmviM5prUQNdCAgA2OpYA=
Date: Fri, 12 Dec 2025 09:05:28 +0000
Message-ID:
 <AM9PR04MB86048456E6BA337E3AF5754195AEA@AM9PR04MB8604.eurprd04.prod.outlook.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
 <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
 <33d659bd-eba9-4b47-a374-32b6c763d640@infradead.org>
In-Reply-To: <33d659bd-eba9-4b47-a374-32b6c763d640@infradead.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: AM9PR04MB8604:EE_|GV1PR04MB10524:EE_
x-ms-office365-filtering-correlation-id: ead7ce10-0a07-49ff-d38e-08de395d98c1
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|366016|1800799024|7416014|376014|19092799006|38070700021;
x-microsoft-antispam-message-info:
 =?utf-8?B?bU1kK1VJV0tvM2xTRVBRMTJTd242ZldLKytHL1BJWjJOeEhDZHB6L2VORE9O?=
 =?utf-8?B?TzVWdE40aUZxQ1ZpZmxBMVR5dmtVZDVWMUFlQlVlVjRJcVJTY0ViZGxUdXFw?=
 =?utf-8?B?MzdSUUNOMDlQNVpUY3BpR3hLTmNnOHJRbWVrMEczYzhkTk14Ykx5bGVKc09R?=
 =?utf-8?B?MDhTUjZwQzlYcytqb1gyVmEvZlNKd3FjZnQwQkJEamo5WXVDWmNhTXIwZENN?=
 =?utf-8?B?NlJuTFI1ckxXZVRkOVM2K1Jod3JPWUR5NXR1V0FHS2h2NHNUdTJmaEtoQXg4?=
 =?utf-8?B?eDRtYm93VHk2SU5WNFVkMDA4TlpRaUhaZ1MwbTZ2ZWtzbU8vM1BxbzlTUnVV?=
 =?utf-8?B?eDJCMGpOcDFGTTJrUEUyQnY4SGhLaWwxU3dlOG5UZC9NN1BkMllRNFNmTHcv?=
 =?utf-8?B?MzFyYm1FSG5nbFRINU95bkJRakFHWkpES1g2NEtJNUJDai85UmlPVUFkVG8v?=
 =?utf-8?B?ZUY5L3NSU0hhWUNJRXVoR2QwYm1NZVlRLzdmc2ZyU3B2WmphRkd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8?B?MjBZc1JhMy81K29KeWJqRlB0ZlAwVlcwa1lvRHM5d3d1Ym1JVVM5Vk5iRU0z?=
 =?utf-8?B?VC8vTm93cG9aOUUyQlFDVEhKZWxVZk1aMk1URUNxOGhBQXNEeTlqZWNPRVMy?=
 =?utf-8?B?SC9IL1c2ZGZTRkZDVTJRcGJTNUxXL25oQU9telBNMXZIL0lkang1dDV1RFN3?=
 =?utf-8?B?dkh3dHZyTUxObHZDcitqNGk0ZVdpbittVWl4RWx6RU9RcHVwdWh2UUpIL0F0?=
 =?utf-8?B?RHdOOHo2RzZFNDVnU2pUaWFJUnpxOFkvV2NaNG5HS3hVTkd4eUpwY3lXYWk2?=
 =?utf-8?B?dW9UdjdaUzFPS3BFM1RyQUZOWkxodUNkQUE1WXBPWXhaU2tqejdLYURPQ3hE?=
 =?utf-8?B?UVB1YlFObC9UNzJYY1Z3S0VUU1VNajR2Ykp0ZWZmSkZid2Z3UEN2dCtxNWRY?=
 =?utf-8?B?UVdkWHQ4bGtVMUF4RjVRckovbGFPcVZnTjBJTzh6Zld4NTM3UCttcE43OHNa?=
 =?utf-8?B?QlRvdW5wYzFGZTFJdGIwOXlXTGZaY3l0TkxmK3NvMWlYWGxWK1VOa3grOVpa?=
 =?utf-8?B?c0tyMytPY0s3RU5ZakgzTndBdWxVZVNTeEdPcWRDV05tMXFGN2F2d1cvaXNJ?=
 =?utf-8?B?ZnEvQzdhOEdaa3Z2NUV0L25UVkw4OC83Vmw2TVFMZlI4dEUweFlBRUpJaUp6?=
 =?utf-8?Q?pYYYOh?=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014)(19092799006)(38070700021);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?utf-8?B?b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QTWx4Qk8wZi95cDVucG5YVDVm?=
 =?utf-8?B?YkZWSUJPanRsS1RrbHBwaEFJTWUzajBYWFRQV2ZNOUt2cXd1MnU0UEFhd21N?=
 =?utf-8?B?WVU3WjUySVhhWms2eEZnYXN3dTRTUXJDTE1hZXBWSU1ZdVdna3Ixem5PZUhR?=
 =?utf-8?B?VGliTGYwd2g0SzRmckRDUm1EWU9yRWVNaXFiaHJWWXRIckNEYUdRbzBpbVRC?=
 =?utf-8?B?ekRFTjBJUlhCdVIxdzJGalZIai8wUStwMUhmS0k0ZEFWczRHand5RVd6RHdX?=
 =?utf-8?B?TTJodW5OWEcwSHZjTDFXb3JmNW1rSnp5ZytMTExsM1pCWHRLUUUrT1lORnBi?=
 =?utf-8?B?bkFFZHhSd3lvSnVad2pYR3Ric2xuSFpYcHM4MzNBV3VVbHBUSEhodWNHeDZO?=
 =?utf-8?Q?xGfs=3D?=
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: ead7ce10-0a07-49ff-d38e-08de395d98c1
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2025 09:05:29.0173
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: Y1X/uPjD7+gwjIwJIIb/94rVf1qQ/wo2DfayoPKb2kvSKj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sgICAgIHNlbGVjdCBGV19MT0FE
RVINCj4gPiArICAgICBkZWZhdWx0IG0gaWYgQVJDSF9NWEMNCj4gPiArDQo+ID4gKyAgICAgaGVs
cA0KPiA+ICsgICAgICAgRXhwb3NlcyBBUElzIHN1cHBvcnRlZCBieSB0aGUgaU1YIFNlY3VyZSBF
bmNsYXZlIEhXIElQIGNhbGxlZDoNCj4gPiArICAgICAgIC0gRWRnZUxvY2sgRW5jbGF2ZSBGaXJt
d2FyZSAoZm9yIGkuTVg4VUxQLCBpLk1YOTMpLA0KPiA+ICsgICAgICAgICBsaWtlIGJhc2UsIEhT
TSwgVjJYICYgU0hFIHVzaW5nIHRoZSBTQUIgcHJvdG9jb2wgdmlhIHRoZSBzaGFyZWQNCj4gTWVz
c2FnaW5nDQo+ID4gKyAgICAgICAgIFVuaXQuIFRoaXMgZHJpdmVyIGV4cG9zZXMgdGhlc2UgaW50
ZXJmYWNlcyB2aWEgYSBzZXQgb2YgZmlsZSBkZXNjcmlwdG9ycw0KPiA+ICsgICAgICAgICBhbGxv
d2luZyB0byBjb25maWd1cmUgc2hhcmVkIG1lbW9yeSwgc2VuZCBhbmQgcmVjZWl2ZSBtZXNzYWdl
cy4NCj4gDQo+IHRoYW5rcy4NCj4gLS0NCj4gflJhbmR5DQoNClRoYW5rcw0KUGFua2FqDQo=

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010064.outbound.protection.outlook.com [52.101.69.64])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADACD311C35;
	Fri, 12 Dec 2025 09:07:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.64
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1765530439; cv=fail; b=RpuwL2Sn/limcfSYC4jyooje3c7pGpYnaweB0MNp37aN2rkKlTtsG+dw1LEjeEH8hHVEUL5guKvDw3vGHr+zJKE5ZgouI0UCzIRlO+7Xb6feCGbrvVB6pOY4krk1dpcgNpWfYUO9orHFI78/ecHZNm6lmhlxXW1b3yKc+5Ji/CI=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1765530439; c=relaxed/simple;
	bh=+UnDTG5gfJh4UnKvHDNF9Xj1bDQom0UlBEy+kXhF3fU=;
	h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
	 Content-Type:MIME-Version; b=o/Y3lNizPl9LevDvTFLrGOMe/aG/fzl+xistPCSyVq6PuzqK8SxVtCZaXvmIiKZ8RW4khh/oNOoNxaKQFWR0LLR2zW4mNZTZOo734pPT61OLbQhVO0fhMzshFLk11lC1eFFhS3xhti7Smog4WgXlcGapqyye19w1uzFrXVEQ0n8=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=aJyeVHlW; arc=fail smtp.client-ip=52.101.69.64
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="aJyeVHlW"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=lvakheHoX81vl6NRpstw2gcnhWdjUpSD25pMrXIgPIy20zORehZIVoov/vsDhbfpmxjaSAMmHQMJPXUW9klvQIXtDIff8mq+Zv0qudEs5Fd23NnKukT3kJzub3BkqaFWwxNktw3HIj2IJUWzGzRPFOtbsxcQtZWluG2SWBAm6XxLIfZoilPc41jHy33JojZywYSxHVdAwSXFLPuZlvZ1DQGrduTpZLi13deqYZVxRVsUlPk+7BaVAmn4XcdKXkM5H6OSDyrrpUBpiuRq01EtM5C4N1UPjH9USNiZYYsHeYMyNeEoyM8pEk9bph5Q2pPecAn0zcdzbBzR1DFca/hn8Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=oz7vYhgPHG1PjjrNekncJuLS5n3OwxZ69IuhoWlNXCM=;
 b=SWPYwSxLPF6mKUHR4Ha8QG9tdcrzdzMntt2EuvY3aUczqfMUx1A+XAh8qob76PrNR1pCCWjQ4RonSp1BRzx/4w/NvfJbVSrWKWTCJM3TJrKkXp+TByes7yxU7Th9NoImSzUJLcVeRlGoAb5YzXun4uteLpCP/0uIqnDlLRsQgH/aOn/IgqZYRt1B/dAgur2gnSOxumSkdsVmL6GvDkcMhe+XPB+U8ERr9INm37iaGgVmXMtovrJqeH7wSCAzWYskmkD/c+HwPeUArozh4WgePMAOgCuCQgFR6VDFMA63Py4AyiuyPDW/pn+LysytzeGCvpCjWHKPgUp9ptSf641Bww==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass
 header.d=nxp.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=oz7vYhgPHG1PjjrNekncJuLS5n3OwxZ69IuhoWlNXCM=;
 b=aJyeVHlWmTflKGF/NGBi9RpdwD2yowC3uBiwDZsevgCUQjLGXxuXKyFzx5xJUMI7KEVoNNpb2q585ijkMLiTpnmIY13DdELvYKOSEcgcrNjkKjdhvP5oHoadAB0pxkh+sSIfIcVBtgXSCoygHtiE+edK4ea0TdXLKg9HDokVUvcHJ5x3s/KHJAdEVcOVAZYMR8beHP2anudJ3bQ9d3vGnu4gNaq0WEI52hzs5WkeTWPXbPgerjiFQqrqqS0KZ7q3DMLvkXblzALB1YwcmJ/UPnIE+7eSQ4DQoM1Ke1uaVmZJ+tV+Mfkmr7gOIzVuGnI9gBLX8DnGkw7I1boDZoFJGw==
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21)
 by GV1PR04MB10524.eurprd04.prod.outlook.com (2603:10a6:150:1d0::5) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.8; Fri, 12 Dec
 2025 09:07:12 +0000
Received: from AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827]) by AM9PR04MB8604.eurprd04.prod.outlook.com
 ([fe80::e751:223e:aa3d:5827%3]) with mapi id 15.20.9412.005; Fri, 12 Dec 2025
 09:07:12 +0000
From: Pankaj Gupta <pankaj.gupta@nxp.com>
To: Krzysztof Kozlowski <krzk@kernel.org>, Frank Li <frank.li@nxp.com>
CC: Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh@kernel.org>, Krzysztof
 Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>, Shawn Guo
	<shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
 Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>
Subject: RE: [EXT] Re: [PATCH v20 3/7] firmware: imx: add driver for NXP
 EdgeLock Enclave
Thread-Topic: [EXT] Re: [PATCH v20 3/7] firmware: imx: add driver for NXP
 EdgeLock Enclave
Thread-Index: AQHcZHY7guUrzF6CzkWjbB+TVSP+h7UQL2GAgA2U0QA=
Date: Fri, 12 Dec 2025 09:07:12 +0000
Message-ID:
 <AM9PR04MB86046ACCE6AF2BE7099FD3AE95AEA@AM9PR04MB8604.eurprd04.prod.outlook.com>
References: <20251203-imx-se-if-v20-0-a04a25c4255f@nxp.com>
 <20251203-imx-se-if-v20-3-a04a25c4255f@nxp.com>
 <1ee383c7-ccbc-4c90-adf3-bfbe87fb6765@kernel.org>
 <aTBsdW0lpZSCVsgp@lizhi-Precision-Tower-5810>
 <48d5895d-fde0-4795-8049-788fa3171fde@kernel.org>
In-Reply-To: <48d5895d-fde0-4795-8049-788fa3171fde@kernel.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nxp.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: AM9PR04MB8604:EE_|GV1PR04MB10524:EE_
x-ms-office365-filtering-correlation-id: aa7e9ed1-b86d-402f-36ca-08de395dd68e
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|366016|1800799024|7416014|376014|19092799006|38070700021;
x-microsoft-antispam-message-info:
 =?us-ascii?Q?QokYOMKqDD1ATBI2tU9OnnHy0H799JBb67LHxRXi8l+7w3RED9Lu33j4zr8y?=
 =?us-ascii?Q?49iksAx5bSeSyM5xlnzKTG18LYV0tika3tyKL70IoFfewexKzFgnmVZhVPRa?=
 =?us-ascii?Q?LNUtrJqGU+SFUtwxJf5vXu1qKdBRqbDAnlp+0ME9WbUYawscSb0M/CQBLmNE?=
 =?us-ascii?Q?NY7n0PkVNDqnYyze0D6WOZEutPjekes7YBF7oE9RqupHR7ye8ljVNVqKrHna?=
 =?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S9OqODPdieivuPb+IcYPtl1X0ZpneqSoTUZtJuarfoctVDVw?=
 =?us-ascii?Q?p8/XMtx4S3jsGg61I4UJXqunCeBvrWl9MDQqGpN9JNTcr0a23MOAte6DkmNZ?=
 =?us-ascii?Q?C938ll6qTwzgLOjXS6v4R595L7wKy9gOG7MS6k/8RFj0YBbcGWdaKm1NcKKA?=
 =?us-ascii?Q?n1zkxQg/j1KikKAxuXMU/wtlAtoL1Rk2ILeX6QhgcWUUV+BQWbS2uz69zCZ3?=
 =?us-ascii?Q?+yKpezDAJ0ZTaCpjSVWSdwVcBUEW6ISs7SORPyZovILIK0BjEZwuFUL1ArCC?=
 =?us-ascii?Q?u6WYBCkxPqrx2Dm8zkvF92cTScX7MnOTXYW4hnDL3hYqVsLuLkUhPsXErTmb?=
 =?us-ascii?Q?zCFWnTdLqN0ZgDwKCFu7v+YPJLGclHO8kVxZ6ZG2dL+p2p+bdpvCBMPHEc91?=
 =?us-ascii?Q?O7U6e9W/g9Xznt+nsbIYWMY57F9jjwy0nIsL?=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8604.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014)(19092799006)(38070700021);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?vdYn11hJ0hE6azjpDlW8LjFaJ09oxa9jiBK1tUPsDYd/TQjaRaIbFzudrzdn?=
 =?us-ascii?Q?cfP/r/QW8HD7HnZFdasd4LMrrWBc8bL1lWPak6Sq1fHUa9tlcTUWdNhNa/6E?=
 =?us-ascii?Q?ymlz9G6LrSnbEy2FNF9908c4H7Tzcvg8s3Gn9XeEuiTH9JnUQG5HYH3Hoo5N?=
 =?us-ascii?Q?NaPC35GxVXb/KsWkw8Edcbx+6UV/2KjaaMh94AKv0uhD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a9mQ5NC2tMuVTAylYJStMpoPqc6OaZDcJWlGedK1Y3xjiOV14EPrbrax1izo?=
 =?us-ascii?Q?5BFNP1piVSDeOKeKYMHq3SLTLaAAYfVVDFZ9Kd9LB1bK7GvWYxcPQFpbdVVF?=
 =?us-ascii?Q?WFe38z3ADYo1RQKCBQTwXS8yHwbJTzhoatxJI1iba20eJshug2ZK/VhhXKYf?=
 =?us-ascii?Q?sL4vG/T9YGXbAR5iZkhQHG63fxL0pRSLaZ8t7ZsCaOHSpFoIbSrTp75KjtC0?=
 =?us-ascii?Q?EV2IMA5+Nmsej4J8P7mMiMQf2RibncpF4KRTYRojrPWik9iCys70KPw2duav?=
 =?us-ascii?Q?OhSPwjgxcJ7SUg3jj0/IbpBaCYBdwWmsk6bBjVNG+8pHjziFNm4oLY9es15X?=
 =?us-ascii?Q?UzcGOnH9aMcdw/qkJKbJwQfvCHBZpiRLGnJIP39nANsO4MzOxO6JOpChvlvs?=
 =?us-ascii?Q?/MyeERqit0wjLd88gC3ROFeYhr4Vr8CTG3pqNiNkvg3CsosqfrulAghRav3L?=
 =?us-ascii?Q?VXcdkEMwLlogMaTG1p4=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: aa7e9ed1-b86d-402f-36ca-08de395dd68e
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2025 09:07:12.7131
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: tQsz81q2fngqGis1vw8VOkLh4Dupm9NR5L+T08U5e/NwfdcQQU55IhD+lNj2BKlRV9HOoyG7wY+TCsvsEwBL5Q==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10524

> >>> 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 with Linux over single or
> >>> multiple dedicated messaging unit(MU) based interface(s).
> >>> Exists on i.MX SoC(s) like i.MX8ULP, i.MX93, i.MX95 etc.
> >>>
> >>> For i.MX9x SoC(s) there is at least one dedicated ELE MU(s) for each
> >>> world - Linux(one or more) and OPTEE-OS (one or more).
> >>>
> >>> Other dependent kernel drivers will be:
> >>> - NVMEM: that supports non-volatile devices like EFUSES,
> >>>          managed by NXP's secure-enclave.
> >>>
> >>> Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
> >>> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> >>> ---
> >>>  drivers/firmware/imx/Kconfig        |  13 ++
> >>>  drivers/firmware/imx/Makefile       |   2 +
> >>>  drivers/firmware/imx/ele_base_msg.c | 269
> ++++++++++++++++++++++++
> >>> drivers/firmware/imx/ele_base_msg.h |  95 +++++++++
> >>>  drivers/firmware/imx/ele_common.c   | 333
> ++++++++++++++++++++++++++++++
> >>>  drivers/firmware/imx/ele_common.h   |  45 ++++
> >>>  drivers/firmware/imx/se_ctrl.c      | 401
> ++++++++++++++++++++++++++++++++++++
> >>>  drivers/firmware/imx/se_ctrl.h      |  86 ++++++++
> >>>  include/linux/firmware/imx/se_api.h |  14 ++
> >>>  9 files changed, 1258 insertions(+)
> >>>
> >>> diff --git a/drivers/firmware/imx/Kconfig
> >>> b/drivers/firmware/imx/Kconfig index 127ad752acf8..5fe96299b704
> >>> 100644
> >>> --- a/drivers/firmware/imx/Kconfig
> >>> +++ b/drivers/firmware/imx/Kconfig
> >>> @@ -55,3 +55,16 @@ config IMX_SCMI_MISC_DRV
> >>>       core that could provide misc functions such as board control.
> >>>
> >>>       This driver can also be built as a module.
> >>> +
> >>> +config IMX_SEC_ENCLAVE
> >>> +   tristate "i.MX Embedded Secure Enclave - EdgeLock Enclave Firmwar=
e
> driver."
> >>> +   depends on IMX_MBOX && ARCH_MXC && ARM64
> >>> +   select FW_LOADER
> >>> +   default m if ARCH_MXC
> >>> +
> >>> +   help
> >>> +     Exposes APIs supported by the iMX Secure Enclave HW IP called:
> >>> +     - EdgeLock Enclave Firmware (for i.MX8ULP, i.MX93),
> >>> +       like base, HSM, V2X & SHE using the SAB protocol via the shar=
ed
> Messaging
> >>> +       Unit. This driver exposes these interfaces via a set of file =
descriptors
> >>> +       allowing to configure shared memory, send and receive message=
s.
> >>> diff --git a/drivers/firmware/imx/Makefile
> >>> b/drivers/firmware/imx/Makefile index 3bbaffa6e347..4412b15846b1
> >>> 100644
> >>> --- a/drivers/firmware/imx/Makefile
> >>> +++ b/drivers/firmware/imx/Makefile
> >>> @@ -4,3 +4,5 @@ obj-$(CONFIG_IMX_SCU)               +=3D imx-scu.o mi=
sc.o
> imx-scu-irq.o rm.o imx-scu-soc.o
> >>>  obj-${CONFIG_IMX_SCMI_CPU_DRV}     +=3D sm-cpu.o
> >>>  obj-${CONFIG_IMX_SCMI_MISC_DRV}    +=3D sm-misc.o
> >>>  obj-${CONFIG_IMX_SCMI_LMM_DRV}     +=3D sm-lmm.o
> >>> +sec_enclave-objs           =3D se_ctrl.o ele_common.o ele_base_msg.o
> >>> +obj-${CONFIG_IMX_SEC_ENCLAVE}      +=3D sec_enclave.o
> >>> diff --git a/drivers/firmware/imx/ele_base_msg.c
> >>> b/drivers/firmware/imx/ele_base_msg.c
> >>> new file mode 100644
> >>> index 000000000000..a070acbd895c
> >>> --- /dev/null
> >>> +++ b/drivers/firmware/imx/ele_base_msg.c
> >>> @@ -0,0 +1,269 @@
> >>> +// SPDX-License-Identifier: GPL-2.0+
> >>> +/*
> >>> + * Copyright 2025 NXP
> >>> + */
> >>> +
> >>> +#include <linux/types.h>
> >>> +
> >>> +#include <linux/completion.h>
> >>> +#include <linux/dma-mapping.h>
> >>> +#include <linux/genalloc.h>
> >>> +
> >>> +#include "ele_base_msg.h"
> >>> +#include "ele_common.h"
> >>> +
> >>> +#define FW_DBG_DUMP_FIXED_STR              "ELE"
> >>> +
> >>> +int ele_get_info(struct se_if_priv *priv, struct ele_dev_info
> >>> +*s_info) {
> >>> +   struct se_api_msg *tx_msg __free(kfree) =3D NULL;
> >>> +   struct se_api_msg *rx_msg __free(kfree) =3D NULL;
> >>
> >> No, don't use this syntax. This is explicitly discouraged.
> >>
> >> NAK

Accepted.
Will fix this in V21 patch-set.

> >
> > Add link for reference.
> >
> > https://eur01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flor=
e
> > .kernel.org%2Fall%2FCAHk-
> %3DwhPZoi03ZwphxiW6cuWPtC3nyKYS8_BThgztCdgPWP
> >
> 1WA%40mail.gmail.com%2F&data=3D05%7C02%7Cpankaj.gupta%40nxp.com
> %7C10fcf6
> >
> 46c5424c32be3508de32934df5%7C686ea1d3bc2b4c6fa92cd99c5c301635
> %7C0%7C0%
> >
> 7C639003805451655771%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hc
> GkiOnRydWUsI
> >
> lYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3
> D%7C
> >
> 0%7C%7C%7C&sdata=3Dqxkxvyfwzl970fCJNa6iMr1i1zWYIdCIg4AIQMowvX4%
> 3D&reserv
> > ed=3D0
>=20
> This is since beginning documented in kernel, so contributor could read
> cleanup docs before using them. Above Linus remark is nothing new, he
> already wrote it ~2 years ago.
>=20
> Best regards,
> Krzysztof

Best Regards
Pankaj

