From patchwork Wed Sep 27 17:53:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13400713 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 0687DE810DA for ; Wed, 27 Sep 2023 12:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HUizLNkR1lX9ac5gdn2PqX+yDkFziCu+X1kDdk0nqa4=; b=pVAqmPQ85MyAsW 23T9XmlCQT2lbsCdJh7ATxya28v4XLXBzW+AgQ+aSlaDJXhAFF0/YiSatlv6DJVrbt4cPrvdVP3lX GdvKhBCItCMI7mbZu9cC00EVrtbuEw2WCjs4JlGrl3upPz75CNbxrahHrL0SwaBGUUeVYG5fMo6g0 URUyY4rvAnUn0eBdm3oI4UFrpiL0sTG1+pdToXTho4Ray79XlM33Ygiu5Ta9eD2B/bJ9gvSJ2JNXD t537ACXYhdDI1uGTjeQweDRshFqZEzAk5Ul0fYlzYAKbqzPe67zMRrYFncaVM6thYLfiJoarLjbEA HXgM1RFKa+GMndsDOsrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlTct-000t8h-1I; Wed, 27 Sep 2023 12:26:47 +0000 Received: from mail-vi1eur04on061e.outbound.protection.outlook.com ([2a01:111:f400:fe0e::61e] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlTcj-000t5K-2h for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2023 12:26:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ULo6z070lhQg1G6xx/NLn9QrGyFZu4P9BYao+pl4B1YvUfw/IMr59VSUAd4rSZdWUHn392TLXGtfjGH2+GxyaeQM0H0AZ7smd8TER/s6f9TncmAIH8Ncr0AlvAQbtvLpJn+JxLWptHPUcTFPwauwgRh2cExmAAXMzzcnLJ1bOC0OfcdInqUZr17YEh5ufRXP0msEZlEVJycT1qTdEysNcrONYKlgz2KZoT2gJj0hAjhVneb8RDUsYuy3Rg6DVyZdwtS9K1RkO9KAI9hm4IN4aWvidsiapBve/zdnmN0FEw8tTcUU9sma7tACC9BVGa+GlhR4dm4GPa3R4GkkiZ4VIQ== 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=G4Qg/nbJczaWykdnPsCprrI5TVjM058N/677FUPGEhU=; b=VEF4io4uCzOYIMRk9VBozN1mXIbk3hMzBMhs2e/yixNkp538nRiIA2Kw5zdQM0EfHX3GfZROrkvhSdlnt1Tm6OdiPFMzhPvlBjCPscIS1lnWd9y/ugThL5lQ57qF6hAlUuCf7B7uQKLPQ1qw2SssEXareACYt7zDOlMtL9sBwAFiVB71s/+KrDT4MM96/nY93Klp7YtStvpMX45uypsUIgtMT5u8mPqlpzz7MN6C4/i1dMm0PH7t1D+lSFU7NBhu1PMqD2t91fZWlxqaUc1J7EsIhPin01VEUoUZMFqHF/LsQuHOMp5K45/ykCqiQTTXg7rpPLMQUDBQ2EJFLTd9Og== 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=G4Qg/nbJczaWykdnPsCprrI5TVjM058N/677FUPGEhU=; b=LlS7T70ZzeE6nqh4Zl38xSQJeeTuIMxK5YNfbKyE0aYWUTX9YoPgPurybOJu7HWofIhS6FvZFyUWnGCcLHzmNhU00MhftQ4fwKxYf6vJoOB4aV/tkXh8X0q/rOtM7eQmMmiJWz5DozJpmyWLrdnP65y8nYWQcUiW9Kq7xUsObnw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by AS8PR04MB7704.eurprd04.prod.outlook.com (2603:10a6:20b:296::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.27; Wed, 27 Sep 2023 12:26:32 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::dbc:99b7:7808:f82e]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::dbc:99b7:7808:f82e%7]) with mapi id 15.20.6838.016; Wed, 27 Sep 2023 12:26:32 +0000 From: Pankaj Gupta To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, clin@suse.com, conor+dt@kernel.org, pierre.gondois@arm.com, festevam@gmail.com, linux-imx@nxp.com, davem@davemloft.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, gaurav.jain@nxp.com, alexander.stein@ew.tq-group.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [PATCH v6 01/11] Documentation/firmware: added imx/se-fw to other_interfaces Date: Wed, 27 Sep 2023 23:23:51 +0530 Message-Id: <20230927175401.1962733-2-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230927175401.1962733-1-pankaj.gupta@nxp.com> References: <20230927175401.1962733-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SG2PR02CA0128.apcprd02.prod.outlook.com (2603:1096:4:188::20) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|AS8PR04MB7704:EE_ X-MS-Office365-Filtering-Correlation-Id: c946d3d6-b7a1-4f07-9be2-08dbbf54fb87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rQOKg38X1S7iVACD5Cn8S8lnS9oh380e2+DRTXbenj55bIzCgCm+39vuDdH0cOWGQy1RFKm03Op4SyeCNfQxxPrAdvwsfdbd/sw+V2x0aMvXs8cSUXoYiIMsJPz92+ec+TyyYZf6R4lRR/ek2mALzwE3TKHXmp4JPdhoikzv2TnmlqhsC4GHUkW2sB5Y6Td9276JxQ1khySdYKcK8c4FIQrwum5Tpwc7mgMfDgLXvHNwqooQ7U3bAljuTp98mrEpQKItDErhbk1spd1crabSMhnkVyd6n9dbXoyD7lFz6EIO+rIGvhbcn9oyvM9A5knJQhw6TDzcKTjSVw+5/aPCwu2/Tj2W7+uY3yrzAHN07o92qlHhY5Qu8h69/g+bhbn555IFPy/xnr6N1V7tHmGv/bMYg79lJZdBfvLEXn3IvUt+JANozqc889L0Fde9dd3HivQYNs90UOLhhx3EHZZTX7SAttFUgg6Qv3V6IhjmbsnkmN5xRv6Nhh65fZlzwYXmJ9apRV0Gz6W/uzvwDA06K9kZF8RY8PtI5R/cP3VoAvk9gBErP+STrhHhgKgqHPJCcEYsG6PQvRwr4SeXseAhPXiqEKAOcMJQCrulfhjmdZx1XJbjiFyh9YsitpwNtctOkLJnAcOJIX6psTnWleBpXw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8630.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(39860400002)(396003)(376002)(230922051799003)(1800799009)(186009)(451199024)(1076003)(2616005)(6506007)(52116002)(6512007)(44832011)(26005)(8936002)(478600001)(921005)(5660300002)(6666004)(36756003)(4326008)(2906002)(316002)(6636002)(86362001)(66556008)(66946007)(8676002)(41300700001)(38100700002)(38350700002)(66476007)(6486002)(7416002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t6IYxPdF9AF7Ym/iTHWb+96TZFCNS0EOuz6FkIN7W2IDMzT1mqngw8Q8DTbQyIUyRX2pNJO9CDlukWAuz3QeHmkdJFLjYp3jobJULIbbEsqjxZxv+nhtQRrFn8968FXMAWq0bXHJ7jt1+QWOqynGJ6C9cY5JhZjNZXJ7HelQRMlJ1FPevs7j7yG3xKTBJde259IhrVr/WWWzZJPxZNN7ZJcIxtLjAf5tXtzBwxIeZi94bLaPKyxEPHeZ8ZjlyyvI9hooHEhpjAScjEJaj/0/N5TZi+Fg95mR5Rmf7ceIgeHJ9ReDJqI8XKaPtZ5Bi14pJQmdT6OyqRID+6M3OhKTguyDARBgqCHE+B23D7yKSFo6lIyHNasK+VrQ9pzUiJ8eI9Bwek1OXUGX+uJwd8GPdT/moYJtbL5D0A+FXzb5PA3I4GJxNiYVz+3gmqWEa61mVDPJw3oRVGpsIf7+OnxJfUZNt9mycoR2Bz1u6DZKWY0j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S/mIKL9fVLz9iXBVMDyM5BayEiA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c946d3d6-b7a1-4f07-9be2-08dbbf54fb87 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 12:26:32.3347 (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: yhlkK3LvVXCn/vu8rrKkc4CyOsq7dtlnBnJMUxop/aAFQoF9ZJx0QQjywDQFcHfBrJHDDkSdJyuYZpAti8H26Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7704 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230927_052637_875670_2F89D28C X-CRM114-Status: GOOD ( 12.44 ) 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 Documented i.MX SoC's Service layer and C_DEV driver for SoC(s) enabled with hardware IP for secure-enclaves like: - edgelock enclave on i.MX93 & i.MX8ULP Signed-off-by: Pankaj Gupta --- .../driver-api/firmware/other_interfaces.rst | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst index 06ac89adaafb..1d21b88ef20e 100644 --- a/Documentation/driver-api/firmware/other_interfaces.rst +++ b/Documentation/driver-api/firmware/other_interfaces.rst @@ -49,3 +49,70 @@ of the requests on to a secure monitor (EL3). .. kernel-doc:: drivers/firmware/stratix10-svc.c :export: + +NXP i.MX Secure Enclave Enabled SoC Service layer and C_DEV driver +------------------------------------------------------------------ +The NXP's i.MX HW IP like EdgeLock-Enclave, creating an embedded secure +enclave within the SoC boundary to enable features like + - HSM + - SHE + - V2X + +SoC enabled with the NXP i.MX secure enclave IP(s) like EdgeLock-Enclave(ELE), +are: i.MX93, i.MX8ULP. + +This driver exposes two interfaces: +- service layer: This layer takes the two mutex locks: + "mu_cmd_lock" is taken to ensure one service is processed at a time. This + lock is not unlocked, till one service processing is complete. Multiple + messages can be exchanged with FW as part of one service processing. + "mu_lock" is taken to ensure one message is sent over MU at a time. This + lock is unlocked, post sending the message. + +- c_dev: + This driver configures multiple misc-devices on the MU, to exchange + messages from User-space application and NXP's Edgelocke Enclave firmware. + The driver ensures that the messages must follow the following protocol + defined. + + 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: