From patchwork Thu Aug 22 13:48:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13773453 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2068.outbound.protection.outlook.com [40.107.241.68]) (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 E8AD31E50B for ; Thu, 22 Aug 2024 13:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334019; cv=fail; b=YqQYFc9tQkoYestqI5UXWIDLA3bQX2BA+tq8dimtHNa0IeqMK6fUjTwkqP8L7dj/YYlMw+N+NeZjhM1CqqrqIvEUZHnLwkp525qKu59Y9ft610V2M2Fw30W0esWjJ21Kq3XNOhpF6LEe/GnnGC/4JxDZ8PN50+K/XrbUHGXn55s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334019; c=relaxed/simple; bh=2c1Tdc//SpqRuEFleWpbSpnpm5Zz5h3NxNQRqCJkfMc=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=fZXav5VGv3FJlI2YFj+/5Roe1aYBLSqMqcyweLC+qPJjLKIjBy080G/MUpXHsZqtVYIGFfMFBYF7WPqbJOih5odM1UlwRjfh5xg9H5vly9AWSo4qnzoBOadYcrxs8ooJU+gaK4R1wffuP1KJqdp83iFI2B5mmfvYEDIdf/CCU5w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=sOKQFoTl; arc=fail smtp.client-ip=40.107.241.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="sOKQFoTl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HtTIw7I1Y2zi/9EzxBwOKLsjRdAWemJhybCf+011kj4UCHHh7XRBh2L3gdCs2NjVt/YLFiYlMMjuS7+MDhxznGGSWlFMBJ44anNVDidpWadNwaBThhKxCYN5NlPg9t/5jhsTPtOuEL1amW5ySS1KZ3XPW2qLESJJ7SMZzhPYoKvRAiCHh1D4fQm5W+ydIwN/+J7Y77xh7csg4PEw+uRpC8oaDL5GkH2omQLLV5wQespsS12QTuo9CxD4KUUMtLUFV3UsX0UCBa1yi9p0i9bJEMfWZnZO3iKGKkxJ4njP2Of3pLXPfB5jfsrY6dEe/J0iJmh7eqFT6VRvcGxXJRc+7g== 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=68G/TYAvloXvSBmmvY0rM6I9gK4aRAneNSnIBDgZFZw=; b=Q0b3DRCFUXAwPw7+swTMWcKWNnkvzboyUwqi8C8MuMergxCnDTsylqpQzQxPS5h84p+YTrgaA4AeQwbZwU4jWJaKHtfVUozktldQ4KC8XuFLdodyNDQfsmgw7aRQSr1aMB1o1agJ5C2ncJRMWynxl3AkdDUzKnTgKyF5SHwyzC7tYBzjOgOtjTEIYK9mKGtNkM1kZwPpTuNf6udAX2GiLsypbGT3eKfKkdIkSdMc+pcibvrzG8dVZvrmRpTjBEFdBC+7Z1SVGreXLDKlFSlIgj3O9qQJ88VD7Q6Mg+Gg7arIs8JCFla5DMtsQr8E2+NE7bmNbQYfj5NL3urzlfyW6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=68G/TYAvloXvSBmmvY0rM6I9gK4aRAneNSnIBDgZFZw=; b=sOKQFoTl2Z469vDDKPsoUY6aFy1q0ufou+3WjV6ZfYHORzLngEEZzc6R7xrARDXmZCzTQIUmwgv+Zmx0/ACLqXxeIVvdO/8id60WcwWW0p/VfAXLai8KqSZz66VEbOElVPsAQwhpQOPnN136VFaMF21/mmWnbfrnVsC4xJxnDzuw3OpAEwUvOlEMyFInJMiQj81hJKOQiKPxI6+vEFgZ4EYzTdK9J/+X5cUc4mMHFhPljGYcUR2ZyFJ9Q6qeeGLs/cVrAtzo87c4WyAb+/TObgsi3K9/IfGKFSxQ7/BEZ2y2XGc67nq1ui5Y5cr+eqFvA1NiBwGcyeyH5C0GGAluLA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by GV1PR04MB10126.eurprd04.prod.outlook.com (2603:10a6:150:1a5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 22 Aug 2024 13:40:12 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 13:40:12 +0000 From: "Peng Fan (OSS)" Subject: [PATCH v3 0/2] remoteproc: imx_rproc: support non-blocking tx for i.MX7ULP Date: Thu, 22 Aug 2024 21:48:48 +0800 Message-Id: <20240822-imx_rproc-v3-0-6d943723945d@nxp.com> X-B4-Tracking: v=1; b=H4sIAMBBx2YC/3WNzQ6DIBAGX8VwlgYWEe2p79E0DfJTOSgGGmJjf Peih9ZDe5zNN7MLiiY4E9G5WFAwyUXnxwysLJDq5fgw2OnMCAhURFDAbpjvYQpeYeCWyU5wpni D8n4Kxrp5b11vmXsXnz689nSi2/VXJVFMsOiUrQUDzaC5jPN0Un5AWyPB0WuPHmSPEk2gbpQwH f14ZfF3r3TDq1ZKZqn9/lnX9Q37lb8RCAEAAA== To: Bjorn Andersson , Mathieu Poirier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Daniel Baluta , Iuliana Prodan , Marek Vasut Cc: linux-remoteproc@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724334552; l=2424; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=2c1Tdc//SpqRuEFleWpbSpnpm5Zz5h3NxNQRqCJkfMc=; b=RECIKpxkaiyiLPh1jNd4VamzfqMnSWfeIbSmhmOwHPwi3zouVMjjekty40Yik2NVhNpbf8Fox IPhfB3QkigBB2eM86yqsLzrUTzR/7SsUyOSe+kyOEMWUPT9TyCaN0Sp X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:54::15) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|GV1PR04MB10126:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f53540a-e52b-4970-fe48-08dcc2aff278 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|1800799024|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NZvwZQW8lNh4o3rNQWsAesAwq8aVqFK?= =?utf-8?q?AG2RnkQAshKNwZOdsnSUXkT1/rco3a7y1OzTx672PHfCcR2Jrsm534vRSKKfYdG+s?= =?utf-8?q?XxbC4guQHfpIeFZHt+ARMVYi7jrAuCTTACnsfKptAnEGKxyD8fFwagxfExHi5RO1U?= =?utf-8?q?QxU6pOnZDh/tYKeAbmuklI2RGw7RUduTAd2+lc2RLyPPcGxYY7fO584Tntqv4+Taa?= =?utf-8?q?rxd7HV/ZKKA+g5CNU2r8knBw9Iz1Y+pzkLotFVnmQ4OfIL57H6EHqd+Dg68f5+kfm?= =?utf-8?q?kv/R+5ur0/FHwIB4S5jVRMba706u+N02dg9LbxnXNoYTlrWDpO/8pl8WApCxoTBKL?= =?utf-8?q?7MOXvZU7BRsTAYyBOMcgrgUaWy+9+wUd2HBDG0V8JYlLP0J/Lokmdntzdv3ZG4JYZ?= =?utf-8?q?qaqhzNxlCVAfacqNYQzUd1W84svA3KRXPTYW4RmZKraw/U3MI6kLAoBofsoqZ8MdH?= =?utf-8?q?cUJVMCzND3gLb0FO1YBdVdsL+zIYWwSsouEuQmcjP3emToimp7MV+QDyIG3Y3LCDh?= =?utf-8?q?d+Kqkp4bT7MYZz2uRHeh2kSy4IuQuXpE20Yz6qWMzbhbia6pLv3FTaRka1cvld3vI?= =?utf-8?q?U67Md70m4gLXYt6O4CH5+F0Ps0Q58R8K7vMoKxxOuF6eOtTWtSzKtZqa0F+Ks+TV5?= =?utf-8?q?UHiZNOUPvuxv/J/Z5VPhoB7CcegNQD4zLfBCdv4YwNqKQKbLaMnxAat44e93Xw/oP?= =?utf-8?q?LnhXUt4nW3c1LD49NA8AN1Ei9Gl4zx8uly2HdViLcfXYHwujsirJxonG3HRT5lrNo?= =?utf-8?q?cyfpo8eDPsakrPNxC+r9bvK78IjIDmt/tgwBUGwtxHtN6GZOtg3FKil8z35q4KmvG?= =?utf-8?q?0+Kh+ZG3+K8yAhixCwyYgfajo1KEycggVC/3arTAVTPIeBvJrCepzgBEcSU8m1VTR?= =?utf-8?q?AYFMYXR72bN7tMUUuQp8J8toUWe4ZTzauyoRZYxLeQE3IGDtX78bhzX1DtvXcBH+h?= =?utf-8?q?JAz1EVwMpJWFde4bVWzy/87VDy5T+I/XgYsPKZyGtMoVieZXKquyh7r0bt7lo/B26?= =?utf-8?q?LEATCe4zpe+CdT2NaGJpHg8u0a11TCsH1oOckr1/HlC/AJNjABiQcG5Ukya1DR/F6?= =?utf-8?q?oM/6vVxvS6zO4jMQjcLa5Nw4Gn/njDdxDCs22H5hEKcu2CdtZrh3HU2ZRmyUvqlOm?= =?utf-8?q?ms1vRzDfTARmodptO8yBI72TJHc+mZG9m/3/Zj4IozW84UJBq8V0/hHaqdser10SP?= =?utf-8?q?BFxmdvtHH8IMwuOQAHQSwze31VTr9Ok6ZzMBRkwHQghbjm1bNOp8UniyrRHdHQ+82?= =?utf-8?q?B9gs1F2/jrws1yj7elS2qUc49QlaZY6J5r62iMqf7GNici5Lp8sUGLdcKdfon00KH?= =?utf-8?q?r4t+qmYdKGDu2mPhZt/m6mEuxfCQI2qDZkIW0xCQn9AnNF2jOjZzzU4=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?e839XdCsD3Jn4OC1PtUe8Y3HIydt?= =?utf-8?q?mj2M5mCcTvJohxGd+bO8/VZZZHpYQmFP62hLNSiJYpIreruOJLfIr4xnrVymzMHoc?= =?utf-8?q?CBrxU3SAeq6+Smubfk6F/JkyUK3ehSzgEilsPc3woBbepKIFBzd0Y5RAyvHN1V7yl?= =?utf-8?q?6eaMcZ/PK2zZRGaaqpcHjhKucf1Yb66ltPUOpaqEiApNcErpHJBimoRpQH8eWS485?= =?utf-8?q?sBiwAJuumsmDK575m0Qlb10cOLx6yxzNqHzTPVuSdAsgMOGQRPmROPQiupo6vQftd?= =?utf-8?q?bXIFNAsuqKp4PD2S41s1LneTpdRzUVs/nvX41xyadGs9IXMM+sfhj8xYD2rQa2uci?= =?utf-8?q?u7ydmbEklHm5LSdVksn4PGJs6ly1DXTxsCJrXUdojtu9st5waYMgIwMffpR7CJogC?= =?utf-8?q?zPSR6v0kKs9+y6hh926R1vRb21TRPybx+M3Uqv7go9TWsh4DLplYafp+ISmvkkJEj?= =?utf-8?q?ksTY4JTaHCJB+EX0V+aYxFvfLHo0bWKpHyw8B6dGo6/H+08s+c6OD7+tU7OL63d7A?= =?utf-8?q?tR2wYjlljjSLIhZ+fU1cLEmuoXgeU7+k3uUNhpTRsxWZFCbArdGKG8hL+79sEAbDp?= =?utf-8?q?brO26RP7wgZbwjCUUJqwW1atFc0f3g0usUONAp6aszty+SwZisy9c940f4kdv1DbE?= =?utf-8?q?o/QY/ey3U04D6DKKERIA6qwQrj8qz7B96vtBQ74nrRhnLwhUel+gc5Im+DnRSNjHn?= =?utf-8?q?Ivqrp5ltmkEoFfS1nEsiuxk44TTUFQufc27/+UjTRGBHy365xNl4kSAxGY037b2rE?= =?utf-8?q?hHfExOInJEFrk8zvGy7fSJFNHjnt+wq0LD/UPAKpBDrieUdshQFY9BuKYbm7u2syQ?= =?utf-8?q?s5Df1RgiDoPmLtkY20z44FSy/j1SxucLBeVsJl2cBFkyOZZq2ZJ3Gtd1t/5S/UbXv?= =?utf-8?q?Rehzk1ive2noC2LpdEIWeYKJPltcGzxqZ+qQr9K8Bl4sud7dBjZc5XPOzB7UXVbRI?= =?utf-8?q?VIuI3LVsFeaX8yk8LtIkeYOSbvUsVyGRJJhCaB48lUm4X44rqDpEqRvYFJC76cwV3?= =?utf-8?q?NDrQ/v028gTIXlh1V5j9MWVJ+pmqNDo0Vz/tUpjSEPP6OHIsP//2oiWoISTUDzQ/9?= =?utf-8?q?F17Bkt0XN40Mn1hz1h5I0tJ0RlbwtAJu+MaMM5c7cx2FF4ko0oUZygolTVng/bwXw?= =?utf-8?q?EiOohXH5dAIlbx/O+CwFDgBw9XJDGLEyLFLEN6o/AS5jZYaVjZXw2vBsXFK7gZEIV?= =?utf-8?q?12PJOSXFofgUluGBlNt6VXNaHJ19zntBCI4FznpueoWz/JgRgPKQGu3SuI36ZlF/Q?= =?utf-8?q?QP8j7qOsH837BC4chTBTAKuN8aL8SNLImCtJJXKsJ8womtxuKPoZ+vn1WZsfpHxqQ?= =?utf-8?q?cKiQZZX2WxwDR1Gx9DwG/dQi62XbdJWBUna5vhZvZ/aJbk0ZSAplgKjn1cgXf7SvZ?= =?utf-8?q?bCxRxYhtS/rXOotAbRcnubtMx5VoSyS4nhhLHT4O8YT9uFwNzQj7AV04+en+3AtzS?= =?utf-8?q?hOL/msjuj4ncZi5g7+vJHbj1zqwow0Nlle3hwlMsuhTCcGuqXqdWNaJ5epG6+co0O?= =?utf-8?q?f4gr4KJaDebX?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f53540a-e52b-4970-fe48-08dcc2aff278 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 13:40:12.4966 (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: cNZnH5OwDnhuamLLxOZqnBEtktPwSdKHEUR9QDxgBI8lTBYMERV1f0qSrTtR7iF7mRnt8wKnO5xPamLEfQAGEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10126 The i.MX7ULP Cortex-A7 is under control of Cortex-M4. The i.MX7ULP Linux poweroff and restart rely on rpmsg driver to send a message to Cortex-M4 firmware. Then Cortex-A7 could poweroff or restart by Cortex-M4 to configure the i.MX7ULP power controller properly. However the reboot and restart kernel common code use atomic notifier, see kernel/reboot.c: do_kernel_power_off, do_kernel_restart. Linux 'poweroff' cmd will trigger kernel 'do_kernel_power_off' Linux 'reboot' cmd will trigger kernel 'do_kernel_restart'. Power off and restart are totally different operations and are not complementary. So need to make sure the mailbox be changed to non-blocking mode in SYS_OFF_MODE_POWER_OFF_PREPARE and SYS_OFF_MODE_RESTART_PREPARE stage. Otherwise with blocking tx mailbox, there will be kernel dump, because of blocking mailbox will use wait_for_completion_timeout. In the poweroff or restart case, there is no need to wait, because after M4 got the message, M4 will put A7 to reboot or poweroff. patch 1 is to support non-blocking tx mailbox channel patch 2 is to switch to non-blocking tx for system poweroff or restart. Signed-off-by: Peng Fan --- Changes in v3: - patch 2: Introduce an flags entry for dcfg and set IMX_RPROC_NEED_SYSTEM_OFF for i.MX7ULP, drop used "struct sys_off_data data" and add comment(per Frank). Drop R-b of patch 2 because of this change. - Patch 1: commit log rewritten and R-b dropped. (Thanks to Daniel). - Update patch 2 commit log and cover-letter to clarify reboot and poweroff are different operations and not complementary (Thanks to Daniel). - Link to v2: https://lore.kernel.org/r/20240719-imx_rproc-v2-0-cd8549aa3f1f@nxp.com Changes in v2: - Separated patch 5,6 from v1 - Update commit patch 1 with adding "No functional changes" - Link to v1: https://lore.kernel.org/r/20240712-imx_rproc-v1-0-7bcf6732d328@nxp.com --- Peng Fan (2): remoteproc: imx_rproc: Allow setting of the mailbox transmit mode remoteproc: imx_rproc: Add support for poweroff and reboot drivers/remoteproc/imx_rproc.c | 54 +++++++++++++++++++++++++++++++++++++----- drivers/remoteproc/imx_rproc.h | 4 ++++ 2 files changed, 52 insertions(+), 6 deletions(-) --- base-commit: 33a32de2d79c051f27ed57c4ac90cdb406f91928 change-id: 20240712-imx_rproc-25f3ab753c58 Best regards,