From patchwork Fri Jul 5 13:52:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13725197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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.lore.kernel.org (Postfix) with ESMTPS id 0B064C30658 for ; Fri, 5 Jul 2024 14:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: Content-Transfer-Encoding:Content-Type:Message-Id:Date:Subject:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=wKRGDFXYh1nK9oVqCxNJGhTBJh0QvgS6gXTXFthBCD8=; b=IoPkdtmwmy827G6emOdFskpa32 pA0+0f5Qh9pkpKBofknmxPu8bZr6ew2U071+XLk5afPu7BbrDK83qnZnk3kqvmzXbDSZBuSG9cIPD PMFXO/1GyPCJF4DGBzA8N62g59m69Mm6a5ho8L1zv8KHJdp2ItVn24wuyr/LOXkd2ESuDdR3G/A5Z HCE35SFuxkm4FZN7sFe29HC7bTAu0fC13ZqCpYA1ofa/m1MgLsJEb4PGhH+phMTivT0i5yOpqHVjT Y67m8XPfutJVsl8ujYkDBPkvhILYpc5wlOfgwcud9s2dNt4MdZsX6Q6MrSptceqJUI+gpdN3LIKdC nyHTytbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPjey-0000000GA9e-10LW; Fri, 05 Jul 2024 14:11:36 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPjej-0000000GA4W-1uf5 for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 14:11:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BCpzhRTT1Mv647nB5QENcQ2DAqlAzWTbnZIzpFge1Dn42db9cG/7SPjFAsEDutUQB3SOz+SHYKiMNxKCF2Q291ODmZoHsZtc+0uPDQEodO4BznGU+OyrQFxivoU7CnNJSyPuBpPoFfDv2D2XDKP3yTTBhDlYLfoOXrHvBoy4JwqhHt+TKO9D70ozs8yEfYwAAsgvG0b+aFgZLt3iuK2hxRLFsds3dKZ1hwZcdOyddCYfWNcnGieJWvWLOKmo6VDBlc1pk+FfEvZ6yqNNALfQ8eRxo/Syz8OGY2qIbkanUUkVTl/OEKwXjGKTZf0Qu7t8hKJMRriT9hicb4vu4bcTaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wKRGDFXYh1nK9oVqCxNJGhTBJh0QvgS6gXTXFthBCD8=; b=RbmzgWpDB17fd+PwR842yqDHCYbOElM2E73b/AlGuvzn08YTMyHnuCZGrg7PWhDPctxm04uc2QYbe6TGeDLGjsIBFaiZRrmtF0F553JgHB5Wf+yG6O+GWq5JXZ1NlZXM4KMK9oMDxLLcaAzuhFNcsNoDHMDE4MI1WruWdzgUHSM9Syfp+4+4F6w3T3WCtrk5PuDrIMURJ6OYJ89I450PybTj4mUpNxW/fJ+gjbke3rAn2dyPg006x1xlNHy6/yxcUwCtCdRjlfEbT5hKEQoFztsYBcEpCda4IRo+P2DG+RHvwWSwcQxpQabfSRQhvas1kuESL+WHFbtAlSKjn5pkKg== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wKRGDFXYh1nK9oVqCxNJGhTBJh0QvgS6gXTXFthBCD8=; b=F/6gGYdT0nI3a83d7jooSzcD/wK8thAl0pz+BoaUWQkFzPeUoABsyNd0HAlb5ynZF6eK0xh5OOXMgMVKqi9fNgs0q/Puo0oK5yfvpaTGe/Fx+Fb69Fh5/CmLapXZ7/QrQXpmJqllIa0Q6bX4DwNMaiFHILgrpI++hoMCL+ECx8E= 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 DB9PR04MB9260.eurprd04.prod.outlook.com (2603:10a6:10:370::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.23; Fri, 5 Jul 2024 13:55:53 +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.7741.030; Fri, 5 Jul 2024 13:55:52 +0000 From: Pankaj Gupta Subject: [PATCH v4 0/5] Changes in v4: Date: Fri, 05 Jul 2024 19:22:39 +0530 Message-Id: <20240705-imx-se-if-v4-0-52d000e18a1d@nxp.com> X-B4-Tracking: v=1; b=H4sIAKf6h2YC/1XOSwrDIBSF4a0Ex7Vc37Gj7qN0IGoaB3mgRVJC9 l4TCrHDc/H7cUXJx+ATujUrij6HFKaxDH5pkO3N+PI4uLIRBcpBgMJhWHAq1w4bDiAEaOasROX 9HH0XlqP1eJbdh/Se4udIZ7JffxUCVSUTDJgqK4xUXBPp7uMyX+00oL2RaeUoqx0trqDOkVYbw fS/Y6eTpP51ZsUZ5WjrvBGWm9Nt2/YFrOiBghABAAA= To: Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Pankaj Gupta , Rob Herring , Krzysztof Kozlowski 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=1720187574; l=13891; i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id; bh=EVN1PD0DbRAt3m/2onpulg4TwDsl7xnd9tG+Foo0WsI=; b=6QGfmmsDI8S4PqDqE0j4ldnY9sYupJQnIfTYH7YTTnR/1Xk+kcwb6DvkeFiviky769n9NnBUh fNRgWOTm5KZAPzim1jGOWViNL2HxMK9GFUdOkreWBzCcoUUJenvPX4I X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519; pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg= X-ClientProxiedBy: SI1PR02CA0059.apcprd02.prod.outlook.com (2603:1096:4:1f5::19) To AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|DB9PR04MB9260:EE_ X-MS-Office365-Filtering-Correlation-Id: 427175a3-6489-4733-cb5b-08dc9cfa2f33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?aykQCkXcSmwLhvknF76N6PjQhZzzs5q?= =?utf-8?q?9cNS2PzLf5elHgnI77m4m9bOmbvUlKTvuzao3o5LRyZ8FlemD6NY0dTBxsCzBfR9i?= =?utf-8?q?9RumFO2b3C8VsHOv1/Dn5y61MpRxLTU0ShkNngKKZLJTC7PAUlgpnZRtDYrt2K6hO?= =?utf-8?q?im8aLoqlskE8jU2HruCyQvIsgDVC8brfM/8tiWz1VgAftHsWPiAzsiyTmpcG/IM5n?= =?utf-8?q?s12cZAb+8u63zzHnwXzsCEYVZqnghhO+Jfc/ukxQEKvmSgrh3HDqzXYW75cmnN4i0?= =?utf-8?q?WAGOmeZdarJVVB234rxvLK2iWL09iYv1HhBuhlJj5ClDDAyLQPFbgn0qKTDcmT3nM?= =?utf-8?q?S8ifHg8s3JftDnSk+jQHUQ1+1T5McTjiZLfmAMe+gpd4cMM6MTq1VX27TG9iipiQS?= =?utf-8?q?y+qNhSmlU+zlGJe+7RuQb6iTzrX4+V6MKPfHDoyuox3SQQchLenyhoIlUOoJX6/te?= =?utf-8?q?AP2HQmg9sh2Ux/nqNLfy7Jt7e7BTeUli6JKd2NVn0TuNsk6eht4hvuEPLoDxzZ95L?= =?utf-8?q?jid01NDDpVIYTgyhWwOB2nH0zgZMv44g3dkEyCBhGT4GGsh0DdHdMItkZuKp2yFr1?= =?utf-8?q?pAd6T8G/Tau/hhviou0kka+jDHw0xzgL2X87vI2R723H+oJw6/MuUjDw/D+X1qk2J?= =?utf-8?q?146k2ftZLy7ZXJh9f5sVOoN4EId2Fnj2MSORRX2KSS/34+kopwUBZKZfA8M6zeW7E?= =?utf-8?q?CYIrTpuuUTIv+SzoNbemjO+rEDfs2mZLMXlzUZKbAv81AMvblrYwoU1SIGhFI19TH?= =?utf-8?q?0T8Bh0scfaf96O0XhyaxqjJtUaF1yyqkNe6M96TOOgrxRpsnhmiaVIRSm6T5hIkxi?= =?utf-8?q?ftj+mvQrFN56JwCsODnyxd4pF0WrBxg2LmsTJCJCAgMgYCpsCUAvloYxKi6nBZBWe?= =?utf-8?q?mNBlPHx1tq5K/1dpKGdjw1J6wEv6UPwrGJg0a5blDqpjXKfdHGnSEal6P7Stxdo0/?= =?utf-8?q?dKbturNGxXSoUUvBtLJrAxYEJx5KpSt+68o4rZcOy5uV25GA7ubYyaQupKFIGdvx2?= =?utf-8?q?+H3uwkpJLO2UNmMFVPNSGRYKTFd8s8T07cJChLpuo0nW4NUKCe5TcEihWzeWGUYmT?= =?utf-8?q?K3SBCHamNU/LZsKzvQtKQV6mZM/nP0X02GU+680D1aCsN5Z/Kn3/bmvbOseqokfet?= =?utf-8?q?1BVIfH6A+RjDUyL/IaNbUC2XLGX3nZNpUBcIMtg8Pq+/nptu5MSRiqqjbdP/nPoeG?= =?utf-8?q?vavsF5hZQBNS0AEsMDRSZgRJoc4uvMeTITDp/MDzbeq4jm5z/b/kHP4PL5LkV+yCz?= =?utf-8?q?pBn+nvkkqguB/nJT0/3XxwwekCXdfp4DzrOP5F0WxB0kpuV6yO1kL47KRtMassBv5?= =?utf-8?q?wPJMcAL0WQho?= 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)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?f2wDKU7Fm7RswsLQQh3c/FTY0kI3?= =?utf-8?q?H/LbXaGxcvkiyXxaMWsNQhtHOEoACd3hQcZPv7iVMQQIQI8ooQ7gytZKfaj+ZfAPh?= =?utf-8?q?no79rXKzaslr81KKG+m23NBwlBD1Cg7CM/Ruweaz1zobtv9wKOYWjKkOLlUketMfa?= =?utf-8?q?VN20uHB+uHxaIYzgLSB5IYO9/I1Q8VwBjYaorAH0xX2auB5Bqg354NwdoE6WQHeow?= =?utf-8?q?Ta7Xers3h75CdLNVYo9HpI86Yh3OJgB0fA2eBet92UX/Zfu//Ts+M6XK5DtMsIpaR?= =?utf-8?q?NoVQrW6iF1kFfkC3NjjnqxgqL/ZyZWNnJih0WJqml4mrICPjtr2gHsaLch3UB5ua8?= =?utf-8?q?eQUA4YxBIa8/HmnYJzsyfjjaz6lkpRb29UIgSVvDo+ljpB5lQTi0VOkKQF2VHUu36?= =?utf-8?q?+QRun0aCS6G9WHxGK58BwPr/VtwUBm4GPta/Ic+A8nlZw8g9W6L3NLmPF1UfMtqza?= =?utf-8?q?6o/hpz1zjsyp15eghzwveEM1SsyQJusKg0EeEdaKVa56Ocoy958q4Z76Sxf3IhZjs?= =?utf-8?q?il/5v6e25lyt0G8jpKDKuIWHOQlpX/7p63Z6uM8d/vklLt/Rvz2WS+R+9jf9PXoCO?= =?utf-8?q?S81E+KfPSZKsq+gpAK5A5mKV06VovDyD4BfM3KRMEyL8SMExdOQmKhIhjKggur8mA?= =?utf-8?q?5QXXMaphwQpEgceEaabw7j8XhCkQz1QutBgtWA4BzXC/ka6NnNLiYb7WXpQgwDM4Z?= =?utf-8?q?1RqMKS7ETe5dO3HYDVr/vr4h+TuowLJUSFCBKP1XtRHTGinljE9ENVTra09dm8g6p?= =?utf-8?q?dEhFO0Tb31Nf8f9G6l6LKxTufGFIiM0sC57dV1/T9g7rJJGXmVgLW+dI3Xoa5E07V?= =?utf-8?q?tdIZxnf0w9iRH3AxjPkr8TdLtHGzTXzDalCm3hF81PdI0dFr8uj2TmDbQc5j+Qh5H?= =?utf-8?q?tjzkVXnOfADZHzW5sOxB39uOZ3kmDbByeFOiwbUcetiOxusbuXKFVlUPOA7i5bxPJ?= =?utf-8?q?nG35twBozREJaWm5cDhSixffq5pCyB6qs30aMLv2bmYiGt3sQjYNXdUKGaaYtFYtN?= =?utf-8?q?EfBZl3jQwJexcBhmQN8maF7Qf5TeqXhtOnn0+3Vm1kSQlb3Cs06HCgtSjK8nW8p8M?= =?utf-8?q?fk/uXLMAtyJMfdW4Wmr36bGBbahk0TGkzk4HbxCM7YtZ+Qzro6sUezQkVcmIUsHUg?= =?utf-8?q?Zd7n+QZrlZys4s7iZMK3Wbgdi4vEEtzuFT0QYf/DB9uDy8PNvEowDxT0syhKabuFa?= =?utf-8?q?7StjBhxtWjSkjzeuma3LMt99WTc457f/XUueJFqz/T2wOEBTKksNKFhV64RBt+6AX?= =?utf-8?q?DsFhdlrqh7JtnORQFkNrBDk0rlPo7tHlmhHjg4+7b5KrvngRzaXZzc/RNCHZReY3R?= =?utf-8?q?bMUhRx6osXqsJQYI/ujCcS4Qwgd4m9ZA9HV7S/9fYI4Y+txjofJj+gkA+23DsSC9Q?= =?utf-8?q?vNq33weP2xXhciHoKw39modNAxoxrgaaAhsJMHgChckY4jF7fu7qjAeDjnfRiyQ+I?= =?utf-8?q?sbbqNdS7A1b9ot/Vg40p5Bh1tD3rfsshvltndyXFbQv5vVSn1BSnFASV8BdNQwsSH?= =?utf-8?q?O6+4SRbehkby?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 427175a3-6489-4733-cb5b-08dc9cfa2f33 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 13:55:52.8808 (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: KGJaqitcvynx6OrRWkxE4ppn7V4KLmNIn9JFYVY9z9xjVdpPIEYbh9fV/rl2escDWJKHqnhpjLvAwdcXlEbz+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9260 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_071121_666679_ED5FA275 X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: : 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@" 3/5 - node name changed to "firmware@". 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. - Link to v3: https://lore.kernel.org/r/20240617-imx-se-if-v3-0-a7d28dea5c4a@nxp.com Communication Interface to NXP secure-enclave HW IP like Edgelock Enclave Hardware interface of the NXP Secure Enclave HW IP(s) like EdgeLock Enclave, V2X, SHE etc, is based on the Messaging Unit module that enables processing elements like ARMv8 core, RISC V core, within the SoC to communicate and coordinate by passing messages (e.g., data, status and control) through these interfaces. The NXP i.MX secure enclaves hardware interface kernel driver, is specifically targeted for use between application core and NXP secure-enclave(s) HW. It allows to send/receive messages to/from the secure-enclave. Patch-set adds the kernel driver for communication interface to secure-enclave, for exchanging messages with NXP secure enclave HW IP(s) like EdgeLock Enclave, both from: - User-Space Applications via character driver. - Kernel-space, used by kernel management layers like DM-Crypt. To: Jonathan Corbet To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Shawn Guo To: Sascha Hauer To: Pengutronix Kernel Team To: Fabio Estevam To: Rob Herring Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: imx@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Pankaj Gupta 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" 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 - Link to v2: https://lore.kernel.org/r/20240523-imx-se-if-v2-0-5a6fd189a539@nxp.com --- Pankaj Gupta (5): Documentation/firmware: add imx/se to other_interfaces dt-bindings: arm: fsl: add imx-se-fw binding doc arm64: dts: imx8ulp-evk: add nxp secure enclave firmware firmware: imx: add driver for NXP EdgeLock Enclave firmware: imx: adds miscdev Documentation/ABI/testing/se-cdev | 43 + .../devicetree/bindings/firmware/fsl,imx-se.yaml | 133 +++ .../driver-api/firmware/other_interfaces.rst | 121 ++ arch/arm64/boot/dts/freescale/imx8ulp-evk.dts | 17 +- arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 14 +- drivers/firmware/imx/Kconfig | 12 + drivers/firmware/imx/Makefile | 2 + drivers/firmware/imx/ele_base_msg.c | 251 ++++ drivers/firmware/imx/ele_base_msg.h | 93 ++ drivers/firmware/imx/ele_common.c | 450 ++++++++ drivers/firmware/imx/ele_common.h | 48 + drivers/firmware/imx/se_ctrl.c | 1197 ++++++++++++++++++++ drivers/firmware/imx/se_ctrl.h | 132 +++ include/linux/firmware/imx/se_api.h | 14 + include/uapi/linux/se_ioctl.h | 94 ++ 15 files changed, 2618 insertions(+), 3 deletions(-) --- base-commit: b63ff26648537a5600cf79bd62f916792c53e015 change-id: 20240507-imx-se-if-a40055093dc6 Best regards,