From patchwork Wed Aug 23 07:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 13361736 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 54225EE49AE for ; Wed, 23 Aug 2023 07:35:27 +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: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:In-Reply-To:References: List-Owner; bh=HudV/bIhsmZFUeJl8DCUGtSkn8OkhoNjgvk3P3qtvQo=; b=lHgR4KTnYXxQs8 a4SVfFwdOLPFgTJ3kXwp+8au2gA1WlXy+Eb2zt8bOHf7kEN9OhqfOuDGY9lS3jfosxk+9Joj+DqPE smiB/2zutot4ku+x9LK6VGzzYEUudhGPlwDOZbwGhyDbNbBfc34mI8LX6/c2ZGT6WW+5oWo/uDWt9 2EIAvF2+Ja/hcShXHRMqzWe/cMXcoug/WEzTwqBuGU5zC/JvPOR+ooaXvJiG46BU0a7TxlHBwUlPc 1fiqlJoSB68BLYs+u4RTrBc5QE/oSVkGmpcbRqsPhsnbRRaf4E9kXfGeMKhJJ3HOovSC9YgZS0aQ3 aWj6/SbOhbOhV2bSHSRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYiOI-00HTNV-0j; Wed, 23 Aug 2023 07:34:58 +0000 Received: from mail-db8eur05on20613.outbound.protection.outlook.com ([2a01:111:f400:7e1a::613] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYiOE-00HTMM-2q for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2023 07:34:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kzsu37T27uvlZb6l4NKBlc+hiXy6j2V6kXhZVHjOxeutr22VubB4Qo6OPAp0/m4zF7yGTTOPzvcVuMwYnjkROGW8c+xx0ttFrekvDDFLcgaAF6HVaqi8TIg+YA+osxIMsLAw2SKwBXbkTHjimfnca0LA92O0SSJ430GdsLSRsFzu2IgpiBarcrkOlkVhp9+40T28ybqLlS+YWmIrz8ydkyd/E187roJtN/W1rOkELpsN1sAyucMSxFQ0f5tGrnHCuEnunRCeJGHDA1zZPB6AjUtNbYTJsTndM1LN4KlwYxixzP60S5GfBM2duisx0ZK2fQb4ThKRLDDhwtuhb3qgTA== 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=9kCbXEAEVU62oQ29MBuWHA7B2lYm2gYVVW7wG/sxUTo=; b=Bo/v2Z+xADeVHiNcLuMbFCQyv6oruboCocrHzOHuDHhvL62VLZeA2E9vh/lWjZURpkbg2nDoDQbzdZ7R03TfWoXtxwtjQAE8X1RxCN7sowY42Q+S3m5EllORRJREOq/Ni+dclvyTnGM5/NUiKgItYUhV8DXgwki89+6a29S6uTRE3JEUEKHzL0i4SmqoAWoOxA/F5f6JXnzaxIpS/IbnTzEnUoczwyKleJarq7o2IKIM9BbeGvTVWeQ/7k1ooqLSu1ikRJK4lEZLZw1mxO4Ff6pGx9a0s+Y4POt1m3ylG+IB5hMuIWlAz6wwTqC5/cy93z1X6ybzJUBJxyhAEoi/NQ== 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=9kCbXEAEVU62oQ29MBuWHA7B2lYm2gYVVW7wG/sxUTo=; b=blr+YTX2t+jKjo4pGsXNwUk4hXbFTdz2yN1hSNQUAJwSdOhSLgZTkCcGmsxmD9pM8QhfsPeTjod6fc5s0Z4D/Ww1xLfZ4U5PUq2bIcKiKvk/lsXULbf6xtlTqLirMBLLrC5kEAMf+mEWwBzo+pDnLb9U9iKepPfnktgBKem7bUU= 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 AS4PR04MB9409.eurprd04.prod.outlook.com (2603:10a6:20b:4e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Wed, 23 Aug 2023 07:34:44 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::175:d311:2cb4:7915]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::175:d311:2cb4:7915%7]) with mapi id 15.20.6699.026; Wed, 23 Aug 2023 07:34:44 +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, ping.bai@nxp.com, xiaoning.wang@nxp.com, wei.fang@nxp.com, peng.fan@nxp.com, haibo.chen@nxp.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, sahil.malhotra@nxp.com, aisheng.dong@nxp.com, V.Sethi@nxp.com Cc: Pankaj Gupta Subject: [PATCH v5 00/11] firmware: imx: NXP Secure-Enclave FW Driver Date: Wed, 23 Aug 2023 13:03:19 +0530 Message-Id: <20230823073330.1712721-1-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0036.apcprd01.prod.exchangelabs.com (2603:1096:4:192::22) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|AS4PR04MB9409:EE_ X-MS-Office365-Filtering-Correlation-Id: 46ab42bf-6aed-4553-6cb9-08dba3ab6b56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /NYF6QXFP+GaVMlmKmepYiTssFRyVS4cTkzFGRvtskgNH0GYmrOWfu6V5KoFoMfS4MHAX/P4SzMRKp4MJOZyNMOMquin55RyyYiOzy3PRcm3Fb/pSwONtB2efDjWol8WKc2lefZj9V2HMlHaUD5YIJDu4WUP1LxcAaZZyNtJ44ZyiXqYG/qEhX+q3xet8IbJozPOpS8mMy3Ms4H1WP+E0wRzmLiXjk5Som2h8hH3OxHbfSnzq7UKOdWM5lwCSHMzHsKmfoZ6muRieiMXT9G1sJB1I0H3+bf13SydqU4mD0jRthuNSIXFDMpFzADVb60gil/z/5QlNA7R7m9zNDh+cyCUiz6BZCPnqF41RUdTOMjEOqrPBVspiqcmoL0mVvklqkEK4Eb3P7rXPgT8Hd0t0VccQYMPy5nez68rVJr0SIbQxv/n6M3uONMycbTQy3D8150xK0AkakFptUM1iK9IW92Ux3IgoB9DYt0CPGsp5C++Mjx1KEZnWbzrP9SMtX5WN437ix5cvK1lNcdjvaBXhwbu58xLGKByBAscxKU7kwboA15q/EDQUNX/qZr5cCrAgFmp9IxOLPeDO8z9+PgCyMgSVn8lq5VlHPqfZAFdHFQd/b9Gjsr0TaK9wV8S25Afb+9nATrJhH8nKzWcu0MK8A== 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)(366004)(346002)(376002)(136003)(396003)(39860400002)(451199024)(1800799009)(186009)(2906002)(7416002)(38350700002)(52116002)(38100700002)(6506007)(6486002)(83380400001)(5660300002)(44832011)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(66946007)(6512007)(66556008)(66476007)(6636002)(478600001)(921005)(6666004)(36756003)(1076003)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: huVTqE/lkprhUZqF1k8a+E99fJrQjiEMS3TvEbn7WveRvuUqcCQgfaNI41AVeJD10cL0ZE1ddUrKSPKWD5LuNktS9PQ2OOMKtOrDpCqhkZ0Z/0pDi3N5PB2c3FCDSN3bAAP/IYOVWAAhpv1MQkrjqJdMQGyQSn383ibeDx38zoc177HKtqDhJfCZtVh+2cKEHqEOk8lhFpTT+HK3jVqID5HX3hg+mVWf7xAJ5OMh0a0MwjVaVkR4CXnGv4yV/c+nruVFqlEfqWyewQ8C/NBLK9rnbp+O44o1QsYpQ6b/EUBuUrI8Jj0UFR6kq8Icl9+qK2eovu1rcZqTeKeUAZ04sbZEI54hmiGO1kFqBuGKeQvpOcluHx4/I9M3bxllSA1Q8svzYV24FPTnnb5sCWwdnFLxXLkPuav9Zo5XOcaLEoHsgfTRz5zTDi3zfSCG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P8+8yNCK/8czgSJNjHIgzPJiOzbvnYsifxMrCyzMEVKohZOp5SH+hsRF1T+wFtt/f2cbCH/LvUP0WaC/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46ab42bf-6aed-4553-6cb9-08dba3ab6b56 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2023 07:34:44.1347 (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: I2NAcIcn7LhXQInHEYfOH+5pNVcpfmFj5HvGgOg4rtMuWiZEjjWhYlyuV2q18tHJh5jb4AuodSuuvqFROKrywQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9409 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_003454_921181_FA737FE5 X-CRM114-Status: GOOD ( 15.60 ) 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 v5 Changes: - 1/7 DT Binding: Disposed off comments from .yaml -- to use "-", instead of "_". -- to use generic name, concatinated with soc-id. -- removed mu-did. -- renamed the ele-mu to se-fw -- moved the file from .../arm/freescale/ to .../firmware/ - 2/7 Changed the .dtsi, as per the comments. -- removed mu-did -- renamed the ele_mu to se-fw. -- updated the compatible string. -- tested the DTB. - 4/7 Changed the .dtsi, as per the comments. -- removed mu-did -- renamed the ele_mu to se-fw. -- updated the compatible string. -- tested the DTB. - 6/7 Changes in driver code: -- replace pr_err with dev_err -- removed export symbols, except one, which will be used in other driver. -- Each API, send-recived based on device reference. -- Divided the commits into smaller commits. - Base Driver -- Added ABI file. - exchange init-fw message with enclave's fw - enabled TRNG - read-common-fuses v4 Changes: - Post internal review, changed the name from "ele-mu" to "se-fw". - Disposed-off comments in the dt-binding file. - Removed the non-hw related dt-bindings from the driver code. - Corrected the File MAINTAINERS for correct name of yaml file. v3 Changes: - update the commit message for documentation. - Fixed dt-binding checking error for file- fsl,ele_mu.yaml - Coverity fixes in the ele_mu.c v2 Changes: - Fixed Kernel Test Bot issues. - Removed ".../devicetree/bindings/mailbox/fsl,muap.txt" 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. Pankaj Gupta (11): dt-bindings: arm: fsl: add imx-se-fw binding doc arm64: dts: imx8ulp-evk: added nxp secure enclave firmware arm64: dts: imx8ulp-evk: reserved mem-ranges to constrain ele_fw dma-range arm64: dts: imx93-11x11-evk: added nxp secure enclave fw arm64: dts: imx93-11x11-evk: reserved mem-ranges to constrain ele_fw dma-range firmware: imx: add driver for NXP EdgeLock Enclave firmware: imx: init-fw api exchange on imx93 firmware: imx: enable trng firmware: imx: enclave-fw: add handling for save/restore IMEM region firmware: imx: enclave api to read-common-fuses MAINTAINERS: Added maintainer details Documentation/ABI/testing/se-cdev | 29 + .../bindings/firmware/fsl,imx-se-fw.yaml | 121 ++ MAINTAINERS | 10 + arch/arm64/boot/dts/freescale/imx8ulp-evk.dts | 15 + arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 11 +- .../boot/dts/freescale/imx93-11x11-evk.dts | 15 + arch/arm64/boot/dts/freescale/imx93.dtsi | 10 +- drivers/firmware/imx/Kconfig | 21 + drivers/firmware/imx/Makefile | 3 + drivers/firmware/imx/ele_base_msg.c | 272 ++++ drivers/firmware/imx/ele_common.c | 188 +++ drivers/firmware/imx/ele_common.h | 31 + drivers/firmware/imx/ele_fw_api.c | 110 ++ drivers/firmware/imx/ele_trng.c | 48 + drivers/firmware/imx/se_fw.c | 1274 +++++++++++++++++ drivers/firmware/imx/se_fw.h | 176 +++ include/linux/firmware/imx/ele_base_msg.h | 66 + include/linux/firmware/imx/ele_fw_api.h | 24 + include/linux/firmware/imx/ele_mu_ioctl.h | 52 + 19 files changed, 2474 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/se-cdev create mode 100644 Documentation/devicetree/bindings/firmware/fsl,imx-se-fw.yaml create mode 100644 drivers/firmware/imx/ele_base_msg.c create mode 100644 drivers/firmware/imx/ele_common.c create mode 100644 drivers/firmware/imx/ele_common.h create mode 100644 drivers/firmware/imx/ele_fw_api.c create mode 100644 drivers/firmware/imx/ele_trng.c create mode 100644 drivers/firmware/imx/se_fw.c create mode 100644 drivers/firmware/imx/se_fw.h create mode 100644 include/linux/firmware/imx/ele_base_msg.h create mode 100644 include/linux/firmware/imx/ele_fw_api.h create mode 100644 include/linux/firmware/imx/ele_mu_ioctl.h