From patchwork Thu Dec 5 04:56:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vabhav Sharma X-Patchwork-Id: 13894700 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2045.outbound.protection.outlook.com [40.107.103.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE166191F60 for ; Thu, 5 Dec 2024 04:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733374623; cv=fail; b=iaK+8lpzhjOyBAP2Bd6CjsBpdOn+vrwCoWmkzQYYe7ByLOpxXV4fBD79MtZLo9qszDvbMn7wz5Mnn6ttIayaqladvqqY/8EqFHWIYK84bNE6YwQr7oau200qYUVAAb4gNI3QhLOP6x9jCMaM90wnyvvxVe1ynf/jIKoOw3Pp5xw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733374623; c=relaxed/simple; bh=Ez54fTGxK0UJvEeE0KUM0ZXtC/kA23RXzKM+yGCtlJ8=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=JmF8tOlFqCVbAiY+io7R9+Mt3uxXe80F4lKChbCKVmyvmGUkqBudo9fExuaAv7QH7hbF/tf7iTTGGIqOMM2A5tftiCdrjlPYiAnZIRo1zOCtVare+5tS8jpjIkddavXawP5eihFJht60+FSvzP2dWNAWUjQGPU/jX9WgNeEr6qA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Swo701cX; arc=fail smtp.client-ip=40.107.103.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Swo701cX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vXku5ux98dpg0LPF8sqpR4JrC2eSV0qx3tICfbwNGZrMmnOEOfwPeZehjktYQu3uTZCstgqLfgHCcMAUsd+BNvi6dTjb0ByW/O4KzAYCAwdIMWUq+SITGDp343zUxf2/w1cwS82oD1ynkJtXm3ijpH8M65VILF7CF7+wfVHbI1PYv45H/XFh7+c7JqSUTCpcMgC/LfMqxT3ZQUlJpGrXxOG8QP/0i7dmtoKfrIJQCcagvCOQYfs+RFPMdcSPPLU3R1wKtvrB18jwkPZkmWCWHVzQptSGxDCP1Y8ty6k5p668PWq7SwGme81mBehtt++23cpyClaSJ7Uzod2N2MtiBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=EmcP9hWTFku5uAfCWQR/HdQ8iAHQWY06a9BHnSJO438=; b=g/NY5UFgU+9mcjUR2I8+gN1NfMXW2R/+oSJolzbtU9vPInVYzIDczUKrUkxopEK849Jojz26bNpPQnAaGZQHR6iJdInbO2kL6mVw+PMJ/dAmNj0jthw8PKyqjw7zKOo6diZIjPyJ8LvcvK+T+ye/triaDckQwEN+AHQaMSKoOej2Vq6v4tGD8g+U11rTOEohRN5rPHVpb2/9Cl8s2RpSQOW2HJQJ1nAvSf3nvcUPHK5ZecfQlMpMczxFOBF24jHZZusSI/BNaoHbhE8JPWaJha/CZSeKZfX51O7tQTytYRzf2gagabrgtU4ALiy7e5v3vQF8cmGVqBf5j4xsMEbk/g== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EmcP9hWTFku5uAfCWQR/HdQ8iAHQWY06a9BHnSJO438=; b=Swo701cXH+9CPSRXuCu8OzpT3moqy+S5i+FHDJG8STkl9A1uzrV0/zAf5nSZmSjgyHyrVwez2cd4ChYy6EGFHaYbLKbaO2Mj8JsmvsFUI915GDrr8WxhfYdQY0+MJf2H1MebTDsdkMifO7y5pA9His0ogUT/HBbYUbGtUo2zOpfM0CAovM3056+McNcQ2PEHJOBzaGq3b4eyZUIEkwxM1Iy4X1w60s/BDdchcUKrEFtkWL7LESm11kz4g2nt7SWIEnEtaMBD+LV26tZ3/CGAPTHoRaTEVvba58wdl2O+nmdiX3n/zmip2X5QaR5NtD8xBu9UHdVm+NtQMuiQGZjx3A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS1PR04MB9358.eurprd04.prod.outlook.com (2603:10a6:20b:4dc::19) by DB8PR04MB6794.eurprd04.prod.outlook.com (2603:10a6:10:11b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Thu, 5 Dec 2024 04:56:54 +0000 Received: from AS1PR04MB9358.eurprd04.prod.outlook.com ([fe80::d74b:21b6:d315:cb84]) by AS1PR04MB9358.eurprd04.prod.outlook.com ([fe80::d74b:21b6:d315:cb84%5]) with mapi id 15.20.8230.010; Thu, 5 Dec 2024 04:56:53 +0000 From: Vabhav Sharma Subject: [PATCH v4 0/4] firmware: imx: secvio: Add secvio support Date: Thu, 05 Dec 2024 05:56:31 +0100 Message-Id: <20241205-secvio-v4-0-5c37cdc39573@nxp.com> X-B4-Tracking: v=1; b=H4sIAH8yUWcC/1WNSw6DIBBAr2JYFwMDRO2q92i6GHGsLPwEGmJjv HvRRNtmVm8y783CAnlHgV2zhXmKLrhxSKAvGbMdDk/irknMQIAWRpQ8kI1u5CXaFqFUaQxLx5O n1s176P5I3LnwGv1770a5bY+EFEaBMLksVAG65JJHrDuMeejQ93gb5im3Y8+2SoRfszqeR8kFr 0RbE9RIDcK/pE5JSlGckkoSIRStpMpSo7/Suq4fivIiQgkBAAA= To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dong Aisheng , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, frank.li@nxp.com, pankaj.gupta@nxp.com, daniel.baluta@nxp.com, silvano.dininno@nxp.com, V.Sethi@nxp.com, meenakshi.aggarwal@nxp.com, Vabhav Sharma , Franck LENORMAND , Iuliana Prodan , Horia Geanta X-Mailer: b4 0.13.0 X-ClientProxiedBy: AM9P192CA0022.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::27) To AS1PR04MB9358.eurprd04.prod.outlook.com (2603:10a6:20b:4dc::19) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS1PR04MB9358:EE_|DB8PR04MB6794:EE_ X-MS-Office365-Filtering-Correlation-Id: 0da9b2e6-d40c-476d-3978-08dd14e93c91 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|1800799024|7416014|376014|7053199007|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HBo1ND6IPEvvOE+lsTeOVV9xbt8A6vW?= =?utf-8?q?supHprc2+HoYcROKLkP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Gc84c8IKrRg1zQbO+H1M1Dno9C97vafJSFK/e1XfnjiOGC35pG+rX?= =?utf-8?q?SMemrb75vh+BBXfKgds94x7Jhcp20SFXiJ7hJDa+h8XpIr35wk5tdoDF4peP6x5Q2?= =?utf-8?q?ir8Tjskm0YXNAaTKH8M7Zz1OchjiGH9bwQ1KUaGAGZ58elCipVZlPLtEM0z8X6GT1?= =?utf-8?q?n+dKa+YY4O0w6WFzDDWMsdkd9rYnbWaDQ67jv9jCHkcLQgf5mmyYMA7FpOZUR6XF+?= =?utf-8?q?zOAr8S8945vzEFFyMha9I+9qgTZc4H3L2F/im7Y/ydv6FXGRi1ArGX3GQVrQJjJI6?= =?utf-8?q?BZNmRAMx4rgxOQc3WKq3xtFAlPD67mBxv02fBQYuu1+SYp0ifNF+j3uqiQX5UpG5i?= =?utf-8?q?USimO8Q7FlfRe0VWfS3IpuxrLEjP4GAA+9NgrbaycHIYk+UwOMzhu2Bq7CJOUSZ9x?= =?utf-8?q?mN3AJ0ZdTlZ8x0nzH8dim01x2hYwfmUmmw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS1PR04MB9358.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(1800799024)(7416014)(376014)(7053199007)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SBuCJvASYUX8+Dcvbn6dGW8O+Jqb?= =?utf-8?q?fOcf8CWDFXapi+ktrkMuyTRiXck1SxU3MUUdIzokAZkFX3lDnnWSg5SxJXK0+uvRj?= =?utf-8?q?TbiqX1Zqz9KpBvMUBr9YMvtWH/auK7Nk481ZyNSCghLArHaEZtg0asewrsv4HoTkS?= =?utf-8?q?U6n34OCBfJ1cM3I/6i0l+Cl+PoFypPdb27E/y1EoUWP8qikMdpUAhLYXqNE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cwr?= =?utf-8?q?HkobrPdIkn2FgFxMQ86gZYUVebCHe4wsYYZvCu2FGBLj+VED+M4O9tUSoKDNjrKyx?= =?utf-8?q?sHXbLvxjPE2CjiU7xLRaqMNsuIxKL8a3r282uuJ1vnQM7adgQdCKd9u434/bxh1So?= =?utf-8?q?VR4XvOEB2n/msFdcHIvB43NLHHFlkZKioE6EN9lmLYaMltkxEFujpvOV3UBnq/eWj?= =?utf-8?q?SjKXqX8xX20Kda60ZB5gXzr2CXwG2gWzNAgzbOyy8KrlXKeiKimzbk80AJoh0zYYC?= =?utf-8?q?EfhDWbqKDslQ9xzi+KuQ7IiDmvhKmb/s07nnHsmqOBDLl/fCeGmEPQVJETQeWAn2Y?= =?utf-8?q?aOW5AMXB6b5O+/Xrzr7on0F3HXF6ptJeGx+4irehUm0G/psTsrXHUIKb1XQI6JJnk?= =?utf-8?q?Y86r7OA76yUfh+MSvPiAzYR4rWuGhs8eFtDmiwG41lcnG4Pp/vq6wzxbPL2XxbSkp?= =?utf-8?q?iSkO3jD4DQCZ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0da9b2e6-d40c-476d-3978-08dd14e93c91 X-MS-Exchange-CrossTenant-AuthSource: AS1PR04MB9358.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2024 04:56:53.4245 (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: P+sGHOpZhu06etiOGti0d/EXqvlVbvAgIAM7YzVwpsHHM7YNZI2wt1nIU0cqhFc3/Tz8ZWW5Olu5SI7I74TC6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6794 The tampers are security feature available on i.MX products and managed by SNVS block.The tamper goal is to detect the variation of hardware or physical parameters, which can indicate an attack. The SNVS, which provides secure non-volatile storage, allows to detect some hardware attacks against the SoC.They are connected to the security-violation ports, which send an alert when an out-of-range value is detected. This detection is done by: -Analog tampers: measure analogic values - External clock frequency. - Temperature. - Voltage. - Digital tampers: - External tamper - Other detectors: - Secure real-time counter rollover tamper. - Monotonic counter rollover tamper. - Power supply glitch tamper. The on-chip sensors for voltage, temperature, and clock frequency indicate if tamper scenarios may be present. These sensors generate an out-of-range signal that causes a security violation to clear the authentication and storage keys and to block access to sensitive information. Add linux module secvio driver to handle security violation interrupt. The "imx-secvio-sc" module is designed to report security violations and tamper triggering to the user. The functionalities of the module are accessible via the "debugfs" kernel.The folder containing the interface files for the module is "/secvio/". Get status Reading from the "info" file will return the status of security: - Fuse related to security tampers. - SNVS readable registers. - DGO registers. To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Dong Aisheng To: Shawn Guo To: Sascha Hauer To: Pengutronix Kernel Team To: Fabio Estevam Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: imx@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org Cc: frank.li@nxp.com Cc: pankaj.gupta@nxp.com Cc: daniel.baluta@nxp.com Cc: silvano.dininno@nxp.com Cc: V.Sethi@nxp.com Cc: meenakshi.aggarwal@nxp.com Signed-off-by: Vabhav Sharma Changes in v4: - Modify description of NVMEM controller handle to be used by snvs driver. - Modify the type of argument1 in copy_to_user() in imx_secvio_sc_ioctl(). - Modified the type of argument 2 in copy_from_user() in imx_secvio_sc_ioctl(). - Modified the type of variable as static for structure device, platform_device. - Export the API imx_scu_secvio_init() to be used in SCU probe imx_scu_probe(). - Link to v3: https://lore.kernel.org/r/20241107-secvio-v3-0-ea27f1e9ced4@nxp.com Changes in v3: - Dropped [PATCH 1/4] dt-bindings: firmware: secvio: Add device tree bindings. - Reuse SCU node to prove secvio driver asynchronously. - Dropped [PATCH 4/4] arm64: dts: imx8q: Add node for Security Violation. - Removed explicit secvio sub-node within SCU node. - Create seperate secvio platform devices. - secvio driver probe asynchronously. - SCU driver keep going and finish the probe first. - added new function imx_scu_secvio_init() called within imx_scu_probe() - Link to v2: https://lore.kernel.org/r/20240509-secvio-v1-0-90fbe2baeda2@nxp.com Changes in v2: - used b4 to add the devicetree list. - Added all necessary to/cc list. - Link to v1: https://lore.kernel.org/r/20240501053205.1737248-1-vabhav.sharma@nxp.com --- Vabhav Sharma (4): dt-bindings: firmware: imx: add nvmem phandle arm64: dts: imx8qxp: add node for nvmem property firmware: imx: Add SC APIs required for secvio module firmware: imx: secvio: Add support for SNVS secvio and tamper via SCFW .../devicetree/bindings/firmware/fsl,scu.yaml | 3 + arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 1 + drivers/firmware/imx/Kconfig | 11 + drivers/firmware/imx/Makefile | 4 +- drivers/firmware/imx/imx-scu-secvio-debugfs.c | 274 +++++++++ drivers/firmware/imx/imx-scu-secvio.c | 619 +++++++++++++++++++++ drivers/firmware/imx/imx-scu.c | 8 +- drivers/firmware/imx/seco.c | 216 +++++++ include/linux/firmware/imx/ipc.h | 1 + include/linux/firmware/imx/sci.h | 9 + include/linux/firmware/imx/svc/imx-secvio-sc.h | 216 +++++++ include/linux/firmware/imx/svc/seco.h | 69 +++ 12 files changed, 1429 insertions(+), 2 deletions(-) --- base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc change-id: 20240508-secvio-8acfa2838385 Best regards,