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 21B9DCF8840 for ; Fri, 4 Oct 2024 18:21:30 +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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6ejzPfq6n9+Bw+6pFEbOHT8tTpb5SV7/vplpzQ7m/L4=; b=tpsW/9wzvse6s0V5mwNLm/30E4 FPzlmcTOWZMs+ayXwsx+JpVTPymUaGdxuYp8PxyOU9LlqCjp/hDwCit/TvRD6NDfyj+oJ6NESp2Cr +TOTsDSWh7WbCBp6Jty4B+5JkJyoC+DbKeRH5kvSrR3C07qd/UIojuQtYNOaBihyVVJYLt1xmH3Sr F25n0P8U9qb10OgOisgUGfT2DYfSKrCPeiS2DqRsiUHsPKc/b8W+6/1OKUtnPbo633aqZtlXJ/f8a ySfHxt05aoGVdA8Clr3yfieAeDpVuAD4u6FZT2EINug3AQdMsVCkeabx076G88a40EbbvgvV4ftic HQOXt2/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swmvV-0000000Dfku-2eCR; Fri, 04 Oct 2024 18:21:17 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swmuB-0000000DfDp-06t9 for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2024 18:19:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 533AB5C5DCD; Fri, 4 Oct 2024 18:19:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7B07C4CECD; Fri, 4 Oct 2024 18:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728065994; bh=gtzWo99z98MAVsqzZyZyVJlwrxTdbh/NNL5OBmjzUPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEEKLgM6wMW9/fJZpaqVGkdmSULb5AA6KrQsvyoLW09ZUxMNMCaNwz8dU/hiQOlel yKHyh8IkuGl1rE+D7zHlUMO9j3ZKQv5k3YhgVgJ01cYNlwQ+DE05LEf5xC8t/1wvhD RQSg95BMSjEB377aGkX/Q/8i83PJNKr5sxfwK2qWwIJNzSIniHHP5zCAQZYjr2Epim vCUcyquLyNX34hAogJ3eZx+Y9JJSl3WNBZqH5bh0c6BQGprLufb9hgwO3s7V10x+5c b3cdlQ+iJfhvwfZhfNksFDy1km/rWJEA4Sz5lVo+2tdpidYKq3RL2XZvh+ureBK7zD 1aYcSf2IYSG8g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peng Fan , Iuliana Prodan , Daniel Baluta , Mathieu Poirier , Sasha Levin , andersson@kernel.org, shawnguo@kernel.org, linux-remoteproc@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 6.11 45/76] remoteproc: imx_rproc: Use imx specific hook for find_loaded_rsc_table Date: Fri, 4 Oct 2024 14:17:02 -0400 Message-ID: <20241004181828.3669209-45-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241004181828.3669209-1-sashal@kernel.org> References: <20241004181828.3669209-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11.2 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_111955_197166_7DDFC4C8 X-CRM114-Status: GOOD ( 14.80 ) 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 [ Upstream commit e954a1bd16102abc800629f9900715d8ec4c3130 ] 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 Reviewed-by: Daniel Baluta Link: https://lore.kernel.org/r/20240719-imx_rproc-v2-2-10d0268c7eb1@nxp.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- 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 144c8e9a642e8..f1424da9cb5a7 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, -- 2.43.0