From patchwork Mon Jun 17 07:29: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: 13700277 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2066.outbound.protection.outlook.com [40.107.21.66]) (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 773F518FDA3 for ; Mon, 17 Jun 2024 07:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718609578; cv=fail; b=igCFqW7AXjouP7lTAG1bdF0sHEJgCJbGh7G0AzGd7OYEyszC4bc4y5j/cDciQ0Rrz8UuSz9+bPxCDzi1SyPhCZEFwjaEqGTqlzOkXgWInhbeYR5fBXQwQyzTKl+MpNys5OhdH+EKIj1rsX8WGVn6p8OnIhzsjUG8vv9MaNAPRkQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718609578; c=relaxed/simple; bh=EUeRLH1u3HnFhFGQ8WFYu1U3Bzgyf144085PpyjlZlA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=tKOgSblLnunp09h2XKlJ7f39Ys1j42nhLmiyRGJ8cfkZLa4hVnLojxfmjvN89XS/o9maRO07jCcEyIrN6pUL4jYKTxQYZYyqThqeL46TRFA6c0g5tu+EhrDc5ZPQwxPg6b/l3XTH3828SaNr0eiuvmf4MNjEOuh8mEITP7AzOEw= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=XiPztCWv; arc=fail smtp.client-ip=40.107.21.66 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="XiPztCWv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FCJ2KIqkBAvedxMRjcujt/4sN0Hul1YimdaRjv7tE8ORQJnMV2ZCA+/mTJVvZT0sBAZl+W42KU9Kxwic2n3sLAhrOnc5Wvvnyp33ZQuzMFZSQ3bjN9LyCGNwk2bo9Qw9YGe00pRaUTxu0Lip2ICIvqxTwS7GscvvnokWD+cLmV4GwV1XwqquFlYj69LErKGA1p4UfSqZaDD5Qd3zdbezuVzgnqL3l40U2CLbric3DoJHpkaX3BQQyyBZfiYauCe2/pIoakQ56X3aAk8BQtdlg6XlOn9Zn3aG259E01ISPCFHPRbfeT6I+Fm0qeizvI2b9+Lpf1XjGCG2EAFnyhYezQ== 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=wUUkBLMg0O8LrsxQpmu3PouhOIOH0gJxqVubz2X/YPI=; b=nyTzhWEeoa719S0KbARwsxwz2nVAA/4h5CP/yyUG113fOEYyKCqspsboXhmeAKkxLzsDthivyipWgRZUPN1wHLI+qHYUjI9kHDHAqvUui4IzDSCFK/QhcR4JdCwMwi069LkeBNScJjpxFebdQ15aOumbIMptLRwjzM9lk6LztTWJLgQX8zR2+mqR+LQ7AnDAJyQ8jguN380YU0wRHF8dj12jm/CfHJvQsEB8D5rfuDlMprQMtzXiFgyYQSONavCB48c6Lx465nmShI66XjCk24lX2OLjCjVTEx3+rLDeNv9IGwOHbdfJvkbnna5jiiJ9qSBTbG4833Qvok/Y6YmrVw== 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=wUUkBLMg0O8LrsxQpmu3PouhOIOH0gJxqVubz2X/YPI=; b=XiPztCWvpYuj69eC+Qb0fIWLn1ew5sbXvE1CbRUxgg8nP2tzXRCXZB201S4+vbXrWw4j1NIRxuIyfVqH3qafsR4qfd9reomJwytoHZF/wVSzddSstAzABaIMJHSIitKEMTP4eVV8rHj+agmyy+JWPMl9inwsOZoLyZEfF+z3mSw= 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 PA4PR04MB7982.eurprd04.prod.outlook.com (2603:10a6:102:c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 07:32: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.7677.030; Mon, 17 Jun 2024 07:32:53 +0000 From: Pankaj Gupta Date: Mon, 17 Jun 2024 12:59:39 +0530 Subject: [PATCH v3 1/5] Documentation/firmware: add imx/se to other_interfaces Message-Id: <20240617-imx-se-if-v3-1-a7d28dea5c4a@nxp.com> References: <20240617-imx-se-if-v3-0-a7d28dea5c4a@nxp.com> In-Reply-To: <20240617-imx-se-if-v3-0-a7d28dea5c4a@nxp.com> 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=1718609402; l=6534; i=pankaj.gupta@nxp.com; s=20240523; h=from:subject:message-id; bh=EUeRLH1u3HnFhFGQ8WFYu1U3Bzgyf144085PpyjlZlA=; b=5N946jyoYyIH+1rE0s8cEU281jVSBh/5qwW/oTXVP5LKHeCgTUWSgMoJwPWLuXmbNwts5WiMq xrHees0xJ9wAqQ85XpulXdeZHfiV+y6DlA7drrjxSPpwPdGQkEeNoe2 X-Developer-Key: i=pankaj.gupta@nxp.com; a=ed25519; pk=OA0pBQoupy5lV0XfKzD8B0OOBVB6tpAoIf+0x1bYGRg= X-ClientProxiedBy: SI1PR02CA0036.apcprd02.prod.outlook.com (2603:1096:4:1f6::20) 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_|PA4PR04MB7982:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ce71f75-8013-4d15-f011-08dc8e9fb2ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?RjZDuVc8ARC4HSFdeCtuhuBCgPu74jn?= =?utf-8?q?WpOoUx1UFSVoM/n0mDU0DU0rOHsdxBw9wZLK8GGSGktMGp/XXgCUliCLT+N2giqFN?= =?utf-8?q?zDDUhHeBDphs9W7LrYOPPoS31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U61dBVSGdNrJ0GzoHr6NW6MXQTrB9fSRwfvuIns?= =?utf-8?q?fbymniY7ZUQ+JmRqL9Il7kXmdQywJkXTiyUO7RWG4cNYJVZrsuHx6w05MtBoVhXH5?= =?utf-8?q?QDrw6qHqcJ8IOw4PD15gXaeLi/8K4MxnTJYeYgSWQft4zc+87mt7K6+QP0+Up6ZNt?= =?utf-8?q?/rBqyQdu3z+D61qEscX8gjn66iniPk3vqQtL+yF8Lz/iKWDMmbmo2TLRhBoxo5A9C?= =?utf-8?q?6xe9SdTyhqe9AizbsUciXXsxhtHbt5m0vFF/gKAHskX5CJuCX+Bdrqiyt05WvB2hv?= =?utf-8?q?rpsM86VAmIGG0BUWGqC6rUQJP39Jm8zckmptaeatyQrw+v+9d6+H9Tczc2p/5IkL8?= =?utf-8?q?DD/1E9RKIYU4?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7Lt0F+NQTypYctv+cEkjnHjKvJTz?= =?utf-8?q?O6vSjuwmvY0OTbnAFifdNayJzqE6Fsjlh+HAkCTaNfInGcXUKjg0MOzVLDOT/igmr?= =?utf-8?q?AGLg+rmMDiTFVdohNlIiW8MM8j91bryMWVFeFFYshV+bSJtNdWzUtAVJV9yplEOMS?= =?utf-8?q?NQYXelA8l/WX+i779bcZt6DQ6EcRVZ1cBzByMyj24a2a11vakzkowJ83gR8AGHxPi?= =?utf-8?q?0PvQukK0cf9tUBaqtCmNgl05YlcdmtzgD/ZalKlj1zO38s9RnQxo4Xg/5Xt4u0QPY?= =?utf-8?q?LVkZKgtjB4unz9wvdppoRlM3WKuNO91wYSXBiEh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zv8KBMrTsOsBEOFU0zkEj8+PZVpu?= =?utf-8?q?NFUkrNgvFwK4Q0CaNec71leKb/X7wo5BnSZ8aHyBfOiMzKvJPBIOdSDIr3dxQu7b9?= =?utf-8?q?1qdSJ61MY46zwVStU1e5m5ry34vHFliuBsnMPXH41Az7iqRxh/1HTBMEi0ZOtOBcO?= =?utf-8?q?NvuWzXW7EblgPMu+k4vKoHLapK0VkbOP4gR54yUs4ys+SEr8b0Fc26r8Gjh+9Se+Y?= =?utf-8?q?yWkF5kSbTjUNqAa3PXbAC7bSSgARMtCW3cfWnIG4hU2XtFeukeQj2rAB9ddZZoh4z?= =?utf-8?q?enEQswx1Xc108/LRf3XeyB60FlWPeWbh003pmx11FlLhqgtg4SgEwFdsiEgh+Dr7e?= =?utf-8?q?iol0oukuRZpl?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ce71f75-8013-4d15-f011-08dc8e9fb2ba X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 07:32:53.0878 (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: hc7ED1EA5US1TfDwGP1lnMY1FwoKnFKhhiMODK9sZhW23MgBglhjWD4UyY2kY9uYe90+ZrXLO26ScLktjJQchQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7982 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 | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst index 06ac89adaafb..65e69396e22a 100644 --- a/Documentation/driver-api/firmware/other_interfaces.rst +++ b/Documentation/driver-api/firmware/other_interfaces.rst @@ -49,3 +49,122 @@ 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 exists. + +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 +MU(s), 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 +-------------------------------- +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. + +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, + 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 + 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: