From patchwork Fri Dec 4 07:40:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D78D3C4361B for ; Fri, 4 Dec 2020 07:14:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6794922581 for ; Fri, 4 Dec 2020 07:14:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6794922581 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9giX1uzltHZFPikXVWqgjd2TGT3Hrp6fv/R6XxSmTJc=; b=AFuq0lDGe34n/qV+6GtFMB3qZ 7og6JyRrWgVy8iiF0X2zIFtvcVaE90WCbBSKvtemqj/wMRQKsSWdME5jup+Ac+qOOsr/ntvfY6PoE IEJQajLrW2t3MuFL+itwLrlIRjRT6kio+3j9dcdVX5E1MpJkQYD7saUyOM86fb0gju9wnjtmPzMmg wdoTvETzGM2igVB3/cLGQu/fL6ew3UnoyseNVM57SPw6kew7O4Mup3nc1WIWxAlOoEY5vVTM1bFU8 leoNcH/rfVBCZzM5kAjxIm6gY1M0px+BY2dEDAn3ybM7WxykRLWUU1j4DK24hIvNyg9UmI+GIzF62 JHeSvTm4Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5Gz-0004zC-Jp; Fri, 04 Dec 2020 07:12:57 +0000 Received: from mail-eopbgr60044.outbound.protection.outlook.com ([40.107.6.44] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5Gw-0004yJ-HY for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:12:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WFgd21kaOdaTmiKVeNeF823SGkManiZdXjS99IWpqhuXQDcbmBHuaMDZREkLG4T2moCIC9/zuo/EWQ5u0wtkbTziecOtbpfU2NSlqLY2ehSyBeaUkqxicb6GKTxIHbI1+LweP1MmQgy+7bRBs/7zeUOQg5ZMCz9eubDyK0ESDC4DdCUVKY5esanekkM2hKJtdEpENd0JlTLJqgmyLLyfO0eqUIjjVaNaBONzdfQchxiW3RxJ3LCGhe2jT5tfQ8N7uAf/hTEoJbKcjJF2n++t4jWk4EOEcLy9WP+diVcGS1WFQEFnMKKqQsAdlcHkWcveULVfpHjb/rKqzPYuEhJbgw== 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-SenderADCheck; bh=TbHIk3RdLqqXi21+8pZBW4CmocG1F/6hgmHhROLpy4c=; b=E1TUaJGPbrs9QwPyW5oTMeonNhCzW0SeRCQzEJMvkFujAKKt3w4cnqFt2eoPysKw9M4EBcZNhZH3mMUBa45w8ieCXSAcNkJT+Y2W3UdvMlkDcKbAVNDUC1ueY0J10+ft74w/H48UaZqApzO7yThJ26AXjSUJimVTrYKMb+tGs46G08n/ZT2lwcumuxUt+2nmUUdAjc+TOrS8bq03BWzrFfm4mT7UhpbYLqKImC9t4DT6ScKNS3yne3sDGkXi37Eqab+Dt+srQPUAiZkScQDgs6OsNte91dE0zG0ueDdUg2J+LX0E27bKkgdutaTiLGRaatPGqC3rYYBaYjmC23ZQKA== 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=TbHIk3RdLqqXi21+8pZBW4CmocG1F/6hgmHhROLpy4c=; b=Oj2ksfG6a0Krxj0aYyhBJe2+lakx7xpVw/8ACAHWXk3LVOc5QAVfQXC0dDBGhzSJi2tFpTT5W74kayjSthjNeG2BcZQLXJAXKNBTX4jGYoLimcQrZFM3mHj1fK9YAfNjrJm4YykCbrB00u98vViorXbIfMjHcAiw7wNHI5LRWHM= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:12:50 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:12:50 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 1/7] remoteproc: elf: support platform specific memory hook Date: Fri, 4 Dec 2020 15:40:30 +0800 Message-Id: <20201204074036.23870-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:12:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3b0c9533-82e0-47da-c23a-08d898240287 X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lF2mouCJX0mxk/iOMgzMm+2wz2QBG+pVzal4yxPCP/pqo8c+YvlgSYGSwyzTNN9XQLe+8qIztSo17pzcm4hM7fZffH7bYxjDlOAAKW0ZM15KdZkRCdS1Lc3ik6t0PTzPbcmfVG05zfNfjQ7Q4CKrM5oY3m269WzpURSfof2V+kUY3DGVtTtfTsf0eTeHJQbGhi0M8apNgrtqr+8dAAcELqxfUEvGd1x8Hance4WQyuvG6xeJuqmKREa5u5p4Bt6/mEoUJmOe1KmcSXiFhvnV/Q35CHL1MkZLnOIAubHalThEm9OM4xh0+fKXILp92ZPZNbesPBloJmTYQlsOlPkRLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(83380400001)(66946007)(66556008)(66476007)(478600001)(316002)(186003)(16526019)(8676002)(956004)(54906003)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uMg96VdwdCHdsrMjHj8K7QFvBmqYHL6OrCsU8IIJaQVjsDTXaLHyHhCuq+UZxxiHM4ihaqV+pWUyftZo32LXgFvq8pvGaP+WUQ8zkgmWMiZQ3TL9JaSAMlZTKvk7wqrPVyGZvygXIxXh+A/JCanpSLEDmoU7DFoKVsD3AdqvlM253UO+bsdmE3VN81ym+o1WRzMqcK2xO3cidYh6RRWeF0Wo9OElJ7vZylBOcu8Y8pLal0J0W5A/Thwcp99YlZAn4ECuXSBnwa7PmgcWRDtwFqbPS5gznjWLbwWd8dSf6GyXs96Uad3hbJ3QTQu+TiF3A4lkzyvWyJUOMEefd5YcjwA85X517vWSv/sgV2HA9rpwYwjNSURkqpvgbTBTN14Wjre3A4IarLTBX4NWtJGeW6U3/OJZSpnMkqxi1gBQpkFmSIHUZsM9rDV7ZO3Wes2nnvLLZBODdLVz0N7+7m5PXq2yCsYrYHegY9GNPMmyb2OQubnyneLX6DqGz/U+Az76KCRnjMbxW+dgNyQYy65ZC7cpGhvDAS1J+z/VJqgsMVhFUynQzYfU3CKt+tHaaBrzqw6fGD8yxWsu/pLQ1HnTSxDJU0UjDpSazdwnKg+dU1MAP0hJ3MVcpTgUqvRj9JIDmaLuEjIRYZpprqMMA0kJ2l6iHlDsIIoMVeS8mkmXEpPYFI0avjUTyIVfekCcVxdW4pfTNbdI3q9VTIsrJqqpxjq1f8Z8xwDuVqlcAwcX4/vq//bQFuVZ4aT5GTH+d2u4ZG7+dk1ky9AqrN7P4b+m+nhpkIhz6Vp0/DkQvmZWNfsp2/rmUeByepjUbSkgGEBh1XavSXDw7CRMdzpOdKQ84QK1jkVTC9XDQLUE2RTjvY1JSgYxBBeQrw+L453lj/ZBetPEmIGB9GWwtwKhdMyFBTxe7JB6SyjjMD+Mg0ype8JGmS+MCZRSzVSlPGTTV9c/JJkHqbo4aPm6mhrDDvMA1ZW7dSMUNS7FUs8CShW0NsSTmFrpr2+v8xdqYiYdprz/ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b0c9533-82e0-47da-c23a-08d898240287 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:12:50.4619 (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: OIgFh/JhomGtZAjykH50EY78imMyIl0ptr3kCmAUIMxvql0+l2hGoLB82jrjAFXsCsTVErO0XSDHaSBsohS7rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021254_690395_BA410B53 X-CRM114-Status: GOOD ( 15.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan To arm64, "dc zva, dst" is used in memset. Per ARM DDI 0487A.j, chapter C5.3.8 DC ZVA, Data Cache Zero by VA, "If the memory region being zeroed is any type of Device memory, this instruction can give an alignment fault which is prioritized in the same way as other alignment faults that are determined by the memory type." On i.MX platforms, when elf is loaded to onchip TCM area, the region is ioremapped, so "dc zva, dst" will trigger abort. And ioremap_wc() on i.MX not able to write correct data to TCM area. So we need to use io helpers, and extend the elf loader to support platform specific memory functions. Acked-by: Richard Zhu Signed-off-by: Peng Fan Reviewed-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_elf_loader.c | 20 ++++++++++++++++++-- include/linux/remoteproc.h | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c index df68d87752e4..6cb71fe47261 100644 --- a/drivers/remoteproc/remoteproc_elf_loader.c +++ b/drivers/remoteproc/remoteproc_elf_loader.c @@ -129,6 +129,22 @@ u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw) } EXPORT_SYMBOL(rproc_elf_get_boot_addr); +static void rproc_elf_memcpy(struct rproc *rproc, void *dest, const void *src, size_t count) +{ + if (!rproc->ops->elf_memcpy) + memcpy(dest, src, count); + + rproc->ops->elf_memcpy(rproc, dest, src, count); +} + +static void rproc_elf_memset(struct rproc *rproc, void *s, int c, size_t count) +{ + if (!rproc->ops->elf_memset) + memset(s, c, count); + + rproc->ops->elf_memset(rproc, s, c, count); +} + /** * rproc_elf_load_segments() - load firmware segments to memory * @rproc: remote processor which will be booted using these fw segments @@ -214,7 +230,7 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) /* put the segment where the remote processor expects it */ if (filesz) - memcpy(ptr, elf_data + offset, filesz); + rproc_elf_memcpy(rproc, ptr, elf_data + offset, filesz); /* * Zero out remaining memory for this segment. @@ -224,7 +240,7 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) * this. */ if (memsz > filesz) - memset(ptr + filesz, 0, memsz - filesz); + rproc_elf_memset(rproc, ptr + filesz, 0, memsz - filesz); } return ret; diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index e8ac041c64d9..06c52f88a3fd 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -373,6 +373,8 @@ enum rsc_handling_status { * expects to find it * @sanity_check: sanity check the fw image * @get_boot_addr: get boot address to entry point specified in firmware + * @elf_memcpy: platform specific elf loader memcpy + * @elf_memset: platform specific elf loader memset * @panic: optional callback to react to system panic, core will delay * panic at least the returned number of milliseconds */ @@ -392,6 +394,8 @@ struct rproc_ops { int (*load)(struct rproc *rproc, const struct firmware *fw); int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); + void (*elf_memcpy)(struct rproc *rproc, void *dest, const void *src, size_t count); + void (*elf_memset)(struct rproc *rproc, void *s, int c, size_t count); unsigned long (*panic)(struct rproc *rproc); }; From patchwork Fri Dec 4 07:40:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEB53C433FE for ; Fri, 4 Dec 2020 07:14:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DFCA20639 for ; Fri, 4 Dec 2020 07:14:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DFCA20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H9IXtrbdwLPEFmk+g9eEyFCpHoMU2YOtOnFtLq0+VTI=; b=zY9HRgyzQOtuurT+pYydOy/BM klDCNA8LPcW9UWDKBG5m9vud8OCiV8KdMC+KBMjGRr2Fg8G3PJQ+1JDQOfLR2EH1JtZct2UCzPGaD glCN4R9rhPifSOpzjbt/yoqcC87YAJT6fl43uzInsMjU2lxhny1Af6U2DACHuPKAPyEM5OxxNoJcB tKmJ4JGobTZ0kN1eff/CadnsMJkbg8RCXFv15c2GbMfwNJ2z7lPsIM0xyO7wUOdOINm2jq61O0PXs /XVRy/UOTGFB0q0tTJKSp1TECkABn3KBfuimxfMyPnVmrXrsT4Om5DcdjJ2YQuXwU1+2d/wx3yw0k 522A3Hs9Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5H4-00051A-EK; Fri, 04 Dec 2020 07:13:02 +0000 Received: from mail-eopbgr60068.outbound.protection.outlook.com ([40.107.6.68] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5H1-0004zU-HF for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:13:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nB13aqE6GqesOgiB6a4VXnUGmWvzdjKObeZ4ZZiS0yoUZEcREA6baMAw7Nx2+Zt4ENWhg9Hz8lFGvIAN8gE3NOT57YvRPHDuTmwzI18UHrpb6gA+pDmtS+TCS1jbXoaymSEyQNJLFyDEi9tonbq3fFYB4wNELaESNHVe31/3YSSojzPCdiekSFRzy6xaX9eNPsSVShu25tPnezbuulbES89gzIzji4Vi/bcqqLLaS/YVFtnY0E4aa+udDT0j3JPyBreOqYmLbvAkRvnOwmwiEOvpAQz56/R46NXpeOI/jUhEYcswHgHM5VceGQaFot7MGgtg9/USnw4Bk4DmrGBmrA== 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-SenderADCheck; bh=dIrXfbf48ik12T5YEmhpeZUyRG6RoaYP6vbqxR0GavM=; b=EpXE2QgIZL9jMPON6HkLisHSwMrGUTO4VHwXuaInGi/sXBLUhlT3750QTy7Ij0f0W7mFjNcs7TRThbl1A4J2AD4GJMYJ619geo1dAECEjM5uw6Ua0kGf8w4Lp3ins6wSFZd5wLB2D98DpyV/MHDOHLl4Hh0Kxpl6tevVUPSgWxOWm5BwrDFAdROQa+pwlxYO4vPLiiiju85oS8TLC41SFuGVFJREnFohxTEYkTBxKgMhOwr3qi/SpS78yen0VQ2p5prp9PDYtCZOXVk1mdA+uC1fKeSnxFRettrWgcux3HlJwzCNU7FaG+Rxq+D/K5e/95feK4Xamd7x2n4WE/LLEw== 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=dIrXfbf48ik12T5YEmhpeZUyRG6RoaYP6vbqxR0GavM=; b=mSEjtu2ejUpOc9vIBbDzMHopPTafo/gEgReYKJ1CUnzCWZOQUpv0uIBlMOFxAAmUySaR2ecGenyPqJhvuC8It9WJyjIqiXYeK9tQFXLi3zPTPLJ/4gXu0LEOBbbYy4WxI5b6HrCRadwZTmtveCurUGBsP0zp6t9OV6tPNA8or9E= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:12:55 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:12:55 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 2/7] remoteproc: imx_rproc: add elf memory hooks Date: Fri, 4 Dec 2020 15:40:31 +0800 Message-Id: <20201204074036.23870-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:12:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e4be73e4-01d3-467d-90d0-08d89824059e X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ijgu6WXqx/VReIfVLr5ow/FeGCfG9WkFfZz+38VBK7yee1vLxgotK/f2kTJ02XzUzJKUzADYJwkOFoQH0eSqOSiPhrGikXPVgCKce4QxDMcd3oScX5ZNH/OKbHeWtqllOSjlxnnS/Atowi93DeViBqVdF15c7CKZbF9dTTKPLnIImw0kOiDx3qdr94lXCiOOmOI3DIWzT69z6erYYi2BMJpCv176dCUGcMy0TQtls0pd/N3VchnfFYaVR1iMxcbhxHkb++9CMDgVVRPefpGS8e/EzZ5N3jZ+CkToW5bVkyU2m0abq5LP1PWnoFAnzFNccaoaxJgi5k6gUVc1+209hg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(66946007)(66556008)(66476007)(478600001)(316002)(186003)(16526019)(8676002)(956004)(54906003)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fKwjOBEQEfYKyf00zoNKMnO92D7O+OfCRqB/0ZuaPkOwJBXhYzeMnmJDvHlyMcXwBeUhanS39nx/8MPfIp9+ioBIT+7p3kIU2I/S3UpuFj8REVBa4DTpNZCWApTub5EUKU7Wb155k000m/ngB/mFjvmKZ8u0yIs/KLusIH55T4E0AoPQZcSuB1ESBLSFa+ntDuNJo6I/DPU0K072MlFV/MdcBKC1+3m0HrRHWPxDsMN5YQfO/YFOe85uLX0KcmujtLsOaft/q68M5dlNmg+k1fQW8vTGGZ3daHJcPapY7U2J6hckvRMt2yI9obGV9JvziI68JiF0NUTx1onylowGD4j7YrLGvRsMihTfQpHEHaC/t24FEdravpSCo1qDpoaSp3Ipj/a75D+yyqE9TYzFsdnoRYhYSYkLrp5e7SjA8dUhastX3taZjEGozapvghCLzvVeaZzUgZYq68HGRgBLiv4kcsE3DsVrkJp6A+C+M8z7+oxNK1XCptessWcxzlN8FbQ6Y82QUiqT5B7C80nudzJ7ghsuLTSbwkjELBC8rv8sTGc1tlV/6a8jgNaj28EyA5GVZTu6bAHNkTOPBzhylTAK4cGRFBbZ7imUw0qQYy0FeIIa37UPIsR9GCPSMYJHcBlp23XbsB+O/7WST6nkntaEX6z4X2IKNPUR6IsJeX3/hsFumCYwU0Xh0SFYQDIRLTr7zbT2KK5TsViMRjBRPpOyExRcaC29NG0yerexTOz8/NkwTBWgQ8zbi56wXVn3t09efQgxZ0QZahmv5xCKThpcmUs7LIkV5pQ5ZQIECCh5kBU7JQdy93SvoSYkrhSzPAYsW3ovWGaPb90H/uzctBugeztXYT6ze409XdLWjmjFcRknhCcwtVk0/iTK68ZEbCPOvDmxX2qdZJ0M+azXnTuVY+VxgSyD1bTZdFH2pSKTCCDu5clOFZ0LYVkWvD3Hp8mEHjx0aAPBBuZYQNn9ed+PXfeqBRMmi8+0WxFmpUdc0XnZvoEADJ2mFWX55wgT X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4be73e4-01d3-467d-90d0-08d89824059e X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:12:55.6356 (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: ULTq7zogRYgjZBhf4V37NeMporycGSBMSdXN2TMLIkryGQH0O+RZrS6s3e0kkW78HSYTfuw0qPcld+onvTGtsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021259_593447_A3637939 X-CRM114-Status: GOOD ( 13.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Add elf memory hooks according to elf_mem_hook setting in the platform configuration dcfg. Acked-by: Richard Zhu Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 8957ed271d20..d1abb253b499 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ struct imx_rproc_dcfg { u32 src_stop; const struct imx_rproc_att *att; size_t att_size; + bool elf_mem_hook; }; struct imx_rproc { @@ -310,6 +312,16 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, return 0; } +static void imx_rproc_memcpy(struct rproc *rproc, void *dest, const void *src, size_t count) +{ + memcpy_toio((void * __iomem)dest, src, count); +} + +static void imx_rproc_memset(struct rproc *rproc, void *s, int c, size_t count) +{ + memset_io((void * __iomem)s, c, count); +} + static int imx_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -340,6 +352,11 @@ static int imx_rproc_probe(struct platform_device *pdev) goto err_put_rproc; } + if (dcfg->elf_mem_hook) { + rproc->ops->elf_memcpy = imx_rproc_memcpy; + rproc->ops->elf_memset = imx_rproc_memset; + } + priv = rproc->priv; priv->rproc = rproc; priv->regmap = regmap; From patchwork Fri Dec 4 07:40:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5401AC4361A for ; Fri, 4 Dec 2020 07:14:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE3CD22581 for ; Fri, 4 Dec 2020 07:14:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE3CD22581 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Gb2fmuWRIyqrL36LH3jyhRa3wrVkVKWUHs+BJjy9J7A=; b=Zm3dRste87sh3pTPNSwpt3Cto m7v6I9slXk6gc+ftTFX8yjmBeEIIqee5P6DmCpuSO43IpZ1rQ5+1Yv1gc6cKkD8Rt0HaUlDlg70ho v/78cBze7kc01beFdJXNZF09yvdqYdu0fAfHDf5coUtb6MS06ZbfjO1aFIG8Wqp083CbWCvXEt+uT 2fhpSiDLCiVzopsKbpDGP4mGQ8udvB0WhHHVsTnXr1ZRzI++DrXIHJ2rKnp3rpYyUDS7tbKcwUdIo ixU7d4Nbx9GT3y8mv8FzneAZSW0+I2rtsX4UGDsZGuWMEdY2M9IyiK0YJ2mEvboGuk9ethwCMO8hj bOBPqMUJg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HA-00054k-Cv; Fri, 04 Dec 2020 07:13:09 +0000 Received: from mail-eopbgr60079.outbound.protection.outlook.com ([40.107.6.79] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5H6-000531-PG for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:13:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UrKKckrWq0B7KUQBO/VC53k90YeEaseaBmm/6ijf5WWgzIgSRJ0KS1xtKKRABbaBtfz9iQkKHF87qsaoCIgCQhG+4XDyac8H0C3Y0mhrnfEhgL7fFVljQc5SxD6EbRmFAUpxW6L3LjgIQQwSpIdZil/Q3q3kO26y/LWMh30jlNO1ptbguFhCY6zVPObHs1PeV8FAQbK4xePIFjfxN4AmWNpu0PBdPlBK1uM9jCjx06Lm5mD+lIqvKJIK6N7plCHVzsojSUqsjht48agBdQeaa7YNCttQaAOsfm9AuILEI4AqOW5EJjTYXjmtw+r4M/HufZ585vaXAiUngBdsB7WTug== 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-SenderADCheck; bh=wU4Vb0VtFqPKNwGdl7EKJrfBvjjO5DZcDzgxF4eckHQ=; b=WpWN3TuRy5Lo73g6/8VSCmmwxEiNrZg9QLSi0yf7IqVH+dWWvqRFkJvHtLZrNIRjPvhw7N98tO5OZkGdCUAonclBJKWS7GWoms/vVKmFsKDBmMTym4kAzQEz/u+HykLLevIkA1f3rDdmhY3RQKqP+mnl+MAE3eECmXyGNIO9aqP5JEFiqxFG7JHVBXfOk6/ehnsg2dbBsKuLEbyYpOxxaLJ0EQIcrwlyKCcYYfxyyZlMKFDsxZcO9PZCJcEh5HOEiJ329ZrCxvYihwZPHMyzS/CrLmW5zNt+ECOxMaog+jQzXVVGp0dAfyXjXJRs45BHlXdIX6pS77Ry1cwsMik+NA== 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=wU4Vb0VtFqPKNwGdl7EKJrfBvjjO5DZcDzgxF4eckHQ=; b=PnNLnxFaz7EGaJrz/wa/Yrj+UAXei3gULJltDGULxFJs3bRokabtKoT1bDo7VrfLevojEXUwlDR95xLASJAqDcYwy2Nq7uxhUJ2ky/o2L5bB+SkApjIFJ33OiJHgjNMt0FUFQeL4sVKS5JoUX/7MU3lAuab0a4tqK/IQrpO+x20= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:13:01 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:13:00 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 3/7] remoteproc: imx_rproc: correct err message Date: Fri, 4 Dec 2020 15:40:32 +0800 Message-Id: <20201204074036.23870-4-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:12:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 58ab7108-f91f-46e3-b5f6-08d8982408ba X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:935; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gk67HStydzqoeHt2vzfUNHLw3Jt6EWWgFaDwj/FMAVv0IIhfEiD84kP4A/r4lwJekiy6bLJDXjcjj8R7eXC7UFcg6xf1HJ000ogckEvXso9c3Gz1fU7bBJNsRVdsvAplCbFjgO6g88X34dx/jIZ4Ey3o6NAhfU468kNAEIcBRiLW1BYDXRdDdeBdqz/ZlSb6LiJVDqsmY6/R9uq1zbspOczHmqvKJ/eNv8DStjQbnRTVlV6gwS/t8Q0ydzUKUFlQVFoMhFe3clDOW8KVoVWsCnEA0KYLqFjNXV6dMZW73HEScIPQIuIugAiYBqbno+QO+Z1XUOaCsCQ3uXInilOXpQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(83380400001)(15650500001)(66946007)(66556008)(66476007)(478600001)(316002)(186003)(16526019)(8676002)(956004)(54906003)(4744005)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Bai6SbGB+VduOcCrppePoWM0WYPDMazRzM+Q8PMZPoprA8icejGdbvzWdl+XYTD7DIks4VYoRlla2DCLtCT6vnCdBAGhkUN4qw9bLO2YgiofjuY6hHWUWguk2KSoq9lM+JDVEPINC8AOL0WMhKWpn2MN61X+Le1crwmD7ywq9JULk5YTyAIFdLO90MaCmhmrIO/IZxL1iZ2iXsGF595G7zLUYpat7h/D+6tKQncvwYiGBzDAa9e/G89WKpVoev2GgfdgufFnvbvboclWubaRYK72nQi8jdEZYmwguDKMVqOhEuA4ZPemwOQso7awxFdPUcXRe2FgafSGbeOH2nmN1rbjWOV2pBZvDmPdXO23ddqbyM0jCuzY4GQwYqeCpvAB6Itx82fynu1r3eXDxAGyOVsvriuXEUXzdLHvN7yT0oVixUTdlcG80cKIpTwBVqNUC8Jyi67RYdrRpg1KPKi8IgYaZJS2I9zdd2UtCc+AVG26HfWbDu70GApxduLbHZ/8NXXitozhTEQtGEHMn5N9bS48rz5PNB64rg2Qy9nz4+OQ7e3VzDNLBPi1Yd2Ail+P/zHTwBqvU/afZAj8pKcI2TuylPdqThpvMvunOw99UapUpuZ+HErWniM6gIT0BNwTTbtE9BNVW9vdRYgYJdzU14ebzHj1JH9PneaSvRlZNUaT6xe9NWycxGZlY/rTuIzXJmdpK73BHB/kfX1q2XV47hAxq/fYMcIyvIZ+isAcSaHwt2c4S7zQ08fz8v56tCUn0rH3s+ov+i8kdBi++KXcmWe3wU0q70OpzAnoQoEHtW8bvKHGJM5iV81MfckCV/txEEPcSBC4vhgfeOMbJSsd7wB+yUrk0B+lrWhFmQ+r7CPgC2AsjzOJrwY1rFbrbjqntSz9WJbxF/ggDsNXT8QWBao0nuJZriL/hnt5JYvYYrtrpHLAF57rfnDM6gW/P04QcjvbFq3w5MsRp1sENpGL4JOrz5/lBPD5LNRemEmtGDfAOsjKZBUds66a4EsDHPWU X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58ab7108-f91f-46e3-b5f6-08d8982408ba X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:13:00.9232 (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: GBat6OMxqwJe6o9JUrD5WV/j/2cVaWEI1vNBmeIB0FhZpdQoA4Po2lgdPXTr9UrMWWMHYKXGe5NH34Q8Yxm9vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021305_786540_263232F7 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan It is using devm_ioremap, so not devm_ioremap_resource. Correct the error message and print out sa/size. Acked-by: Richard Zhu Reviewed-by: Mathieu Poirier 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 d1abb253b499..aa5fbd0c7768 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -270,7 +270,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, att->sa, att->size); if (!priv->mem[b].cpu_addr) { - dev_err(dev, "devm_ioremap_resource failed\n"); + dev_err(dev, "devm_ioremap failed\n"); return -ENOMEM; } priv->mem[b].sys_addr = att->sa; From patchwork Fri Dec 4 07:40:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1826C4361A for ; Fri, 4 Dec 2020 07:14:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D59D20639 for ; Fri, 4 Dec 2020 07:14:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D59D20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EKFMQcfmEfHH691H4tJtOygBTWFApoFdyTINwUyRJ0M=; b=VsVgZ3sjGaOa6vVx5gfV63GPk 6JXnkTSsGomug6ta8Bn3ve3DS86hZV/F2AyRlP3rn3B1mGHSisznC5edLKvi0TeCWQLzura2wmPX3 84CVgT4AtmpeT7GbJblWsQtKMGOnCagFzr64GOWrzjD70c8KvwPNP2v4UWV+IFk4EZPF33684dMG/ uR3VxZvjZPKheIpY8VEtMOIrsu5T/p3+NGRzN3BI3gYfL7sLBj03ydocfjy588MyDdipYAl0yAc2p Zre2L3yJ9E9AFEmD+FODM1lBiy6V+GebCsrE0WNn7Nc4ixitTAuH4mNYy2J9DhLVPHLviN75Eqizv 9UxRmF89w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HG-00056j-NZ; Fri, 04 Dec 2020 07:13:14 +0000 Received: from mail-eopbgr60081.outbound.protection.outlook.com ([40.107.6.81] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HC-00054u-CR for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:13:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fytxTk15GkaboMUPFKXD4LCxqU/6KCes9ALLgjZXRnMS40tPb5094OHTIsqSgCW27144pA6iBpBy5lftG16eXVnFQel12dtaia9HjaPri9l4fklsGBzAO1Jw3LpsfAdyc+m2yiQAUQ/jQI8uU9KUzdgOG96kxgCuZ2i9pw6MpmIzAROJZRdAjQTzQolrtwxQ2XwgGWR8ZujfTT3XOz8qRB85x4xOy2vHER1U9mGnTOd3eBCgzCub6Ed3dwTfcr6Y6xire/yqv9HG/cMjrv7B+FSGKsY8rT9LLswndrPXBTopNtC1dffHaZDZa7o0ql/LFXDtmv0Ml5liTjA1aVFPhw== 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-SenderADCheck; bh=5rGywZqaua3hhIAQ7LwptTy7EG5pyguMPLg3XWoT9gU=; b=NjhtRZ3axlF4v6RbSspMLXl1cyIiU08vzG+Fi1EQrnhPcgeriiPzUq+FXVt+0tjNdMHIufRIiHiW8cu2quyFuDpHiGtNeftQCL37i4FcXLI5KhddyOpBIcByY7x9h9kOm+otxDoM/ljAkPI2nupq62B4zNL0bgP7tee1DhfxBBJpzRGi/sRypo2EB0IOXeOwzizrfQBl4g1QRnayPbbFikTKQ3Y7fJXAx2F6hETI2ROvLGKH4lBP0eQH7dCB8WMlwV4JTvBhriEHIFFlW44ziVpIHRSY+QnCaHbATcq1+Osmq5wi65Dk1VL/eQZ06ipdcqw1oihnDLvmHh38xxKziA== 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=5rGywZqaua3hhIAQ7LwptTy7EG5pyguMPLg3XWoT9gU=; b=UlEbmJZWwCk9dIu6JMe6CBUhp2sp5wI8ib7Fnn5YW6xd8dHSkBCAqRcWQsyIDcPT2t6wvUwwI1PpK1Ed44Aq69PL84gl93BH1myolksx6AbPojBmX8uqqBdJjUlyLiW3l3r54BRNZ2OIrfXFXAwGD9Fck+/wcsA5NhL+lmiPA/A= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:13:06 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:13:06 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 4/7] remoteproc: imx_rproc: use devm_ioremap Date: Fri, 4 Dec 2020 15:40:33 +0800 Message-Id: <20201204074036.23870-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:13:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 318385cb-7359-47e9-3f56-08d898240bcd X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:660; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FlDt/nLfunDqC8xFA6y/EZSKdERmqcTKeadVb6xPnqq4Hj0WPrOqzJsM0KPkxDY8V6idBN3NLbUfXiWcbmSl6EeVWNSEbARH2XRMnvW2HCpHJ/xoqw+UaI3PWZ3Nd1EaWhctiFjw5GrvL3Xas9bczjU9PWHVRo3Tn/ENJpJraghw/QzmVpMb7/isDxC25swH13bJ8PN85/0i66Jwk4iiIgIulud2auNoR5zzxt3z8mRqQvpnVwL7s6l6YYSfV1oc6WRw1JM9z+zCKQZX8OQWJFapcBNsUBETOItEfqM+8NdwmKoahb/MVZtsAZNdUAA1E6RnTbEC6phnxVjWsUHL+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(83380400001)(66946007)(66556008)(66476007)(478600001)(316002)(186003)(16526019)(8676002)(956004)(54906003)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WhtqXjTY2a8lPhvEiH+L4yZaD38eHzQEVlh0UKZCvacK5srR7Rrqom6JMn459NY4ML7noyRpNkLq2tE/T4MrgaFShn3cuZQJ1j22OtvIwrDPgraDL4rAAECE1WQe67GSyCChCxL0DNv9qrvBQi8Dfuz4HNjAtMTDDeoA8oLcnuXmuKHo3EQ0e+6lYsKoNeJHyfxW1uQnyQ6J3AJ8+Cg317z84Mwcwu+jCCOE+TSHV3pSMU9wtMgJBAq7RGZ/I+YQZZRjEx9VSFxhrhrj2nYwS1CQn8pfIHCovM/8m8edfAj6FhEjvWFysvyY18SXOa+zK9zXh3FHz9z+Fv7xJgPoLkQ4C9hVOeHTo0xatQ459ul8vllluC9jty3G19TlO50b73VVfa7MqJXVEUDQRXtUqBtiQz7Iv5vlNGNvVibH2k9eiPtGJ0Ie8r9emSpFIpvvPpdwqqxnPWYGwdCr5WwX+VQYhmJcKSxXxRDn+P/ekL7tvSR+ZyWjE7tldAQN8l6YarvD1rTIpslBpe1gBAyW0vou5K+okDITcd6Z2DKV9x4ajhvHzE44s2KB3nE9AZFKqDj28sz7479VJIRFqVTDwuo51YYsw0bkq6bdRwAP2fopiEnN7HnuiGdZcKun3VEiUSHzNGs1MU6fuVBG6/n3k9Hopn8thb6yAg7Den2gDGEJx4+R08yS5pzQdMvh9hAwPRioOeqwsuMSr2kofNBFDdjPrUJUU0zxzNdxA+v5Hh0e0FuYnEhbqI8EKlDu5Q33RUXTtsmUuubMhnAoHNIYW9pU/JBeaEm6syqIF91Fzo4uh4GUSOQNsEKOMzckt3oXW6I3jep8/1i/1vsQ+Ivg2TdBUk2yDgw6nhFWYhqorspYuiiIh07uwoVWjRlHyldIaim95MxXsemUG19/2gcOYEHv3aw45cTZfnuW4q+HArVY924z9zYzDXZwN9rTI6ElXvUHaeJhHHHsSpqAVz5id5PF+tYWkRcj8BYmtTujuOHXI/RtAYeAzUjyCX9tG8KA X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 318385cb-7359-47e9-3f56-08d898240bcd X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:13:06.0348 (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: RRXTZLXxvM8P/Dj56cDbvkke1u6/ILx575iuXeT27qmhdZDMXRUAn8IyURFmajnCoaitX/R+1BIDOHRA9qkokw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021310_488223_61396632 X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan We might need to map an region multiple times, becaue the region might be shared between remote processors, such i.MX8QM with dual M4 cores. So use devm_ioremap, not devm_ioremap_resource. Reviewed-by: Oleksij Rempel Reviewed-by: Richard Zhu Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index aa5fbd0c7768..15c7baa480d7 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -298,9 +298,10 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, if (b >= IMX7D_RPROC_MEM_MAX) break; - priv->mem[b].cpu_addr = devm_ioremap_resource(&pdev->dev, &res); + /* Not use resource version, because we might share region */ + priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, res.start, resource_size(&res)); if (IS_ERR(priv->mem[b].cpu_addr)) { - dev_err(dev, "devm_ioremap_resource failed\n"); + dev_err(dev, "devm_ioremap %pR failed\n", &res); err = PTR_ERR(priv->mem[b].cpu_addr); return err; } From patchwork Fri Dec 4 07:40:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 148BBC433FE for ; Fri, 4 Dec 2020 07:14:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A118E20639 for ; Fri, 4 Dec 2020 07:14:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A118E20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eEaaMq1OckrBVoVXu+VfKQPS0+ztC3ZAawCK1r7EV1c=; b=b6MoY6y34BiYvqiaEIj3mAkO6 zahK+PWI43fti5G63iOTn1C4krjjlnQUcx3BnDqgWTGbw901IdHdyTjdPeH/xu1OibkPR1cdoX6be dDG7euVvtTdxg/jNlEG0v8buXFWpyep5Sy9HrOJbBKpXb1V9EYZoBB3dK4lVCok3ZyF84S5CeOtjQ tL2/JxD9LcMj0p3JaGdF/CsMdPWZtj4+rn7JWpHyEwg1n0fWEHw/UOjLWEHgqaaK+QfjtP9fpnRsd BgTggpF9kc1Zn+QBFpmByHLl+dYJry+N/ONrPfa+Usioilaozm9DVPmMnPnmSbsrovPjAxBPeT5XF w4wnw5gCw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HO-00059D-3p; Fri, 04 Dec 2020 07:13:22 +0000 Received: from mail-eopbgr60051.outbound.protection.outlook.com ([40.107.6.51] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HH-00056d-1h for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:13:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lCDO8BZrLqgpUq5M9hZxGaxlaCjMMc9bauKSX15ZYQSfN4TkHOaJW8dYJAoJFj0jnedBe5PpEFExiQHTIiPLfyxT3Gw4KS8cB3HtvO/Q0eZ4f2S3XY0oGIAOqm6Ps9jMeNs/spDQ3ShzuHZb02XBJA2aJiD0jriqUsD3qgbXfwjk8ETSa6L3qhQFITY6lbH/oMrHho1rHjgFHnMfI88UysBpySlbw5PkMgLAHUC8+w4dFVmhPUxV3FuexywceTHi0ZI4tdu1t5B52Onq8BfRTPoczrhu3CGilkj2M5kToUdnaZmFxhFHb3MO9yol3CACZspzQqhjoJfkK6I5ZLWy+g== 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-SenderADCheck; bh=69mDimMzLu3IO5s4RcOT8U6CJdzR21tb+dih4rXAJvQ=; b=NQR3pHt9kCK6Z4Qwoul53lgoHfzQf6eXahpVqQlV9KceCbc/jLVNaWJPqw/LlHpFMmi0wAwOMELRbOmXSve4vreGMxyICVV8yeYquF8vCYZkjUSThXgJMq2OtfNZfng+SNUS7LzVt61yqhd6ljGL1M6A3PgxzqYQDFC2sivpVOarBEcvXiGjBGhG7nVkwGPZTSVeaKAiCumyRsFjfwD7HmmjOzyJS21+yACNFycwTTNDBsJs9IP8Pw2GB88RUxTvCwdhx8yUVmY3I905VnKpGxjDnNKhuKmHlgyAHTbVxIMJJpblyOQje5hdOXItvEni4xBSwHiu/R6x3GH8MGLxCg== 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=69mDimMzLu3IO5s4RcOT8U6CJdzR21tb+dih4rXAJvQ=; b=Zeu4uW7J7t1enBkxtrgueQz3yHRWZE1ZJxBIk3w4iSHC/BvLVR+8kif9En/6Zz2wMH40ftKfKcFHod1Y09LupWyJQYigvshm7hcG2EktXOqTNsVCSaTcrRRIJHeQNmeU8l5aXREG3tEy8nEjNjcL978TNTlDjeQ+LAKvBh82ZTw= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:13:11 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:13:11 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 5/7] remoteproc: imx_rproc: add i.MX specific parse fw hook Date: Fri, 4 Dec 2020 15:40:34 +0800 Message-Id: <20201204074036.23870-6-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:13:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4401f702-7dee-4b3e-057d-08d898240edf X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lwEhT/1CZAmB4FULKZYBlrsBwexy5uhWObDAu40/QWmOuDJG2h3b1y6TKpp+mjbCzNMBRFzrKwImMOqoXVfXsbstBWnG0PRvG644pvaquG4njdTM2KwsPduN5ojf9Ni2dUPdmGio88TY5mG2oXdK5WRNNSmJ83Xq1sgtthX+8uc1QmkINuRw+Y3/NXfc4iiwGntF8a/oNHtKlGHOC3cHgWFBMe7lJJQ4flbAvPDGztHNLX3gNH+69co9AFbqQZqU2+iL4IxN1UkMk+xd6mMaZVhXj2zqC10HEz/ajRi3tzsdkKpsupppDAM5besy7izlTYdajxIjOm7JnnVq50c2KA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(83380400001)(66946007)(66556008)(66476007)(478600001)(316002)(186003)(16526019)(8676002)(956004)(54906003)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OQjwKrhHaPDLjwGzgU0aL+HtuFpjlSAdLEN/48Z4MbvHD0YkEvl9i2S/i7egW9fRSn1qa6kT4aKTgkWhvprtQPLkPgLeo4yPkCW9dY2eR9uFMkm3UA6VisZalpXI0vcUkCA6UaVdq9DzYEH8ppcnHGrl+t5JulsW+jWUmx8cp21Xv4mJAEd5rG4T9gjgCzf1r/c1DaYd/EGdKpGzAZMzc5Vk7bWLUCrqPPCIbmyVPeDZZsX1t4VNMB7v6+pKH6ON4GhgJATjrlvNr2IGmvNeBzYVMZTe+EkqPwcgl8B3Tu8mjzES3knjcDdD+G8W4xPgidaK7NmDBBy1JoZRWJDN+X5ffxWAtNQupsolSnJRBuOiXZA+Vwb3IPoT0ZsKf0D9xPmwSwTnsWcl0Zopj0x6OHaWxbw3uJthduvX/k7awyxYp6Yop5IrY4O7ksB465jn94bzto+H0VKUFBNTQVMuy4u2RjcegmEOtCh8pny3EB6vAH4VODtQ/ZVvmWamKFjOJCtdBdu5jBKXXrMJvYbLWEJg27BsXGISOIDW0CL6mAscipz1dj1zLoy0Qp8bOWJfkrJHAGHzlicCO+KwtjJUPdXKy0SwxW+uUa+F7FvCUNhZQ9MDhpxAqQNb80QlOKxV224YvvYbkb69X83BU+2SKTjUzsErlTlCPIHhlz9XcwPX5GUksE2olpbNgt97Wwz+UlEruNAKLVj6lc42qRcQxWdtbNSnm5GLlP6pXUVq+WoQ7SftDU8V81Or4rCMDZp8/1woBLBftJKbNvBWA+gNGrBYqmf/YsjVP6g4FhmMhOWTMTNNKJD0uzrIxo9AuaYgz1Kuer6ApWekHMxGMwsFPzcxYplGG/TIc1gCZcJR5IoLvZqkJ9uQuJ4MwuwSaQP/9caTQ/agbcGvpJzI31HGOxA8Dy1bfHuYeICsw+z1fFaKIoba8tZ5RtGbKpb0E7qwfdlMGWWcOXqryqWnuYQr4lc5R6cd6NM825Efl1TuFc7Cni/5Yw1z1WQTyhr5fLw1 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4401f702-7dee-4b3e-057d-08d898240edf X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:13:11.1995 (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: 6EqkxG6qqdC2O9T+egeM49jbxHTlf/91EKt7VAtlR87tw83BErdeF0qRPcBlh2nwo2brNGnB3Q1a0iFX0KdG0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021315_208192_32ABB4B5 X-CRM114-Status: GOOD ( 19.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan The hook is used to parse memory-regions and load resource table from the address the remote processor published. Signed-off-by: Peng Fan Reviewed-by: Richard Zhu Reviewed-by: Mathieu Poirier --- drivers/remoteproc/imx_rproc.c | 93 ++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 15c7baa480d7..de44b7d6ae63 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -243,10 +244,102 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len) return va; } +static int imx_rproc_mem_alloc(struct rproc *rproc, + struct rproc_mem_entry *mem) +{ + struct device *dev = rproc->dev.parent; + void *va; + + dev_dbg(dev, "map memory: %p+%zx\n", &mem->dma, mem->len); + va = ioremap_wc(mem->dma, mem->len); + if (IS_ERR_OR_NULL(va)) { + dev_err(dev, "Unable to map memory region: %p+%zx\n", + &mem->dma, mem->len); + return -ENOMEM; + } + + /* Update memory entry va */ + mem->va = va; + + return 0; +} + +static int imx_rproc_mem_release(struct rproc *rproc, + struct rproc_mem_entry *mem) +{ + dev_dbg(rproc->dev.parent, "unmap memory: %pa\n", &mem->dma); + iounmap(mem->va); + + return 0; +} + +static int imx_rproc_parse_memory_regions(struct rproc *rproc) +{ + struct imx_rproc *priv = rproc->priv; + struct device_node *np = priv->dev->of_node; + struct of_phandle_iterator it; + struct rproc_mem_entry *mem; + struct reserved_mem *rmem; + u32 da; + + /* Register associated reserved memory regions */ + of_phandle_iterator_init(&it, np, "memory-region", NULL, 0); + while (of_phandle_iterator_next(&it) == 0) { + /* + * Ignore the first memory region which will be used vdev buffer. + * No need to do extra handlings, rproc_add_virtio_dev will handle it. + */ + if (!strcmp(it.node->name, "vdevbuffer")) + continue; + + rmem = of_reserved_mem_lookup(it.node); + if (!rmem) { + dev_err(priv->dev, "unable to acquire memory-region\n"); + return -EINVAL; + } + + /* No need to translate pa to da, i.MX use same map */ + da = rmem->base; + + /* Register memory region */ + mem = rproc_mem_entry_init(priv->dev, NULL, (dma_addr_t)rmem->base, rmem->size, da, + imx_rproc_mem_alloc, imx_rproc_mem_release, + it.node->name); + + if (mem) + rproc_coredump_add_segment(rproc, da, rmem->size); + else + return -ENOMEM; + + rproc_add_carveout(rproc, mem); + } + + return 0; +} + +static int imx_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) +{ + int ret = imx_rproc_parse_memory_regions(rproc); + + if (ret) + return ret; + + ret = rproc_elf_load_rsc_table(rproc, fw); + if (ret) + dev_info(&rproc->dev, "No resource table in elf\n"); + + return 0; +} + static const struct rproc_ops imx_rproc_ops = { .start = imx_rproc_start, .stop = imx_rproc_stop, .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, + .sanity_check = rproc_elf_sanity_check, + .get_boot_addr = rproc_elf_get_boot_addr, }; static int imx_rproc_addr_init(struct imx_rproc *priv, From patchwork Fri Dec 4 07:40:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E885C433FE for ; Fri, 4 Dec 2020 07:14:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF82B20639 for ; Fri, 4 Dec 2020 07:14:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF82B20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yTcSPvnEjVr0Xbx8H7bzjpHWOI7Je7XJVxY89zqx10Y=; b=KYJO/s+YP+fnhKBnsef9hu2d6 dvSg3HgX5wrdj91kolUlV4q+cI/iQ06gnuDl60xzlUgQRhcpB2UZ2w4E4lXk+wmQq44sTdV1oYNKA AuT0pVpPdzpOrvD+1PT+xJnJOoCzjy6qZVbG/HLxtJRfYeOJkY2ZODI86ljMzVmz6dBUFFzAJ0ekN 0TpyhaqJCwRAIVX40urjZ52c8wTdjxZwfHqncSjwCMhlT5pAUOhh8BaUjNYAF/9sFce+AnZElrL+z zFQEIJHcsNgzLGNa4pODd8zldNSQ8Yvg1os+oUovS4Ela8t7XhQC5nn7yaBnR7w8TqYTxOoRjVyYo ukUQ6Nk+g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HY-0005Ep-OR; Fri, 04 Dec 2020 07:13:32 +0000 Received: from mail-eopbgr60061.outbound.protection.outlook.com ([40.107.6.61] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HM-00058r-9X for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fj08DOpBJGmaeAp18dKPqw6E6C8p606eB21liAtf2/L9vIwKv/XSPcpzpTAaBRjrMFv0SS+cnibV/7PSg4R6c+QXkyekAU7zI/rfHncnjtqRzhkMEGoZ1qAK8lOA6gyzwX8jk2ld5CNYHDE5UfLfiMbIrPBbumFms1ow9EyzulHwAnrca9UN01ZzNKpfnBYiRUcMRaVfMXlCEgxMkxkC1kT/M81V8CKt2xVXN4ljTLBh0/o5XRsCLtSNxR5tl525ydKaJhkifmFTCh6d/EOaQQVOSmrlQXHuyIKzKq9N0sHPNbdNyuBXxkDR75uojb8CiBHJfGb77z2cIUkvScy4wQ== 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-SenderADCheck; bh=id4kNbQUHWxiXZqg9n6qNuHlA2iTEWH7H9YHzE+KI70=; b=mYYCaXZm0uaQ/KAXe6WX6m+3gDVDkxGqvnbMnd1niM344d/yJbaBfkNBOWo82MA0TyVAhv59pjx1+ouICscljHc1G/JLvxlW7NPMSzFVoMCVlU/kYhsiZ9SspdeYhrSiBKlEap75dU5g3zURkjkwo1FlN/5q1DueKYN7W67gH8j2k6J6VZCF76TTDoupE5MnnRnivazSjO6fKBH4fGEuYvUGwbY8amvLXRvJVxj0ynLcMjyKjH45OizNXKwTdnzplpfZiDrOWIZmQtkfhTe9KaNppbtrzOmwcQSNxS4wMucKYLVKYmU9SvObEhi/aEYCv1AQTASoeSLfzb0cz1YL4g== 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=id4kNbQUHWxiXZqg9n6qNuHlA2iTEWH7H9YHzE+KI70=; b=DKZZ5Xj1MHcUXVqd/SrcRBXwT0fyHYvXFN9L6IfobWJiahFA0Z6AOkx/p1UA3A9NAOpPrF2WauvdbKI3ppet6xn+emTjMSzxBRXW+848lhduYVPLrSEagOMWhvhlhW+2mBnl3lIC4RBW1mcpZP4rBoOwO05Ew3tHFM0IP/X+cWo= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:13:16 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:13:16 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 6/7] remoteproc: imx_rproc: support i.MX8MQ/M Date: Fri, 4 Dec 2020 15:40:35 +0800 Message-Id: <20201204074036.23870-7-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:13:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 08044133-b020-4351-7978-08d8982411e9 X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:61; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JL+xuYOSATXVJvoiGK5AZ94k9tumyBlF4yqk8Hw1sq+xMO8/DjibCI73m6COwzKpjgNHqC7bF3LdWtv59VU37QfpHyThVtrmqSWoa7gE2tiItMSbKCKvdag7+NLkHrnQ45h2x+WhPfldXMlHZuHG8N8p/DKWLx0NKVcKOvBWtn8SmBs9fsjZUNpI/e8MzIA2IPuUgNdkVKb5E+urYTV2aEDGyjExzaGWvrYXD7CLEo0+EqjT9WZS/GhdjGmPyQe0Tj1iVZlN65KkNRSObMIqlvU5sa1LgypxunjGRNYJ1W9TQZim+0bGMM89nmQXBGYOZvUQv54A71VhyKbATYbqDw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(346002)(136003)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(66946007)(66556008)(66476007)(478600001)(316002)(186003)(16526019)(8676002)(956004)(54906003)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Jp89GTwPTZPt1y28N9xdBfoFFsIfWxwI46kM40MLIcCqRXK+KAQLAyBgP5doSbAhby5jthHeP7G9uuULmis9NTkwxaKHxJG9acozoTgwZNeTygVsTp4XPagWx+EzEnIIaLz0nN9zIIbPPe2+AbUbFjo4xPuN7dMuY1RXPBpJxY1iClTfoi0Ye5l8E9VDIRPRfCPpl3ftSkt+hdNq5ZaB+4ge0LAJr7sylaAUqxBZP3hUK3lj6jFpLCW7gUs2L/gMs6p61ILpQtttQqdH/YglVNHIUH/0jn0xQfHjNCkfX2MS9LS5jGvmnYYYDnK+GNPhl+lGcpP1s9fRTFDrvRRF39ehRwnX6QCgRz7wrlx4s7hvYc1TFmN4Vb9bNu/yTzrhrHCK/8YM+jR8ipBeSmpsfRIOskgpdi3/5UtOBwWsFJCMtiqyuki+OJw2tC4b0iuOQ33NqXE5zCd2Ag1bq8IAoOFZ5fINBn5lrseAheo7YN9+yCpRDEJpm9XleR755p6G7D04qUWqS6WvMFRtasAxAke8eke8QAzlB6iJdY42yv1RzlvXrE2EtYp9/mTd6Ex/s1ohTXwlr19VxEF6FUOIl1vEOICGwGv7txpeAysHj1GGbYkxDS4Du+3DNCjImAlxd7vYr7WKJiBT31ojgrYz3BQH+96AwCtITePH9uWg9U+++x/qOayvlMeyFMpZugOSw2nYw4GlCoyuPvLLvl9QtnyQu1b4KJWzS1n1ItmmcFIms3Nw7RfvFa+6cOXpDOuGp33DHFp26eKjLhFX9epN3YV0z2hqSASc5yaOrw6/fWCeIg5+qCYztL/xItO+M4f4RRhNYGQtYnYWzfEHONW1xj1ygkWY/XqaGsJrl1CAUTOt3PaqsSkQkTNb7onwFv/E47DuWuO9NjYYNWaXJIkojk1JXgtvRf7sa8JrJReXf2+7sdYdOrdgJ2genlIMB1jCit4AXi8PtYitPcw5TEA0q3SgJA6XuXazbpTcNbClzs0BuDtG+iKrSTLWU3+tFbH4 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08044133-b020-4351-7978-08d8982411e9 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:13:16.3221 (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: 5DlWuoxVZy011VyYO8alrPltd7/2PvYS2SzqtRl8MYspP2sAG2jKtdaggEdy/q98yXNL7kX/4tOicnDoUko9iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021320_443538_004A1A78 X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Add i.MX8MQ dev/sys addr map and configuration data structure i.MX8MM share i.MX8MQ settings. Reviewed-by: Richard Zhu Signed-off-by: Peng Fan Reviewed-by: Mathieu Poirier --- drivers/remoteproc/imx_rproc.c | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index de44b7d6ae63..afa650610996 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -90,6 +90,34 @@ struct imx_rproc { struct clk *clk; }; +static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { + /* dev addr , sys addr , size , flags */ + /* TCML - alias */ + { 0x00000000, 0x007e0000, 0x00020000, 0 }, + /* OCRAM_S */ + { 0x00180000, 0x00180000, 0x00008000, 0 }, + /* OCRAM */ + { 0x00900000, 0x00900000, 0x00020000, 0 }, + /* OCRAM */ + { 0x00920000, 0x00920000, 0x00020000, 0 }, + /* QSPI Code - alias */ + { 0x08000000, 0x08000000, 0x08000000, 0 }, + /* DDR (Code) - alias */ + { 0x10000000, 0x80000000, 0x0FFE0000, 0 }, + /* TCML */ + { 0x1FFE0000, 0x007E0000, 0x00020000, ATT_OWN }, + /* TCMU */ + { 0x20000000, 0x00800000, 0x00020000, ATT_OWN }, + /* OCRAM_S */ + { 0x20180000, 0x00180000, 0x00008000, ATT_OWN }, + /* OCRAM */ + { 0x20200000, 0x00900000, 0x00020000, ATT_OWN }, + /* OCRAM */ + { 0x20220000, 0x00920000, 0x00020000, ATT_OWN }, + /* DDR (Data) */ + { 0x40000000, 0x40000000, 0x80000000, 0 }, +}; + static const struct imx_rproc_att imx_rproc_att_imx7d[] = { /* dev addr , sys addr , size , flags */ /* OCRAM_S (M4 Boot code) - alias */ @@ -140,6 +168,16 @@ static const struct imx_rproc_att imx_rproc_att_imx6sx[] = { { 0x80000000, 0x80000000, 0x60000000, 0 }, }; +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { + .src_reg = IMX7D_SRC_SCR, + .src_mask = IMX7D_M4_RST_MASK, + .src_start = IMX7D_M4_START, + .src_stop = IMX7D_M4_STOP, + .att = imx_rproc_att_imx8mq, + .att_size = ARRAY_SIZE(imx_rproc_att_imx8mq), + .elf_mem_hook = true, +}; + static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = { .src_reg = IMX7D_SRC_SCR, .src_mask = IMX7D_M4_RST_MASK, @@ -513,6 +551,8 @@ static int imx_rproc_remove(struct platform_device *pdev) static const struct of_device_id imx_rproc_of_match[] = { { .compatible = "fsl,imx7d-cm4", .data = &imx_rproc_cfg_imx7d }, { .compatible = "fsl,imx6sx-cm4", .data = &imx_rproc_cfg_imx6sx }, + { .compatible = "fsl,imx8mq-cm4", .data = &imx_rproc_cfg_imx8mq }, + { .compatible = "fsl,imx8mm-cm4", .data = &imx_rproc_cfg_imx8mq }, {}, }; MODULE_DEVICE_TABLE(of, imx_rproc_of_match); From patchwork Fri Dec 4 07:40:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 11950793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15A91C4361A for ; Fri, 4 Dec 2020 07:14:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD57420639 for ; Fri, 4 Dec 2020 07:14:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD57420639 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=B2aMErlQ+DgnHARwn/m9iF76w7X6+bmzei3v95ST6Uk=; b=Fz2xQkiBhD4e0/UDEuUeR76BS APtlyFXZm5OL2mM/DAtUME2dbe4YAbnubsr5VYYWXyYAyQtHlKLB73TZhYDaoAWmcZaeijWGHKkvV gAkjjBW9zcfNHxvwqnnjesml9uo/Dq6GQ8g//hQBwEgHpekZ2/bNvL/SABBGvnA9vn6OxgniiggRm dlhUoPjU9pd4H4T274aiMxD+jMz3hAfKyvHMORfiy9nfrT9Y0iiG1DrtaBDXPT7FbVVIRenS7Y+pY 32D1OTXfBpNsKFci/rooX3oQGK+eYOjYh4hBt3AqtxCznR/TSdkNwJVFzmStlz0AKws3uFHB5o465 AwHfxZvkQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5Hb-0005GP-NJ; Fri, 04 Dec 2020 07:13:35 +0000 Received: from mail-eopbgr60062.outbound.protection.outlook.com ([40.107.6.62] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl5HS-0005Bu-G3 for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 07:13:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CZdTaVbmQpuADNJi4AK3kIR8UuvhXm1hA/ZbunJ5eGQDVFXc8IfCpUyFRUw9tw5wdHxbCZ9ZB9aR16qpNt1+kJTPK//9MzIbAptQZ7ta7FY7YbdoTK8o97WiPzs1tu3OWAj/V/EEmzKa4cvR3UYQ+IRd7lhojqi1jyjWhUDEWiZNRhylX/ztcckThS0pPUxzH3ynNsBW5jxnODSuxedMYUoQm2xmMj81gX2xcGm3hXLwL4Q6sY893upTKgwPdYQxs4m8yxt96P3Kv2+/HlyMiRr2cxw1kfKRlwo9R9K9W6wEU6HEAoNolMrrJTMcv7va847EeWRgLTJr9CWWXUyMew== 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-SenderADCheck; bh=MWI1iBwj+ZcTpsP+Y7/u5FuTyoCxkVZVW9/7Kbc1bQc=; b=ilFZBxm6JdvbBcfYTzzHddk23S6zDuOwUP2BtQUTrMlyn9vWIOPJtHeCjt6HOiQnYOz4y/84k6bXs7tSo+YgtNNXuCaJKyJvrtsCe7KY7AZfjVjcLiGHjzF7+AOpHOtOu+tcMrmmnx0AlwK2n4oOaTgkwDDa9tHG5WJ9bfcLjLRWeHqB8vHwC7qOUa5cC3b2o8/J5Z1wpLEobX+Jra+rbWwSx1lXRLzpeSsJi8CT4G15M71ADbGQl0flhs6n9c3/RBfBq5boV1oDEQYJLtHXoXLs/URuMIYOSxLqvBec3Tynw2GFGWAn8GrY6/XbibX+wr0wYTO/bUqXK7EqbSGfRA== 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=MWI1iBwj+ZcTpsP+Y7/u5FuTyoCxkVZVW9/7Kbc1bQc=; b=iv0yyssiMtbdpPKHAu50yAPyFIYtiqw+SQrWt4neV4+w1/k5MJscrpovPCODsV7syzfqJWPBqA8fXv/V2Bl/4iQV7Y1/fjx/hTNi29mWIcQ/UxxLmddAoHSqIf5mK7u6CRyOF60pmmfhLgz4wD4pUR97YUoJ5CjPkzwycwOZ6tU= Authentication-Results: wizery.com; dkim=none (message not signed) header.d=none;wizery.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4633.eurprd04.prod.outlook.com (2603:10a6:5:36::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Fri, 4 Dec 2020 07:13:21 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::c964:9:850a:fc5%10]) with mapi id 15.20.3632.018; Fri, 4 Dec 2020 07:13:21 +0000 From: "Peng Fan (OSS)" To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, o.rempel@pengutronix.de Subject: [PATCH V3 7/7] remoteproc: imx_proc: enable virtio/mailbox Date: Fri, 4 Dec 2020 15:40:36 +0800 Message-Id: <20201204074036.23870-8-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204074036.23870-1-peng.fan@oss.nxp.com> References: <20201204074036.23870-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 07:13:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 23e76920-3d87-4edd-2d3c-08d898241515 X-MS-TrafficTypeDiagnostic: DB7PR04MB4633: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:182; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ++33u3oGkCgVAxaBU41v8ZgpCbSsYdSmctOJ2w9UgDeymIpha+A3q4PSUVfywy2l2+199BnzLbveAUWLRJc+bQ+N2ukey7siN6GA23V6mpw+K1iluEFx43TeBY/Q9n4efjFxNxcBZpvduLjb4wRV4nRzvUpNMYP+Ffnix1UjGJvisaA5K0nFjujTEbyEROjYV8EMmQ8XJl/UID2SCBlQvlCHnOKJ1G5SJK3WM0OAMsONSXcrtgxEsMosYRIPzgGa+ZEzOyVvva2r3pMKPnnD4jpG2Zve6heInQ8mtyR0AgZEZejBcZuYkXtA75DgRGgIFAHdtyD2/JwZHsIVdzLdvg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(2616005)(86362001)(52116002)(6512007)(7416002)(1076003)(83380400001)(15650500001)(66946007)(66556008)(498600001)(66476007)(186003)(16526019)(8676002)(956004)(54906003)(6666004)(6506007)(2906002)(26005)(6486002)(8936002)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 20jcHlJGWOS/YlNPCvPs8tndcn/mh1nGgoOANwHdcqXvgOs1JdICYU00IfxXYSCgIwM2jEU+yq10JTUhr+YAqTr99PGC2LnmBexqH4uMwFS5SkOABaqPMGh/k0pPXPutok/37MOk0sPc5olq3kOzayGafqnmDPC2Umnfobi28N6DNx5Mram7+vlkWUYgzEZIkd7OhdvPPVLPe72vCEXeIQr50pkPOeC/wxPc0QPipFPLkO4HvpVJw6t26O8+I0Wd9kgpXAGfZLHeA/zCbP4jX6EiPfvFxqyVlNqyaBmYhClTzh19ioudSD6B2LOiVmhhLsE3I0Lin+WkHSS17/UjzcV5ekETM6ECxS4ohI++YIWbtTZOXynN08LhGr0DDczIjWm8K8CzmvjMjUU3Rh1/LusgcwUDgMZ5+OGSw9FAapZqvOQm5sEFG2LSWCjE+u6R7U7Lfe6U7cvbaVzvEp5nm1+cnPkDS+Q2/2lEWZKCQfa/kR04MyzLR4AqmhFwpPRa6yyFTUlZCl7yoM06V/FZhjfpVedm22OpmwMPloFZEv3qZX+vNAn4U/p8MF0+wb9u3I1zad7ScAsxqZabWTeGIgXCaA12rQjKM6o2y3sVQcG+orMx+q4qMzpd6F03ELDZO9Z6Ga2rab74f/V44sLsBkZnGTSghKLxVV8f5ZOBTpn9nvv7dCUzUAyhewNWtnaaIy5oMx/mVCjbKj3U5KgdHNf7tbbzTqjtaY2KVAjjxEAFnqxv4QLlLch+uqMCQ8KbleCpyPSUD01J2AqIyeEpqLSZIXrHqukscDj9leMMNhsoamR0TWjRxCPQ/2vJzI7RgErv5k4d2nQy2ZbPSnlLTHRvfuCIhPEbGh4OxZcEiecHqVzKVKzWa63UiVM09fjYn+wIxkF2CVr/ck+eFJxUs8n7yd7DXs8cBR1EEEXjM9b0r8Qkg12WGjxz5f2CJoWHxCmk9olaQGWf/J2ZeQS4xfDvXnd01bmDZl8HmwwOeOo35dxM/T1ukSg6ICrcSYeN X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23e76920-3d87-4edd-2d3c-08d898241515 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 07:13:21.6207 (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: HoKuq30Ac7cpOhzX0pH3VROxcxP6ewMOt1294zH4W7zNy28+LGYIqXDac387TqHdZY/YaOOhBxfHQ9ojVuM2yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4633 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_021326_639571_7033FE5E X-CRM114-Status: GOOD ( 21.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , Richard Zhu , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Use virtio/mailbox to build connection between Remote Proccessors and Linux. Add work queue to handle incoming messages. Reviewed-by: Richard Zhu Signed-off-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 133 ++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index afa650610996..584584a00921 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -16,6 +17,9 @@ #include #include #include +#include + +#include "remoteproc_internal.h" #define IMX7D_SRC_SCR 0x0C #define IMX7D_ENABLE_M4 BIT(3) @@ -88,6 +92,11 @@ struct imx_rproc { const struct imx_rproc_dcfg *dcfg; struct imx_rproc_mem mem[IMX7D_RPROC_MEM_MAX]; struct clk *clk; + struct mbox_client cl; + struct mbox_chan *tx_ch; + struct mbox_chan *rx_ch; + struct work_struct rproc_work; + struct workqueue_struct *workqueue; }; static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { @@ -369,9 +378,33 @@ static int imx_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) return 0; } +static void imx_rproc_kick(struct rproc *rproc, int vqid) +{ + struct imx_rproc *priv = rproc->priv; + int err; + __u32 mmsg; + + if (!priv->tx_ch) { + dev_err(priv->dev, "No initialized mbox tx channel\n"); + return; + } + + /* + * Send the index of the triggered virtqueue as the mu payload. + * Let remote processor know which virtqueue is used. + */ + mmsg = vqid << 16; + + err = mbox_send_message(priv->tx_ch, (void *)&mmsg); + if (err < 0) + dev_err(priv->dev, "%s: failed (%d, err:%d)\n", + __func__, vqid, err); +} + static const struct rproc_ops imx_rproc_ops = { .start = imx_rproc_start, .stop = imx_rproc_stop, + .kick = imx_rproc_kick, .da_to_va = imx_rproc_da_to_va, .load = rproc_elf_load_segments, .parse_fw = imx_rproc_parse_fw, @@ -454,6 +487,77 @@ static void imx_rproc_memset(struct rproc *rproc, void *s, int c, size_t count) memset_io((void * __iomem)s, c, count); } +static void imx_rproc_vq_work(struct work_struct *work) +{ + struct imx_rproc *priv = container_of(work, struct imx_rproc, + rproc_work); + + rproc_vq_interrupt(priv->rproc, 0); + rproc_vq_interrupt(priv->rproc, 1); +} + +static void imx_rproc_rx_callback(struct mbox_client *cl, void *msg) +{ + struct rproc *rproc = dev_get_drvdata(cl->dev); + struct imx_rproc *priv = rproc->priv; + + queue_work(priv->workqueue, &priv->rproc_work); +} + +static int imx_rproc_xtr_mbox_init(struct rproc *rproc) +{ + struct imx_rproc *priv = rproc->priv; + struct device *dev = priv->dev; + struct mbox_client *cl; + int ret = 0; + + if (!of_get_property(dev->of_node, "mbox-names", NULL)) + return 0; + + cl = &priv->cl; + cl->dev = dev; + cl->tx_block = true; + cl->tx_tout = 100; + cl->knows_txdone = false; + cl->rx_callback = imx_rproc_rx_callback; + + priv->tx_ch = mbox_request_channel_byname(cl, "tx"); + if (IS_ERR(priv->tx_ch)) { + if (PTR_ERR(priv->tx_ch) == -EPROBE_DEFER) + return -EPROBE_DEFER; + ret = PTR_ERR(priv->tx_ch); + dev_dbg(cl->dev, "failed to request mbox tx chan, ret %d\n", + ret); + goto err_out; + } + + priv->rx_ch = mbox_request_channel_byname(cl, "rx"); + if (IS_ERR(priv->rx_ch)) { + ret = PTR_ERR(priv->rx_ch); + dev_dbg(cl->dev, "failed to request mbox rx chan, ret %d\n", + ret); + goto err_out; + } + + return ret; + +err_out: + if (!IS_ERR(priv->tx_ch)) + mbox_free_channel(priv->tx_ch); + if (!IS_ERR(priv->rx_ch)) + mbox_free_channel(priv->rx_ch); + + return ret; +} + +static void imx_rproc_free_mbox(struct rproc *rproc) +{ + struct imx_rproc *priv = rproc->priv; + + mbox_free_channel(priv->tx_ch); + mbox_free_channel(priv->rx_ch); +} + static int imx_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -496,18 +600,31 @@ static int imx_rproc_probe(struct platform_device *pdev) priv->dev = dev; dev_set_drvdata(dev, rproc); + priv->workqueue = create_workqueue(dev_name(dev)); + if (!priv->workqueue) { + dev_err(dev, "cannot create workqueue\n"); + ret = -ENOMEM; + goto err_put_rproc; + } + + ret = imx_rproc_xtr_mbox_init(rproc); + if (ret) { + if (ret == -EPROBE_DEFER) + goto err_put_wkq; + /* mbox is optional, so not fail here */ + } ret = imx_rproc_addr_init(priv, pdev); if (ret) { dev_err(dev, "failed on imx_rproc_addr_init\n"); - goto err_put_rproc; + goto err_put_mbox; } priv->clk = devm_clk_get(dev, NULL); if (IS_ERR(priv->clk)) { dev_err(dev, "Failed to get clock\n"); ret = PTR_ERR(priv->clk); - goto err_put_rproc; + goto err_put_mbox; } /* @@ -517,9 +634,11 @@ static int imx_rproc_probe(struct platform_device *pdev) ret = clk_prepare_enable(priv->clk); if (ret) { dev_err(&rproc->dev, "Failed to enable clock\n"); - goto err_put_rproc; + goto err_put_mbox; } + INIT_WORK(&(priv->rproc_work), imx_rproc_vq_work); + ret = rproc_add(rproc); if (ret) { dev_err(dev, "rproc_add failed\n"); @@ -530,6 +649,13 @@ static int imx_rproc_probe(struct platform_device *pdev) err_put_clk: clk_disable_unprepare(priv->clk); +err_put_mbox: + if (!IS_ERR(priv->tx_ch)) + mbox_free_channel(priv->tx_ch); + if (!IS_ERR(priv->rx_ch)) + mbox_free_channel(priv->rx_ch); +err_put_wkq: + destroy_workqueue(priv->workqueue); err_put_rproc: rproc_free(rproc); @@ -542,6 +668,7 @@ static int imx_rproc_remove(struct platform_device *pdev) struct imx_rproc *priv = rproc->priv; clk_disable_unprepare(priv->clk); + imx_rproc_free_mbox(rproc); rproc_del(rproc); rproc_free(rproc);