From patchwork Fri Jan 6 03:43:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13090908 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F46AC3DA7A for ; Fri, 6 Jan 2023 03:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbjAFDly (ORCPT ); Thu, 5 Jan 2023 22:41:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbjAFDlw (ORCPT ); Thu, 5 Jan 2023 22:41:52 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2068.outbound.protection.outlook.com [40.107.247.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D116A0DD; Thu, 5 Jan 2023 19:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hyrg/rMT4aun2ZjJmn846V+1wuTJL8AKKg3yZ3UADp1AOFIBwFLUPL6MYp7zwAvWgEINQhwaGKIJufzfbZbfQP1DlnrTtSTN7KjTzPlFl7P4pmu8HYAnVhcVXxblRJdZTnbaJR671vy68CfJMzwr69VWg2tr9BLMKrngmq1EPgNt7eDs5Vzla/pXIvmLNTd3kWyx6xDYOX/fo8DrGt8+utRB5fWvs2eh1ovF8gS/RCZL+UmVcs60/yAXAxcjgDRdDZCaNNN3nNS84I0Fm/8vKGFmHq8LChAPPfLtQuE5ROf1HUk2Gq524Nj9w7mGyl3NQ81BolVKcv5wv0CC+5nGwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Mtyz/Id7LtYWFBn/7/P8gXCcUUxg9YUQhRDL5xyN0uo=; b=lTiLvPWlnbcVfPDhT/BoqaNirY4Ono3d2udDENH7ldHbxyZenr/WXUaAblsAkJxXvCIWhh4fkKIe3RmUbfnhmkIgEO4nupamlIVNS4jDHzkGm6K5Hc3vOhQCi174RC9nUIyjcJmE1Em6aX+7CqIx1xSc/yApwq95zazrPdkgIwSglCFxLDG7yRcbVbakDLrc9ewPRk6ea1M8Hk6d5NeMxt8rWeyy4bFBSNHVf5vw++QULjREZNv0rOC3S1HqzgP1JNdhnQUYAxGTLctT4EdAJ3ZWfBzuAAxktgDubpacHQLK0Kma/CQqhUglG6YYHsOO5YS6wM0D1i+4EpFUjd3hIg== 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=Mtyz/Id7LtYWFBn/7/P8gXCcUUxg9YUQhRDL5xyN0uo=; b=RyEMPNE2z7zJ5WV7o2S30OTdYuAN3oRtWOIFay81ee/q65Il0MWkIlCdUAc175yBkshc2dWsPrJePQX9M/fir0BwW3W8fP+IEP2GaWKoBdmNO54DVZrFRiMXYpmqRi+eoUygxZUa54FB4cjJacS6fva2xjsO9utsYnOdf+Y2jc0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB8480.eurprd04.prod.outlook.com (2603:10a6:10:2c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 03:41:48 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b%7]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 03:41:48 +0000 From: "Peng Fan (OSS)" To: andersson@kernel.org, mathieu.poirier@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, arnaud.pouliquen@foss.st.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 1/5] remoteproc: elf_loader: introduce rproc_elf_find_shdr Date: Fri, 6 Jan 2023 11:43:01 +0800 Message-Id: <20230106034305.2868740-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230106034305.2868740-1-peng.fan@oss.nxp.com> References: <20230106034305.2868740-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::10) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB8480:EE_ X-MS-Office365-Filtering-Correlation-Id: 253e3d80-691a-4b98-f05f-08daef97f0aa X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g73t+q60DJ2bCRyJ/osZJsZFDFUQZUkOaG7mjP61qtUX/yKL3RUSLEihWBLD3hUt1Iwjxrw1T9DOXFIMoiTdzCLmDg/q9pKyz61BJFbOiJoMVIwPWP5TWUBJqr/gMpsR+LCjZdcs2CKKSSdKFcWFUftl6lffk9xsuc1rEw6jx5aiPaFnnKOSpbWDpZJ9mVdzTPPmDsBx7kzsY8TEOSHlW61qNz+l+X8rRAsnhBuIFcFmQxXiWcCthpofj+yFHdXDPBUEMmtLttJesM3X4L4UKCQDbXE/945+cSwHYOylWjlrRX7owaQM754+XNobXfGc4gGOtbl2e1Ete8R1P/OMjpnrTyA3cJv7oSVNeN1Hc3qQHCCyYSjcRKbdNtXsstF+PKv91t61XN/Y8o4kquYEv//hfMoYo7Fj7rp6GaM3NO4gsnfW4lH6oDXL4tjslpBA6c15HXcW9RfsTLVkLHgxOrD3ClbO/HpC8C05lsXSMkeKyWI/FJ53h0PxanbqPErgDmzjudkKaF38tOYy4dIQdALROrmlGyQfxmQDmQgOJPmu+oMEt3GzeTIo1L5MumrClY0+vM9eAEeOzqPWswkYe+SQmdFGMK/HW4M623hJvscGjmP9sKfovSAJ/q7NmhKa2/UiJ5nyaIZ31snQG/YHGyPMiijAndGPigfH6N4xBJCMpjRtlHlcvSpdjbsYEF/gng24UbcqdTvxqEJpPjoJTA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(451199015)(38350700002)(38100700002)(6512007)(86362001)(186003)(6486002)(316002)(26005)(4326008)(8676002)(66946007)(66556008)(478600001)(2616005)(1076003)(66476007)(52116002)(2906002)(6506007)(6666004)(41300700001)(7416002)(83380400001)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QQ5I9sZ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UksqB/Rm0NkboLyU3gAsgs6XW415M/AHfPQvT8bpiyg3r9E+XG1fW/xKCrBus1Z1OikTfGztZO7Z2rDWXlp+ujFRq2OfgDO6laeXQ3PXHyCWNAnKfOz/Xi/eutERhn3OWEFakZ83fL/EyOiGFb6xmt9QHhIC0CogkqTluMqw37vb6E3HIlLLFV0PJ9Mpkwt1b7T6ELo6eilnqxisP+GFq+2+OBwCOIUJLshS3tZ1DiqpZWTgvKlZdoTgECDBbwdJ6aQzNIxTvNQuY5lWT4FEEwGJLyxFlEw7GnxYeGDlH+7FJtyo12nVm7s5walchIodHzz8fJGgcKbeyDae1bfLKNFiE33y8y7UAq3Nj5Qu6SqNiCp/yl8lYN+kaUU+uFlw9bPw5gNUZFj8wg7ekmzE5T4dyxqCttDOiY2YT2gzv76njKZ/wAqk9tM2Sx0WBSOlKNLAtQOCjViwwTzyfNXeJf/zC7H5g+hNobPTlcIy3uuZlccoC2wEXaNKkXwQM5w2SdrVFf2NkDqWtBalqBuU34 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 253e3d80-691a-4b98-f05f-08daef97f0aa X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 03:41:48.5368 (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: Y6/nYu1sLAk0z2ZkwONwZqiWtGgCAahxRwmUyuzSkIgb9MMf+Auyo58Fu3HKSE4XLwDvT7g0RylWkiFp5reARw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8480 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Introduce API rproc_elf_find_shdr to get the shdr pointer. This API could be used to find the ".resource_table" section, and could also be used by i.MX driver to find the ".interrupts" section. Signed-off-by: Peng Fan --- drivers/remoteproc/remoteproc_elf_loader.c | 93 +++++++++++++--------- drivers/remoteproc/remoteproc_internal.h | 2 + 2 files changed, 56 insertions(+), 39 deletions(-) diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c index 5a412d7b6e0b..c09fd5733aee 100644 --- a/drivers/remoteproc/remoteproc_elf_loader.c +++ b/drivers/remoteproc/remoteproc_elf_loader.c @@ -244,22 +244,19 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) } EXPORT_SYMBOL(rproc_elf_load_segments); -static const void * -find_table(struct device *dev, const struct firmware *fw) +const void * +rproc_elf_find_shdr(struct rproc *rproc, const struct firmware *fw, const char *sh_name) { const void *shdr, *name_table_shdr; int i; const char *name_table; - struct resource_table *table = NULL; const u8 *elf_data = (void *)fw->data; u8 class = fw_elf_get_class(fw); - size_t fw_size = fw->size; const void *ehdr = elf_data; u16 shnum = elf_hdr_get_e_shnum(class, ehdr); u32 elf_shdr_get_size = elf_size_of_shdr(class); u16 shstrndx = elf_hdr_get_e_shstrndx(class, ehdr); - /* look for the resource table and handle it */ /* First, get the section header according to the elf class */ shdr = elf_data + elf_hdr_get_e_shoff(class, ehdr); /* Compute name table section header entry in shdr array */ @@ -268,49 +265,68 @@ find_table(struct device *dev, const struct firmware *fw) name_table = elf_data + elf_shdr_get_sh_offset(class, name_table_shdr); for (i = 0; i < shnum; i++, shdr += elf_shdr_get_size) { - u64 size = elf_shdr_get_sh_size(class, shdr); - u64 offset = elf_shdr_get_sh_offset(class, shdr); u32 name = elf_shdr_get_sh_name(class, shdr); - if (strcmp(name_table + name, ".resource_table")) + if (strcmp(name_table + name, sh_name)) continue; - table = (struct resource_table *)(elf_data + offset); + return shdr; + } - /* make sure we have the entire table */ - if (offset + size > fw_size || offset + size < size) { - dev_err(dev, "resource table truncated\n"); - return NULL; - } + return NULL; +} +EXPORT_SYMBOL(rproc_elf_find_shdr); - /* make sure table has at least the header */ - if (sizeof(struct resource_table) > size) { - dev_err(dev, "header-less resource table\n"); - return NULL; - } +static const void * +find_table(struct rproc *rproc, const struct firmware *fw) +{ + const u8 *elf_data = (void *)fw->data; + u8 class = fw_elf_get_class(fw); + size_t fw_size = fw->size; + struct resource_table *table = NULL; + struct device *dev = &rproc->dev; + const void *shdr; + u64 size, offset; - /* we don't support any version beyond the first */ - if (table->ver != 1) { - dev_err(dev, "unsupported fw ver: %d\n", table->ver); - return NULL; - } + shdr = rproc_elf_find_shdr(rproc, fw, ".resource_table"); + if (!shdr) + return NULL; - /* make sure reserved bytes are zeroes */ - if (table->reserved[0] || table->reserved[1]) { - dev_err(dev, "non zero reserved bytes\n"); - return NULL; - } + size = elf_shdr_get_sh_size(class, shdr); + offset = elf_shdr_get_sh_offset(class, shdr); + table = (struct resource_table *)(elf_data + offset); - /* make sure the offsets array isn't truncated */ - if (struct_size(table, offset, table->num) > size) { - dev_err(dev, "resource table incomplete\n"); - return NULL; - } + /* make sure we have the entire table */ + if (offset + size > fw_size || offset + size < size) { + dev_err(dev, "resource table truncated\n"); + return NULL; + } - return shdr; + /* make sure table has at least the header */ + if (sizeof(struct resource_table) > size) { + dev_err(dev, "header-less resource table\n"); + return NULL; } - return NULL; + /* we don't support any version beyond the first */ + if (table->ver != 1) { + dev_err(dev, "unsupported fw ver: %d\n", table->ver); + return NULL; + } + + /* make sure reserved bytes are zeroes */ + if (table->reserved[0] || table->reserved[1]) { + dev_err(dev, "non zero reserved bytes\n"); + return NULL; + } + + /* make sure the offsets array isn't truncated */ + if (struct_size(table, offset, table->num) > size) { + dev_err(dev, "resource table incomplete\n"); + return NULL; + } + + return shdr; } /** @@ -326,14 +342,13 @@ find_table(struct device *dev, const struct firmware *fw) int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw) { const void *shdr; - struct device *dev = &rproc->dev; struct resource_table *table = NULL; const u8 *elf_data = fw->data; size_t tablesz; u8 class = fw_elf_get_class(fw); u64 sh_offset; - shdr = find_table(dev, fw); + shdr = find_table(rproc, fw); if (!shdr) return -EINVAL; @@ -377,7 +392,7 @@ struct resource_table *rproc_elf_find_loaded_rsc_table(struct rproc *rproc, u8 class = fw_elf_get_class(fw); struct device *dev = &rproc->dev; - shdr = find_table(&rproc->dev, fw); + shdr = find_table(rproc, fw); if (!shdr) return NULL; diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index d4dbb8d1d80c..f4d392fbaf06 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -117,6 +117,8 @@ int rproc_trigger_recovery(struct rproc *rproc); int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw); u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw); +const void *rproc_elf_find_shdr(struct rproc *rproc, const struct firmware *fw, + const char *sh_name); int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw); int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw); struct resource_table *rproc_elf_find_loaded_rsc_table(struct rproc *rproc, From patchwork Fri Jan 6 03:43:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13090909 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AC9DC3DA7A for ; Fri, 6 Jan 2023 03:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbjAFDmA (ORCPT ); Thu, 5 Jan 2023 22:42:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbjAFDlz (ORCPT ); Thu, 5 Jan 2023 22:41:55 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2076.outbound.protection.outlook.com [40.107.247.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8CA16A0FB; Thu, 5 Jan 2023 19:41:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ipvAQX1eb1gnyCrJSO5X3tAYVuN3Yf+hiwgAV2ZoNQzExEY0vjrXDVAUXzqJ9RU1OniZdy5sPrewgln8J5I4hWjpor7bvj3PQFI7Y7mfMZQ0xpKJpsjxDazbYKPiDTyRorGd0iX3at9wfTWogJBxzxBcAwCDNOKgQPSvh5gdI+8TSGd5Yifi6FghlXTsSbR/dtoRrt3bwHNhEOQRL1dQ7sQawFb8e0a2XsbVuoNhbftOkV3BmY4RBtxQGZ0iFLt2o2gPi4czzdOAZkgQ2YbabG4v+PyO+CfcBLURl90huJ4iSmC39eaI4RUphctHeuZ9zqyTfSaprX9D5Ed2Wmuu9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=8lc5MM1T8vUGaBjaF/rjasRhwDWKTZxJI6RGsmSNl7M=; b=Ckfup+3lhBy2INkHNIGaoit6FKFs85EqpVapuPnWDDEBJ3wY62NTsqS+kAdPb8CZ6ZMnwr24qJzFHTuk9CeYO4QQ9OhARtQeJLqg6ZiVwakqOLabmKVKwmqyP/QfvhtnSQQ9U+dc+ypfgtUTS3cmK296bYMP5kJsnsiFrfBXUkDeaRybFjRDSEai8P+l+VlZfaFX2tXWcDkkJvRccW6Aqj11iBWBYd1RDqFEJIKSoeBxcq6iqPrxDF6/WsIqiO5dMoN/yRBIRBRFzYo9h0h1XTnZQBmBy28dqlc7j8qlg28pwsGI/X3vzX8LH2pY8W0/b4+XXEew9Wf0X8IA0v0THg== 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=8lc5MM1T8vUGaBjaF/rjasRhwDWKTZxJI6RGsmSNl7M=; b=FfYtzZd302JtFxaUbdlwWmIxm3AhEegPph9/NxtrJwECvHsUpSXqM8mYbSo43WX0UQjXcHaxfvXBI7ryjH6wdqlS2q4jRNJywbrKzUvNqrjD1pgxGV/pgE2w0dsxJOspEl+isPPfMOYZ0xNeW7dvbk/Fzj+p0SGl+zkJe8HB9Y0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB8480.eurprd04.prod.outlook.com (2603:10a6:10:2c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 03:41:52 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b%7]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 03:41:52 +0000 From: "Peng Fan (OSS)" To: andersson@kernel.org, mathieu.poirier@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, arnaud.pouliquen@foss.st.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 2/5] remoteproc: imx_rproc: add devtype Date: Fri, 6 Jan 2023 11:43:02 +0800 Message-Id: <20230106034305.2868740-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230106034305.2868740-1-peng.fan@oss.nxp.com> References: <20230106034305.2868740-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::10) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB8480:EE_ X-MS-Office365-Filtering-Correlation-Id: 1db7f10c-35d7-4d14-54c2-08daef97f2ee X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i4QGogK0i9ri8FlC0+YPIgld5HNEeJwUDdkdwe9KrFeaMLzizgfx55mkYpc/sZTYfuCFWnTkpidTjkTj4IS/sw18tcUqSMTVlDqoEG/OPDgZrzdfpN7camCm5Qx2wDORKU4cpQe4V8HcsAqbEf7RL7821y4M2VZhu29dxZt1Hp+LwOGgUTTi5Zym1cXyVoNrioAeapQPszTJNg9lr6yAyZMC1TpvTuhWmYAReP8cc5uq3cSnpoWFi1qtN73KfTd9BxT5P3gYmuhUB01FA3mh2wRxjSmG91uvrCVeHvH/dZ0z4CbRTgSoRfVCHV84Ompu9qlT+p5WhJj7C3jDgAQnekxfKuWbTqYMqhsy3ePRpFbZY7SHqlUcd1/LmpOSKYXpt2sMv9eZAbXD7Qcy7GIvoQVU54g7KJIvQ8P2INYSwfKVmozBMzRWVZEuz8WuG7RbulDSwQTt3UfGxTS+ZBfL2xl6HZ0yvHVzFhEBJs/0ivlmhXu7acRNgEkWaBWdoHWjHQw05oSDosQzCbqK1buZKJ1zXXykQnVIEXyovThf2WnUe+bllNz3nx7Ba+HNFyeXFzxt+kA1JOgNUDnYP6phro9diNlpT+QSy7fEZrXlRC2hFImLUIzXcxkTowsuO5tQeYsW/9Gs+pAkYJ73s04FA1tlaO1FYucGXpZuSevDQFHWgjeYu7Ws+8qixNE8TKvJTIj73fbk/VkqCa72Kaf1Dw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(451199015)(38350700002)(38100700002)(6512007)(86362001)(186003)(6486002)(316002)(26005)(4326008)(8676002)(66946007)(66556008)(478600001)(2616005)(1076003)(66476007)(52116002)(2906002)(6506007)(6666004)(41300700001)(7416002)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hDLkAeigymkDvIOY/r5FVeiaOkqwEZBs2WD0pRslphaTVdojrzP+4/RScN95mIUuLuiZcg7N6TmtHQUTfPpBgke2dbcVu8GrgfHRYhXNUEDMRc5yklmlCZyEuqGcpe/gnyN0iXxjyHhR7hq7YTh/uhb6RnmI4b+4N0Xux+ipYRhqhpwHnDkyQac/QJb6yEqMMYmhja13sTqfEWC4fN2sW8rLLQElUi8fJ6zbtqyxZcGViExFUl/nCk9hjUFHVCGL+mJbsj+tlIS3uE7Q/L6b2s3tEi33G5fEZO1OoGfnR4U9lMbN4O4QL5BIauvwdNpnxKxBYmo35Cx1HWiOUQh9uJdsP2p8afWqzmIggr3vjYEmYi4lTcU+kdG7gHxEv3u4jypfr4C0ittA2KDg6bMcVBWA+0uUCSoQ57lJ7n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ClUfAZXL/iGvZOnpdX2hSQpSEMTJrQAFHRk4//gQFwWiXUKVLnZNDHxc1Py6jE0a/jqWEdcTCH2N5Bz8Bn0JMIeavij X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1db7f10c-35d7-4d14-54c2-08daef97f2ee X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 03:41:52.5214 (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: hgytj/opKYnAJ/yO4pBzwTAzbusJsShgZ2sPKOS3rbsnDFAb9Y6oFbw7u4dqj4g4uYvdpB+lYwsgfnwP4UrZ7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8480 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan Add i.MX8M and i.MX93 devtype which will be used when parsing the firmware. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 3 +++ drivers/remoteproc/imx_rproc.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 9fc978e0393c..8a282fb67a4d 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -289,6 +289,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = { .att = imx_rproc_att_imx8mn, .att_size = ARRAY_SIZE(imx_rproc_att_imx8mn), .method = IMX_RPROC_SMC, + .devtype = IMX_RPROC_IMX8M, }; static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { @@ -299,6 +300,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { .att = imx_rproc_att_imx8mq, .att_size = ARRAY_SIZE(imx_rproc_att_imx8mq), .method = IMX_RPROC_MMIO, + .devtype = IMX_RPROC_IMX8M, }; static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = { @@ -349,6 +351,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = { .att = imx_rproc_att_imx93, .att_size = ARRAY_SIZE(imx_rproc_att_imx93), .method = IMX_RPROC_SMC, + .devtype = IMX_RPROC_IMX93, }; static int imx_rproc_start(struct rproc *rproc) diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h index 1c7e2127c758..43b105ff0175 100644 --- a/drivers/remoteproc/imx_rproc.h +++ b/drivers/remoteproc/imx_rproc.h @@ -26,6 +26,11 @@ enum imx_rproc_method { IMX_RPROC_SCU_API, }; +enum imx_rproc_devtype { + IMX_RPROC_IMX8M, + IMX_RPROC_IMX93, +}; + struct imx_rproc_dcfg { u32 src_reg; u32 src_mask; @@ -34,6 +39,7 @@ struct imx_rproc_dcfg { const struct imx_rproc_att *att; size_t att_size; enum imx_rproc_method method; + enum imx_rproc_devtype devtype; }; #endif /* _IMX_RPROC_H */ From patchwork Fri Jan 6 03:43:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13090910 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99E92C54E76 for ; Fri, 6 Jan 2023 03:42:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbjAFDmN (ORCPT ); Thu, 5 Jan 2023 22:42:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231876AbjAFDmI (ORCPT ); Thu, 5 Jan 2023 22:42:08 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2057.outbound.protection.outlook.com [40.107.247.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20DB66AD92; Thu, 5 Jan 2023 19:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AXnC0m9dUUWGgSBapwnjhomtS1b+NFPrleGXTKdr3zspZzoAy5CzBBlDZKBWbMaUA9LVVYeAEwxyXakf3LW4OKXp6aTvdVYUXBIkB9PBdpAJSdAoJuveNulMxpSlA77sr7x+57Tl85SzjLEsqN4V7gU1vx30GwZidiNzFFD6Xc4h8I9Wx0l4Yq6Ka2xr8EpPN8/puOgOK8cT+43ZkYtJITjLu2NU8o7MERNKCXbb8EgHRXg3T9Pjai5rnK/a6QBy4WLajxONBMi1H580apjuXADznMG3rmdfSEPu7tz8pQSuvcOE1uQiQMZU2NT53GYXTwHi+ivxCLOsz+B1A34ROw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=YSPoFCp1WU1ODs5miVRwkzxQHfokDiDO6FyQQnFZ4VI=; b=Godh0CP7oNaNgyjv7/RFf1b3h/IdyRU3I4cRjNRihZG1AsmRDSMiNLTSy1nRiS8h0hfmQai6ArFCD+h/wkCFDo8HBf/tjcmxJhE+fXvXrgVi9OSpQvpvp1xtS3dedOksUGLaqApH62qw8tnoI3JjCkie+RvGMK5R4MT9GW4gKSmAlKYkqJb+WnjGmires4Z+aLt+QGgFvxrrWTnLEqSQDR8qy1+SeIcONzs478j1vImmCVFq9Mcfj8rSE2pigMEFwMYXATLGJaOgoss4UNST9mQkY7s2R+/YC5/NrlU45JaL0w8pwvgRny5IMp1t+9oFAJnBDtXTONcqSYTfWOpqVg== 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=YSPoFCp1WU1ODs5miVRwkzxQHfokDiDO6FyQQnFZ4VI=; b=MOKxhtjMvQ+ubQlyJz/mNxdwROPkRJmevdyWlSeevWFu09zWxeQ2m4J0cng0Zte5iWnbHNB5nt4ZKwS1D6aL8iuL9p7u7aC+lkVMmomiLmRyXAuhQ/A23mb+8FiKH9SoZj47+Ytan36e1id9LZT/tvE5QzQvFA2SI3nrs3X842c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB8480.eurprd04.prod.outlook.com (2603:10a6:10:2c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 03:41:56 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b%7]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 03:41:56 +0000 From: "Peng Fan (OSS)" To: andersson@kernel.org, mathieu.poirier@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, arnaud.pouliquen@foss.st.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 3/5] remoteproc: imx_rproc: correct i.MX8MQ DDR Code alias mapping Date: Fri, 6 Jan 2023 11:43:03 +0800 Message-Id: <20230106034305.2868740-4-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230106034305.2868740-1-peng.fan@oss.nxp.com> References: <20230106034305.2868740-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::10) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB8480:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b0d759b-242b-4c82-b0a8-08daef97f550 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7vNcCEdy1ALPxlXeLGMlPMZcc+RLFmW6301g2lij2tOuYVFYvyTqqhn6Mp2OgXuSH9bx2TbsJeEKI9S6dTmC/DRrdDLvUanG5kUOhKi8YzUO/xmvFkVag01Rovv5tQjf9f6SKDor+osEO9HIPIL93H/GvtkND4aCPQUtU7o+EZiAUt11CfS8XL6G09bZ7uSCMguIMqWZorK35dWCwtoXRGeZVxxCSi3wI4LDs+nB2UfQDhVf0nEjeORlAs8W3XUVyNR8vpJg/HA+EQOQBAvi0NmF+52hTRpYoGdv2E7xuttVekZxuLTsrTDiLw60iSGGkRmw3aKH6et3eCLeDhesCL0GPBdc7Qbc05DlzCnAQUcMZ55e36X/EmOsX0b0ioLc9JhO3dHLyiGPS6TDBVmPAMAGKrVoDpRgS2kAxQlaFAav0Wgv2yKX8JInIW3ZcGYQLSZf+DbRTS6eP2Mgy+vID5ZlLxiu4mICERb69OB6WuxWxynlaB46Pw4QQABfIHn6GXo/D2kx7L5mGBKG3Xd2q/OQVsT7ShijAzHAmWa2xLIu7j2rFAveai1wE1qUPFmlUVwzQ+ipD4UoEVgRkobnfBFhjJv/IzYrkoI9uf+vrtYcS4PdWrbCFHIkx13lU/Cry5iMzwXCIqYVtUhXsHcelcr91zTuyogpAlCiTGmQPDp1pHiCUW5YRnwzIeBYWmp9LfUOoOolwt4riolLLRAW8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(451199015)(38350700002)(38100700002)(6512007)(86362001)(186003)(6486002)(316002)(26005)(4326008)(8676002)(66946007)(66556008)(478600001)(2616005)(1076003)(66476007)(52116002)(2906002)(6506007)(6666004)(4744005)(41300700001)(7416002)(83380400001)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: suJGMPSU5aHxb5t1+3Cf26whiPHK6BO8UoJEXNX21pxOzwkTpUeydZCTcIpygn92cCjbn3q+bqsPAZhgnb9iiuhvc67O0nNDbt++7x9+2IJ7PPelVuiIOvLqn8o3iT0+qQDwjG08tdweTj8mKegyMX6HVMHh8KSb/U0BHiryrlRDwY/hqzIlcgTNagEzmyuydjf0wXnRH8fREdW3DbtTqSpHzij8xlwnyiyJTeaL5GY6d81etUJyugpETQkyya+v7uFockaF09L4giEYYgQOWjkJ48hIUM+JY3RtnHrYulkDPD24ubucxFpfAlULuM86aPH/Ti2DTb79iAfjZoR1hYGMGIFKmbaaqKRpmXkxqk9ztRAOgech76arR3yXDNQWZLaQB1a3D1iYLgTDjvTrKHQQL+3FjxYqSyrTYii4bE9LZjY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MYy2oCBSPGDr1OpmZg2vA+RtQC5x8qpHISNLZCzJES9DHA6ibYpelQdtYd810+0vpd9K0bgEenUA+415HWWkRRyP/WMpUWzczup X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b0d759b-242b-4c82-b0a8-08daef97f550 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 03:41:56.4120 (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: ryXRMnyn1VSx7pNMPAljOZjQnoph/3DUS1BLgPdD5AduwzTIKFb2KfqOjwZkjXQSdesuXGFRnmCJJACxvndKVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8480 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan The i.MX8MQ DDR starts at address 0x40000000, so correct it for the DDR code alias. Signed-off-by: Peng Fan --- 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 8a282fb67a4d..13199e593b47 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -206,7 +206,7 @@ static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { /* QSPI Code - alias */ { 0x08000000, 0x08000000, 0x08000000, 0 }, /* DDR (Code) - alias */ - { 0x10000000, 0x80000000, 0x0FFE0000, 0 }, + { 0x10000000, 0x40000000, 0x0FFE0000, 0 }, /* TCML */ { 0x1FFE0000, 0x007E0000, 0x00020000, ATT_OWN | ATT_IOMEM}, /* TCMU */ From patchwork Fri Jan 6 03:43:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13090911 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86D23C54E76 for ; Fri, 6 Jan 2023 03:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232030AbjAFDm2 (ORCPT ); Thu, 5 Jan 2023 22:42:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231923AbjAFDmL (ORCPT ); Thu, 5 Jan 2023 22:42:11 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2057.outbound.protection.outlook.com [40.107.247.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A95946A0FC; Thu, 5 Jan 2023 19:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Enxzq+IxHpTyAGM9cS3xviSCBBjP2+JRw3jb8g9Q0oT9Myu7EprZMHTbrkO+69hvkruwOJE4AHdcBZvO6zcVLCsOjDssPKZq3dxfET9T9AEtmOJBL3Huq8ONh9DKUmY7bPIvLQvM8Qh3TL7oSK7aQgzUMQxRIZbpBqMVcbz+Pk/FUzMFjSqfnFUCdbhVTX7Sdr14blbYffJyORCMhZVOpl9/2CKNviEvtrTkKzAGFj9u8ElJeVHUjTxEwplkcdx7/58rCk3GCu8ggIjCycDUCozv7NHV7rtSQV4Wof4mv27/XUNQEiYn2L7j9WsmzSPK9vVwwUOsmzv9THaSRTA54A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xYjpcui40d53tWYIiBAMBJIEqPJx9z+VymgxfqhVTZ8=; b=dzYEOSkYTwbBLhoYM1oFY4xa1k5QHgyi2OXf8iewBl9i+5VloRGI3tMhBDSMwa96KZycxxe+hWtW3k/wh/DLUh2tmaIAy+MxDqFBaOfrkfCWo8ylOBCtpikQVqcdvxNx/909hnuqwRhzIum9sNNJi64jjz9I1mRi9G8vz1UhNAn7XyGZ1fXQhznjpmpkCGGZPExh+rckcud3kyvPDPP//09nKAtoCeEunUx7RRLEeAUvkjtQkur3ZPqHXdZet/dmLEvCSpJmX7d8vch0XHD9ktBGUsgpJVYTPib+9A573dEGBzh23kEYwRPeNFpPf/MnYxZHJyPuwCF3AKNB9U+TMA== 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=xYjpcui40d53tWYIiBAMBJIEqPJx9z+VymgxfqhVTZ8=; b=B12EREubryABvAAgQa9lxXk8BbJtIAVDoSjSfSTU6RSIpTTdiF7Er7JHSyVl7gBpTjztnX0X84Zz7R2UrBEvz0tM/mIGsh4DsLeFpe2W/uymWmJnHbDIVvQeJkraAAN6E2R5W1mkwFdM+hpxju8QGr7ctlCgXYvL9x+hoj0HyzA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB8480.eurprd04.prod.outlook.com (2603:10a6:10:2c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 03:42:00 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b%7]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 03:42:00 +0000 From: "Peng Fan (OSS)" To: andersson@kernel.org, mathieu.poirier@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, arnaud.pouliquen@foss.st.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 4/5] remoteproc: imx_rproc: set Cortex-M stack/pc to TCML Date: Fri, 6 Jan 2023 11:43:04 +0800 Message-Id: <20230106034305.2868740-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230106034305.2868740-1-peng.fan@oss.nxp.com> References: <20230106034305.2868740-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::10) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB8480:EE_ X-MS-Office365-Filtering-Correlation-Id: a8fb7b01-4c6e-4418-0ed9-08daef97f79e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4Jx4C45/GhhUVIdWcy3Ga5xLWKr1LuXmvoCtxaEuLyE66rx/Huo2k+pgnFA4DSJmkksXgMSDVFt9wFP5uGrSeaVMuVdSS5/G5k6DnukPbPEYhedTamtKEclUuIRMb4QLZ7vbUIfxnRAZV5HPL96rHqReTg6NXRxvIoMT4NBfoKTvMNz94z7bx0CeVo2RpvljQjjo2ISQltDvC0d7PkalFe1Zy3dmDbE7a9YSaPfkdNLK+XwT0OoJh3qbDofKk/975CcynAhcTTOaY+SgqYwDewpSicgR0FxkP389/HF85JuAWpKix8q4RkRAY1uZA9cmgUhZtkFdOsll0Akg7PhxAR1oHLfSl2WAVMf4N64cdD+UIrWVaYYYBO2c91Jn7RgVulkd4B15tW31q8xL8LxQ/P4GxfFqNbksGAk6VuH4GobvdHm26bgva1ecOhEJmvkDf84gp2wO8nBSG3azUKOPGtEY2zK42VF9I0mw72QH6Wd9LmoSidtdxOijbVkhGngCFYgfV+mbsQjl2owPGXPrDxmbdi/ZgxcwfeVv7Yb4EtGv7t7OKPHuTKIzmhUcNq6Fqq8tfJzu7nLgcNkihkT2isH475AUs3o0f/9N1wIJePMQAQTt6YmNWr9m/9iHt8Opw8QGmYRezld0gU/bzEI1cwth+GJvmyKa9HaFSw91kePl1hDt6zW1fcQDlM8dJYLGWg6CzTQoOXFbFNZcURsgWg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(451199015)(38350700002)(38100700002)(6512007)(86362001)(186003)(6486002)(316002)(26005)(4326008)(8676002)(66946007)(66556008)(478600001)(2616005)(1076003)(66476007)(52116002)(2906002)(6506007)(41300700001)(7416002)(83380400001)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lEAFr+rCpHYT0TrJmffcCAu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RgwMJAYW4w+9kzpc+WJSf8BuuFkf6hmJmCpwvwYLWdH7qg9EZIlwsTukjglIKC5g79AeeT8aHTVpSE18Ydt6TTquN6UrDj45780FXtr8HtYrc4KXt/qyIzNkFJPyiXMxC2ugKxXDU9KKuRb+1OKIyT9MTJGzIrVKJK9WmgswicQv1zd/z1jvAUNwxMdYZPd5q6EfyaoALiLBL9vY1LJKlkFI16QSKbl9N5cPUxcdzyTQ1EzbQr5b57zB8Y25pnuxnllHvxJZZY9q+MCnYP/dhbrSN9W4AfJFnjEQsXpAfhzGwio7LWdAtbIs5KZsPSqpaskpeNcJM9XUyS5wPUxH38SG3KH9L6yHZ5YrgDB1yjm03K+FH96XtSR4+Ic7gliq3/9lSEwr5ZG7nYXBzSK2eVknZmYCfMnXpkza2R6a0e1BsMlS9pp5YG3uwokQ7F4caYj4h6qsmoT7JPZ6kZC9c8zpLGkwpTaZsVkU7HSAI7ANzR X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8fb7b01-4c6e-4418-0ed9-08daef97f79e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 03:42:00.1339 (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: gp0S0rpwl5l5yF4Un+8TS1IaYr8JdchuqXGgqL/Dr5dlSM01CY22l2unDMOYPkHgWmYwFdQngsFjYwUP2bFeIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8480 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan The i.MX8M Cortex-M core not has ROM. It has a requirement is the stack, pc value should be set in address 0 and 4 from the view of itself. From Cortex-A core view, the region is at TCML start address. The stack and pc value are the first two words stored in section ".interrupts" of the firmware, and the section is the first section in the firmware. When the firmware is built to run in TCML, there is no issue, because when copying elf segments, the first two words are copied to TCML also. However when the firmware is built ro run in DDR, the first two words are not copied to TCML start address. This patch is to find the ".interrupts" section, read out the first two words and write to TCML start address at offset 0 and 4. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 37 +++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 13199e593b47..2ddf89e15dc6 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,7 @@ #include #include "imx_rproc.h" +#include "remoteproc_elf_helpers.h" #include "remoteproc_internal.h" #define IMX7D_SRC_SCR 0x0C @@ -634,6 +636,39 @@ static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc return (struct resource_table *)priv->rsc_table; } +static u64 imx_rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw) +{ + struct imx_rproc *priv = rproc->priv; + const u8 *elf_data = (void *)fw->data; + u8 class = fw_elf_get_class(fw); + u64 bootaddr = rproc_elf_get_boot_addr(rproc, fw); + const void *shdr; + void *va; + u64 sh_addr, offset; + + if (priv->dcfg->devtype == IMX_RPROC_IMX8M) { + /* + * i.MX8M Cortex-M requires [stack, pc] be put in address + * [0, 4], so the da address is 0, size is 8 words. + */ + va = rproc_da_to_va(rproc, 0, 8, NULL); + shdr = rproc_elf_find_shdr(rproc, fw, ".interrupts"); + if (!shdr || !va) + return bootaddr; + sh_addr = elf_shdr_get_sh_addr(class, shdr); + offset = elf_shdr_get_sh_offset(class, shdr); + + /* + * Write stack, pc to TCML start address. The TCML region + * is marked with ATT_IOMEM, so use writel. + */ + writel(*(u32 *)(elf_data + offset), va); + writel(*(u32 *)(elf_data + offset + 4), va + 4); + } + + return bootaddr; +} + static const struct rproc_ops imx_rproc_ops = { .prepare = imx_rproc_prepare, .attach = imx_rproc_attach, @@ -647,7 +682,7 @@ static const struct rproc_ops imx_rproc_ops = { .find_loaded_rsc_table = 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, + .get_boot_addr = imx_rproc_get_boot_addr, }; static int imx_rproc_addr_init(struct imx_rproc *priv, From patchwork Fri Jan 6 03:43:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13090912 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4734C3DA7A for ; Fri, 6 Jan 2023 03:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232089AbjAFDma (ORCPT ); Thu, 5 Jan 2023 22:42:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbjAFDmM (ORCPT ); Thu, 5 Jan 2023 22:42:12 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2057.outbound.protection.outlook.com [40.107.247.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF08D6B589; Thu, 5 Jan 2023 19:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y620mummi6E1HZlIvTwdYFrD+LkWUAKQINrnqHKFwzGNyfbUNau7ue3/Xg7PwZLXFoV3V6hM15oAyfFwR4gg9Gkfvaaaa3DvHq478Yg57JjYVm2qv9Wrz98P3BtpZER3grfZEzd4plTIKNgj/2lP9uaNMP9QWDR+b1uNYQOxhTXg91ebEO+wGFkrDBkfa3tXDCX6+b2qEF5aKGUShN854YyPu92e9Wbf4l6ffdsmi3v5grE5gvxy2/mY32JZPXtZMDX6X/Ltkkj5dkwzR+k67ee4cZqc1wX2ZUcU6FCqLhUPoKhNLKCU22d+eRfVT1dF6gTL1+pW24HCEfgHnbm2iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=l4G5wZXUhS/UCosIeUj4Y9NRHxRLQxGvBi6w+2JckDA=; b=XC+UBeQ2cWpNFlut0AOqhTnF51xIbFkgbN3VH/AtoX5PJ5uJEDz2Qmkk6CSmnbs0j8eVm5m+ZM1nXrbIZm1YnattzMSrUsZ5xnlRGCjfO6ZWR8e5wOGb6g4cBOZeAy4TTymVOesyaevBYHsenbH20jhWuBzk3zh2Y4Y86TAp7hWTwYsT9dGotEg175rkmzShV3uTiKoowhas3P1z8cqOzbjzi6Rbuht+YMH27chKO2U9Ncg1UwOkJRcZBt6EYpFg3yTLm2SXFWd0vyA2TOvAEiyHe8/f0Kc68T75tC4P/qD+2h3IG1uZRlLr0oKImnxJ9AGgFOlXcJoiQDhL2C7MvQ== 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=l4G5wZXUhS/UCosIeUj4Y9NRHxRLQxGvBi6w+2JckDA=; b=banDoSh2TTp8lnb3n+pmi6eBGviO8m+C2I839C6/Cuu0w7KsXcQTF0pOWiDayJy20z+9Z5ZhzvYxFcQs8uxqtYGUNNO6SMr5U43cxCNg/R1B5VzgADLmwniMY8gaqdWPpSz1KD4gUiI1FOV9F39qqSWoDr8GsYcpyhiO4GaIVHs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB8480.eurprd04.prod.outlook.com (2603:10a6:10:2c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 03:42:04 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::29b9:5061:2054:174b%7]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 03:42:04 +0000 From: "Peng Fan (OSS)" To: andersson@kernel.org, mathieu.poirier@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, arnaud.pouliquen@foss.st.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 5/5] remoteproc: imx_rproc: set address of .interrupts section as bootaddr Date: Fri, 6 Jan 2023 11:43:05 +0800 Message-Id: <20230106034305.2868740-6-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230106034305.2868740-1-peng.fan@oss.nxp.com> References: <20230106034305.2868740-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::10) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB8480:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f2b2bb6-fd75-4aef-7848-08daef97f9d5 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VdsBD2on/an/hcKwkbuwjPJ+awFyNhU1Dz8dIvJYFYSVWM+Duh07b/PdOynDbcwRJ/gkbvfjBS/SEgbQ70o6hoTo7JHb7Pu1uXme2mlIFsskTACouSxynGZI6s3T5eXQ2sy5BMk497YUZWEvho0wa09j42v6kGDek8C9pvY/S0irkdGCmNwUJH3LPjoPT3xTBRz0fzCdDsOjGJheIPIVqBZE0phcPBADZbLG6W2KfXyqXQnbHaeClE1iBVc0d3GhA/JT0rDKW/mu0EAFvp6gN4H1D0XJz77f2qcg1JS+f554NsB5t2MVm9Dejnzm7BLmNIXi9VixB3+Mqw5qP3W724xSrQJwoqeSLzwRVTzCoRF56vAxRIt/oIosCLcLdRtlAzgEqIj32lIaVHTuTtsVT22KIz+m3tOVNj05KU3TJUEzxrd63mJoa7fDOyuTvdeKsItqW8LhbiFWwGwbjTrTvrb3ZHRs3uXDYJXBgf+T+DBJO88g4u99vzvLDJfX495S1ctxMExCblB6R5TLkL6FbEAYW3MZo6E9hfXTb106Y0i3EWiMdEqBcbkQkOBH8GDcUuNSwt3FjQ1WkMIrGLTmDRgFDefSPsgJ9JuovdZx/Awh/9MWa9/vvWkSj5cxc/7A40d72LAuZ++j2pDqWBS+9uJ38wLQIvVqTTbBWhVtwdHOV+P6Qehpi2misNJ+OyVi6ofI8SCaysQbXBQZ4Bj2xVwPpRWNyYRhG+bUAPdUox8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(451199015)(38350700002)(38100700002)(6512007)(86362001)(186003)(6486002)(316002)(26005)(4326008)(8676002)(66946007)(66556008)(478600001)(2616005)(1076003)(66476007)(52116002)(2906002)(6506007)(41300700001)(7416002)(83380400001)(5660300002)(8936002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yOwyW6kCwV3EtfQ4Z9RRjSsr1zJDxAHmXLqin9lOxufFGkvyDymCqy2FwivoZxpzVph+xaWGKSFKQAGhDM4XLfxNjLqkX8s9qYcsypiNDsUq/PgZEEZSIUZsgH7dyyGisgwazeTAs2mpR0fWwpRlSYeL3s1LvUnGyYoEW/3szA74whlpn4hoRRIvkWv9cmullyhjAB/WvcBnCziK0VOwZTfKW4NK3GFlbEcuRpD890h8Br3rG2AHrN/p9GP5VwJezYHpxUYxXYHgSTG7SszBtXuL3F34fpT0IrhOKD4OETBpIiUeOhYwKgRmbZXlJWrVTx6PBPA4tRL020gwrhg7YRS/KDbHiP/dhvtGopCY5V6/4j8Pa8X2sCZT+wpTvO4pxnV5vYIFvhwKjXETNTOOw4vgupsFzF2pwgJwj1xzxYeRfFC1P2AmD8mA4g9Z3f0En7n+5Ok500N3hSVJd9q3JBadUG13CS+drz6FtmshbE71ILdnaPXCrqMbiD6jKJ11HmD+E5NV8/3YyLhCtLK0RCGDLTXADY4Aez6OZypy8aWlsunIndYeO3VoXsYxYWqqwiOX9dOgxMSyAfu601rkqqeci4nswU593MZ7us7DEvYflgjL7XfeSLzNrMWwx2cDJzdTzGvrY/BZ7d9bYA+ndrO1Idj+FadWmTDZ3IJGNya0tUsUPbtyTibwur3GJPx9i6WX2JLTyjnnVzLv0utE95lNaHOHIcOMmel5Bt4SSYS+qyCO+XhbLCrWp4eD674OTiyP5NoLHmZ/eWpHCL3f5ttT0Qdw5viGJOaZSsZrRdGmOww7WoxIwWl1rGWwneq4oYuoZemj9FtVqobgAyZvY33IcloCcaupSGGdFR6v0jPRY1yEdaqgttv4FDbRtk0DD3BjBxyDJpD0ICAvGKSOflUWVsz3q8ijdxF1cNY1Na4FwXRb0L3UOE16685/l969Wk4mC70LfG0Mn+r/INqTOqeLOTIHgJKu8Ng9fn37X3RJdUZvnWrnlS1yodee+qsTx0EelHy4ohpL5AszxlrSG8BzQ75ND2S8h6lXe8SYS3qQwZPdWHj+/elkoHFJ9zkah33HeJLVTwpyhpruWSEIYSMuzF/X3ecnoGO4hoBCxt3Z9+i4rbHeBdmxCOCVR1s7qBhmEwJtW6EweukOx/lSZIq9q2Mdeoa4vknr/5s9NyAkgYAttc5e+NJQd/G6sn6fLA/+rHXfaw/4sEZcCO/mg0Vd2XvVCif4GNh2FvH5hijAFXY7bRmuKiRg8uctE04Rp0M3A3V8Qxx3DltL9Sax3+YtmhRL+sD7iSaR7nphr+qEzE7KlwTNStxnFdE1f5EzGxKn2OWrKZTVyDa9wEU+9ohVQhRMOIMyjWdyaKMhs/Gts7kwrqdEZH0Iq2BdsLbnHwh6+aqYvyJdo8T3GbZUD3l6UPPW2E0LBGlbWCG4OFGHOdcp8NeluNCzYJ0wUShrRqO3xWYmumyi8MkS3lV/0RDsHb05DZqecuDpI9j9a3yaNEVtehg2sjMYcT3TiFLVTUNFBtbJA0viezjxfE5+5h88DOv2AVRtxd8ugIC/S6Z5ydtqKTVytXkx/XwdCMO2 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f2b2bb6-fd75-4aef-7848-08daef97f9d5 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 03:42:03.9462 (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: R2D+nKWlLmLS96ROjvJCgYgTzkp5LKLzjY6yrqNgupnpoSnqY7oqbe5ek75vhDAXTyX56h1UJSPT2An6WRkDCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8480 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan i.MX93 M33 has ROM, it needs the ".interrupts" section address to start M33 firmware. In current design, the Arm Trusted Firmware(ATF) use TCML start address when the 2nd arg is 0 when SMC call. So When the M33 firmware is built with TCML address, it works well. However when M33 firmware is built to run in DDR, we need pass the ".interrupts" address as 2nd arg to ATF to start M33 firmwrae. Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 2ddf89e15dc6..2e90fd470198 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -374,7 +374,8 @@ static int imx_rproc_start(struct rproc *rproc) dcfg->src_start); break; case IMX_RPROC_SMC: - arm_smccc_smc(IMX_SIP_RPROC, IMX_SIP_RPROC_START, 0, 0, 0, 0, 0, 0, &res); + arm_smccc_smc(IMX_SIP_RPROC, IMX_SIP_RPROC_START, rproc->bootaddr, + 0, 0, 0, 0, 0, &res); ret = res.a0; break; case IMX_RPROC_SCU_API: @@ -664,6 +665,13 @@ static u64 imx_rproc_get_boot_addr(struct rproc *rproc, const struct firmware *f */ writel(*(u32 *)(elf_data + offset), va); writel(*(u32 *)(elf_data + offset + 4), va + 4); + } else if (priv->dcfg->devtype == IMX_RPROC_IMX93) { + /* i.MX93 Cortex-M33 has ROM, it only needs the section address */ + shdr = rproc_elf_find_shdr(rproc, fw, ".interrupts"); + if (!shdr) + return bootaddr; + + return elf_shdr_get_sh_addr(class, shdr); } return bootaddr;