From mboxrd@z Thu Jan 1 00:00:00 1970 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 1D21BC369D9 for ; Wed, 30 Apr 2025 05:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To: Content-Type:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vccj7coqlaLwTAfsRE5A24eNVUMjylLXHpABf2YMWbw=; b=xdKSnSSrU110AUh1CZtr/DBarQ 16eoOH8ktuxV0LtGz2CuqxImrCzFBx7e39GGyuSbhmpPhJnyBGcf0gvuLnf2ICHiJB9QMZN1Z5dt/ qRGBo6I/Dg8BBNtg+wDR0uKaWQ1yUFBJhns3k4Ebd5fvIpdjH/TakGru8HNJfZRHIyScIZbFDFK5D OHmQ9BJbi9j031AP/+nlO6UYwGufbEppWGh1ZJqbwHa1al/PTyWjra/xFzzG6qDtFIWFmHP5ZRxQY d4LQtMn0pNoUFuzc82ompR9eDKOm7T9LusFRTt30sFRdR0EgNjFmJvUlGDKfdGNuWxivOu1IBGmYe opgxZruw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u9zZl-0000000Bhvf-0ToZ; Wed, 30 Apr 2025 05:01:41 +0000 Received: from mail-am6eur05on20607.outbound.protection.outlook.com ([2a01:111:f403:2612::607] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u9zXs-0000000BhjQ-1Wtl for linux-arm-kernel@lists.infradead.org; Wed, 30 Apr 2025 04:59:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FBbUZt75N7VyacEgHvJ4ujnBQdAa5g9wf4bXQ6Jp6eRBXKQRxnuuWeJ1HwGuA3pmn8qMWq1XAz/vUklFh1cWx5BuajW3baA+1T3bBqjn2pfp8mgGqabK8xkP3sxUc3V1HzQCxMNRl24sRkVOxMoRFY2T2HuMDSggUVbIs2zsw/fSWR1GD3/dNS7+wyXfzX32PF5fCVugO3onvSH6QOXfGjl4ynbLsevzSu0DNp/P+NbQapApzK5cC9HcbxuzBsaEE/QPg5uN86eXq5/hg1bXDnoF2S7ryFEe3NSOVZGhbxdeiXli1Li5GGeRyrmp1503i9M/QhoJNwiKN5o//VfIgQ== 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=vccj7coqlaLwTAfsRE5A24eNVUMjylLXHpABf2YMWbw=; b=p87LUKtPzeq0Q4bEFXcmDiWYzQnOM9twA6fLF0NBTAMYUpW/yXC2/EN9JIwIuo4h3ukQdW1o3NgixeOFGShHmwdWSlkRw9n+XeHoD5aVsLevgdPhedlRX4liVPlEydz8pTb0bL1GWceHekivQC8+g7Cf24f+A2Ykal8cRW14lk4z9vyhDxN06HTS9qDK3dPJBTcOlKZpIHpJ/Yweqpl4fTasr1AUqN+8JSv9LPzekVL9/PhPTgCCM3MNWeWSVLxSc3z6yuUe4yIg5j+GM0XOx4rCCOETGTHKiNGezYKRZSgSFT4bQ710msEDxMAUYXq/t05bwI5mnMAoWmLXOseFPg== 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=vccj7coqlaLwTAfsRE5A24eNVUMjylLXHpABf2YMWbw=; b=n1cs1tGeS7l1CSCIpMjcuB37zsoQo/bfosY6Duvnrjype5u3ViuPsXSAitvPY/x0UtqqlppPfMpughzivm5x18N0zWDesZDVUUnsgfuQY8LXH761auRJWvvuDbIG+YhXS93j7SKFshzQy3K1j2qxABqhNbCflaw1eHvU3i/pg1pGKF5HDJ9CbQwQEFvV/Ebm/+ON90HGWbmQlgxqZUZcP3Cnb3/+h8zbgumoDYJECUeBkvVxpWSHIQ1j7z62Q22vQX8wOV7iT1cVjspMfF655k8nEfLwNK/RXRcpE6BTmnNLFU6pfoWmpfzLbcWgQORhKQ9cYWS4v97c6O4Mi/fC2g== 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 AM9PR04MB8812.eurprd04.prod.outlook.com (2603:10a6:20b:40b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.21; Wed, 30 Apr 2025 04:59:38 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8678.028; Wed, 30 Apr 2025 04:59:36 +0000 Date: Wed, 30 Apr 2025 14:08:35 +0800 From: Peng Fan To: Hiago De Franco Cc: Mathieu Poirier , daniel.baluta@nxp.com, iuliana.prodan@oss.nxp.com, linux-remoteproc@vger.kernel.org, Bjorn Andersson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Hiago De Franco Subject: Re: [PATCH] remoteproc: imx_rproc: replace devm_clk_get() with devm_clk_get_optional() Message-ID: <20250430060835.GA31028@nxa18884-linux> References: <20250423155131.101473-1-hiagofranco@gmail.com> <20250423192156.b44wobzcgwgojzk3@hiago-nb> <20250426134958.GB13806@nxa18884-linux> <20250428171257.276bqhaupe4ksu5l@hiago-nb> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250428171257.276bqhaupe4ksu5l@hiago-nb> User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: SI2PR04CA0010.apcprd04.prod.outlook.com (2603:1096:4:197::11) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AM9PR04MB8812:EE_ X-MS-Office365-Filtering-Correlation-Id: 193c6b49-e2e3-4bb7-22c0-08dd87a3ce01 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|52116014|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?XAuNfISb6bIglqba+O2oOF3ofJ7h0O3tABr2xGy5jrrv95cEXqmrtUmZ8fxS?= =?us-ascii?Q?J6mVkNCjG8M2HcdmsC6FYofgBSjwCprjG8SZYH77jMY/bIVj5HOKtS5+hCtP?= =?us-ascii?Q?6fY7mBd79BT7vs9TkJ3y5yNVnZW7ozemgxA15druldSATz3PfdrALlsmbF7h?=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tRYW4uMNBwC93EjmHKWF9hHE3ij5T0JyY?= =?us-ascii?Q?Ao7+qdv9gVbX44I0uJxrvKaKeBwNLES63uT8ZpR0es+t967E+snIQuxyi+9J?= =?us-ascii?Q?SmF91p8kVMzOKuzB60D6PnXqGg6Si3KsJfYrf8Zispo80JsguVz7Oqk86fdD?= =?us-ascii?Q?SDiP1qPgvI/p+Tc2sfxd96CLZID1codRhXlAoqLZW7p5dZJTpd5zI/yremll?= =?us-ascii?Q?M44lHBshWudhFI2s6QfHfkgXkrVBWegFNPzeBtUktUStwvTuNgdarmwESSfW?= =?us-ascii?Q?sE0H2nKhnmlrU4C4DC57Y71vB0oJCiBLQl/8OepUoJOoGVD4UVM+uT6MoF0o?= =?us-ascii?Q?g7DHGFmnf3DHMcUFqdIcX62dygxPuelH4ZxyKRO5HeBMuYvcrp8EQuMZlS0C?= =?us-ascii?Q?YswQMsHhTIplSEvVCNEQw/OfwewiN8apvirYzVLRnvGJFNwhU7yCfhRYdMKZ?= =?us-ascii?Q?b2zE8n1PSOBSq4E=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)(52116014)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?U0rVuOoYBtc6laNh0hw9Dv9f53qwqQQZNhWBnzHBOa4eGo1ymYHOEb17DuDn?= =?us-ascii?Q?Bdo9a1J6ABRfI+zGq61TMeWtBMZhmYe7uv9k4LosQsAnPeZK8h9PwOQpKnHZ?= =?us-ascii?Q?RMZs16cOFSvMoG9Lq1VuSxc7gasWuvlv/4PHFZEbcV26p2AY+OvyXV+n7wUh?= =?us-ascii?Q?X3Sc688WTy4jF9ewVZpvjMpcocPAKtHMfnL5al06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dmu+EVcfRnH0r44FA4PE86CP2BbAYNwvVxKenzDmk3yYjl+X3d+cPP6p?= =?us-ascii?Q?iI/DJ9pM9prNeWDAXn9bLr8NqXAUHttgnXUBPYumR6SFbPRbyK2PndKJhtH/?= =?us-ascii?Q?7psnjIv7gnxzM97Y1tImdfwLQhkhkRXAKD5omTPTBJD482wuJlk7buvj+sJ4?= =?us-ascii?Q?mUuAizkQSrsQkThfXCBSd8b4Dm3FzoVL4LA4JcO0DRe7igYQXdksK+HS/KSo?= =?us-ascii?Q?YCdEn8evsXHwoHjrGgJQzijE56y+605vG0iPlhq+oRgTfeVPu3tmJ8DbvBn8?= =?us-ascii?Q?UiWYHXWD28pUd07guGpdGUQI4HmcIOI+O7jxlkYAaDEaRwxd8V6/Htbcm1Gr?= =?us-ascii?Q?ZzyLMaeP77vxWAuOr9904lt3Cnuwn3hp/ao0DKyy2Aiv54weI1kqcq7AXzOd?= =?us-ascii?Q?oTkumrmVpCDO2roV68X4ooMc2ZMmAwXZY6fdEzE5m6pY9T5pNq8LvbxI+rrz?= =?us-ascii?Q?zhEtYzGz8wR1vt9qjOctC3H++FZTMdgDiPfIqUPX?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 193c6b49-e2e3-4bb7-22c0-08dd87a3ce01 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2025 04:59:36.4680 (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: odADMUaXi6QHZ83yed42XPlTQYB1fkJgXlRWbHfdXygL4LQIzhcvlYB4J69g8tP5w/Cxx95C9tnJGm6VIj0zmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8812 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250429_215944_573646_E7781067 X-CRM114-Status: GOOD ( 38.63 ) 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 On Mon, Apr 28, 2025 at 02:12:57PM -0300, Hiago De Franco wrote: >On Sat, Apr 26, 2025 at 09:49:58PM +0800, Peng Fan wrote: >> On Wed, Apr 23, 2025 at 04:21:56PM -0300, Hiago De Franco wrote: >> >Hi Mathieu, >> > >> >On Wed, Apr 23, 2025 at 11:14:17AM -0600, Mathieu Poirier wrote: >> >> Good morning, >> >> >> >> On Wed, Apr 23, 2025 at 12:51:31PM -0300, Hiago De Franco wrote: >> >> > From: Hiago De Franco >> >> > >> >> > The "clocks" device tree property is not mandatory, and if not provided >> >> > Linux will shut down the remote processor power domain during boot if it >> >> > is not present, even if it is running (e.g. it was started by U-Boot's >> >> > bootaux command). >> >> >> >> If a clock is not present imx_rproc_probe() will fail, the clock will remain >> >> unused and Linux will switch it off. I think that is description of what is >> >> happening. >> >> >> >> > >> >> > Use the optional devm_clk_get instead. >> >> > >> >> > Signed-off-by: Hiago De Franco >> >> > --- >> >> > drivers/remoteproc/imx_rproc.c | 2 +- >> >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> >> > >> >> > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c >> >> > index 74299af1d7f1..45b5b23980ec 100644 >> >> > --- a/drivers/remoteproc/imx_rproc.c >> >> > +++ b/drivers/remoteproc/imx_rproc.c >> >> > @@ -1033,7 +1033,7 @@ static int imx_rproc_clk_enable(struct imx_rproc *priv) >> >> > if (dcfg->method == IMX_RPROC_NONE) >> >> > return 0; >> >> > >> >> > - priv->clk = devm_clk_get(dev, NULL); >> >> > + priv->clk = devm_clk_get_optional(dev, NULL); >> >> >> >> If my understanding of the problem is correct (see above), I think the real fix >> >> for this is to make the "clocks" property mandatory in the bindings. >> > >> >Thanks for the information, from my understanding this was coming from >> >the power domain, I had a small discussion about this with Peng [1], >> >where I was able to bisect the issue into a scu-pd commit. But I see >> >your point for this commit, I can update the commit description. >> > >> >About the change itself, I was not able to find a defined clock to use >> >into the device tree node for the i.MX8QXP/DX, maybe I am missing >> >something? I saw some downstream device trees from NXP using a dummy >> >clock, which I tested and it works, however this would not be the >> >correct solution. >> >> The clock should be "clocks = <&clk IMX_SC_R_M4_0_PID0 IMX_SC_PM_CLK_CPU>;" for >> i.MX8QX. This should be added into device tree to reflect the hardware truth. > >Is this correct? I added this clock entry and also updated the clk >drivers to handle this option: > >diff --git a/drivers/clk/imx/clk-imx8qxp-rsrc.c b/drivers/clk/imx/clk-imx8qxp-rsrc.c >index 585c425524a4..69c6f1711667 100644 >--- a/drivers/clk/imx/clk-imx8qxp-rsrc.c >+++ b/drivers/clk/imx/clk-imx8qxp-rsrc.c >@@ -58,6 +58,7 @@ static const u32 imx8qxp_clk_scu_rsrc_table[] = { > IMX_SC_R_NAND, > IMX_SC_R_LVDS_0, > IMX_SC_R_LVDS_1, >+ IMX_SC_R_M4_0_PID0, > IMX_SC_R_M4_0_UART, > IMX_SC_R_M4_0_I2C, > IMX_SC_R_ELCDIF_PLL, >diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c >index 3ae162625bb1..be6dfe0a5b97 100644 >--- a/drivers/clk/imx/clk-imx8qxp.c >+++ b/drivers/clk/imx/clk-imx8qxp.c >@@ -142,6 +142,7 @@ static int imx8qxp_clk_probe(struct platform_device *pdev) > imx_clk_scu("a35_clk", IMX_SC_R_A35, IMX_SC_PM_CLK_CPU); > imx_clk_scu("a53_clk", IMX_SC_R_A53, IMX_SC_PM_CLK_CPU); > imx_clk_scu("a72_clk", IMX_SC_R_A72, IMX_SC_PM_CLK_CPU); >+ imx_clk_scu("cm40_clk", IMX_SC_R_M4_0_PID0, IMX_SC_PM_CLK_CPU); > > /* LSIO SS */ > imx_clk_scu("pwm0_clk", IMX_SC_R_PWM_0, IMX_SC_PM_CLK_PER); > > >However I am seeing a permission denied (-13) from the imx_rproc: > >root@colibri-imx8x-07308754:~# dmesg | grep rproc >[ 0.489113] imx-rproc imx8x-cm4: Failed to enable clock >[ 0.489644] imx-rproc imx8x-cm4: probe with driver imx-rproc failed with error -13 >[ 0.489708] remoteproc remoteproc0: releasing imx-rproc > > imx8x-cm4 { > compatible = "fsl,imx8qxp-cm4"; > clocks = <&clk IMX_SC_R_M4_0_PID0 IMX_SC_PM_CLK_CPU>; >From hardware perspective, this is correct. But i.MX8QXP has SCFW which manages the system resources. For this clock, when M4_0_PID0 is powered up, SCFW will not allow clk_prepare_enable to enable the clock, the error return will be LOCKED if user continue to send the enable request. When SCFW powers up M4, it will automatically configure the clock as I said before. Set rate is still allowed by SCFW, even enable API return failure, but I think there is no such requirement. So, diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 74299af1d7f1..627e57a88db2 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -1029,8 +1029,8 @@ static int imx_rproc_clk_enable(struct imx_rproc *priv) struct device *dev = priv->dev; int ret; - /* Remote core is not under control of Linux */ - if (dcfg->method == IMX_RPROC_NONE) + /* Remote core is not under control of Linux or it is managed by SCU API */ + if (dcfg->method == IMX_RPROC_NONE || dcfg->method == IMX_RPROC_SCU_API) return 0; priv->clk = devm_clk_get(dev, NULL); Regards, Peng > mbox-names = "tx", "rx", "rxdb"; > mboxes = <&lsio_mu5 0 1 > &lsio_mu5 1 1 > &lsio_mu5 3 1>; > memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, > <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>; > power-domains = <&pd IMX_SC_R_M4_0_PID0>, > <&pd IMX_SC_R_M4_0_MU_1A>; > fsl,entry-address = <0x34fe0000>; > fsl,resource-id = ; > }; > >Am I missing something? > >> >> But there are several working configurations regarding M4 on i.MX8QM/QX/DX/DXL. >> >> 1. M4 in a separate SCFW partition, linux has no permission to configure >> anything except building rpmsg connection. >> 2. M4 in same SCFW partition with Linux, Linux has permission to start/stop M4 >> In this scenario, there are two more items: >> -(2.1) M4 is started by bootloader >> -(2.2) M4 is started by Linux remoteproc. >> >> >> Current imx_rproc.c only supports 1 and 2.2, >> Your case is 2.1. >> >> There is a clk_prepare_enable which not work for case 1 if adding a real >> clock entry. >> >> So need move clk_prepare_enable to imx_rproc_start, not leaving it in probe? >> But for case 2.1, without clk_prepare_enable, kernel clk disable unused will >> turn off the clk and hang M4. But even leaving clk_prepare_enable in probe, >> if imx_rproc.c is built as module, clk_disable_unused will still turn >> off the clk and hang M4. >> >> So for case 2.1, there is no good way to keep M4 clk not being turned off, >> unless pass "clk_ignore_unused" in bootargs. >> >> >> For case 2.2, you could use the clock entry to enable the clock, but actually >> SCFW will handle the clock automatically when power on M4. >> >> If you have concern on the clk here, you may considering the various cases >> and choose which to touch the clk, which to ignore the clk, but not >> "clk get and clk prepare" for all cases in current imx_rproc.c implementation. >> >> Regards, >> Peng >> >> >> > >> >[1] https://lore.kernel.org/lkml/20250404141713.ac2ntcsjsf7epdfa@hiago-nb/ >> > >> >Cheers, >> >Hiago. >> > >> >> >> >> Daniel and Iuliana, I'd like to have your opinions on this. >> >> >> >> Thanks, >> >> Mathieu >> >> >> >> > if (IS_ERR(priv->clk)) { >> >> > dev_err(dev, "Failed to get clock\n"); >> >> > return PTR_ERR(priv->clk); >> >> > -- >> >> > 2.39.5 >> >> >