Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2626097rdh; Mon, 30 Oct 2023 03:01:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6J12QduDYkXQuQbsSFt+gNaddzuNeRNbV8AYp+tbfIMVDtx93SmdBdwWtD9J47fFQizcS X-Received: by 2002:a17:903:2448:b0:1c9:b2c1:13a3 with SMTP id l8-20020a170903244800b001c9b2c113a3mr8156343pls.49.1698660064632; Mon, 30 Oct 2023 03:01:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698660064; cv=pass; d=google.com; s=arc-20160816; b=IgzM6+Xb4rUhjY/WMJQrC7IsNXkqxM8EmcGVlY0uXd1I7UJ181gAhytYn8ihIUErhe N6ear5KiG6HW8UDGwtMCwYo3HxpZV/FKap4IxmMP9mUCQZS1MK31XEXWLqqt9SsRFMEX iX6+cFVv8AvIEPkxvKIggIyZqt/JsVLK6fvYtK1yVNqkBdUx+UCGeB1HstyspHvIQ9n3 QtUmFbwEqImsiNsbMqZNKJW+VqSpxNiX/FwwxxafPAqegiB1daPbkUN27R7cdmcpPfh4 qvTQHt+Xxp7/OSQlj3sNZmrEtGYTdPwY93fqn21i0y3472seSdhW8GFvqLIj4t6CaZpu L2Ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G4Qg/nbJczaWykdnPsCprrI5TVjM058N/677FUPGEhU=; fh=PhkPLZHnlbS6I+4VLYKKEzEfaQxz9t7w9SK9rKaz9As=; b=g+3UE0u79QTadkXqZW9mWP4xYPSJG7H7CGsNMucl8egVr6mEV6LHQtsM7cVe2xToGB kbVuiO/EgaMuOCSF15mge1vsNpnwsbF7k38bXwWYmUOjeSJ9zJZyI+0ZawHJEsr3iEVd 0QSfEI2/wpGL8A+7WvVpgbljmk9rz0OkmQXd4Gm2vQZdfzUat80dvIU3540OxaSbDClf kIMqkQLFBOY8u2DtFqIyPaFqsDSCBFmXTQbMzBAPK9zS6db6xMOWCw0tkqZPgL7d9kyT 6nj5mtoO4s1lEEYweLitohuu3gKAG30/oXuI5PwH6m9LL6PX7NlpmBxerjjhjtY2IM51 T5qA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="S/mPxkRJ"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g5-20020a170902e38500b001cc2ed18253si3573504ple.15.2023.10.30.03.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 03:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="S/mPxkRJ"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B164D805A793; Mon, 30 Oct 2023 03:01:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232730AbjJ3KAe (ORCPT + 99 others); Mon, 30 Oct 2023 06:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232856AbjJ3KAF (ORCPT ); Mon, 30 Oct 2023 06:00:05 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2089.outbound.protection.outlook.com [40.107.15.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A8BB10DE; Mon, 30 Oct 2023 02:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IXEk5emtCANSm/GQFZzFecoDBbL7OrfQKPtxM/9tgcfD8LBIKP5Zvnu2BqQb/ZkACiHhTozpAifvQFSnhgJOKql+KhDJta80RVLNNpgUs51jL2XW3WBjYjBofMZWlWpNjrtDZ/oILmhNK/+YUejyEFiykuQABxo7rEyPaN0nLNNeqk5YqWOt/s6RqlL9vVq0z+s05lgTlBzb3q1GMdjqRbet9pN3nne4U68C+OE+cTD+rLJvujcMjFik26etMt/p+qrRaaYHsZS/drxFP3h/L+jrKobHyu1VBrtawCC7tctPnCIlsdjqpy+q9qGfZkePYZouZOhZSZzCrnYn+3Xf+A== 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=If2mqbR015EsVROkB90PJkimzcX7EixobjwA8gdLL2Yuyri90Vm84VL3e6WmIb3++s3Uen7BJgigU6b2t6tNuDoOXax1EHI9YBUQxkWAktWho6FEnSmJK6IAJxmOOmz9yvMoEuPLUaT0LJoNG9au91qHeLUSc3okXpfBMezTrWhzztoM9tzVUFOaEbqP8u5YfmEqf1OwYz0K/+J1S/NsTWxAkFpnEV0Btk9bw88oMCYONzi6CbUXJLkoZOY64ss7f+FoKj3ux3Ytr1VtSeQSwJqq7AA8/psZ4jQ5+wNAKJd31g15sVKogiolGQRYpCKKWudzFDy/MOVoRJC3rlS0mA== 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=S/mPxkRJ/9RAqP2196VOphhtoS0TVPK8pD9uJkRJVHMNqqgf1NlRaYwzSEyL3y8QQvhcgEmfLO3WDPwtZekB+BWKP8AQA7S6Wz2cWk9igSXXHOazyCBaMxWvUYBgjOyhZPXFsH0c2/vQ5OBo2vv07Z4/4aMsgft+i28oKE17wCg= 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 AS8PR04MB8513.eurprd04.prod.outlook.com (2603:10a6:20b:340::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.16; Mon, 30 Oct 2023 09:59:33 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::9ba:8e4f:1465:9351]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::9ba:8e4f:1465:9351%4]) with mapi id 15.20.6954.016; Mon, 30 Oct 2023 09:59:33 +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 v7 01/11] Documentation/firmware: added imx/se-fw to other_interfaces Date: Mon, 30 Oct 2023 15:28:39 +0530 Message-Id: <20231030095849.3456820-2-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030095849.3456820-1-pankaj.gupta@nxp.com> References: <20231030095849.3456820-1-pankaj.gupta@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0100.apcprd03.prod.outlook.com (2603:1096:4:7c::28) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8630:EE_|AS8PR04MB8513:EE_ X-MS-Office365-Filtering-Correlation-Id: 53b115ca-6c50-4a36-6ad9-08dbd92eeae6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BpffQoUJgjg5PEsGLsAWqBG9Lr5vV8WGKipRKVv8aPWxbErWpKug7DxU6kc91TAMAA5Z4KAfRDs/lYR+XnqJ7BzQ1/DI0TYVrTheZkOFv7lvxtBUJsW0tZzEC36wn0A1Sn1bwZxff4jpuLul9BaEubueiObkYM+v2Qsn3su3Cmdd/AzFw84KrT4jod8fkA2fhIcKv0zRHVG6ogqYsCz47VjdgISwdrcEF0i5PIT3FJIOrL122kb1lpF0T3xgJRZb6KvYYWVq1+mERAYhGIj/SO8Bss4xr2MTg5TUjbcD4/QLae830JaSMgrPdVZzOF3k98Jkbz91JxUMwxCIjxPtiqR4hn9FP0hyjcYr/Nl5a9j+nrVABMg+2c8rtNwCf8ogXUznjbjphJDCCckqYJ7Y0+bu0NHZh5s+2Xexhjv8fsVg2O+JIEwSFwxVfk7CURzzbzAxmWDD9L5ERvThvo/sZqQhVMl4HRTjATUEBweJzdCHe5bKC5YF4QmklSpxn5RH6GAjcn4AJGTBiT8py7kJZk6EoA9vKRAEcWXM9u/Kx1KLfUzdpL+IcvcZ3/YxEa4W4JaUnvNPg8adngj5XGWtcFlsw8I0V2EDMELw1RfQvOP1lEyhleq+8ZbHjpQykjAIjiJ0IwFBRJw1qayTf94VzQ== 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)(136003)(346002)(396003)(39860400002)(376002)(366004)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(478600001)(66946007)(6486002)(6506007)(83380400001)(36756003)(38100700002)(66556008)(1076003)(2616005)(66476007)(2906002)(41300700001)(26005)(52116002)(6512007)(44832011)(86362001)(38350700005)(921008)(6636002)(8676002)(4326008)(5660300002)(8936002)(316002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0UKeSRMtVnI8ldhlJzyEnPfm3fKES/GOPwEY9MVj40MXOGwsk2RecPIC/AcS?= =?us-ascii?Q?YHmXtsaNkEh9LAhxn68zJzFcLB3GHM8tbEEnEUSeHp+J9d4BOcUKEoyaH69B?= =?us-ascii?Q?gNzPYaEnXy5uCRhxq8H6rkTpokbXMA8+gsLeHCh9+Eov0AdNJbm/OYo7ILBt?= =?us-ascii?Q?etWxnnHpn1e5ItlXry1qLkjad+/nMz/Ozqt+EEYgRIcEL6O4jIqD0ty/7zZG?= =?us-ascii?Q?Fxgst+XWg2MTwfKn8Oeb34Q2g+X2IVAjUq30VS7APTkEWhfRUbROFWHl2e8U?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Bj8Vr2mn8pZ2rJTDyGxYNfsLv/a?= =?us-ascii?Q?rWcKrRmzMdwLuZP27lLymOFHvq34DMHenpHHf7+W2A/FWxGupLXvCvn9NnRH?= =?us-ascii?Q?Ce1GMd2zY5Yrty2eRAHPCfnW8cWl8Wy982nrZzwkgeEmP/fImIyko8mpBcQo?= =?us-ascii?Q?l2CTcsMkNSxa21E1PS7nvcgmHVuAEcdSG5neXrNcxxIrX6aAVq+PLif1R8rD?= =?us-ascii?Q?tC9JI/hjluaSXESNaB+wNKe4zAWiEfdFxOctnQR7WB7WBvbMJXQapsOMdFfP?= =?us-ascii?Q?gQb34qE4dur+mFDQHXfPWSBpHXEo3CAD/C3fzJHifVD52F9QImFyC7BEvgHk?= =?us-ascii?Q?56A5JyG9PH39x5iwMewGryDrud68Yt7AXgt040Nt1OqTyNXWzF0lsvviLeTy?= =?us-ascii?Q?8EC1C6IfxvY93Tcfx+OGm9YRPkwWiRsasqJWMhi/?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53b115ca-6c50-4a36-6ad9-08dbd92eeae6 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 09:59:33.7683 (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: zoBg5LCOtPkQr08EUsiYEsoj3Y/yokmrFSd9j9uNQu/zlzZn7rqTjgjXkWMm5n03d5h2nBJcLRy71WkhQqgIHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8513 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 30 Oct 2023 03:01:01 -0700 (PDT) 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: -- 2.34.1