From patchwork Fri Jul 19 08:36:12 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: 13736995 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 BC293C3DA59 for ; Fri, 19 Jul 2024 08:28:43 +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=PNKaS7fUoM3FwI6TqITKPI7NTovw6Ya4YHiU8stizyA=; b=zfOcVcrllgpuZ7a/d+17b+FgCa RSlQ2kyy7nQk2PqvjceT3wE1hDAQmjVxXk8j7qf5qwbEeCuaF/0LQ8Do+r12hsiW3vFgkYGqCtMxv KodVWsyrWK8Ca2XqT/jxr4tD3Om5YVI3WKlOeivPTkWRlhKbVLcCg+jygUJlpemDURCnkBCs8RySp RQ2QqcMYopr/appOMhc3dm1DbDtqwKOJW72XWk2kru53w0yMvT1dWfklzlFGNZT+mPkE6hRFZ9Hg8 rE0Tk+W75FIhJ4+AvEkv5fcYlQoZg18fOql18fOSmf/dFs77rO91buvzO72iWDutrnulgnoVCWzux VZtlGwtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUiye-000000024p4-0S4y; Fri, 19 Jul 2024 08:28:32 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUixe-000000024I8-2bLi for linux-arm-kernel@lists.infradead.org; Fri, 19 Jul 2024 08:27:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wB60dij9esiL3gTpL1guP+Snvn0AovkFr8375RnJ4MrCV1mEcki0pY0pVnjoF3g8tYr7oDROcMnqWj3DaDx0NyHNUS00dTBnRADXNBN/Hv+46psF5jj0/nJnWoYX30oejdJVmyaYN5T3FvhO5LA5okRPJ4IdxwnGfV4xbrPsrUaU8BMQAZIZMrajdsS9VF00qncfu0GEZFUKmYhJVYNThp9o4aXw60yakXvN7sS5Lr18JakloSQvMDi3J8RY1EHlEzVz3kEbi9uQSHSfICDFzipvBpD7lCF7DHMR+J9GR1jmKd67fR3VXncxW6WGxw1X4+gYg57CoWDOhDsQ4G6etA== 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=PNKaS7fUoM3FwI6TqITKPI7NTovw6Ya4YHiU8stizyA=; b=IKPEoVD8VvvV7BBlTUAb9LM4WAgHcec8aXNbJxdVBiiqJC1KqJtjp5zkTHthQ16zqJiiZlvNiDvjbGXyHHtuUayjNuj7cs0NreuQLlnLC9Y3SQKCvmVfOmFPHVAOBCYiMOZU1z68gTzi0OBAmucdMQ05+COeXWvRvQ757YvXdxmc//ToNzfwkT8kFA/TZeIFiimTByYrujp3RTzE9CQkhkPTuz37bCjSIrZLJebYB72rxEiZXBcMdvNxFkQeAm7+EAVMF/Z6YLovA88cvLjvVQHRUV28AkrhYDgL7823VYOeDbPDf+5yB3am2AXRfL57qmFzVz6/krbMpydmBMK+tg== 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=PNKaS7fUoM3FwI6TqITKPI7NTovw6Ya4YHiU8stizyA=; b=hdY1e9ag3YLmWMS5IX64JDmNDL/mnMUcy5LzAmoit6/IgZmCi4uZX+i/sYUOS2d/CsfpxLAfOZMZLQkKgt+RApuRgNg06RMzNkHtdtczA8vtcR6DIS8tNN2vLjVZy+XyncN+A07IikUzGIuu+eVYsrgGKbybjmgyoKkufaWe4i0= 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 GVXPR04MB10993.eurprd04.prod.outlook.com (2603:10a6:150:226::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.31; Fri, 19 Jul 2024 08:27:26 +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:27:26 +0000 From: "Peng Fan (OSS)" Date: Fri, 19 Jul 2024 16:36:12 +0800 Subject: [PATCH v2 2/4] remoteproc: imx_rproc: use imx specific hook for find_loaded_rsc_table Message-Id: <20240719-imx_rproc-v2-2-10d0268c7eb1@nxp.com> References: <20240719-imx_rproc-v2-0-10d0268c7eb1@nxp.com> In-Reply-To: <20240719-imx_rproc-v2-0-10d0268c7eb1@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=1721378185; l=2234; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=wd7mw4EohSzycQxzYHfyQ3npQrgFZ41qvhJqdiqbWFo=; b=sdWoq91BF4xlQ5RE0ILY3LiDuz+cJxZl7nRrpVytgq21H2CrMXameWq8DvnDABdyIeq+84kD8 saY6iUCCvgSCuCksiU1N9JGJdTRkkI87DFSJNzfa+l/bAyqT2ytqyaK X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0232.apcprd06.prod.outlook.com (2603:1096:4:ac::16) 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_|GVXPR04MB10993:EE_ X-MS-Office365-Filtering-Correlation-Id: f4c31cb1-dd48-4d7a-b14d-08dca7cc9f16 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|7416014|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?t9HSEyzyqVDoHf8SMt4gfr+REE70oAa?= =?utf-8?q?Lvp0QsOiHVrz7ynJkeRj7qNwWAAuWijzazqDfDiVpdm/C8uMm+6kDwIOSe3lcApVp?= =?utf-8?q?joEAtdE3dX+VRKubeIIBgE0CNeIl//BpYiGqSfuFT99q0XQqSqB11MzFJxbUjt0S2?= =?utf-8?q?61WvdCsdGZyJu3ULR4LFsLsJk4aHyR7zj664Gvuwvod9b1LLkZPsfSu1rpBeKUfhA?= =?utf-8?q?3xvmKGXm2co22I6kdgpa03tKMVDIHcRwnftvpILf5eXLQL0pwfMvqulR7IZigHdV3?= =?utf-8?q?HCQNCuT0URp/hk2cMxabuROP4O5kw67z+nX6eAizZVrB4xZxnVKdrN4bqVfWmmv7o?= =?utf-8?q?defYHk6BBs9Eo08lOiOvJLIYfWolsQXgMU83rMWT87bWs6LZx8SHIxK1dWTRBoNk5?= =?utf-8?q?e7EkA4nMwAzcm3eTtF7eLclZpw03NmxFCKaLSHMZ1AWjql+xXn/diNiIi4mdd7iAw?= =?utf-8?q?UjuVh6x5nS4YBxLHQLTl5tE55MrEroR4GnFTc517Pu9O+MqUICGjRcAuZy76mHvJC?= =?utf-8?q?3phdHTFDvff0phMONHeRnR+TPnJyiDR41b52bMwBsDs/irpfxEqSwgmeNcbkgLwpA?= =?utf-8?q?wmQh2Yz+yDINuSeRqIaXWnTq94qC55eViaTI134iXWtxGqkJqQI3si+/iMgV7uh8+?= =?utf-8?q?rh+78wb+MSueePsFDdYIB9dCoplu/3ckhYb44A6crxBhBmJJivjXyRx7VYFliwVwN?= =?utf-8?q?jMS6BMdbloIsjdR1+PiFsCKIH8reeYZKJwy7VAlmW8zz8nq8zwSxwUzH15dfMpnfA?= =?utf-8?q?rlfxkKWUYmdPL6HjiGnUFuJnjPUCyJdE02lFDpYu68xpUX9UES1kuoVybqDgLFzKt?= =?utf-8?q?9DAydiF7SzkTyU5/84+AhMjxpIAD7CuKpUAysF7CgvivLxAfVKnCVHZW+26AooPBF?= =?utf-8?q?0lHH5c02QDg6LdYRb37ohkDEpr6fGAKbNB7Ma64iabEakiOHt+GdlerN3K0+YgNkC?= =?utf-8?q?96m9N2rCHVrBwU/AgPqdq/p6yi0slqCGZlals+t81Gd7RCnG7t5ouvhYXON2M4t9L?= =?utf-8?q?pLHdmMk/X4MDmDPfL/e2RYzPgYB+/Xbak26ovIUDe/Rbi6U3OqiPrET2NRrRnLzEt?= =?utf-8?q?tW3T5Un8FcOk3f5Q1pOqTGu3MsPp6+mWAoFejQ7WuxDgX2KdUySu4yu8XWxJLyNTI?= =?utf-8?q?3xx2X2APV3309Z/4V8zqosXZMpIwYZp3YnTUlpKrpbkXaxzWEal9WW3UHvSiSiNjL?= =?utf-8?q?gJ/zDeHHy2qB9O2yNwnP9SbQ0hxbAH+nc7lR83cgfNREWT1G/VBgQQaz/ThShnK1C?= =?utf-8?q?J4LRHwergZbEwllRC/P3H5eWyjw/pzqclXdtjBLKZXDj142JmPqQUqZu6S9WALjFQ?= =?utf-8?q?NUrdQtPnh0tUf/weAxioXC3plvT4F7X3VA=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)(7416014)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5K9XbgqA5AAItptCYto+kzS32ajp?= =?utf-8?q?anH4Exi5W+5f9BwyRR2lT91lu5v5xL8ivtwvvRf3ExuOt5MobpbAWhA5o6Ke4Rzuf?= =?utf-8?q?JgFwYFMmsZEUmP9r2n28TySengXFTgRAb+dqMM/iummMB+zJbel97GWBAyPd0rKm6?= =?utf-8?q?Fax951t99K22WI/Z08zyhffnQAHqIn/YjjnZTmpoFrgQOBaWylz1mg27PF7h6xDya?= =?utf-8?q?LOBui6oqw8DtxysHNOmDUTA+FywGdeo79TMvrXqhPr+/t2rQixLGhylq5Jev65yk7?= =?utf-8?q?VoQO55s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DxZD+4IT9F2advA7J8w4FowOtzBEpyUMcAJZUGF3VxD/lMVV07DnGoZnk0dsv?= =?utf-8?q?E1v5VJO5cbp0ukLJ25/B85iAegoUbz+DTz6py6YwMaWl01oiNxz9ur0SSKFfe5VNa?= =?utf-8?q?S3hxfSHVONX6qAWNJc/S4WielbpDoMofMpmIjBTVOyV+zIS8lquWPPl2vCEZN0JJT?= =?utf-8?q?GpxEu6Z7vkXvQ5eGcfb37EhCi9Fk8SA0gOBFHOTdvnNh3wF7abj/RKqRjzhrUiU7Z?= =?utf-8?q?rSB3NysTp/IUcvL9lHvhGcfOw6CB6bbmtqtgVksehuQ6lFfDIzwTWwE7S4NyDE6AL?= =?utf-8?q?lpyhEpSbGRhFFcfRh+OYUHwKmqY1ZgPSekdfLt4/pxuFHomn7oIHqmgTs7fBrCmWG?= =?utf-8?q?uEDANlLgOYq0?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4c31cb1-dd48-4d7a-b14d-08dca7cc9f16 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:27:26.4805 (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: 38wrAw1PRwyLnew/H8SVZXGBvNarRK9rj/4cYOzzeCsDXPszuS7y8t2JSofkvRd5g0baPyPOyFdDiAAqjRD7Bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240719_012730_711847_CFC1E7A4 X-CRM114-Status: GOOD ( 15.02 ) 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. Reviewed-by: Iuliana Prodan Signed-off-by: Peng Fan --- 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,