From patchwork Mon Nov 4 15:18:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13861528 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013005.outbound.protection.outlook.com [52.101.67.5]) (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 61ECD1B6CF9 for ; Mon, 4 Nov 2024 15:23:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730733814; cv=fail; b=SQRe7UsRSioREhhPgyhtI39L0wy34w3ywXSE4gQ3Ul4MDg6O9jd5XHRwGka9oPhHvAJKbdiGdN8ZUjmepDwo2nWeqdnoBunEBKPfV9ZXWu/sMU89/D0tdsnf2AV417cnEsF+ZQvsDfmZUk0Eip7wWQP5Y4X+ngZ0BKQDZ74bYMo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730733814; c=relaxed/simple; bh=FwHu8HOgjdeesS4jBLvkey7Y+WnnBYkcgUp1hGR75ZU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=grm7gfu/H6fsXuqQL1yU6jpSEVHpbltqZ0obaXM8zqYDnrcSxl2DOZFBRtn1xT/6i6eY4NKk8uZhDp6N3O9iUIHYMWWWJAE6HTRN+99DFi5Gf7wg2Y0vVipCK2EAmXbbbwGcPd+uiiRj/fi8/PGB9qM2mx4AW8CvbEUy1CN1oL8= 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=i5d1dk2r; arc=fail smtp.client-ip=52.101.67.5 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="i5d1dk2r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g15BxkRBBPJUL4L639dwWGBN81H4nuqhc1kKME1XfUIHOq9XPIxqpoxk3FChvAPOuuiiJuARa+KvlcxxxWIQRyZjvG6LwZwTdwlt0Ki1OSRRsoM61SblhsZCZjXZGwCUDj7mXuwm7toGQy3T0Wfe3bjTx7Z9ENEu6d2jWPCnIu88OQLefjjXYq0brF14YlTlEZJgU+DMRe7WsJurV5RjM+AHeHFV5ORwtY7RuXDGDjR5iuDUoOkP+fq+bn2moaRhlfmhwUacaNXHJyF1OyBl/FSct4adf5wymASyZlIFcTkwzDVjkNn6csi+sc3Wi3LCjTn9eLn5uMRk2gclfZBJdA== 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=rydjPSyjFpE1b+KVUJhSPw9jPLhoKfIzwxtGoWGJhg4=; b=pSUqXrZ7kuXOerLJmVl14Har7ugommCZHvclbzVKWfgSKnPxBP1ZRSWdRp2If/Jf3+P6rg3kSzX8y3BFo0iLLMc81pfIPc4t7r3qd6o0Yrk3nbhm95+Lzpe9+Zf5QLm0LDsi3eZ7n9HLuLqgD4MP+gl/DGGZu6YHWRxvyQJPAajkOwLWWqoA3N2h4gYVT+I40lSw121el4jts9rE8VoH+ffk7klVdFei3YyPuJXQli6i8jD+OrwshpRKBVSQMBy34Us+DA3rPelfxQ3QK7eF+rFKJoypo2d+oMQO754kXzNOIsai9fEoFngF4WIM/GVWWT+RVKbRMNIWLF2RqwtIZQ== 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=rydjPSyjFpE1b+KVUJhSPw9jPLhoKfIzwxtGoWGJhg4=; b=i5d1dk2rZoWbdiIZv9DipcfTuWdsnfP9+vNhzUQi8vODKaBT45fJWPHhmOtjqOBrLJlPGTwmiVJ5/MTQuweZlg+dw0GMhU81GXK+pqoDsDEMff/o2o3O/a4CF5+9lPacKtefEfO7SdrzyuKOOM+CGj9UpzgbMr8wKAuQeQPUhnoNzv5GtFDESUBZRxACcSpHVWIQYpZL9u7bhSlnmkHldTG0x0s53KMGD/X76GmVtGlaadab/Iivsto3JCw8T38IQQQifEPX6b0tovw+QEVjFBFjXhgVac85oMYQWSoNRp8gED/K5ZWk+61K/hXmJF19rhomYqlsUg2hE8fK0E5UYw== 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 AS1PR04MB9430.eurprd04.prod.outlook.com (2603:10a6:20b:4da::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 15:23: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%5]) with mapi id 15.20.8114.028; Mon, 4 Nov 2024 15:23:29 +0000 From: Pankaj Gupta Date: Mon, 04 Nov 2024 20:48:38 +0530 Subject: [PATCH v10 1/5] Documentation/firmware: add imx/se to other_interfaces Message-Id: <20241104-imx-se-if-v10-1-bf06083cc97f@nxp.com> References: <20241104-imx-se-if-v10-0-bf06083cc97f@nxp.com> In-Reply-To: <20241104-imx-se-if-v10-0-bf06083cc97f@nxp.com> To: Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Pankaj Gupta 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=1730733536; l=6679; i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id; bh=FwHu8HOgjdeesS4jBLvkey7Y+WnnBYkcgUp1hGR75ZU=; b=3v/+tY8ZVygqHWLdcxoA2FYVuq8WcUkXj+eUuBkKs+mvVMKrpLotbVvzaJHASWdLdiEJGmTZ1 4IBDRuzDYt7CV+b3crjb7jcv0kq0y9cDiUxnYpqysLXmIp9RaOEKw4z X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519; pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg= X-ClientProxiedBy: SG2PR06CA0214.apcprd06.prod.outlook.com (2603:1096:4:68::22) To AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|AS1PR04MB9430:EE_ X-MS-Office365-Filtering-Correlation-Id: 384e878a-3d13-4182-4b24-08dcfce4a2ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antisp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T+94TkjN6/F2MhSeCkTxTRudyq9nEchw/nGb?= =?utf-8?q?7zQzDD+NsqxSosx+tYLvpNZ5wpwfcN3xpRAy6DLLwf0/NFWtfoirmvkVNwIWH5e7z?= =?utf-8?q?B9jcfyWJvbbBnLIVjuB5PqfDCCNi1grYth/aXCAm13AKpzFAJAhW+nd0V3tweo0Bu?= =?utf-8?q?VZG9nWTv9wjdIcMufDhZCLnXaLTw4YW9U0P/UvISlKNNMRkENodYatJdy2MVdxCoH?= =?utf-8?q?9kANFk0a4P9qtqj3V6R8PjTctiG6RhuvKuV7QBwYNEwCd44/2G0YqgeybMDbtT+8B?= =?utf-8?q?Othy7Tx0QlWJGuQnO9/Enb0Ny+PsoYVVSs4ZWfTzufo7g1HqL/wvRYjj8me00ZHL9?= =?utf-8?q?Emvp5Kvee56t9kBfQcXHeX7rmWXDm7gPJPPVNRU6WSNNmpQWfEgMh08ESzdP+LtiX?= =?utf-8?q?SB3DLtsgBm5jZmSnrHnDM8ZOxbz4nHZd7prOTMGkB4rwhq7g056rI5GM=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)(7416014)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WvqVh3JelrRg1M6ZNCVL9oQo796c?= =?utf-8?q?oRt9o/SAo5YHbbX0jaRR3NHcTLXU7VwVR06eyWxf4qxxO70yGX6F1wHnCcYAkgOLJ?= =?utf-8?q?sKbmC1tXJCiaferT7dxJFvDpXCRfT+gglxtgHWVlXpE8m+6Y9VVRlbj1dVoZeo9CQ?= =?utf-8?q?c1jBZzLI+sDHgyM7ttcA0kVuyk3Bw8UJfKmwwZp4ZbJNDp/J/J4EyzqQVFpdLraS4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rlSFHhJPfWeeBeTNOBy0Tm5bZYsR0O3CsuYpSkHtkF3gBoQB91c5HzCX625msT?= =?utf-8?q?8Bgg+qHqVmBWgtIRpYZF+XUzS5Ls5c4vwzSpIVDLFTIWcuF0dZnsnZ9LyisbHPYvT?= =?utf-8?q?5s+Q/sdZSyCNCAI9xvbYsJm9jAnpF+pRvb7uR1JyAQ3bUR+lpZO3waGCYEuDLCEQN?= =?utf-8?q?GHuh57X1ONBkddK2+v5xEw7hN6/eCuIGKJqNnfdzMtyKj7lgTXGvIkVUsUzKLcb0Z?= =?utf-8?q?6/wq0mRGqzHt/EQFvqM+WVm44WS2I3w3dDhV3UhpQU8mvjwLZBcaThgS9dtICVDBb?= =?utf-8?q?B26m+Vfg0M9SCaSDEy8AFUGJVyKFuT041oKmFRun9kz+V/AU54FtjFqNpDDyFWJHv?= =?utf-8?q?AOwD1NV0+pmIjcGsEDbD63AfRYLsIwvzcw4jYLxserZZBrQUyixqdJRm3KfJhYxTH?= =?utf-8?q?0X6s+Io5RKfN?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 384e878a-3d13-4182-4b24-08dcfce4a2ea X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 15:23:29.7404 (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: zDNlRXGyrU9CGG0YB8f2Td4EOGZecsaEm1VvpZ9d3LLJUDPbleUPdyerroQ40+S3NjAgvQyBnSa3HpcsD52uKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9430 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 --- .../driver-api/firmware/other_interfaces.rst | 121 +++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst index 06ac89adaafb..a3a95b54a174 100644 --- a/Documentation/driver-api/firmware/other_interfaces.rst +++ b/Documentation/driver-api/firmware/other_interfaces.rst @@ -49,3 +49,124 @@ 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 Linux mailbox driver. + +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/_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/_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: