From patchwork Wed May 1 05:32:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vabhav Sharma X-Patchwork-Id: 13650244 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 9B2DAC4345F for ; Wed, 1 May 2024 05:33:40 +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=R9R1BL84yz0eWsuiYuE4apKiS+AUIevQ/oVJlfLF+cc=; b=HCoP/l9BnzZ0PK 3F4vpvo1Jb1uR1Ua8ZLNbaMc8pPEl+CcOr/+io4n+LGjxij/XWKzRljFY2Ay8NGsVCkHboNHo1mRD TAUO5bbtxRoobnfNJJiQIxqfDHV9BJdtIh6eOffpz7tW81d3O3MPJyxr3c6ehxLEMCNm3Nnq4ys1b +hpxvcVWBXrcD4ANfGDuEi1jYO51ZhYGdnBKMEQ6Y5sY/XR0X+2Hwfna8weUcTIfITU//RtNgbiPM Xv5gLlGEr7LQRO3vws0WnvnqpOSTltgbzeWqqbjd8NjB5W/LeOMB3bL6/WqafxkOVZrJmKvs3+i9B nRYBwRZbsSfl3TPUc4gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22ap-00000008ccE-2xNS; Wed, 01 May 2024 05:33:23 +0000 Received: from mail-vi1eur05on20601.outbound.protection.outlook.com ([2a01:111:f403:2613::601] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22aN-00000008cTt-47ai for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 05:32:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ifHrmBH7i4XsKEcRWQT0gNB3LyckNrbgT9chKnFUjDaab1Ap2eDS6iRRngkkGxk+8VlGjcX6fT0WDGKKu3FKUvgn96tHpEsl8EiMtUXKP4Eww3j2Tqa7gqzmp/PUeTHPv8UaYdQaM97DWLFZ/95ezNpLzaQ+KsLiRj52FpzQ6QYemyWp+6I68o5Qe43KhEa1ORuCobVFtx4bLIOujWX7DhmP3OoOlUN2qWyxucqFjFUHp+X9alZ4PD+UnVIboZVEpspzQNZKnh5WiKJfOreaA5AspEEhXj+GVu9rk7udlak3F9IO3DonvbV/r0zM5H3D0mcqCU0OtwZs1k7B/SO6gw== 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=O4u5a9BlDewljnct/kMcV6x6s3nlS0FUFWdWexA+zss=; b=TlUkhYCRBTSWAZsyhAdQrzZhX59W7TLD57la42f33zZb12eC8Jo0EYq2CqgOoxLdX7vh56odrFdhzAqK0IeVXseEASlsYJnKRZNZCr/klqPfEcY+G7h01xqDfkv8Nsn2PSC6FzbBTSFMPLLjHMIoIzNd6tvae4qHpNFxxf9dTLHuYSZ0jkKiGEecVjAiZqvc+3mjHx7SPi7dkr5bTw4YN6g9c8GO6xg+7E7rRDir1/bnNzB3rrbtbPAW0xf2JksEZyDXf3iEj5zTU8qk0y/bi+y3SjzZXxAcB/9D5L2oLt2ElZBHCZzhY+n45FPemPZAp9lWLUkXg4hELW/Vxs4gfg== 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=O4u5a9BlDewljnct/kMcV6x6s3nlS0FUFWdWexA+zss=; b=rqWVwqDoimMCyggqX8OHNpxpYbkjkhlWIrrgEpR6pAYtMPK/hmbLWpfJRdMAFuHnS+6b0JEkVpxzNG6nGyqAQOQtA475on4CTe1/nHwDuGJJ1GdvpH36peslSRAflsLPXdwlzH0WyAJr9SP70cC8CGBDMrKVV44VMrYw+NdpU+4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) by AM9PR04MB8859.eurprd04.prod.outlook.com (2603:10a6:20b:40a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Wed, 1 May 2024 05:32:46 +0000 Received: from DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab]) by DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab%3]) with mapi id 15.20.7519.031; Wed, 1 May 2024 05:32:46 +0000 From: Vabhav Sharma To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Pengutronix Kernel Team , Fabio Estevam , linux-imx@nxp.com, Ulf Hansson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Guo , Sascha Hauer , Iuliana Prodan Cc: Silvano Di Ninno , Varun Sethi , Pankaj Gupta , Peng Fan , Dong Aisheng , frank.li@nxp.com, daniel.baluta@nxp.com, Vabhav Sharma , Franck LENORMAND Subject: [PATCH 1/4] dt-bindings: firmware: secvio: Add documentation Date: Wed, 1 May 2024 07:32:02 +0200 Message-Id: <20240501053205.1737248-2-vabhav.sharma@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240501053205.1737248-1-vabhav.sharma@nxp.com> References: <20240501053205.1737248-1-vabhav.sharma@nxp.com> X-ClientProxiedBy: AS4P189CA0029.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::20) To DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9354:EE_|AM9PR04MB8859:EE_ X-MS-Office365-Filtering-Correlation-Id: 7996f2a8-72d1-4c12-88fd-08dc69a0218a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|52116005|376005|7416005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: S8p4nUV3hDTSl2K0WtMV3EcUz6yQsVYwb8IuG7ATRsp0mh9yaWoGIi4ZL8Z+tPpTTa9eXm8UWt8j4u9VwTBiAJG4lM5dKjpwA4kKxqcXeDRFVgMTzt2nPZnKNqYIy9VuGkJsS0vT0iMYMY96NztwA1KimQ9v5bij32illzgSG0saVvBhh/7uRT7YmjaGSwdQu8b4ESh2mcCfKURUKfSC8jaJbIb4cwRxL3x4n74IuESiWyE72wiSuvmOqNOyp5utHjLnqc+fmE1MT3ED0jCe7RZub4QfYWcR29/eyEvWrFzW3qA0fsB93FoBNwHjMGKSDTjBvfwztAQqAGZCIzEAMb02V3WbQyWtVfI2IimGT+KsjngR8rdt9V58CNgKle52vW2kE7QDF40fYLrWxY1gIviGC+jgZIF8serHFoWuqiJvSNWZec8fP6imHnujkDz1srab2p+mTIpgQPR0JwZ0yGCxPgicwl8dPmgSHe2fkayr7bDHVZ3MSqIgB4GUeObGUyTzbRTZ+ZY70sny0zmvT0Ompa/D/DpFqozSOb8VRBggIphmDNEaDIuEF+CKkSeTIMMp7u/Uirh/GWj/7h79zZQ4FFf5gdWse0M0VSWl0hp6Kkz1g9wxbQcENNNhurjyexCrxjeuYtqcjYbhIoIAg4w9aC1GUI8w3l+GR0tvGnFvonuqE/TcdZDZPfhAfKGwhI54gXGSi4fnEspRanDwSrpJ7vQJystGwZYvOfYiD1AtN2zknXvKLSmtjCz04Tkn/jOqr55vmhEKdqUbYPW4prqcR6SnGVLZzd0VbzfKHeqvqedCBc2lf/+5yt2CC5Ulwc+ECu71vSn5ykLAfI1svzbKBHF0qkydYvqCgpvD5MerkztWN1Lmmrr63cj40kheejnxkCZDK7rGs18EjEj9VuQtWAUVD3Hyq+igajSUmpUt5bwQzCWYbmPxy2XtrYRKhFbeqNPVQJ65aCC16C/kL1YOKHpPIKug5WFb9neqiwQjH0Cm4BGbmIv72FEH42z0vCdGXo53UNMWiA/s717+Eqpp+8ZtBpilgkea8LZME5hU+5EkFdSw3Hl/Q9d2BCCkODv3FEePtIRuK4GD+msdNcGZX0fhrTDLK+uAXoj0oF0vepI5/mVYCKCMLQFEp3PXYSm3oYSHLsjXSlZjSzUVS4zWlboPc0LaLgdyVFNr71ch947PEwG9e90NzltECHvvq4BDrzNvfJe2iQcTvd1KW54onTNWnz4opVcGn1PAio2pidHGirGzPgZoaW6SUbmtn5QZBU9v2206mxonGiEfQXU146JiL/WAuk5HE2fIEQ8O3Mz+SYGntBIJ9g1T3Hcc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9354.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(52116005)(376005)(7416005)(1800799015)(366007)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SEhqtZP9zsOnXyMxyxHUsUG08FNqE2nO0UyelXx69YbilKEImcFvWfykS3YSEebKttkpAL3bnWAkFkH91L3EVDcDubftW8BQnh3+7nOL8j76dCJJuZ67kvhO0rf1YjeMCUgCz9m3QnFtJWvxpUMmeW7H59swLECsFHkfjcdozHtPEmryRcECHCMsEpiTR8Cr4jMbLJUlLqNPUBpNhOhFpo45YHUBdb4vTDO8nyvcOv6ObBku2bXKnf1F0owGB9Vg/A4CmY+kDfNz80+kye6Rg2FuHAl6dDxBXDDnRWHqLIdrNF+DjvHPd6SL42ltdtW/EhHND2594Bwu9gz+BtHcv+APIM58RE5soqCarvmfoX2D16Hj4d/9UQ274MZRiszL2sNEiJHWbmC7Ub69USlRIbrTuK5vTjPnEAznrZK/QR6BmN6hYwhs670857qETPLRfNbHnjO84vMDPZwzbX9Jksx11YxWgItVOuiEw3RcWU4nszNG/wnTU7GEXQ68/m3yRNHVXKpc2FCGVEQtcuRDTsqV9+uGs25oiQ4ukwOfhmTKzoPYqF4EQFigNqle6xX0SrQLily4GZG1oV5NDP9HTakPZXIDtb33p8G3DH6+4rWCMInl/hM7uKLYHmoF3Qx0sxBIpdJ88lTLeLqzoFyIR7rY5acwovI8QjwQLP23TpcRMkpmXOG8K4BSLfM3IoghGGQeJBccnRrNSNNlWcXyXIuDLMI31HXlKt6TT9ADI3mkPtHz0MJFsR/1qD9myOPOIF5kFqNYK+tOGM4LE2EqKP1cJw+Famt1YEeFfYbMRWZsNtJlOkUJRAMnOSSAg+iw6qILcimHz73Jtw1jwUsa2Ua6oVY+ro5cJBgmczWpHPZpxX5eC0+QFyLS3OtxhGrkiq7s0yIdXgsoXEXM53TJPPanl9BySLfGe8d5QrerIDFVS7smNj3MN+/EDXDF7ceyaunrBCL61UuLNQnMxWKiuSs2U0QKeQqy8iutETeqmMpa95UIitP6UL3eYBT8r/MhMq8dgtwp84Mx0boX1725Zr5TvZqyf6lAgS3arlkaC44x6OqiS4exEswdK4TEHB2cnX9Sg9paaRzgaModsNxYmVo/znYFkSIhb1VmIkyqH5W7RGVzKvCVYWzpu0F5wRcNXSVV3R3qXf/V7qcRsKOfFdfthCwVf8/PjQb/zaDSNu6xisp4sMvEv9MhCW6JcwxXeCDxCf+18j24LUwhS06WRTIwPWBG869dOQlQTDkPPhg/eHDW9SuFtAiZ64b5OkHakzuDA/iyC+COtbelz6e4jrw94I8WGEzPSfqqrTqJeA62OR6FMrN41STijdGTocZuRHl4W7ZNzhDNSJ7iGG052Mh0BQuWhUgaR80syWkuZa7bavenq16kqPU160jtoW0lEux7OWOGKXSKZhLx59asXvuoHppNy9pGMFlbt8jlMhjEdujaCCJnyICkStvxgr13OTyguzc/AYcCKEV1fKiaYNc1XbSuialtQggeOJx5OcCEmE+EZ6UJ1GaGCJfROgFWGdN2QKW1TBqESkXVEv91HImspma6kAo9UT4Flv2+lfU9eoivAhiSGBlP9vPzAkHL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7996f2a8-72d1-4c12-88fd-08dc69a0218a X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9354.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 05:32:45.9600 (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: twuh7CDQH4NocNwVwwm6bUK+y4M+pGj4GS/d0Z0Vh0hyHNJVTwDq6uQycv5TJbfB/dZbKlJnmWUsvF12NaJO1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8859 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_223256_049649_8ED1103C X-CRM114-Status: GOOD ( 15.69 ) 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 This patch adds the documentation for the SECVIO driver. Signed-off-by: Franck LENORMAND Signed-off-by: Vabhav Sharma --- .../arm/freescale/fsl,scu-secvio.yaml | 35 +++++++++++++++++++ .../devicetree/bindings/firmware/fsl,scu.yaml | 10 ++++++ 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml b/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml new file mode 100644 index 000000000000..30dc1e21f903 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu-secvio.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/freescale/fsl,scu-secvio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP i.MX Security Violation driver + +maintainers: + - Franck LENORMAND + +description: | + Receive security violation from the SNVS via the SCU firmware. Allow to + register notifier for additional processing + +properties: + compatible: + enum: + - fsl,imx-sc-secvio + + nvmem: + maxItems: 1 + +required: + - compatible + - nvmem + +additionalProperties: false + +examples: + - | + secvio { + compatible = "fsl,imx-sc-secvio"; + nvmem = <&ocotp>; + }; diff --git a/Documentation/devicetree/bindings/firmware/fsl,scu.yaml b/Documentation/devicetree/bindings/firmware/fsl,scu.yaml index 557e524786c2..b40e127fdc88 100644 --- a/Documentation/devicetree/bindings/firmware/fsl,scu.yaml +++ b/Documentation/devicetree/bindings/firmware/fsl,scu.yaml @@ -129,6 +129,11 @@ properties: RTC controller provided by the SCU $ref: /schemas/rtc/fsl,scu-rtc.yaml + secvio: + description: + Receive security violation from the SNVS via the SCU firmware + $ref: /schemas/arm/freescale/fsl,scu-secvio.yaml + thermal-sensor: description: Thermal sensor provided by the SCU @@ -197,6 +202,11 @@ examples: compatible = "fsl,imx8qxp-sc-rtc"; }; + secvio { + compatible = "fsl,imx-sc-secvio"; + nvmem = <&ocotp>; + }; + keys { compatible = "fsl,imx8qxp-sc-key", "fsl,imx-sc-key"; linux,keycodes = ; From patchwork Wed May 1 05:32:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vabhav Sharma X-Patchwork-Id: 13650246 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 13884C4345F for ; Wed, 1 May 2024 05:33:44 +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=z3Izj5Zg52FTMXYbFcaJqPZ45V9w7lgB14GcNRyvcOM=; b=xKZf09U5gBV3xU 6K4uIKwosaq22dd2M2Xc4QLgxNMAuKbZtNFw2uOVGTO5w8W0760QDPL8stAHnREZprXbK2pFISU/V AFGiisQlrpLCWEtqggGHmuKZG10tGxlHftCBAEuyFSj0hxcgVq/mOQpOxrl7s542eb4o7iBdY6ojI ay/ZVqWWNI4qdFuVS8gHAT07M423zxxRcy1apjYwUBZC4zESeG3tg7MPxXx/lycPkJCRAXvVo1Uug 8nnmj/KUG13m3zYmtkIAqTqS3JqNyOZAkFDCV5C2mNPToSSYxk0wN4oXMz+uko2w6HNBRWacLokHJ 2JfrjwvKvSE12xDcjc1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22aq-00000008ccj-28W4; Wed, 01 May 2024 05:33:24 +0000 Received: from mail-db3eur04on062e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::62e] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22aR-00000008cUF-3aY3 for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 05:33:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h4KG2mcZ/1Mek9q/NLRYBRKX+VuyVVyqFIKAd0eULgytxYT04ZbIyWjqZahl1S/rKaOlgYWgumRwKgglZt0QxdTf3xkdzNow4Vhy4jfOzEB3tP+PD+qz8u+cgd6AI4EstR2HknE/blEW06nFMf/m0ifYVwlyo6Lh7Qz1hXa0/lwFji/pW+6huLy3/HxPR0Dw+hFU1AVNkx/qL+EJL1my01Wrp7GnLsWAXdkrYkeAkBiDFimLUU5XOgBWc61RCCZiTS0BdJ21Zsho++1dArrwazcqzpnap2M4VPAN98pH6/U/COn/e7Nf+76Lf9Dlv3obA/NQ4vOs4WGoKQJ70aQP6g== 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=Out/W8/iZjCkWUDh5tusZTqTuI9w2WE09XFW9dv0T6g=; b=eFyd51yVSp4Glh0xv8AKmVzWQvcpYsK2/xhsrEXnTvuGUFk2gN6pvEd3BMAPrXopgwqbBvzl75f3soxjs9iTT3A59gnD4veZ7+rLIKRLsB3I8vckrWz5L6MVCJ914pEdkIKZPGguXuKjQOWOZl/+di/iOe/lRpsjcV8VTfrdon7omR4qKaYFaZjjhPqHbMRwA/D6pdjt+AWuF5+wdlaD7m6XZPbV5u2yjKdhtJKs//MzItThspHYF8KX0WPqwc+6Z5tVbaluB08+RlfMSGR3Ih4YUHxGd3zjjXL/UaeGWmvvGb86L7QujWI1uG9DQ5p6LYaTXAGrmNbsluwshlzDlQ== 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=Out/W8/iZjCkWUDh5tusZTqTuI9w2WE09XFW9dv0T6g=; b=iEKTF46ATqH2TQllBe+Um/u2YuD4aTGjvQTBDP8ZaZyXrKE4vlU2/CCGvWJeZgrs1Rw4bsugYn7MJyJJD9Si62iCNECjC2E6TJqRTBns+S0G9e1sJzFmpq4USz0LnNY6TdJebL3rhnwWXBNgfUcPFdAv+MYPTazLiR6t7kr3XPo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) by GVXPR04MB10071.eurprd04.prod.outlook.com (2603:10a6:150:11a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 05:32:47 +0000 Received: from DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab]) by DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab%3]) with mapi id 15.20.7519.031; Wed, 1 May 2024 05:32:46 +0000 From: Vabhav Sharma To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Pengutronix Kernel Team , Fabio Estevam , linux-imx@nxp.com, Ulf Hansson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Guo , Sascha Hauer , Iuliana Prodan Cc: Silvano Di Ninno , Varun Sethi , Pankaj Gupta , Peng Fan , Dong Aisheng , frank.li@nxp.com, daniel.baluta@nxp.com, Vabhav Sharma , Franck LENORMAND , Horia Geanta Subject: [PATCH 2/4] firmware: imx: Add SC APIs required for secvio module Date: Wed, 1 May 2024 07:32:03 +0200 Message-Id: <20240501053205.1737248-3-vabhav.sharma@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240501053205.1737248-1-vabhav.sharma@nxp.com> References: <20240501053205.1737248-1-vabhav.sharma@nxp.com> X-ClientProxiedBy: AS4P189CA0029.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::20) To DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9354:EE_|GVXPR04MB10071:EE_ X-MS-Office365-Filtering-Correlation-Id: 28dd5c37-88d8-43bd-bd84-08dc69a021f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|7416005|376005|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: gxNBISdPuUMw5aiuy0AwAjNTgq2FtzGr6y4g24y69ZZk/haFyG+cWWbTj3YOqzLgBAluaqaPXNclXID1Pck3J3txLy8qxPoz+f+kSg/DbLST/0+uiF+7H5FSRDm2sC+5ZcWLfL8f9slmqwn0AHL2IFNm9kuQ6f5Rkqd37X9O6cGjoGiTqwcOdTmQGWzIWM3bjsH8hUbbLvOJ9aM1UNeAWlZWBfPAB5+jkGmAE96mNKIo27TR0mosYeqVMGDo6T9Q+b07d5OUFm5xQEa3BRzBC13p1df0Ro+cdwhHipRksLMmzB7/954L7A1x+gmPX2BOC2Uh2H2mWOa4ZQa3KZgZrOjQCK0fF6D1kR0I65MVp6CzMoTaepehUGGbdk5/1D+UJ6jzAtKvaa57sQXSUGUeJMXMaZgLkVRkQR0IFesok8y0HZQVLDdTDd3gGU31lkyGMLaR5PddATD+PFvIxEdWzbaVV8dHZ8h6zb/MW/zOuNdg+Z8+50fSfjZD9A1qiC7IVy5qirJ8arsd2ma/vD64Vu2CeFosBSnSM3RXjEypTSd9W9rpaANB+iJ2fapzySIzY+ZC4Ayhg4Q5XM6H5ORdD9f8TK8QsIWcVQxPc8MLs3gao9eNoj99Bk4uJ4EdoGXceZwW3kDqPLvgbO+DYkBQittTb3BP3RhMrVpTzECvmNsy9vQgTM+wAWzYtJJ+NvdAXfEVY8Wfyjvt+Z+67k76Jau9Fed6VJ4XjaGmf2/u7YfGrQIem7PI+yLmITZBsOFMlTPlUBOx7NvettFiB+sEsPjFgyi2lXX5aZgpdv7p3atkArMcpHA7Mmx2fSfl2KQiFBespgkznYxA+dq87uxIrik2dVDiwZ55r3J8NRME3nYI432JaZk5YPFk3L0FPTlls9JlckVX08R8tyn0ZqhCb1sccoQk0Repwf0tvX3JVFyZPFGVec63p3vvZFxOYUzZquxofCWXX7l+hxCinqROBrHMWI7LvmgQpQG0rk0TNQQjmieEVykfO2hQ5eCorhvJc4MYOx0znM/0KoP0iF7bQaiYfi0aTaKJJwuYEP0oxE7j71unuwOt0kZGV19gUI9oqn5+OFLsaPEIgUmKB42LAav0JZs3FEgMRllNLIsgLdowFhdqlNMTmF9jLIBLTQ7rbyFS359BT6+bB9MMYl8SYPFFw/IQqxAI6Qova80T8ciheyzpwUWI7e1Y9MWQ5By/FIt618l+XhAMhOO87Tv8gS5Snj1AcHdfK9ChDdn4zvfv2cDoogd6284esUf9XrCjvcrdsjJI/7UpXhMd4CHDsAcjpc7fTlMDAfqpJfRzo+mriw9NvvUo+LFMwLhi2Ridq6n1M07dmmodhf1a8O/d/fqDBXst8Rt+qOZx0lcy9p8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9354.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(7416005)(376005)(52116005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BVYeWOk38YXD9WYYA9/2aKiR5VG+QS7qzrkzJXKsJnTtkJ96ocQ4Idxj3BEn9Mf9pBOAxcyUPQXB4/+rf/kPiiE51SCnb81Eh/5ihEBOcbEmntMoYxS4+XHXqjwUxbXB54A3aC2NOHLCY1McatlTwGwTXBUWyojTZ7RV+VzhGQDngDG3lRyvmg2wtj0AVr2QdplbWTBsPDsR9tQo1fFOy6426kQMCsK9oSz99xZPQxBIP3P1FgOCxi5QYhb5r+ygBJC6R92BbGL1o8p8nIC31l9g0Mk0NkoQ5iv/Jrd1WiuEXv3Hh698xPxiA33kOeLX8Y8qgfh8dNIuGlZFgVe80UBs6tPda0BmYxBFOSiiDFzAlgsFjEOValleSY7NAMvYhlrGjnjRFnivs/T5YJAI4341XT3v2tg4U4NZktJBJ0vYMjHyMe1MIR06z9IzVaoTK/hov9eIRpGpAUpQWBrnWJ0kxs0gyCK/LPW+GfV/JY0603LO8YcbpHJJCqKgtRLpUF81DsC52WVUMLLwCyshLFMA8FwhrwD9P6jDUBEX7WQqnivv4Se+87J3CoCNW7b4V5G67u8irA51xBM1Y6TgNVWGBsl5FMchAp8tyV2VmQm0oqYAGwT+B1/Wx+usNWPBJ+q9+z11fEoCoezbfh4IzHJdJ2wDJ/v93kS4JVzpjZtzb0IaASdWX1eMDIl0a6Hyare6WaySjhKjU0UpPMnqmx6qgoT+H9qDGThqKuTEoEoe9Pnsa9XaECRPj2C519LCXdyU9eeqevkNcwBM0oSuPAKoKZdCkhjIT8jSaazjlFIdms3gedFeWMitibxNXvxLNE3cLuxElhHILw4gIWWpc4LmPd3y7U6Slknkk4XJDVulkdo7EY+64HLrhDfy/60Kk58ktYt38T1XoFh+YwZRYjOCZzk+tbv/eVRQL8zuhI2vGLUk2WuNk0Ja03l4nI17YOkmJgc3Cil5jKgXiPo9Qn356QwBnaykPUSSXxUdCG4kLlmXE2mqQnCK+TyAfDFcLK9vQJSxUiqKe6nNp4+xJt44dXGuh1YCEInhx4gYi1XFNlKdm5HLdC5vG7I8q2R0KYd1B9uEATOTMnXUZNj1VQbNKERQo5lVj6pPE21UPk1zzvzyqFXHTJJmTD89892vyOuWC/KdKW/TzQ0S9cZI7/aGBDRekvMShD4U5etikN6Mu92KaphoJa9HBiMTExf0rpL40INiNzb3Jib4oLfEeuASr5w5SlPOugF0fpT2UuQnT3hCZHn4mrPRT3bTHJpdPbBGQ6uhzzwSqi/1uOr3akt/DBIEBq90bfdTPO5mVENX6rF0ZseXe9bHopMMM0JCT7ApzlM7sHfEjRCjb4dDK8qi8aZ0Z6qFitmhyvqHoDsqM0GMGqqbCzxAwApLEuFvpWszwPTFlJZPp8nuRaMAtsrSFkrR97RojyEsqo32RmNqmbZ6/TinsxvMmbixWEBSsdenX3tm8i6jY2/y8qzrdSA/nB8q172U2imELs7554/6rwe3IkT/Nw9JNlB3Cc+BMXQIbeFaDte9exzGgv9GlQeNzi0T/AtwOD9ab1Vy394lxP9snTa1WIZfM9Fh2Ju5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28dd5c37-88d8-43bd-bd84-08dc69a021f2 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9354.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 05:32:46.6291 (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: Xd79naCG10ekIJpHecdmFejrHXpP3T1aC/6mEfATjyuKlOej2AshS1g3wCFX0sEoRuS31SaJhkfTYDbx8UbjFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10071 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_223259_933235_AF562BA4 X-CRM114-Status: GOOD ( 22.94 ) 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 The Security Violation module requires SC API. Added below API: - imx_sc_seco_build_info - imx_sc_seco_secvio_enable - imx_sc_seco_secvio_config - imx_sc_seco_secvio_dgo_config Signed-off-by: Franck LENORMAND Reviewed-by: Iuliana Prodan Reviewed-by: Horia Geanta Signed-off-by: Dong Aisheng Signed-off-by: Vabhav Sharma --- drivers/firmware/imx/Makefile | 2 +- drivers/firmware/imx/imx-scu.c | 4 +- drivers/firmware/imx/seco.c | 216 ++++++++++++++++++++++++++ include/linux/firmware/imx/ipc.h | 1 + include/linux/firmware/imx/sci.h | 4 + include/linux/firmware/imx/svc/seco.h | 69 ++++++++ 6 files changed, 294 insertions(+), 2 deletions(-) create mode 100644 drivers/firmware/imx/seco.c create mode 100644 include/linux/firmware/imx/svc/seco.h diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile index 8f9f04a513a8..b53d2dee8ff3 100644 --- a/drivers/firmware/imx/Makefile +++ b/drivers/firmware/imx/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_IMX_DSP) += imx-dsp.o -obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o +obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o seco.o diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c index 1dd4362ef9a3..c96dc73689a8 100644 --- a/drivers/firmware/imx/imx-scu.c +++ b/drivers/firmware/imx/imx-scu.c @@ -242,9 +242,11 @@ int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp) * APIs are defined as void function in SCU firmware, so they * should be treated as return success always. */ - if ((saved_svc == IMX_SC_RPC_SVC_MISC) && + if (((saved_svc == IMX_SC_RPC_SVC_MISC) && (saved_func == IMX_SC_MISC_FUNC_UNIQUE_ID || saved_func == IMX_SC_MISC_FUNC_GET_BUTTON_STATUS)) + || (saved_svc == IMX_SC_RPC_SVC_SECO && + saved_func == IMX_SC_SECO_FUNC_BUILD_INFO)) ret = 0; } diff --git a/drivers/firmware/imx/seco.c b/drivers/firmware/imx/seco.c new file mode 100644 index 000000000000..2d6bf301ac87 --- /dev/null +++ b/drivers/firmware/imx/seco.c @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020, 2024 NXP + * + * File containing client-side RPC functions for the SECO service. These + * function are ported to clients that communicate to the SC. + */ + +#include + +struct imx_sc_msg_seco_get_build_id { + struct imx_sc_rpc_msg hdr; + u32 version; + u32 commit; +} __packed __aligned(4); + +int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version, + uint32_t *commit) +{ + struct imx_sc_msg_seco_get_build_id msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + int ret; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_SECO; + hdr->func = IMX_SC_SECO_FUNC_BUILD_INFO; + hdr->size = 1; + + ret = imx_scu_call_rpc(ipc, &msg, true); + if (ret) + return ret; + + if (version) + *version = msg.version; + if (commit) + *commit = msg.commit; + + return 0; +} +EXPORT_SYMBOL(imx_sc_seco_build_info); + +int imx_sc_seco_secvio_enable(struct imx_sc_ipc *ipc) +{ + struct imx_sc_rpc_msg msg; + struct imx_sc_rpc_msg *hdr = &msg; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_SECO; + hdr->func = IMX_SC_SECO_FUNC_SECVIO_ENABLE; + hdr->size = 1; + + return imx_scu_call_rpc(ipc, &msg, true); +} +EXPORT_SYMBOL(imx_sc_seco_secvio_enable); + +struct imx_sc_msg_req_seco_config { + struct imx_sc_rpc_msg hdr; + u32 data0; + u32 data1; + u32 data2; + u32 data3; + u32 data4; + u8 id; + u8 access; + u8 size; +} __packed __aligned(4); + +struct imx_sc_msg_resp_seco_config { + struct imx_sc_rpc_msg hdr; + u32 data0; + u32 data1; + u32 data2; + u32 data3; + u32 data4; +} __packed __aligned(4); + +int imx_sc_seco_secvio_config(struct imx_sc_ipc *ipc, u8 id, u8 access, + u32 *data0, u32 *data1, u32 *data2, u32 *data3, + u32 *data4, u8 size) +{ + struct imx_sc_msg_req_seco_config msg; + struct imx_sc_msg_resp_seco_config *resp; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + int ret; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_SECO; + hdr->func = IMX_SC_SECO_FUNC_SECVIO_CONFIG; + hdr->size = 7; + + /* Check the pointers on data are valid and set it if doing a write */ + switch (size) { + case 5: + if (data4) { + if (access) + msg.data4 = *data4; + } else { + return -EINVAL; + } + fallthrough; + case 4: + if (data3) { + if (access) + msg.data3 = *data3; + } else { + return -EINVAL; + } + fallthrough; + case 3: + if (data2) { + if (access) + msg.data2 = *data2; + } else { + return -EINVAL; + } + fallthrough; + case 2: + if (data1) { + if (access) + msg.data1 = *data1; + } else { + return -EINVAL; + } + fallthrough; + case 1: + if (data0) { + if (access) + msg.data0 = *data0; + } else { + return -EINVAL; + } + break; + default: + return -EINVAL; + } + + msg.id = id; + msg.access = access; + msg.size = size; + + ret = imx_scu_call_rpc(ipc, &msg, true); + if (ret) + return ret; + + resp = (struct imx_sc_msg_resp_seco_config *)&msg; + + /* Pointers already checked so we just copy the data if reading */ + if (!access) + switch (size) { + case 5: + *data4 = resp->data4; + fallthrough; + case 4: + *data3 = resp->data3; + fallthrough; + case 3: + *data2 = resp->data2; + fallthrough; + case 2: + *data1 = resp->data1; + fallthrough; + case 1: + *data0 = resp->data0; + } + + return 0; +} +EXPORT_SYMBOL(imx_sc_seco_secvio_config); + +struct imx_sc_msg_req_seco_dgo_config { + struct imx_sc_rpc_msg hdr; + u32 data; + u8 id; + u8 access; +} __packed __aligned(4); + +struct imx_sc_msg_resp_seco_dgo_config { + struct imx_sc_rpc_msg hdr; + u32 data; +} __packed __aligned(4); + +int imx_sc_seco_secvio_dgo_config(struct imx_sc_ipc *ipc, u8 id, u8 access, + u32 *data) +{ + struct imx_sc_msg_req_seco_dgo_config msg; + struct imx_sc_msg_resp_seco_dgo_config *resp; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + int ret; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_SECO; + hdr->func = IMX_SC_SECO_FUNC_SECVIO_DGO_CONFIG; + hdr->size = 3; + + if (access) { + if (data) + msg.data = *data; + else + return -EINVAL; + } + + msg.access = access; + msg.id = id; + + ret = imx_scu_call_rpc(ipc, &msg, true); + if (ret) + return ret; + + resp = (struct imx_sc_msg_resp_seco_dgo_config *)&msg; + + if (!access && data) + *data = resp->data; + + return 0; +} +EXPORT_SYMBOL(imx_sc_seco_secvio_dgo_config); diff --git a/include/linux/firmware/imx/ipc.h b/include/linux/firmware/imx/ipc.h index 0b4643571625..df38ab8e7e2e 100644 --- a/include/linux/firmware/imx/ipc.h +++ b/include/linux/firmware/imx/ipc.h @@ -25,6 +25,7 @@ enum imx_sc_rpc_svc { IMX_SC_RPC_SVC_PAD = 6, IMX_SC_RPC_SVC_MISC = 7, IMX_SC_RPC_SVC_IRQ = 8, + IMX_SC_RPC_SVC_SECO = 9, }; struct imx_sc_rpc_msg { diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h index df17196df5ff..947e49d8bebc 100644 --- a/include/linux/firmware/imx/sci.h +++ b/include/linux/firmware/imx/sci.h @@ -15,6 +15,10 @@ #include #include #include +#include + +#define IMX_SC_IRQ_SECVIO BIT(6) /* Security violation */ +#define IMX_SC_IRQ_GROUP_WAKE 3 /* Wakeup interrupts */ #if IS_ENABLED(CONFIG_IMX_SCU) int imx_scu_enable_general_irq_channel(struct device *dev); diff --git a/include/linux/firmware/imx/svc/seco.h b/include/linux/firmware/imx/svc/seco.h new file mode 100644 index 000000000000..508444c02d39 --- /dev/null +++ b/include/linux/firmware/imx/svc/seco.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020, 2024 NXP + * + * Header file containing the public API for the System Controller (SC) + * Security Controller (SECO) function. + * + * SECO_SVC (SVC) Security Controller Service + * + * Module for the Security Controller (SECO) service. + */ + +#ifndef _SC_SECO_API_H +#define _SC_SECO_API_H + +#include +#include + +/* + * This type is used to indicate RPCs/RM/SECO function calls. + */ +enum imx_sc_seco_func { + IMX_SC_SECO_FUNC_UNKNOWN = 0, + IMX_SC_SECO_FUNC_BUILD_INFO = 16, + IMX_SC_SECO_FUNC_SECVIO_ENABLE = 25, + IMX_SC_SECO_FUNC_SECVIO_CONFIG = 26, + IMX_SC_SECO_FUNC_SECVIO_DGO_CONFIG = 27, +}; + +#if IS_ENABLED(CONFIG_IMX_SCU) +int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version, + uint32_t *commit); +int imx_sc_seco_secvio_enable(struct imx_sc_ipc *ipc); +int imx_sc_seco_secvio_config(struct imx_sc_ipc *ipc, u8 id, u8 access, + u32 *data0, u32 *data1, u32 *data2, u32 *data3, + u32 *data4, u8 size); +int imx_sc_seco_secvio_dgo_config(struct imx_sc_ipc *ipc, u8 id, u8 access, + u32 *data); +#else /* IS_ENABLED(CONFIG_IMX_SCU) */ +static inline +int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version, + uint32_t *commit) +{ + return -EOPNOTSUPP; +} + +static inline +int imx_sc_seco_secvio_enable(struct imx_sc_ipc *ipc) +{ + return -EOPNOTSUPP; +} + +static inline +int imx_sc_seco_secvio_config(struct imx_sc_ipc *ipc, u8 id, u8 access, + u32 *data0, u32 *data1, u32 *data2, u32 *data3, + u32 *data4, u8 size) +{ + return -EOPNOTSUPP; +} + +static inline +int imx_sc_seco_secvio_dgo_config(struct imx_sc_ipc *ipc, u8 id, u8 access, + u32 *data) +{ + return -EOPNOTSUPP; +} +#endif /* IS_ENABLED(CONFIG_IMX_SCU) */ + +#endif /* _SC_SECO_API_H */ From patchwork Wed May 1 05:32:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vabhav Sharma X-Patchwork-Id: 13650247 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 D16BDC10F1A for ; Wed, 1 May 2024 05:33:44 +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=l2iG+CpxyR6OZUyMi9l9BIEzQlMOkauQuJr4lVrGnPA=; b=rMJWB/lv9ecvJb UmmxnX/O2ZZvgKMpXDBMA+JYLZ0kpK9HHvQz2lq7rTrdnKdt6LPG2ibcrMrNV9cPCeG5xLyEHNig6 P9IQvwkAM0hjrD9fXn6kzH5bSLvFOLScB1xJpUkMRAGpxVudYZlVbZ5E7wtN1Hmjizl8+1zg5BUri 1m1TP7oXRyooVZM5DsamAlQCdcTxhwUMzmSlvxXfhauIDW8lp9+Mxb6yw4TpcjS8PoBBok+0PqFUF gmL2C5ZA4b6i2CXuL5x9kPUO6AydWmGuu6W4T03/Rr1G4H3tWBuzJ4uOQvJWBBxY05+n/x/4Ou9d5 wVoIyJlMQ/jFxuAUJNeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22as-00000008cdz-2bwm; Wed, 01 May 2024 05:33:26 +0000 Received: from mail-db3eur04on062e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::62e] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22aU-00000008cUF-3KFV for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 05:33:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UoG3pN4tiG9roCt9g3LRbn06xO2y9OQorPUDU00lUYHUzlk9g5aUNHDcnqlvU/JN9mfxZZBUEzu1t+Eaj5JTQJFyQx2nNMQVLY7aHsFfTtDjTPL2R00uyAOLP2yChoVckTD4DGfAkKG2yuYN5S0RdFWN53frc+fvp6MkvpH3v5vfQ1CU+J2AIBSUscZnSeTWIwTzJY5pgIQq3rGmDqywv8FoROAL7ZHifgoodNA0TlHyAMHqOM8qFVtlAe4KpgT6HVgEjMQfL2uWKbHQPYfdjvDrCCIEd3RZBoZNm1B8hDCeoz6cbpKyNWhGvfG+V8UZLKkzMhWr53Dstq/P8o+lWA== 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=V53U+Djg2gLCUFc8LEai1j506uzl4s2ODmchchaDJWo=; b=Mtn9auIRD50Vvm8gmC8/m5ew6G6eNJ+2D5pA8nDBxow+Ds1YO8vzLw0+/CfKbkVY/UTfBami+AfT8ds4XuXrqbx6WY1ngq4nFUC2C9ZubZTIdJR/eghSmKrpSRgIrrHfqNTlVVfnb9rj17HXntmb/dtfgJpqkxYXfQ4RbEFe6Q1Xnt1YGYCBTueOwldgr3Swei/xunGFIBT8Tx3lSbOExVQueYqzNqX+i61fIhOV8FjNIxsaEeKmbV6Jqt9zKwQqa7QphArOPxmtHJ0VVoNV0zsEZ3ZK9AHwKD/mMlfpGcOndfvTdsNqJAfo+h4vUCN1zOHgxWEJTpB3kPVmFsoPkw== 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=V53U+Djg2gLCUFc8LEai1j506uzl4s2ODmchchaDJWo=; b=EpDEf2fuq8R/pLoRH5KosMIXVoY7hYrKbWjt+Uek9xumPN2LlX5suURwxLpy8PXek7SuQH71WgHRA6ldkxFmvdHwju/60jXMvErOp/M5aDQyReT3RA0B7/enGEkkqOqBHpIn+zqgAnUAAH2piHXiTfA5NTFJz2nkxY/gfNOLMcA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) by GVXPR04MB10071.eurprd04.prod.outlook.com (2603:10a6:150:11a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 05:32:47 +0000 Received: from DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab]) by DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab%3]) with mapi id 15.20.7519.031; Wed, 1 May 2024 05:32:47 +0000 From: Vabhav Sharma To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Pengutronix Kernel Team , Fabio Estevam , linux-imx@nxp.com, Ulf Hansson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Guo , Sascha Hauer , Iuliana Prodan Cc: Silvano Di Ninno , Varun Sethi , Pankaj Gupta , Peng Fan , Dong Aisheng , frank.li@nxp.com, daniel.baluta@nxp.com, Vabhav Sharma , Franck LENORMAND Subject: [PATCH 3/4] soc: imx: secvio: Add support for SNVS secvio and tamper via SCFW Date: Wed, 1 May 2024 07:32:04 +0200 Message-Id: <20240501053205.1737248-4-vabhav.sharma@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240501053205.1737248-1-vabhav.sharma@nxp.com> References: <20240501053205.1737248-1-vabhav.sharma@nxp.com> X-ClientProxiedBy: AS4P189CA0029.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::20) To DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9354:EE_|GVXPR04MB10071:EE_ X-MS-Office365-Filtering-Correlation-Id: 94fe66bf-635f-4607-3955-08dc69a0225a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|7416005|376005|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: jmB3uzjr6GELoQntj9q5mesZb1vwZvT6wp4aWdaHy0FabwtvDupyxP+MW0JDHBDhUK4tSsEnfv/r8JHgvvwxvzEZMCRuR6NYLYMg3zheeHxAG6bCEqB7OenAmDaLnN6azVE4reiVoBfnxMgaICL6tlQJzLIz1p9iylEP59p1VJCEKJ6r1D3AmooW/+aN4rZ4jY7ZdvMwRfmNKFhrQEexBoYeXA76rq512f7o+cb+d997xIh+ayyqcvgmjfPb02YH4TXFI755HLlWHqcspv+1NSBAnmvjqTzzYV/p23R3CurfuXfV1FaybRevThwcGmJFhgWo1fq7gi84wOmZTjvhlM1GP5GHACXbHIpogAAq+xK/t/AP6vWDtpCw0Gw2ObqT5H2Z2B7XBFmXq0e7ORaDbOhMTTAvDj3tM//RhecAf7ly7hJUF9nAA49ZCJbDZEtFL0IsNRbaKv+UQaWwIuQhlCEHXv6p+vKlOMX/Fv0X3qcHn0+75cMnxSWOq8ZF8AjTnFPseC8ZVLjsRgjzpm02ptlkfIKs4ljHsNZ87TfRqX4mMsM84HiISgXQzJ7RD1nMQg5arR4N1wdh35OOaLuCrv8Mvjtusipa7WU2R1SxtRdoQ7A9LqtW/zB16T2I9e20TU/G8O79Wnd633gDjFJ+NBuM+u4Sm43id9Jzq9JpMIIKeDYIapToESMeXfVGVD+F0/HmvloNKaeIgzM6F1Z427hshBJap9AjCZSojB/6jKcBSn0R6zTi2+mZdDj4WZjZkHqiX2nujf8Jd+vSMMPHypwMgzx/fY/Bc/P8ckJ6qcxORuCwdSK/q3xKug7kfH9tHr5Rd0I3yIFXR7ijUxKEktDjesmpu1IkZ+jW+MTNwQVT9UW8FMHKB01ehGRTZvBBZ8Vpp79ScisG0Q+mvVLAh4fop8geHhvShf8rUOsOG+GHU51Lbh49TuO+luK42GOCuk0+tIpOX/cqZSY/s+CgRnVbwrSdcJn3EN9c744qEItWH+Q724JBg3czYw3pSeVb1OilJ0ku5xlTUHDP2u4pxOfFd5C2gm+rjQDynmh1KTp2l9NpYPpUICj3bCvwCu5SEDALAOMGqfkdlVdRjfGFxwkuk0wr/FcRDNHw22MUbBeqhyNjnS7YwPcdtyUNvQFZYPDvHaqSAGGLQv3LJNtHZAzr+mIDvDv0fwCIRZGfjtPhTyPZ08wwObHPnM6BTwwH0cowSkNIHHdJ4WVS5S8p3X3+iNlkO/i+s7/S6Lptk/NI8iwjw3LnPo2nXg01ZYaAbqtvfWWMqi4+4ZdPlQHK6eXUxCzMoFbnA2NKWiean+a9IXcdXj5yrPPG83UYK9+C6jZMspB52f6LPq0J72bAo8NMKnnicZJFc4KlLILNfbI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9354.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(7416005)(376005)(52116005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kkdi2FkiEL6/W6DoPMawmbBcpj9K8ZzaLRGw5T8Ykd4BaEy4BWu2aI4bje2Y9P8Q3QZJzsiQmUJmBmyLK4xWgIEPqUNt7ACFQ6q80a+mna9idWfOwez1PHSZuw8g93p39cXEGOjmGMhRmOyfL35zWpj4d5Pd07E/Zd1DSBDqVwF+y7jOs+larIh+QkkSFk79c4UrVgow3pSV4BF/CEI8kCcWnhTaTBrqGLlXwF1x2zn23I/9TKHO3bi1kAbnHRZMn2smxYciW3OO6Jm+tDEuqDjlz865X36dgl++C4E3ebxPDcOqISJS38DaKiuZrn46ShQ5PtVxTN8Xb3g9Buf2d+eL+AeLvqXuvWVTspndWVihh+P2R49aOZAzBcR7ibdEFpN3QAzAm9NyAZQXj8C8F1dC7pnADNvvM8Digeuk9Tr7fX5EuLKeRf9SlCo3fX9wIHoyiO7t90+pQb5p9ssSFN1ngT/5n22etCD0KpHgi5yMmDquiJao5hbUifedt+JuAMRNT7FZU3zIg7YS92ovIVA3arpDEEBiGadaXrQ2wRSp8DYhi0PVRy1nag7SaLvFPoPgDCCLZQH/JcXxIwlVCipSgeh8cAtI7hcpYEb+WC1gztUrrMCLt70aG+rdZoFpgOHGShY4ak7+U2rNHL4Uw4XBl7IgKCiLUOUOQ/+AzP6N9EJ9AgcWR+LI2AiOVf1WL8ZYV/My9WbIgGNv6Nqc6uxGCzQNIdn15Ea+2QZA/+qk27hhNz4DKkxD9MFBnzB6hu/Nu67KjbM68vmAaRU7uqvheBoFfnoCTy9vO0E1gz3VYrBODbEwzSkxhsbJrtIxiewGreC8qElfJx4RU9BLd//38rfFKaQo+QwoinBmCZXhbTpJ62X8US2WOQ5E232ZJDaPYuFVEXBByY09TrJuXtv/i7yJeOOSZGGADyKSVMDwnlePehs1huqxMnNzlSX1DLzeGcHRxyi+ytUA+10Nn7cUsp7Vn9/cIa1SDgqrzjTBRSCwq/w6gliX8T1JomoOivgZPrTcqNFC7OAhGv1Zxv+I8KeR4fQ4vsEE7Cxc/pHjXfs1KJf42DymK9JRpUACkWA5r6l8tnM6tH2gjijxYL3n2h1Sxbvc5l6Xp/yqILKw1CL0wPSI/SCJvXRAkqR8K1rXZnFgEkxsbpvBOhrb8b7OskP/vYWVvS4P6zslP8kk1Nl1kFc32CnTNOipdGkBSH292epLHe03O7c7afh0Ee/vqZjZX/0VM/R3i7BktEehUAjJlUuQUl+6hEaE8p8QS/ZViMFHKoklDx1+vb1nEDnlchOAWBGihdH5ZF8jeZY4UOT7jZDGGcFl0N5ym/0uCDPWXvSz/Bl8ZOhV+Upm27gBWIAsj94CYboYNAHtE+ReEIroJepgIixyOwUV+gtAkShT1blZkG9GmYokBg6Oti+Lv3Gsw2fg0/QBL9LKOafqHsBng7U0qBXs10K/zbjWG3aL8+5JRXPsccnscSh1g3s9ezNjp62PMt0cXaK6ly6/0W+7kb0iNk2dKKEA11x1KW0jFXnthc9VTaJ8TQOhJHfNOnyDiEr/s7ruhI6oEgeWVZUNbn4XxuXiM54K0KBh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94fe66bf-635f-4607-3955-08dc69a0225a X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9354.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 05:32:47.3668 (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: 7Q1B/Ci26xVugJvH7xPmczRVLAEYfdlqbnzMtgyotNNlv39qNchy3OkuA0NiLTstM/OmkoH7B2RR4WqFXwusZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10071 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_223303_170457_4A2E0A46 X-CRM114-Status: GOOD ( 21.67 ) 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 The driver register an IRQ handle to SCU for security violation interrupt. When an interruption is fired, the driver inform the user. Signed-off-by: Franck LENORMAND Signed-off-by: Vabhav Sharma --- drivers/soc/imx/Kconfig | 11 + drivers/soc/imx/Makefile | 1 + drivers/soc/imx/secvio/Makefile | 2 + drivers/soc/imx/secvio/imx-secvio-debugfs.c | 283 ++++++++++ drivers/soc/imx/secvio/imx-secvio-sc.c | 595 ++++++++++++++++++++ include/soc/imx/imx-secvio-sc.h | 216 +++++++ 6 files changed, 1108 insertions(+) create mode 100644 drivers/soc/imx/secvio/Makefile create mode 100644 drivers/soc/imx/secvio/imx-secvio-debugfs.c create mode 100644 drivers/soc/imx/secvio/imx-secvio-sc.c create mode 100644 include/soc/imx/imx-secvio-sc.h diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig index 2a90ddd20104..3d2715a8b798 100644 --- a/drivers/soc/imx/Kconfig +++ b/drivers/soc/imx/Kconfig @@ -20,4 +20,15 @@ config SOC_IMX9 help If you say yes here, you get support for the NXP i.MX9 family +config SECVIO_SC + tristate "NXP SC secvio support" + depends on IMX_SCU + default y + help + If you say yes here you get support for the NXP SNVS security + violation module. It includes the possibility to read information + related to security violations and tampers. It also gives the + possibility to register user callbacks when a security violation + occurs. + endmenu diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile index 3ad321ca608a..bda0259077be 100644 --- a/drivers/soc/imx/Makefile +++ b/drivers/soc/imx/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_ARCH_MXC) += soc-imx.o endif obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o obj-$(CONFIG_SOC_IMX9) += imx93-src.o +obj-${CONFIG_SECVIO_SC} += secvio/ diff --git a/drivers/soc/imx/secvio/Makefile b/drivers/soc/imx/secvio/Makefile new file mode 100644 index 000000000000..55ef1c044009 --- /dev/null +++ b/drivers/soc/imx/secvio/Makefile @@ -0,0 +1,2 @@ +obj-y += imx-secvio-sc.o +obj-$(CONFIG_DEBUG_FS) += imx-secvio-debugfs.o diff --git a/drivers/soc/imx/secvio/imx-secvio-debugfs.c b/drivers/soc/imx/secvio/imx-secvio-debugfs.c new file mode 100644 index 000000000000..6f0af138ee29 --- /dev/null +++ b/drivers/soc/imx/secvio/imx-secvio-debugfs.c @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019, 2024 NXP + */ + +/* + * The module exposes 3 files in debugfs: + * - secvio/info: + * * Read: It returns the value of the fuses and SNVS registers which are + * readable and related to secvio and tampers + * * Write: A write of the format " [ + * ]()" + * will write the SNVS register having the provided id with the + * values provided (cf SECO ducumentation) + * - secvio/enable: State of the IRQ + * - secvio/check: Check the state of the security violation and tampers + * and calls notifier + * - secvio/clear: Clear the state of all secvio and tampers + */ + +/* Includes */ +#include +#include +#include +#include +#include + +#include +#include + +#include + +static int fuse_reader(struct device *dev, u32 id, u32 *value, u8 mul) +{ + struct imx_secvio_sc_data *data = dev_get_drvdata(dev); + u32 size_to_read = mul * sizeof(u32); + int ret; + + ret = nvmem_device_read(data->nvmem, id, size_to_read, value); + if (ret < 0) { + dev_err(data->dev, "Failed to read fuse %d: %d\n", id, ret); + return ret; + } + + if (ret != size_to_read) { + dev_err(data->dev, "Read only %d instead of %d\n", ret, + size_to_read); + return -ENOMEM; + } + + return 0; +} + +static int snvs_reader(struct device *dev, u32 id, u32 *value, u8 mul) +{ + int ret; + u32 *v1, *v2, *v3, *v4, *v5; + struct imx_secvio_sc_data *data; + + data = dev_get_drvdata(dev); + v1 = NULL; + v2 = NULL; + v3 = NULL; + v4 = NULL; + v5 = NULL; + + switch (mul) { + case 5: + v5 = &value[4]; + fallthrough; + case 4: + v4 = &value[3]; + fallthrough; + case 3: + v3 = &value[2]; + fallthrough; + case 2: + v2 = &value[1]; + fallthrough; + case 1: + v1 = &value[0]; + break; + default: + return -EINVAL; + } + + ret = imx_sc_seco_secvio_config(data->ipc_handle, id, SECVIO_CONFIG_READ, + v1, v2, v3, v4, v5, mul); + if (ret < 0) + dev_err(dev, "Failed to read snvs reg %d: %d\n", id, ret); + + return ret; +} + +static int snvs_dgo_reader(struct device *dev, u32 id, u32 *value, u8 mul) +{ + struct imx_secvio_sc_data *data = dev_get_drvdata(dev); + int ret; + + if (mul != 1) + return -EINVAL; + + ret = imx_sc_seco_secvio_dgo_config(data->ipc_handle, id, + SECVIO_CONFIG_READ, value); + if (ret) + dev_err(dev, "Failed to read snvs dgo reg %d: %d\n", id, ret); + + return ret; +} + +static const struct imx_secvio_info_entry { + int (*reader)(struct device *dev, u32 id, u32 *value, u8 mul); + const char *type; + const char *name; + u32 id; + u8 mul; +} gs_imx_secvio_info_list[] = { + {fuse_reader, "fuse", "trim", 30, 1}, + {fuse_reader, "fuse", "trim2", 31, 1}, + {fuse_reader, "fuse", "ctrim1", 260, 1}, + {fuse_reader, "fuse", "ctrim2", 261, 1}, + {fuse_reader, "fuse", "ctrim3", 262, 1}, + {fuse_reader, "fuse", "ctrim4", 263, 1}, + {fuse_reader, "fuse", "OSC_CAP", 768, 1}, + + {snvs_reader, "snvs", "HPLR", 0x0, 1}, + {snvs_reader, "snvs", "LPLR", 0x34, 1}, + {snvs_reader, "snvs", "HPSICR", 0xc, 1}, + {snvs_reader, "snvs", "HPSVCR", 0x10, 1}, + {snvs_reader, "snvs", "HPSVS", 0x18, 1}, + {snvs_reader, "snvs", "LPSVC", 0x40, 1}, + {snvs_reader, "snvs", "LPTDC", 0x48, 2}, + {snvs_reader, "snvs", "LPSR", 0x4c, 1}, + {snvs_reader, "snvs", "LPTDS", 0xa4, 1}, + {snvs_reader, "snvs", "LPTGFC", 0x44, 3}, + {snvs_reader, "snvs", "LPATCTL", 0xe0, 1}, + {snvs_reader, "snvs", "LPATCLK", 0xe4, 1}, + {snvs_reader, "snvs", "LPATRC1", 0xe8, 2}, + {snvs_reader, "snvs", "LPMKC", 0x3c, 1}, + {snvs_reader, "snvs", "LPSMC", 0x5c, 2}, + {snvs_reader, "snvs", "LPPGD", 0x64, 1}, + {snvs_reader, "snvs", "HPVID", 0xf8, 2}, + + {snvs_dgo_reader, "dgo", "Offset", 0x0, 1}, + {snvs_dgo_reader, "dgo", "PUP/PD", 0x10, 1}, + {snvs_dgo_reader, "dgo", "Anatest", 0x20, 1}, + {snvs_dgo_reader, "dgo", "T trim", 0x30, 1}, + {snvs_dgo_reader, "dgo", "Misc", 0x40, 1}, + {snvs_dgo_reader, "dgo", "Vmon", 0x50, 1}, +}; + +struct imx_secvio_sc_info_seq_data { + struct device *dev; + const struct imx_secvio_info_entry *list; + int size; +}; + +static void *imx_secvio_sc_info_seq_start(struct seq_file *m, loff_t *pos) +{ + struct imx_secvio_sc_info_seq_data *data = m->private; + + /* Check we are not out of bound */ + if (*pos >= data->size) + return NULL; + + return (void *)pos; +} + +static void *imx_secvio_sc_info_seq_next(struct seq_file *m, void *v, loff_t *pos) +{ + /* Increment the counter */ + ++*pos; + + /* call the start function which will check the index */ + return imx_secvio_sc_info_seq_start(m, pos); +} + +static void imx_secvio_sc_info_seq_stop(struct seq_file *m, void *v) +{ +} + +static int imx_secvio_sc_info_seq_show(struct seq_file *m, void *v) +{ + struct imx_secvio_sc_info_seq_data *data = m->private; + const struct imx_secvio_info_entry *e; + int ret; + u32 vals[5]; + int idx; + + idx = *(loff_t *)v; + e = &data->list[idx]; + + /* Read the values */ + ret = e->reader(data->dev, e->id, (u32 *)&vals, e->mul); + if (ret) { + dev_err(data->dev, "Fail to read %s %s (idx %d)\n", e->type, + e->name, e->id); + return 0; + } + + seq_printf(m, "%5s/%-10s(%.3d):", e->type, e->name, e->id); + + /* Loop over the values */ + for (idx = 0; idx < e->mul; idx++) + seq_printf(m, " %.8x", vals[idx]); + + seq_puts(m, "\n"); + + return 0; +} + +static const struct seq_operations imx_secvio_sc_info_seq_ops = { + .start = imx_secvio_sc_info_seq_start, + .next = imx_secvio_sc_info_seq_next, + .stop = imx_secvio_sc_info_seq_stop, + .show = imx_secvio_sc_info_seq_show, +}; + +static int imx_secvio_sc_info_open(struct inode *inode, struct file *file) +{ + struct imx_secvio_sc_info_seq_data *data; + + data = __seq_open_private(file, &imx_secvio_sc_info_seq_ops, sizeof(*data)); + if (!data) + return -ENOMEM; + + data->dev = inode->i_private; + data->list = gs_imx_secvio_info_list; + data->size = ARRAY_SIZE(gs_imx_secvio_info_list); + + return 0; +} + +static const struct file_operations imx_secvio_sc_info_ops = { + .owner = THIS_MODULE, + .open = imx_secvio_sc_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release_private, +}; + +static void if_debugfs_remove_recursive(void *dentry) +{ + debugfs_remove_recursive(dentry); +} + +int imx_secvio_sc_debugfs(struct device *dev) +{ + struct imx_secvio_sc_data *data = dev_get_drvdata(dev); + struct dentry *dir; + int ret = 0; + + /* Create a folder */ + dir = debugfs_create_dir(dev_name(dev), NULL); + if (IS_ERR(dir)) { + dev_err(dev, "Failed to create dfs dir\n"); + ret = PTR_ERR(dir); + goto exit; + } + data->dfs = dir; + + ret = devm_add_action(dev, if_debugfs_remove_recursive, data->dfs); + if (ret) { + dev_err(dev, "Failed to add managed action to disable IRQ\n"); + goto remove_fs; + } + + /* Create the file to read info and write to reg */ + dir = debugfs_create_file("info", 0x666, data->dfs, dev, + &imx_secvio_sc_info_ops); + if (IS_ERR(dir)) { + dev_err(dev, "Failed to add info to debugfs\n"); + ret = PTR_ERR(dir); + goto exit; + } + +exit: + return ret; + +remove_fs: + debugfs_remove_recursive(data->dfs); + goto exit; +} diff --git a/drivers/soc/imx/secvio/imx-secvio-sc.c b/drivers/soc/imx/secvio/imx-secvio-sc.c new file mode 100644 index 000000000000..a4e96c730a23 --- /dev/null +++ b/drivers/soc/imx/secvio/imx-secvio-sc.c @@ -0,0 +1,595 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019, 2024 NXP + * + */ + +/* + * The i.MX8QXP SoC contains the Secure Non-Volatile Storage (SNVS) block. This + * block can detect specific hardware attacks.This block can only be accessible + * using the SCFW API. + * + * This module interact with the SCU which relay request to/from the SNVS block + * to detect if security violation occurred. + * + * The module exports an API to add processing when a SV is detected: + * - register_imx_secvio_sc_notifier + * - unregister_imx_secvio_sc_notifier + * - imx_secvio_sc_check_state + * - imx_secvio_sc_clear_state + * - imx_secvio_sc_enable_irq + * - imx_secvio_sc_disable_irq + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Reference on the driver_device */ +static struct device *imx_secvio_sc_dev; + +/* Register IDs for sc_seco_secvio_config API */ +#define HPSVS_ID 0x18 +#define LPS_ID 0x4c +#define LPTDS_ID 0xa4 +#define HPVIDR_ID 0xf8 + +#define SECO_MINOR_VERSION_SUPPORT_SECVIO_TAMPER 0x53 +#define SECO_VERSION_MINOR_MASK GENMASK(15, 0) + +/* Notifier list for new CB */ +static BLOCKING_NOTIFIER_HEAD(imx_secvio_sc_notifier_chain); + +int register_imx_secvio_sc_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&imx_secvio_sc_notifier_chain, + nb); +} +EXPORT_SYMBOL(register_imx_secvio_sc_notifier); + +int unregister_imx_secvio_sc_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&imx_secvio_sc_notifier_chain, + nb); +} +EXPORT_SYMBOL(unregister_imx_secvio_sc_notifier); + +static void if_imx_scu_irq_register_notifier(void *nb) +{ + imx_scu_irq_register_notifier(nb); +} + +static void if_unregister_imx_secvio_sc_notifier(void *nb) +{ + unregister_imx_secvio_sc_notifier(nb); +} + +static +int imx_secvio_sc_notifier_call_chain(struct secvio_sc_notifier_info *info) +{ + return blocking_notifier_call_chain(&imx_secvio_sc_notifier_chain, 0, + (void *)info); +} + +int imx_secvio_sc_get_state(struct device *dev, + struct secvio_sc_notifier_info *info) +{ + int ret, err = 0; + struct imx_secvio_sc_data *data; + + dev = imx_secvio_sc_dev; + if (!dev) + return -EINVAL; + + data = dev_get_drvdata(dev); + + /* Read secvio status */ + ret = imx_sc_seco_secvio_config(data->ipc_handle, HPSVS_ID, SECVIO_CONFIG_READ, + &info->hpsvs, NULL, NULL, NULL, NULL, 1); + if (ret) { + err = ret; + dev_err(dev, "Fail read secvio config status %d\n", ret); + } + info->hpsvs &= HPSVS_ALL_SV_MASK; + + /* Read tampers status */ + ret = imx_sc_seco_secvio_config(data->ipc_handle, LPS_ID, SECVIO_CONFIG_READ, + &info->lps, NULL, NULL, NULL, NULL, 1); + if (ret) { + err = ret; + dev_err(dev, "Fail read tamper 1 status: %d\n", ret); + } + info->lps &= LPS_ALL_TP_MASK; + + ret = imx_sc_seco_secvio_config(data->ipc_handle, LPTDS_ID, SECVIO_CONFIG_READ, + &info->lptds, NULL, NULL, NULL, NULL, 1); + if (ret) { + err = ret; + dev_err(dev, "Fail read tamper 2 status: %d\n", ret); + } + info->lptds &= LPTDS_ALL_TP_MASK; + + dev_dbg(dev, "Status: %.8x, %.8x, %.8x\n", info->hpsvs, + info->lps, info->lptds); + + return err; +} +EXPORT_SYMBOL(imx_secvio_sc_get_state); + +int imx_secvio_sc_check_state(struct device *dev) +{ + struct secvio_sc_notifier_info info; + int ret; + + dev = imx_secvio_sc_dev; + + ret = imx_secvio_sc_get_state(dev, &info); + if (ret) { + dev_err(dev, "Failed to get secvio state\n"); + return ret; + } + + /* Call chain of CB registered to this module if status detected */ + if (info.hpsvs || info.lps || info.lptds) + if (imx_secvio_sc_notifier_call_chain(&info)) + dev_warn(dev, + "Issues when calling the notifier chain\n"); + + return ret; +} +EXPORT_SYMBOL(imx_secvio_sc_check_state); + +static int imx_secvio_sc_disable_irq(struct device *dev) +{ + int ret; + + if (!dev) + return -EINVAL; + + /* Disable the IRQ */ + ret = imx_scu_irq_group_enable(IMX_SC_IRQ_GROUP_WAKE, IMX_SC_IRQ_SECVIO, + false); + if (ret) { + dev_err(dev, "Cannot disable SCU IRQ: %d\n", ret); + return ret; + } + + return ret; +} + +static int imx_secvio_sc_enable_irq(struct device *dev) +{ + int ret = 0, err; + u32 irq_status; + struct imx_secvio_sc_data *data; + + if (!dev) + return -EINVAL; + + data = dev_get_drvdata(dev); + + /* Enable the IRQ */ + ret = imx_scu_irq_group_enable(IMX_SC_IRQ_GROUP_WAKE, IMX_SC_IRQ_SECVIO, + true); + if (ret) { + dev_err(dev, "Cannot enable SCU IRQ: %d\n", ret); + goto exit; + } + + /* Enable interrupt */ + ret = imx_sc_seco_secvio_enable(data->ipc_handle); + if (ret) { + dev_err(dev, "Cannot enable SNVS irq: %d\n", ret); + goto exit; + } + + /* Unmask interrupt */ + ret = imx_scu_irq_get_status(IMX_SC_IRQ_GROUP_WAKE, &irq_status); + if (ret) { + dev_err(dev, "Cannot unmask irq: %d\n", ret); + goto exit; + } + +exit: + if (ret) { + err = imx_secvio_sc_disable_irq(dev); + if (err) + dev_warn(dev, "Failed to disable the IRQ\n"); + } + + return ret; +} + +static int imx_secvio_sc_notify(struct notifier_block *nb, + unsigned long event, void *group) +{ + struct imx_secvio_sc_data *data = + container_of(nb, struct imx_secvio_sc_data, + irq_nb); + struct device *dev = data->dev; + int ret; + + /* Filter event for us */ + if (!((event & IMX_SC_IRQ_SECVIO) && + (*(u8 *)group == IMX_SC_IRQ_GROUP_WAKE))) + return 0; + + dev_warn(dev, "secvio security violation detected\n"); + + ret = imx_secvio_sc_check_state(dev); + + /* Re-enable interrupt */ + ret = imx_secvio_sc_enable_irq(dev); + if (ret) + dev_err(dev, "Failed to enable IRQ\n"); + + return ret; +} + +int imx_secvio_sc_clear_state(struct device *dev, u32 hpsvs, u32 lps, u32 lptds) +{ + int ret; + struct imx_secvio_sc_data *data; + + dev = imx_secvio_sc_dev; + if (!dev) + return -EINVAL; + + data = dev_get_drvdata(dev); + + ret = imx_sc_seco_secvio_config(data->ipc_handle, HPSVS_ID, SECVIO_CONFIG_WRITE, + &hpsvs, NULL, NULL, NULL, NULL, 1); + if (ret) { + dev_err(dev, "Fail to clear secvio status: %d\n", ret); + return ret; + } + + ret = imx_sc_seco_secvio_config(data->ipc_handle, LPS_ID, SECVIO_CONFIG_WRITE, + &lps, NULL, NULL, NULL, NULL, 1); + if (ret) { + dev_err(dev, "Fail to clear tamper 1 status: %d\n", ret); + return ret; + } + + ret = imx_sc_seco_secvio_config(data->ipc_handle, LPTDS_ID, SECVIO_CONFIG_WRITE, + &lptds, NULL, NULL, NULL, NULL, 1); + if (ret) { + dev_err(dev, "Fail to clear tamper 2 status: %d\n", ret); + return ret; + } + + return ret; +} +EXPORT_SYMBOL(imx_secvio_sc_clear_state); + +static int report_to_user_notify(struct notifier_block *nb, + unsigned long status, void *notif_info) +{ + struct secvio_sc_notifier_info *info = notif_info; + struct imx_secvio_sc_data *data = + container_of(nb, struct imx_secvio_sc_data, + report_nb); + struct device *dev = data->dev; + + /* Information about the security violation */ + if (info->hpsvs & HPSVS_LP_SEC_VIO_MASK) + dev_info(dev, "SNVS secvio: LPSV\n"); + if (info->hpsvs & HPSVS_SW_LPSV_MASK) + dev_info(dev, "SNVS secvio: SW LPSV\n"); + if (info->hpsvs & HPSVS_SW_FSV_MASK) + dev_info(dev, "SNVS secvio: SW FSV\n"); + if (info->hpsvs & HPSVS_SW_SV_MASK) + dev_info(dev, "SNVS secvio: SW SV\n"); + if (info->hpsvs & HPSVS_SV5_MASK) + dev_info(dev, "SNVS secvio: SV 5\n"); + if (info->hpsvs & HPSVS_SV4_MASK) + dev_info(dev, "SNVS secvio: SV 4\n"); + if (info->hpsvs & HPSVS_SV3_MASK) + dev_info(dev, "SNVS secvio: SV 3\n"); + if (info->hpsvs & HPSVS_SV2_MASK) + dev_info(dev, "SNVS secvio: SV 2\n"); + if (info->hpsvs & HPSVS_SV1_MASK) + dev_info(dev, "SNVS secvio: SV 1\n"); + if (info->hpsvs & HPSVS_SV0_MASK) + dev_info(dev, "SNVS secvio: SV 0\n"); + + /* Information about the tampers */ + if (info->lps & LPS_ESVD_MASK) + dev_info(dev, "SNVS tamper: External SV\n"); + if (info->lps & LPS_ET2D_MASK) + dev_info(dev, "SNVS tamper: Tamper 2\n"); + if (info->lps & LPS_ET1D_MASK) + dev_info(dev, "SNVS tamper: Tamper 1\n"); + if (info->lps & LPS_WMT2D_MASK) + dev_info(dev, "SNVS tamper: Wire Mesh 2\n"); + if (info->lps & LPS_WMT1D_MASK) + dev_info(dev, "SNVS tamper: Wire Mesh 1\n"); + if (info->lps & LPS_VTD_MASK) + dev_info(dev, "SNVS tamper: Voltage\n"); + if (info->lps & LPS_TTD_MASK) + dev_info(dev, "SNVS tamper: Temperature\n"); + if (info->lps & LPS_CTD_MASK) + dev_info(dev, "SNVS tamper: Clock\n"); + if (info->lps & LPS_PGD_MASK) + dev_info(dev, "SNVS tamper: Power Glitch\n"); + if (info->lps & LPS_MCR_MASK) + dev_info(dev, "SNVS tamper: Monotonic Counter rollover\n"); + if (info->lps & LPS_SRTCR_MASK) + dev_info(dev, "SNVS tamper: Secure RTC rollover\n"); + if (info->lps & LPS_LPTA_MASK) + dev_info(dev, "SNVS tamper: Time alarm\n"); + + if (info->lptds & LPTDS_ET10D_MASK) + dev_info(dev, "SNVS tamper: Tamper 10\n"); + if (info->lptds & LPTDS_ET9D_MASK) + dev_info(dev, "SNVS tamper: Tamper 9\n"); + if (info->lptds & LPTDS_ET8D_MASK) + dev_info(dev, "SNVS tamper: Tamper 8\n"); + if (info->lptds & LPTDS_ET7D_MASK) + dev_info(dev, "SNVS tamper: Tamper 7\n"); + if (info->lptds & LPTDS_ET6D_MASK) + dev_info(dev, "SNVS tamper: Tamper 6\n"); + if (info->lptds & LPTDS_ET5D_MASK) + dev_info(dev, "SNVS tamper: Tamper 5\n"); + if (info->lptds & LPTDS_ET4D_MASK) + dev_info(dev, "SNVS tamper: Tamper 4\n"); + if (info->lptds & LPTDS_ET3D_MASK) + dev_info(dev, "SNVS tamper: Tamper 3\n"); + + return 0; +} + +static void if_imx_secvio_sc_disable_irq(void *dev) +{ + imx_secvio_sc_disable_irq(dev); +} + +static int imx_secvio_sc_open(struct inode *node, struct file *filp) +{ + filp->private_data = node->i_private; + + return 0; +} + +static long imx_secvio_sc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct device *dev = file->private_data; + struct secvio_sc_notifier_info info; + int ret; + + switch (cmd) { + case IMX_SECVIO_SC_GET_STATE: + ret = imx_secvio_sc_get_state(dev, &info); + if (ret) + return ret; + + ret = copy_to_user((void *)arg, &info, sizeof(info)); + if (ret) { + dev_err(dev, "Fail to copy info to user\n"); + return -EFAULT; + } + break; + case IMX_SECVIO_SC_CHECK_STATE: + ret = imx_secvio_sc_check_state(dev); + if (ret) + return ret; + break; + case IMX_SECVIO_SC_CLEAR_STATE: + ret = copy_from_user(&info, (void *)arg, sizeof(info)); + if (ret) { + dev_err(dev, "Fail to copy info from user\n"); + return -EFAULT; + } + + ret = imx_secvio_sc_clear_state(dev, info.hpsvs, info.lps, + info.lptds); + if (ret) + return ret; + break; + default: + ret = -ENOIOCTLCMD; + } + + return ret; +} + +static const struct file_operations imx_secvio_sc_fops = { + .owner = THIS_MODULE, + .open = imx_secvio_sc_open, + .unlocked_ioctl = imx_secvio_sc_ioctl, +}; + +static void if_misc_deregister(void *miscdevice) +{ + misc_deregister(miscdevice); +} + +static int imx_secvio_sc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct imx_secvio_sc_data *data; + u32 seco_version = 0; + bool own_secvio; + u32 irq_status; + int ret; + + /* Allocate private data */ + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + if (!devres_open_group(dev, NULL, GFP_KERNEL)) + return -ENOMEM; + + data->dev = dev; + + dev_set_drvdata(dev, data); + + data->nvmem = devm_nvmem_device_get(dev, NULL); + if (IS_ERR(data->nvmem)) { + ret = PTR_ERR(data->nvmem); + + if (ret != -EPROBE_DEFER) + dev_err_probe(dev, ret, "Failed to retrieve nvmem\n"); + + goto clean; + } + + /* Get a handle */ + ret = imx_scu_get_handle(&data->ipc_handle); + if (ret) { + dev_err(dev, "cannot get handle to scu: %d\n", ret); + goto clean; + } + + /* Check the version of the SECO */ + ret = imx_sc_seco_build_info(data->ipc_handle, &seco_version, NULL); + if (ret) { + dev_err(dev, "Failed to get seco version\n"); + goto clean; + } + + if ((seco_version & SECO_VERSION_MINOR_MASK) < + SECO_MINOR_VERSION_SUPPORT_SECVIO_TAMPER) { + dev_err(dev, "SECO version %.8x doesn't support all secvio\n", + seco_version); + ret = -EOPNOTSUPP; + goto clean; + } + + /* Init debug FS */ + ret = imx_secvio_sc_debugfs(dev); + if (ret) { + dev_err(dev, "Failed to set debugfs\n"); + goto clean; + } + + /* Check we own the SECVIO */ + ret = imx_sc_rm_is_resource_owned(data->ipc_handle, IMX_SC_R_SECVIO); + if (ret < 0) { + dev_err(dev, "Failed to retrieve secvio ownership\n"); + goto clean; + } + + own_secvio = ret > 0; + if (!own_secvio) { + dev_err(dev, "Secvio resource is not owned\n"); + ret = -EPERM; + goto clean; + } + + /* Check IRQ exists and enable it */ + ret = imx_scu_irq_get_status(IMX_SC_IRQ_GROUP_WAKE, &irq_status); + if (ret) { + dev_err(dev, "Cannot get IRQ state: %d\n", ret); + goto clean; + } + + ret = imx_secvio_sc_enable_irq(dev); + if (ret) { + dev_err(dev, "Failed to enable IRQ\n"); + goto clean; + } + + ret = devm_add_action_or_reset(dev, if_imx_secvio_sc_disable_irq, dev); + if (ret) { + dev_err(dev, "Failed to add managed action to disable IRQ\n"); + goto clean; + } + + /* Register the notifier for IRQ from SNVS */ + data->irq_nb.notifier_call = imx_secvio_sc_notify; + ret = imx_scu_irq_register_notifier(&data->irq_nb); + if (ret) { + dev_err(dev, "Failed to register IRQ notification handler\n"); + goto clean; + } + + ret = devm_add_action_or_reset(dev, if_imx_scu_irq_register_notifier, + &data->irq_nb); + if (ret) { + dev_err(dev, "Failed to add action to remove irq notif\n"); + goto clean; + } + + /* Register the notification for reporting to user */ + data->report_nb.notifier_call = report_to_user_notify; + ret = register_imx_secvio_sc_notifier(&data->report_nb); + if (ret) { + dev_err(dev, "Failed to register report notif handler\n"); + goto clean; + } + + ret = devm_add_action_or_reset(dev, if_unregister_imx_secvio_sc_notifier, + &data->report_nb); + if (ret) { + dev_err(dev, "Failed to add action to remove report notif\n"); + goto clean; + } + + /* Register misc device for IOCTL */ + data->miscdev.name = devm_kstrdup(dev, "secvio-sc", GFP_KERNEL); + data->miscdev.minor = MISC_DYNAMIC_MINOR; + data->miscdev.fops = &imx_secvio_sc_fops; + data->miscdev.parent = dev; + ret = misc_register(&data->miscdev); + if (ret) { + dev_err(dev, "failed to register misc device\n"); + return ret; + } + + ret = devm_add_action_or_reset(dev, if_misc_deregister, &data->miscdev); + if (ret) { + dev_err(dev, "Failed to add action to unregister miscdev\n"); + goto clean; + } + + imx_secvio_sc_dev = dev; + + /* Process current state of the secvio and tampers */ + imx_secvio_sc_check_state(dev); + + devres_remove_group(dev, NULL); + + return ret; + +clean: + devres_release_group(dev, NULL); + + return ret; +} + +static const struct of_device_id imx_secvio_sc_dt_ids[] = { + { .compatible = "fsl,imx-sc-secvio", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx_secvio_sc_dt_ids); + +static struct platform_driver imx_secvio_sc_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "imx-secvio-sc", + .of_match_table = imx_secvio_sc_dt_ids, + }, + .probe = imx_secvio_sc_probe, +}; +module_platform_driver(imx_secvio_sc_driver); + +MODULE_AUTHOR("Franck LENORMAND "); +MODULE_DESCRIPTION("NXP i.MX driver to handle SNVS secvio irq sent by SCFW"); +MODULE_LICENSE("GPL"); diff --git a/include/soc/imx/imx-secvio-sc.h b/include/soc/imx/imx-secvio-sc.h new file mode 100644 index 000000000000..d8c9208217fe --- /dev/null +++ b/include/soc/imx/imx-secvio-sc.h @@ -0,0 +1,216 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2019, 2024 NXP + */ + +#ifndef _MISC_IMX_SECVIO_SC_H_ +#define _MISC_IMX_SECVIO_SC_H_ + +#include +#include +#include + +/* Bitmask of the security violation status bit in the HPSVS register */ +#define HPSVS_LP_SEC_VIO_MASK BIT(31) +#define HPSVS_SW_LPSV_MASK BIT(15) +#define HPSVS_SW_FSV_MASK BIT(14) +#define HPSVS_SW_SV_MASK BIT(13) +#define HPSVS_SV5_MASK BIT(5) +#define HPSVS_SV4_MASK BIT(4) +#define HPSVS_SV3_MASK BIT(3) +#define HPSVS_SV2_MASK BIT(2) +#define HPSVS_SV1_MASK BIT(1) +#define HPSVS_SV0_MASK BIT(0) + +/* Bitmask of all security violation status bit in the HPSVS register */ +#define HPSVS_ALL_SV_MASK (HPSVS_LP_SEC_VIO_MASK | \ + HPSVS_SW_LPSV_MASK | \ + HPSVS_SW_FSV_MASK | \ + HPSVS_SW_SV_MASK | \ + HPSVS_SV5_MASK | \ + HPSVS_SV4_MASK | \ + HPSVS_SV3_MASK | \ + HPSVS_SV2_MASK | \ + HPSVS_SV1_MASK | \ + HPSVS_SV0_MASK) + +/* + * Bitmask of the security violation and tampers status bit in the LPS register + */ +#define LPS_ESVD_MASK BIT(16) +#define LPS_ET2D_MASK BIT(10) +#define LPS_ET1D_MASK BIT(9) +#define LPS_WMT2D_MASK BIT(8) +#define LPS_WMT1D_MASK BIT(7) +#define LPS_VTD_MASK BIT(6) +#define LPS_TTD_MASK BIT(5) +#define LPS_CTD_MASK BIT(4) +#define LPS_PGD_MASK BIT(3) +#define LPS_MCR_MASK BIT(2) +#define LPS_SRTCR_MASK BIT(1) +#define LPS_LPTA_MASK BIT(0) + +/* + * Bitmask of all security violation and tampers status bit in the LPS register + */ +#define LPS_ALL_TP_MASK (LPS_ESVD_MASK | \ + LPS_ET2D_MASK | \ + LPS_ET1D_MASK | \ + LPS_WMT2D_MASK | \ + LPS_WMT1D_MASK | \ + LPS_VTD_MASK | \ + LPS_TTD_MASK | \ + LPS_CTD_MASK | \ + LPS_PGD_MASK | \ + LPS_MCR_MASK | \ + LPS_SRTCR_MASK | \ + LPS_LPTA_MASK) + +/* + * Bitmask of the security violation and tampers status bit in the LPTDS + * register + */ +#define LPTDS_ET10D_MASK BIT(7) +#define LPTDS_ET9D_MASK BIT(6) +#define LPTDS_ET8D_MASK BIT(5) +#define LPTDS_ET7D_MASK BIT(4) +#define LPTDS_ET6D_MASK BIT(3) +#define LPTDS_ET5D_MASK BIT(2) +#define LPTDS_ET4D_MASK BIT(1) +#define LPTDS_ET3D_MASK BIT(0) + +/* + * Bitmask of all security violation and tampers status bit in the LPTDS + * register + */ +#define LPTDS_ALL_TP_MASK (LPTDS_ET10D_MASK | \ + LPTDS_ET9D_MASK | \ + LPTDS_ET8D_MASK | \ + LPTDS_ET7D_MASK | \ + LPTDS_ET6D_MASK | \ + LPTDS_ET5D_MASK | \ + LPTDS_ET4D_MASK | \ + LPTDS_ET3D_MASK) + +/* Access for sc_seco_secvio_config API */ +#define SECVIO_CONFIG_READ 0 +#define SECVIO_CONFIG_WRITE 1 + +/* Internal Structure */ +struct imx_secvio_sc_data { + struct device *dev; + + struct imx_sc_ipc *ipc_handle; + + struct notifier_block irq_nb; + struct notifier_block report_nb; + + struct nvmem_device *nvmem; + + struct miscdevice miscdev; + +#ifdef CONFIG_DEBUG_FS + struct dentry *dfs; +#endif + + u32 version; +}; + +/* Struct for notification */ +/** + * struct secvio_sc_notifier_info - Information about the status of the SNVS + * @hpsvs: status from register HPSVS + * @lps: status from register LPS + * @lptds: status from register LPTDS + */ +struct secvio_sc_notifier_info { + u32 hpsvs; + u32 lps; + u32 lptds; +}; + +/** + * register_imx_secvio_sc_notifier() - Register a notifier + * + * @nb: The notifier block structure + * + * Register a function to notify to the imx-secvio-sc module. The function + * will be notified when a check of the state of the SNVS happens: called by + * a user or triggered by an interruption form the SNVS. + * + * The struct secvio_sc_notifier_info is passed as data to the notifier. + * + * Return: 0 in case of success + */ +int register_imx_secvio_sc_notifier(struct notifier_block *nb); + +/** + * unregister_imx_secvio_sc_notifier() - Unregister a notifier + * + * @nb: The notifier block structure + * + * Return: 0 in case of success + */ +int unregister_imx_secvio_sc_notifier(struct notifier_block *nb); + +/** + * imx_secvio_sc_get_state() - Get the state of the SNVS + * + * @dev: Pointer to the struct device of secvio + * @info: The structure containing the state of the SNVS + * + * Return: 0 in case of success + */ +int imx_secvio_sc_get_state(struct device *dev, struct secvio_sc_notifier_info *info); + +/** + * imx_secvio_sc_check_state() - Check the state of the SNVS + * + * If a security violation or a tamper is detected, the list of notifier + * (registered using register_imx_secvio_sc_notifier() ) will be called + * + * @dev: Pointer to the struct device of secvio + * + * Return: 0 in case of success + */ +int imx_secvio_sc_check_state(struct device *dev); + +/** + * imx_secvio_sc_clear_state() - Clear the state of the SNVS + * + * @dev: Pointer to the struct device of secvio + * @hpsvs: Value to write to HPSVS register + * @lps: Value to write to LPS register + * @lptds: Value to write to LPTDSregister + * + * The function will write the value provided to the corresponding register + * which will clear the status of the bits set. + * + * Return: 0 in case of success + */ +int imx_secvio_sc_clear_state(struct device *dev, u32 hpsvs, u32 lps, u32 lptds); + +/* Commands of the ioctl interface */ +enum ioctl_cmd_t { + GET_STATE, + CHECK_STATE, + CLEAR_STATE, +}; + +/* Definition for the ioctl interface */ +#define IMX_SECVIO_SC_GET_STATE _IOR('S', GET_STATE, \ + struct secvio_sc_notifier_info) +#define IMX_SECVIO_SC_CHECK_STATE _IO('S', CHECK_STATE) +#define IMX_SECVIO_SC_CLEAR_STATE _IOW('S', CLEAR_STATE, \ + struct secvio_sc_notifier_info) + +#ifdef CONFIG_DEBUG_FS +int imx_secvio_sc_debugfs(struct device *dev); +#else +static inline +int imx_secvio_sc_debugfs(struct device *dev) +{ + return 0; +} +#endif /* CONFIG_DEBUG_FS */ +#endif /* _MISC_IMX_SECVIO_SC_H_ */ From patchwork Wed May 1 05:32:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vabhav Sharma X-Patchwork-Id: 13650245 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 952B9C10F1A for ; Wed, 1 May 2024 05:33:42 +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=YpzKkY6vUoYnkRgFR54OQVmoyoDZ4UCyZu7+OX9UZck=; b=Ahh4OGCY9zP59x dpKUnCOb5QGRDASnDBOaA8i2Jkz67SWgQW2sZd2HgQ9WmjTV22foAuVQXKeil5hqvjY0mFmXMZ7MA VDDDe0fjsdEVDqJ/0sM4jZFmBrrbLW5kmk0LqcM45kuDgz0E0F0N3JuwFR/zLoDkHH6tIisHyGPJl c2SlZWpmIHO0rjEIOHUo7B/NDbbmdBjGA0Z1YaAl823QlZWZdByXfEhYoYS+i4gC7U8jssDJ4vR5W b/UsIYPTqcd+ug/Sh9ZNosvZ0rM7t0i/LYONPysyMwzWCXcLz788jnjgB2WKI/NyYbTurBMgoJ1H/ B/tYWQCVbIzqggb8/0Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22ap-00000008cbu-06rW; Wed, 01 May 2024 05:33:23 +0000 Received: from mail-db3eur04on062e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::62e] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s22aM-00000008cUF-3CxQ for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 05:32:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0dKCf0gzSt2y5LTDkJGRKXUBAAbj9zEpDQq6sRXMQnAQaQBTNyB/NcusZ694vysCezHpbkGuPilEsL98Ug65f7+kjgT73YdE6qX7cPDoQSCaJkvXUCJO9cDqjarm3rbWEo2gRcn80GERkI1t7k/QU+Rejh/5ghyCRbew8ippNWo+4jADcYUYBVDzzQxLdcnLn0fVLGQPDD0+FwWpdKPijZrG/DqWcEnxsHQ4sbJ59IkiOBnP2aE8ubv0DMRPoKhsilrn+iHbHA7YTC61b+hohH9iMacq6+G1998qgQ7Fxcl0g4erEI7ac1wE9ZW7vpxx8qHb4vPhPbZZDzBj9rHjQ== 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=eZgGzP0D+SRYaz7uBC0SPJ/jBax6W3d2k+CgRnb4yB8=; b=ANKgAY1+dmTNVvwa7uGgaWJNo3jn2M9wfOzPoPiqRKfVYNo9SrSpkj+1Z+sbTOK1AVy+NcRn17o3pgwXGtzLw46hm/IH/FvJl7bNkH5qTso+1r7apph907xmeguyPvwXw/he+VO0g8vqvqr96mfcJATFcjQ7mPHBirnMslHY9+KgNN4YihdCropWUsHwjGCjuNd13kfIAs4XjbsvBrlJqrGxtSEVIOUpMMSYvV7x/8Dm3WsQ1p2riiBv7p+xZw8KNvhbLBMTNXfQDC1QddhD9HvBmX28N6s+Ofrg56cXmKWqt1knP7X78JW+8v4ki6J7ZA6zM4ZNvcUTGfaiBbAO0A== 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=eZgGzP0D+SRYaz7uBC0SPJ/jBax6W3d2k+CgRnb4yB8=; b=e1qVXIhWpk2U7YfkD9tFKUxvJRO38Tc8uutxOdXaAziaZBq+q65Ub/Oj7ZgSeCf2i/zIEJfgXOJlfVufQ7mJYrqOqPgBZej1cm4mMHpOVOWTyTnTdNrg62pDGRyhBETvCzAqTM3j9Rur7cg2+PrHLTym2sYfLkEeOVzZ1XAD6T8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) by GVXPR04MB10071.eurprd04.prod.outlook.com (2603:10a6:150:11a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 05:32:48 +0000 Received: from DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab]) by DB9PR04MB9354.eurprd04.prod.outlook.com ([fe80::3cd3:1ff0:8bae:a7ab%3]) with mapi id 15.20.7519.031; Wed, 1 May 2024 05:32:48 +0000 From: Vabhav Sharma To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Pengutronix Kernel Team , Fabio Estevam , linux-imx@nxp.com, Ulf Hansson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Guo , Sascha Hauer , Iuliana Prodan Cc: Silvano Di Ninno , Varun Sethi , Pankaj Gupta , Peng Fan , Dong Aisheng , frank.li@nxp.com, daniel.baluta@nxp.com, Vabhav Sharma , Franck LENORMAND Subject: [PATCH 4/4] arm64: dts: imx8q: Add node for Security Violation Date: Wed, 1 May 2024 07:32:05 +0200 Message-Id: <20240501053205.1737248-5-vabhav.sharma@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240501053205.1737248-1-vabhav.sharma@nxp.com> References: <20240501053205.1737248-1-vabhav.sharma@nxp.com> X-ClientProxiedBy: AS4P189CA0029.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::20) To DB9PR04MB9354.eurprd04.prod.outlook.com (2603:10a6:10:36c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9354:EE_|GVXPR04MB10071:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d89033b-58fe-4050-35cd-08dc69a022cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|7416005|376005|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: tq/4kKHzI371tQ6zfVdv6IysBm38GFUgLVyU2MOYYpP9wFaDKco7JDi8VE4X9iWVfm3IWTNj14o8xoBil1MS/hujTDdNRZyi4vuG+BUduQEp7xYcA6Q6sJ070n9TunLLYcL7v1bFZsLHxFqiyszaFzgAgHIlR+jiOOxZU5/J3RP0HAEZ68Y/+jEoTG8MM3OUX2NCIWKYOPE/xlhn7dhtUOh8n8Y26AQTANLgR9viS6UHhKGSJC7/+nqUQIUmZsAA7L+/K1iVNwxiR0x/GWu5UUZkaOEfrBoHUJB8inbDEDZdQmaFGowZdCtcSJViG2iMC9vkQuZIDxNg6YSTPEahkDIdGMZ0+L6eXqMGCmhjOzrq/CGVLSox7NPKkvIiQWE22PBFGGb88chhACVZvszZw/Ke93T+GmkmBavXRsPJ6ZMq2fadu8M/iznTijvUvjTc/d4zeR8HNMWrqvjcn7XC7S/8GD6yieXXq219Ouhgl5RjNEqJmV0JhBKOlCofJAi3T771OhEZEl4NByoIT9vO1HWuXAdbMGw3PcKtdwGA+POHvpWitH7ZSO0HoT+yhe4w/NiMMX4I+s8U359OhDI6LXo//0g3mNUgTPT6AuahMQwBQJJ3KzqD+yDOtCTzd7EV0jrro62EMNupYAJaMgn4atZ/ZgbO6wG+p70eI9BTmCca40dXJN38Ag8qnfOV6SuJtLQ8xmEs6IC7ZG+Typi83Q8/Ytx40X+heyGYtiMws3g/VNMLA4vKYtiH9C7E1a0Lq2B8xsEhk0/e88UL/oACMRwPKBZ0lLeSPC8yWFPiz6iCZSuid1FncAeYHtCt7PdKi64rSaW847i2KfAf7TlcRRqAE35lX7F6bkQAEP/XGeHhgMNN5zMDauA/Fh+vPL7h4x2yT0IhS+nozrIwgcnmmmarzeokjohFi3tU9GvHjvAJT1KeeOymlf4V5tJOCzXju88/E+h5o/88r2gH3HBJP1HCS9vfXMTHnAPJKNyqRR/gAuirozrC7KTL8DMomKczUrWskEAcLmNGyAEljD0qujEtkzk/iHrnCMtUJczDaJ17DYy1DxrgQOiBIYyjpA/RkUVmF9VbdneSVxsmmxp2c/MWzPh1vNITKiIkySq61AZvFr1sogOVUbU2MICBfEe2aGO74eKY4y1uZu/Lkjiqs6wTNxJriL9WhTwra6G5gxHNAdXEqkhFFHLIfRHYM20Nr3JhTJRsjQNXeAshkPomjZSPW+SaaphnHwEqaZ7urTQOi4Ix1fTT/TxPLLH8LoOmGu+UQMkbUWriVIrwIOOtzOvs+Z0wqs1hUrJxLoFwPXBDknjtP0HEBWTXHyzJTjfiub3yKf2lpzzUeY4I3Shhcw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9354.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(7416005)(376005)(52116005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I0/QsTrmOE0ITnht8NQDkexW7pcfCrHTbZTQ7aCGvAK1GRwm+4y1WejsRisDcO8I2P6Ee3nn4gskeww8Mau9Yg0yLyZbYxO0uMx4arQQzPeNGu6H2q3rRzHZ7+aUcQI4LWxepjbN3/oJBpmbt16DRRYRpGEr/ZKlF65Kv3rqJu+V5rUaQXfzubFHpWzf2r/CHLhYty7ip5K7uS2N9eab8mbokTXO2hHjRzbHMGzlw1eQe3AVaFkOwbPxPp6d9eDxcyW5W1CbPjJs3xz8ggMlj21f70lP0Rvw3UZaF1paH74p3VyvOhbAc4zAnSQ27uAs/jfYpPfm22VrPswdUl1HU24ECpfpVPlu+lffaCWNWvzuIrMmWnJSynbNR4wwaOUBR+pt7mBuQduROy1IKGs3UwKQKEIVjzUGAqyHO/saDXMKuofg6lbNUx885Y4k4FwD2IhVugEyss0fqkm6+O+wwCfQ4hVFZx3RPbjsmSo9sVtUwJWBUAdtJPVzTYF8Mg1hEk/r6JXr2bNAHIrweJR1LkBe9pdGwbtclHudSdKWkMyJ90Cr+3PtEJmZhjaFz/xbwqd+oILmuC0UbsgoWh99yFVFPYeZrKcszHEHGALRwPfV5zdU5ScP0vE4+5GsIkBNqJ4K2zblzfHEVT1yjZndoArXgDApYCOJo9pw+K2QLAdsSTJVjU5J+r+ryou/3lGxyyRhLrYAwoZY/On2yYJXju/OefAMNtZpziIxg0xl8Cut8NHUUlwrsLsXLiLS3TRc3nqcmt9YUjq0h9wnza7EANjBW/7cMdQ+MB2G/3B4bosQUqEYLQ/rIWkYosxI28MJIhxZ27b1cmI4ah1A+xEia/94OYZnT4HvmFzXrjKrYItH4s90adOL3Qwp9ysXaF75uv4YQLUpZrOSj9ny5Hl6To0w9tqgbCws3Ivhh0w4io6Vgn/9fO7RfIpOYse1pNgWJ4T82dcwGTI3/q4omphebTYQw5wHWyS+BGLWBDXpsGuawZXumnzMN9/inbEJwA2ro0sbIP0OHLukvg1t8kB1IsG1LJ+h7fbWh29L7osiROPxcn6umAvlAYLalYo+G2FY+2zpXb/PzweyRt5itYAXYgTbHwpwbR28wEUbxCK5MB8/GDj/+Gzej0M7oGU5ikCKA+/tCOeJFpTxFPVvPx5pt6KuIA+TPYkAyGY47Dn6bc/yX/bt8IuQ/yn4fa1KLlQamn8f2wCuGwuGi+bmQf2byUq3Jte7IMelmjljYs5tJ2mDAKdPPJbVw6ylr4eKnUINC8VW9RSBCkjtd2ADt0EDQkXb6DDqI1IMuud0iVZNT/Gv6BXLGbQVWHvE566tZTeowSwBXosyx+/GTw+/n51v5ZVKU1X08PtUirOxtsZ8mw8iyWg7/Ot4syVncmFMmnWa0p4910gyDYgDQrFiEHCQrYMvQRIR+ZmoePG+FNDbFTgx/T74dv7mxh6iaj0aQ52QeMr22vvmie4r00tXcSkdLhf8Xd/AIbgcgG6weVo2s8fMalq+IiM2vUU42LLpogTyZYqcCigNC3Z9+fKrALJbGr8XD9OLo68ChUCI2J6TMED1dSuQ7XHwqxFWVw+5OA2y X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d89033b-58fe-4050-35cd-08dc69a022cb X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9354.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 05:32:48.0908 (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: psCwuK2qpk8hIfKHRE/o7dgM4/n1cDI9Jst5C1KXEpv+2kzcBvyXK3gJaBo7AgZw5rtZuIhJ6sduPOlgE3ArqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10071 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_223254_828460_091A66D9 X-CRM114-Status: GOOD ( 11.33 ) 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 Add secvio node definition for imx8qxp. Signed-off-by: Franck LENORMAND Signed-off-by: Vabhav Sharma --- arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi index 958267b33340..5cd9701d47b9 100644 --- a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi @@ -241,6 +241,11 @@ rtc: rtc { compatible = "fsl,imx8qxp-sc-rtc"; }; + secvio: secvio { + compatible = "fsl,imx-sc-secvio"; + nvmem = <&ocotp>; + }; + watchdog { compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt"; timeout-sec = <60>;