From patchwork Fri Jul 12 08:34:55 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: 13731390 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 BA1D6C2BD09 for ; Fri, 12 Jul 2024 08:28:07 +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:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vKXMiTqaYlAeFcfVRMSl+kE94XTGFTZfh/amtvB+/tc=; b=2J6MNDtD9JV6CsEVmz4YHuRjgx 3YGYRxQI/zCALwxzE/CSPbjhoLKCe4QZfsqiBtUlx2IRqCrd9PdeIzMa1KnaVKcUW7fCizQm/Oj1V hWGJZWDuoGR+5HJVq5mDoTQX4GeAsikv/p4V7SURfwsGIHw82J2yJcin4HHJwIwTGP4C2nVfNx8ql 62ty69wRGwBwRrLH4tAKWSEY43/g82FVgLMOyWRi/IUGfIUDCPIe+zAqCd5tLdE/mfcEZ3n70g7rN HpJb+wNwvWe4oUqaaqexmj9JVG+hZlx0HNr894bP9dbUlJTchWByh5M/2HEIZ8SuTqt4U7WJwrCe2 KPRn/zGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBdF-0000000GtUC-332S; Fri, 12 Jul 2024 08:27:57 +0000 Received: from mail-northeuropeazlp170130004.outbound.protection.outlook.com ([2a01:111:f403:c200::4] helo=DUZPR83CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBbU-0000000Gsu1-3atW for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 08:26:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QrcCGA+WBPiGMTnMPo1IKpXTj9SSh8fK1Qcbjzn8CsaRTcLRG08NUKpjllgHc2Uyeka0gLOMesd2tx4jT8RDIOJ2pBg+i9RraMyrLsKA01MRSeUKApml+ZoiIIWt6Ic774++/G2DDJdBhIeXgnuFkXtyAXQQF3e0LZGpM1r4LzDdiH5Kp+YqDHZDd8fLqZUe659gewhqfZPC8zK5GtTlIc/owBF0+S15qkKxtpbfjOQUk6tb5UJZllxltt1FJt4ZWCBKzvZ50T+MTrWKCLPTAsEgpgGi8cbdoFlcTYAyYhOgF3qlTDKHe9ftKHOD/ALpeHcVHOkmIjxBA77eicPm+A== 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=vKXMiTqaYlAeFcfVRMSl+kE94XTGFTZfh/amtvB+/tc=; b=nvkkKP23x/RRlzkq0OcjsR39cpjbyavRvj+bE47wWqYjDtr8/76IhpnjyFRtsyLzOl/W8rMc1BbVmgVNwoBqPmZjUuuhJ4eRUVFZk4Kh8RSnLmGueB4PhPFmQSf3yX7ivn7QqrmM+QXhFK/X5pem50KHKjiApdbeHSMfpzSc/9ADK4Skg8nR1fj4VJh/jEF2JcFvYMFxtM2MDR1bJiZT/TBttLQ+xvIFQQ1bcf9Z1CWvFALjjfBZQqe8ZQYxlgr8jbkDm0qeJm4AZKSZSy6V/CZJK1nMuRSlc5PPB5/XXGgseGu7zm5fsN4HmlE/fITaP9EitJu/z9oyz1aHXp/nTA== 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=vKXMiTqaYlAeFcfVRMSl+kE94XTGFTZfh/amtvB+/tc=; b=bO05qAgNvwWouwVWQ37UP2JulJ143zyielhPpJbtnSPl3kWoo8RlcKI5kFyIUzAwZgabAe3ZBJv6nN13a9aw+qgQdqASgeyFGJWiZrEm1qlqU5HPOG4qBvtGIGmwYZudTHC2k3VMh6qetcrqcU374K9KpMzF8Ur3pgDR2UO0o5k= 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 PA1PR04MB10865.eurprd04.prod.outlook.com (2603:10a6:102:48a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.20; Fri, 12 Jul 2024 08:26:05 +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, 12 Jul 2024 08:26:05 +0000 From: "Peng Fan (OSS)" Date: Fri, 12 Jul 2024 16:34:55 +0800 Subject: [PATCH 2/6] remoteproc: imx_rproc: use imx specific hook for find_loaded_rsc_table Message-Id: <20240712-imx_rproc-v1-2-7bcf6732d328@nxp.com> References: <20240712-imx_rproc-v1-0-7bcf6732d328@nxp.com> In-Reply-To: <20240712-imx_rproc-v1-0-7bcf6732d328@nxp.com> To: Bjorn Andersson , Mathieu Poirier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Richard Zhu 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=1720773307; l=2180; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=5OwRNu3cAz+Ue3vFIv3+yTH/B5Et9HcjPjl6alTKnUo=; b=v90UbQqD4jNEucmhcJp6dCBH7dL4H7jYSrAZE7VhKXG0SopTZ9Q7djq+aZlWO/dv07yQooNUW mL712ueYeuLBDlci6atMOOKanvtMz4w45/1qAumz5qaS0K6tG4gFXOc X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::12) 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_|PA1PR04MB10865:EE_ X-MS-Office365-Filtering-Correlation-Id: d670bc45-095d-4cd0-c4a5-08dca24c45de 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|366016|7416014|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JnROAHvRiZBWjTGldA4lQFBo9oi+rHl?= =?utf-8?q?UjjNutDRzfW6/wx3YxW+t904viEzctXay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/QZCx4ANjzRwsAoMIWJ4f?= =?utf-8?q?t0H+4TiDaMFCQpzJK/4zfTFA9LRUjBv0zey85KTIX/xXkNqXmHWDp+1G7+zBzqgHM?= =?utf-8?q?gDZ0w5YQ+HpU+Kv1K9fYBPU7oSROPz1LGX6N1/DephosjW6fN+xyJkdQFumn1D1kC?= =?utf-8?q?I9ou9IH2LK7pgcEGwaNhwkEK+Y6v902ZxRbP2o/NLRLrU+zvs6j9krbup458s3zU4?= =?utf-8?q?L1PwKy9DOVaJK6mHtdWKMbTFezEHXXyez+kDk2Np9YJvUAGS6gOBsMZNWG9W/8YvI?= =?utf-8?q?98bqZrSNinhq9/4c1I2y+wOXckur8MZVsq0Z83zm1vr8JXUgXgBH3DmtW0EfVy0Vg?= =?utf-8?q?y15VaSmCmftQKuX0ToOFRkwKiJi6diaMuGYb4WqliW1zkFfz5NH6G+B9kQTvRfe12?= =?utf-8?q?IjuMDU7UBYRVaGZizNSBTDNghj/sjg/4wA=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)(366016)(7416014)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?05Xl77T6dL62qT78mqVoK7aTH48h?= =?utf-8?q?ZP9DrLpmnl7UfMz/qI7nahkalVfFY8wdP+lTCKq4vOR/d6HaXnJl2gp6k4g0IplX0?= =?utf-8?q?8Rdgl2SbEDtkHFAeeN0GAA5YGpFObl9BWz5sJKNs1BHn6ojhAUx5R+EGPD9ROiAPs?= =?utf-8?q?E7nVs3W7ufo+ffs+hvl1pif6lBEtqTvz10BjdEGmXTB5i8fYeujcll79y2TXeqcY9?= =?utf-8?q?ObAObPKEEwmzDpuGDAs15f65uqOkV88I4un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33TLmscuq9pLECafBSfikX?= =?utf-8?q?ZOMUXbh2pDZkRaxdPeaDOcsR45kr9j8zw6Fn+/TZLm/S8buwN8Ex0ExijtU3sw5AV?= =?utf-8?q?jq7keS5LweEMPAhOA1dcv/MhbDxEq1PzXoTJ4Sis5JJkCksUP5ynCcOFtQCYoIFis?= =?utf-8?q?EbAT8vdctUu+uliu5BWq59OJzaDsIiPLXxU0E0picS2Koh0jN5Wv++1pQnKJ5awkk?= =?utf-8?q?MWxCWR75LIyDtwR31OAzMX8CnUcep5jlMdfrP3bdRXmtagQk5cJ21LsOlucB7GEJs?= =?utf-8?q?+bnxfXDHYyL/To/urtwHwKIdblJqNCfO+vHNI5RAO31DFZvgHL3RGW6sxWhsLCkye?= =?utf-8?q?HqUusG28hBZEGdFYR5nCbWC60GyFLiGLkHz3lSwA8tJIAFfeiWwf+xUeCmu4VXrO0?= =?utf-8?q?+KJk2XTl7VPo?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d670bc45-095d-4cd0-c4a5-08dca24c45de X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 08:26:05.4425 (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: MXiVTd5iGMxbIMaCoBgW0hjEzOhwRwO1Ac8t1Gojwzvo7094xQGEcJsfyrtg2HgglvNXiX0uC1WMix0JoNmOaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10865 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_012608_941602_DCCC1628 X-CRM114-Status: GOOD ( 14.74 ) 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 From: Peng Fan If there is a resource table device tree node, use the address as the resource table address, otherwise use the address(where .resource_table section loaded) inside the Cortex-M elf file. And there is an update in NXP SDK that Resource Domain Control(RDC) enabled to protect TCM, linux not able to write the TCM space when updating resource table status and cause kernel dump. So use the address from device tree could avoid kernel dump. Note: NXP M4 SDK not check resource table update, so it does not matter use whether resource table address specified in elf file or in device tree. But to reflect the fact that if people specific resource table address in device tree, it means people are aware and going to use it, not the address specified in elf file. Signed-off-by: Peng Fan Reviewed-by: Iuliana Prodan --- drivers/remoteproc/imx_rproc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 3c8b64db8823..48c48b53a3aa 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -666,6 +666,17 @@ static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc return (struct resource_table *)priv->rsc_table; } +static struct resource_table * +imx_rproc_elf_find_loaded_rsc_table(struct rproc *rproc, const struct firmware *fw) +{ + struct imx_rproc *priv = rproc->priv; + + if (priv->rsc_table) + return (struct resource_table *)priv->rsc_table; + + return rproc_elf_find_loaded_rsc_table(rproc, fw); +} + static const struct rproc_ops imx_rproc_ops = { .prepare = imx_rproc_prepare, .attach = imx_rproc_attach, @@ -676,7 +687,7 @@ static const struct rproc_ops imx_rproc_ops = { .da_to_va = imx_rproc_da_to_va, .load = rproc_elf_load_segments, .parse_fw = imx_rproc_parse_fw, - .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, + .find_loaded_rsc_table = imx_rproc_elf_find_loaded_rsc_table, .get_loaded_rsc_table = imx_rproc_get_loaded_rsc_table, .sanity_check = rproc_elf_sanity_check, .get_boot_addr = rproc_elf_get_boot_addr,