From patchwork Fri Jul 19 08:49:03 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: 13737010 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011028.outbound.protection.outlook.com [52.101.65.28]) (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 2D09B7BAF7; Fri, 19 Jul 2024 08:40:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.28 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721378412; cv=fail; b=h6tGgtbNGfW1TyAojyENFlEOd784t/Czorsr1hiFb1tWmLi4g7k18HotAlYLa5b9WH5goQ50Bcsna3SoDjXkE8rUOuWXq1MkEQdbG67Tkp48PvXornLESIjuuEoThxm54zWTCYlHAQgDrL0o3pgDshpbgSZnL29yvjGsgWyu4HQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721378412; c=relaxed/simple; bh=KYyEfSPq7YTUfASdWBxFNDvg2GrfN4Fd23BsX7GvZFk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=uY6WBBvEtf92Yq1DZtELujuCCO9mN5SPo4lNefZ9pwdOBcBD+isnP568BSQNgmqzvwRcSuXiefQl4OMwKvOrFI8cq8Eu+ejnvF9TspUoqiSYYaWwBUxyj9iYkGxTBkpLbtURXK0iv4W9pW8ZgrglpNps0IYrYwkM1rcClIwBUoQ= 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 (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=RHZ5Y5J8; arc=fail smtp.client-ip=52.101.65.28 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 (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="RHZ5Y5J8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JytShI+csmUPQFmWxejCjcaGPdtYdTO2K37x0DwFJg3Ej3OhINk13ZD60AcnIyymwWkbB+kKSnJI/hITVoa2znPfwoCQs6HQzLKa7v3M3eakHwSbjbKNFGU4eCYWIBWELpql10/b6xIGnK9AnNxtroXFRUs6pAHIwJ0yr9idJLrUDpdWmk3Z4DMq2Y3WNmAzl2jz5sboDw3lM2v9TMsKPsyR2gvQL8cUXp7kP7MnFKAcPjH15Xu/t74dufZIm2L+IHP8LnKdtzi395psEiuyVCKma8agHUjzTKUNh/OK9A+S1BNIAiZ68NRer+i1d495nG/Db5rbUdx9em2ZHoKxaw== 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=Oi/KMaB6KbDIf9Uij0D+ag02a/o21x+A7FUICQWfbXM=; b=n0OE4kS+c71XrymmqX4df7aCQkGtD5wKKn6tbZJJGixZlsCMuBJVhORIXsGDELCuOejKsI1/jdh14/XwGf8QHm8P2ZwyVjEsyfxpQiJL22KxG8hEmzN0jOjAgaQC708zwiXY+TAqJmzWvgxg8tD8UOmas89o7SBSx8xJ3z7aGEvadV4576NfjPTeqJq74QYGA3bYRKtKkfDltaCvHUcsve/9GS3kOiERjMyDsELJ58sW1AJmvEKgJ0e5hDNPMcrnjOwg/nQAlGuAch0xRpNkDC7QSXeScfdp+tS+zf1pGcVU4xPuxgsJGZ6X3AoHHV82+7bv+HdE1Y60azIlItcAkg== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oi/KMaB6KbDIf9Uij0D+ag02a/o21x+A7FUICQWfbXM=; b=RHZ5Y5J8HGfqcV32cqgo+BdA2rOE++gaqQ+G2p3PcVF4UGsf9IqKZHmEPSt509zDSvARHwZ0RUt1zVIs6MPlEg/W+h9TcMai8EjhUpEzwki/q+w+LrSch+Zn1W8qJRN7+wJbC2SRHNkd+QWCs3WrGjCRUMPwJKAxrj2KxEEJUGw= 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 DB8PR04MB6812.eurprd04.prod.outlook.com (2603:10a6:10:f8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.18; Fri, 19 Jul 2024 08:40:07 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%4]) with mapi id 15.20.7762.020; Fri, 19 Jul 2024 08:40:07 +0000 From: "Peng Fan (OSS)" Date: Fri, 19 Jul 2024 16:49:03 +0800 Subject: [PATCH v2 1/2] remoteproc: imx_rproc: allow tx_block to be set Message-Id: <20240719-imx_rproc-v2-1-cd8549aa3f1f@nxp.com> References: <20240719-imx_rproc-v2-0-cd8549aa3f1f@nxp.com> In-Reply-To: <20240719-imx_rproc-v2-0-cd8549aa3f1f@nxp.com> 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.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1721378951; l=2299; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Co0X/fogF63BIl2CA2vyYF72Bd5h0JVH5Wy6/50cNts=; b=qkU82bWr+/4fpZIt+QZQGjAmRKZ+8WVVx+prEVydlbLyA9AKLK4ECcgmLJYo/qujPHWjvdbL/ yieUS7iGJagCSNrVOVLRregeykEHNvN94SLY+bhAl84UcUGM9lTlBoS X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR03CA0129.apcprd03.prod.outlook.com (2603:1096:4:91::33) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DB8PR04MB6812:EE_ X-MS-Office365-Filtering-Correlation-Id: 1be662f6-3944-4906-75ca-08dca7ce64a6 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|1800799024|7416014|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?sojac84sNSFz0W6Rp3/WnTk3Rn1x25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8?q?HHidZF75LqlOx1dNWsMflDjBns95cTt9FMV61o6z6hvJbcH7XJJb6vfxMQZONYgH3?= =?utf-8?q?LusjCnksvjNAOuC75icQFAdjxlX8n3YdotXGI44YCdaH0ZZqBqAnqBoUWoonqoT0e?= =?utf-8?q?HrBihfSUlBS3r7ZT8Utn3gHq1/a+k313OkmebouI0z1UrQxfK5n+izIte9tnlEmSy?= =?utf-8?q?20x0KBb1y6eWr+ED9StF4oDCwiWIYfaT1r56d0NAtJPnnTmSaAtTNu6Qr2lN9cxHO?= =?utf-8?q?lo90R1JCgLCgZjQzoPtz4Kslt10Fp/P36rzSut5leombzGSI35aAmJsZrJHG5i2hZ?= =?utf-8?q?T0tsmPPKpvBPSjSdXQigoS6KTdoAwK3HdTjdfs3gfWtUmotmDo1pd/rt7vTJF1Bzj?= =?utf-8?q?6NhtGu8Vj9s7EG7FxWBvhC0lcNBRm/wysZzwE7L9aODlsMv6YaPn+uKjF2ID60Xfw?= =?utf-8?q?L/21IPB92Bdvx51y3iVW5TVlYAwPDRtrFQ=3D=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)(1800799024)(7416014)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fasNs/h+bxNBbBbaO5N6B25BCrxM?= =?utf-8?q?58g/RBGTt/rYR6oZkkjNeDuD4JN8B07MXufgei07JwaaZ5UDueHU+bdSfRGUIs767?= =?utf-8?q?MfDr9TJtp/LYjeu036qenBTgxm/8U+14QOGRm4NPlvAjWv6K0UigGprckDJ02MiDF?= =?utf-8?q?99bqfpbhrEl97/Qnm1NHIYBXcizUWxXZ5JKWQA5Zd87SRwqCbfqPe+KEDbajAuTn8?= =?utf-8?q?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-8?q?uSV+LL1LUMuOhFx+fTg850LBHxUvVwFY2Ii+P4VVL2cGkCMMD2DVvzQupcRSXRTJV?= =?utf-8?q?HvpCuPY09mpmClFwP9pnM+gRAcdvBcXMRm8USdpKrptfDABNXGQdrar4n8CcY3rur?= =?utf-8?q?8Por4QReJgU1OWzc4CzmABC6cEs7l++zxjTRHe6K6Y8YKaSCoVgQAsT6ywQWXs9L/?= =?utf-8?q?qO2yUfFgJtp3K/b6YuV+8P0gnlNt8wLcOTgy9QfN53eeHL58B6zrMAM/S4Ybx5yyZ?= =?utf-8?q?E5R5JJ10BZo2FHmhT1EQT9iAU2KKfMOKLwyBuJ7Rz+WTePeIZqA1l4iMl3cSC7Pin?= =?utf-8?q?rB7NGQXlaD0b2JH8MyKftiaXRVrBxlbjHkG7ohGe7xGwOq0zydJYDuEINnx6BIk22?= =?utf-8?q?sTkCgq6afa9iaO9LflCpHIMDQRGglDrGgl1IsFQU/YDREKEwdLlrahy3hWhtDaxtB?= =?utf-8?q?4fr2QFwHvscM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1be662f6-3944-4906-75ca-08dca7ce64a6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 08:40:07.4522 (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: inxpjBsOjXRQw+c0RmYJh4WzYhSO00TcJGcLSSJEzFySRAON6dRklNGESfEYFmViPqADEwwOsfLZl5w33IOF/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6812 From: Peng Fan Current tx_block is set to true, but there is case that no need to wait response. Linux just needs to send data to remote processor, so let's allow tx_block could be set to false. No functional changes. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 552fccebf7e2..01cf1dfb2e87 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -90,7 +90,7 @@ struct imx_rproc_mem { #define ATT_CORE_MASK 0xffff #define ATT_CORE(I) BIT((I)) -static int imx_rproc_xtr_mbox_init(struct rproc *rproc); +static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block); static void imx_rproc_free_mbox(struct rproc *rproc); struct imx_rproc { @@ -369,7 +369,7 @@ static int imx_rproc_start(struct rproc *rproc) struct arm_smccc_res res; int ret; - ret = imx_rproc_xtr_mbox_init(rproc); + ret = imx_rproc_xtr_mbox_init(rproc, true); if (ret) return ret; @@ -629,7 +629,7 @@ static void imx_rproc_kick(struct rproc *rproc, int vqid) static int imx_rproc_attach(struct rproc *rproc) { - return imx_rproc_xtr_mbox_init(rproc); + return imx_rproc_xtr_mbox_init(rproc, true); } static int imx_rproc_detach(struct rproc *rproc) @@ -794,7 +794,7 @@ static void imx_rproc_rx_callback(struct mbox_client *cl, void *msg) queue_work(priv->workqueue, &priv->rproc_work); } -static int imx_rproc_xtr_mbox_init(struct rproc *rproc) +static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block) { struct imx_rproc *priv = rproc->priv; struct device *dev = priv->dev; @@ -817,7 +817,7 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc) cl = &priv->cl; cl->dev = dev; - cl->tx_block = true; + cl->tx_block = tx_block; cl->tx_tout = 100; cl->knows_txdone = false; cl->rx_callback = imx_rproc_rx_callback; @@ -1083,7 +1083,7 @@ static int imx_rproc_probe(struct platform_device *pdev) INIT_WORK(&priv->rproc_work, imx_rproc_vq_work); - ret = imx_rproc_xtr_mbox_init(rproc); + ret = imx_rproc_xtr_mbox_init(rproc, true); if (ret) goto err_put_wkq; From patchwork Fri Jul 19 08:49:04 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: 13737011 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011057.outbound.protection.outlook.com [52.101.65.57]) (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 60C298002A; Fri, 19 Jul 2024 08:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721378416; cv=fail; b=CWuiQE1wGmZX2HDvbxjzLoQLqDNTzEz3qrwOeVVVu8dDV7ToxLgm34z0oEvlqAQYuhATfSnJzJvUmB8DIYzqq+YiM1VIAZw/Oi4hKwAqj+HiowsjwFxa7sr4/A5o6BXnRe+FSb/msYMB2wWAwvz49+bcdQ6I+vKlIGYCgdypEiA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721378416; c=relaxed/simple; bh=rlUw6E9WN9JlbR6sIv2jpD4O1qh5dSmpbHeKOPorMg4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=bGzWZc1LHSgdDVhVHi/mMoroFrqmawHnB2B0xTfMDIJ2iSsagoOXDUb3qSNPa19AsaAaIMQEvZJUCdbN0TjIv+4RxM4Ip5OgIFZ0LNJblcQnq0ahJ6L/QJddFF3jAi6agqrCA6ob9/O4kGKEakQ576xVQTI0mMAQ9rmM9aanGxs= 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 (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=RRWd57XG; arc=fail smtp.client-ip=52.101.65.57 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 (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="RRWd57XG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fuB6ii/wRT5hjyvV1PrHdMrX8qUrrQB5G31uzqawLlEfc6a+5HAoS1FVFVMAQ/jIhTttA9ZWWmk23FYzhdRqLCrBjKYnHUZRZlaok4Qj5D5aPHHQ0lS+oSbQmo1XybPrztgRYbEgSx+u9kpJ/ocu512Y9H8c+91tWQoaIMUrcaACanf0siRPD7rJYTWb0DZJsKM48qmhc0UOcIHin4zc4Pif1lBIQNfbjcK2+PrTWVHdqoKbJnHNp2t8UR1iXFrkYI1abHNvkEDEFIL1wVedu19ITkN0t68MkvZuh14h91nDntG8FS7JyeLEkNawuar4iFt7H+cw/68umW0GLQuZKA== 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=XNSxgizy+rrvrZ17tCcZ6RNMk2PwDZ358yswXzx4I5s=; b=Wg4EFsoy0NXOvepJtRo+zcSfzSeM9CrZ8i+UEr6zPVqEdL/7AU5ekwmPhyIc1PsbyPtdq0kifWqJQi33hRVEn9BogIBO/IzP3yer/11M8VnizkKUW84DODCvVqtyMUnwXVnjFktyl8cHaVn+hFgykwv6cJ3E/21diLeK3ZTT11rCAEoyNm9ZxZgooLcwXfODDInf3T/fnLkEl98Z0aYeYwlZr+Wh2XRKSu/LfKZCkE7B3q7yTvSccBQrcVWruYZbRb7CTh2acyBCpRmbc3uLjI2A+adfJu7d5ulwV+0avrXHKQ4Drd8nKAvxHeb+mp6Q/i2HQVvKb1G1zKihZP6seQ== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNSxgizy+rrvrZ17tCcZ6RNMk2PwDZ358yswXzx4I5s=; b=RRWd57XGcaI1NkCkXTjRyTKGxfnw5kMK7FHQZO8x/o2AbMXfDsVLiNhDyUF0SwwLeRppD3/qqzIi74kSgsJAZytMNDz8Bd5SpRDeE0ka3XrIHJJmhu2fBpbuEJW3ni6daKz6LAx9NoVeWaDPUQiM+uc9514pjVAlg4Xne4tOL7c= 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 DB8PR04MB6812.eurprd04.prod.outlook.com (2603:10a6:10:f8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.18; Fri, 19 Jul 2024 08:40:11 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%4]) with mapi id 15.20.7762.020; Fri, 19 Jul 2024 08:40:11 +0000 From: "Peng Fan (OSS)" Date: Fri, 19 Jul 2024 16:49:04 +0800 Subject: [PATCH v2 2/2] remoteproc: imx_rproc: handle system off for i.MX7ULP Message-Id: <20240719-imx_rproc-v2-2-cd8549aa3f1f@nxp.com> References: <20240719-imx_rproc-v2-0-cd8549aa3f1f@nxp.com> In-Reply-To: <20240719-imx_rproc-v2-0-cd8549aa3f1f@nxp.com> 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.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1721378951; l=2895; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=9u+mOLa/UKnpD74PoVrTGFSC490GJBGP44V6TiFNVYA=; b=XhxP2n+9b5iHTZSeqM2AsJF3TXHNyn5hV0SXTABeJWtoTt3L2zA2e1oSOT98AEeRblWGi1ItN Xi/qe1DBDnLCTdNHe6R4uhrY7dT2UC3WAFA/fH74+5GyvCC8DPXmyEy X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR03CA0129.apcprd03.prod.outlook.com (2603:1096:4:91::33) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DB8PR04MB6812:EE_ X-MS-Office365-Filtering-Correlation-Id: de398837-d19f-4d89-b55f-08dca7ce6701 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|1800799024|7416014|376014|52116014|366016|38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bG820zf9DD5iCGxbE6hxizAZHaVfFdbdZk3BCTW5SOmq+xmmQUuRF?= =?utf-8?q?4JlejVS/sfTXbk4nEGCylba4XC8X9MMzb4g3L1JmGxgf554ysHcdwYDyPaxBkVVYs?= =?utf-8?q?fP2D2wimnN+ddyzehFYWcIKv1+qbJnHGsF7qOlVeuoWIxEttZuMyOTWjEi6qw+q9Y?= =?utf-8?q?Bhdpj//lD2z/inrxunrk+kmZZshPEfupa68Kq3gLIFdtFB9VhaQ0u0tduWvGFlbcO?= =?utf-8?q?HI9Ht/e+G6f1Vx7mIE8rimRzWdXYirwbMCupVNoP3OsNu8bQ5Lqc3UG8xm9qgpTlF?= =?utf-8?q?/Ul6eKK6Bxe/qDnGyGVWcrIe4NAOAC0mhQzn0GFCyyAtIsHjZbVADE2bwYu0j/Bal?= =?utf-8?q?hy2zBZRfOx4B/qkdQw4d54TSMojFW2lxID9HQ+3a+Vg941RpVEKDfgsWrYwjwaEl3?= =?utf-8?q?aBGtKpHh4izg1XKSIJSz8AoymOGY9v2tqgUUuBPTUss8FlWxGVBxRopKPCahLGqlB?= =?utf-8?q?bb7yPUXFYiiWuacvhkkSf8J1LpHJLxXciQ=3D=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)(1800799024)(7416014)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HpeKASERqBWzTCkhlOpwS/aW7oON?= =?utf-8?q?lDfxMfTWM9A2sHnxivMfZJxNF51eSoPhUgs9r8s+RNCNC92a9sno1yqSAqM3n+IZ4?= =?utf-8?q?gmfNHzcvAqa7HYnWQK+Kdpi4Miy12fJ0bPO2QJChDOClH5cxxHHYWDjOmzrPTH8SK?= =?utf-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isk7xGZ/Vx7cj8vf11s4OW7HJd8HBzDjPQQXOzq2D2tQOOf2Yqxp/?= =?utf-8?q?GcGjsf/fg9mziYFTHVE5fMkCaA7RR2JQ2Epm/SMHdc5HckKQM5OWDPvk637Iw3K6j?= =?utf-8?q?ZO0ttzF1ay3EeuRcygQp7pxEgJPuVMpiMrEYeJMumD6F622MP16kcIHi2KPOsdA63?= =?utf-8?q?v3Jn2ERTC39cSVcKPelSH2ja3ECUMUod5sVilrYDNgKJ3QYrII8kSQ3wq4nn1TIYL?= =?utf-8?q?DX20YQj7SZn+AHUf2slfh7Rn8V/7KX68khCW65Ekex6tzEJQHa3Gs9Mf4RuGrGu3t?= =?utf-8?q?ch+N1fqf2hB5zKyuY+51O468YKPfmC/hqxNeMcFmDplABcr5+Bwzh4NDBnuUfYKr+?= =?utf-8?q?BBhja1eS/6zUNCjK/WlyS3Nuwvhay3mEwJWn1N+9nxUtOaKSIn779oOPn6W/PYGwk?= =?utf-8?q?lZ+1XEeXSrS+OUlQ/im7UiKnSbogf0ozxS91bft8ixUiR7V6QoEtFzZzUTPCuOeiq?= =?utf-8?q?vPY/08km6oLW?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: de398837-d19f-4d89-b55f-08dca7ce6701 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 08:40:11.3926 (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: 0p2FcKPldASIKuu9L6Z3AzTCIxkaN5LIbNUCuQrd656Bnrnc3E/sJivVbXXdTdx9h3AjuFvV1mzsPyDOo1+QJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6812 From: Peng Fan 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, so with blocking tx mailbox will trigger kernel dump, because of blocking mailbox will use wait_for_completion_timeout. In such case, linux no need to wait for completion. Current patch is to use non-blocking tx mailbox channel when system is going to poweroff or restart. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 01cf1dfb2e87..e1abf110abc9 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,7 @@ struct imx_rproc { u32 entry; /* cpu start address */ u32 core_index; struct dev_pm_domain_list *pd_list; + struct sys_off_data data; }; static const struct imx_rproc_att imx_rproc_att_imx93[] = { @@ -1050,6 +1052,22 @@ static int imx_rproc_clk_enable(struct imx_rproc *priv) return 0; } +static int imx_rproc_sys_off_handler(struct sys_off_data *data) +{ + struct rproc *rproc = data->cb_data; + int ret; + + imx_rproc_free_mbox(rproc); + + ret = imx_rproc_xtr_mbox_init(rproc, false); + if (ret) { + dev_err(&rproc->dev, "Failed to request non-blocking mbox\n"); + return NOTIFY_BAD; + } + + return NOTIFY_DONE; +} + static int imx_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1104,6 +1122,24 @@ static int imx_rproc_probe(struct platform_device *pdev) if (rproc->state != RPROC_DETACHED) rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot"); + if (of_device_is_compatible(dev->of_node, "fsl,imx7ulp-cm4")) { + ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF_PREPARE, + SYS_OFF_PRIO_DEFAULT, + imx_rproc_sys_off_handler, rproc); + if (ret) { + dev_err(dev, "register power off handler failure\n"); + goto err_put_clk; + } + + ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_RESTART_PREPARE, + SYS_OFF_PRIO_DEFAULT, + imx_rproc_sys_off_handler, rproc); + if (ret) { + dev_err(dev, "register restart handler failure\n"); + goto err_put_clk; + } + } + ret = rproc_add(rproc); if (ret) { dev_err(dev, "rproc_add failed\n");