From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 6C39CC433E1 for ; Tue, 28 Jul 2020 07:51:58 +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 2933320714 for ; Tue, 28 Jul 2020 07:51:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FKD3vvrz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="YF4aJH5G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2933320714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=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:In-Reply-To:References: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=Eajpf6qyRbE5WhCZJ15MznH013nHpgm4Cqm1PFV6lpc=; b=FKD3vvrz02MY7VaZyQdeI+Bmg CW9bk4alSidV4V5SGR0KAkv9xP922ohbaXwc8PO08LGQJ5V45qsXvOO+dzYML3ch22ZPgIlOn+F/r LEVYPhgF7CkievDn4/Epe/8uRihyaxfAVLbFWeaqLWJa3Ay72mYrbxIeZvubP2ejKNAkbpIfu123n ThRRqJDHFNGcVeONjuTrxfMoh2RWKl2SiPJn/m4Lj4Jr6yQSjVW672pevTwSsaQQiQxmAdDcKUmC6 A27/rUQQGOAFMYozeRA3SHB6PDllw//doyqTSI7F/TBxnUFVwSfaFVjZfhHg2HnYL0bxAvY1OyHZN bMAHddvNA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0KNI-0005pE-9g; Tue, 28 Jul 2020 07:50:12 +0000 Received: from mail-eopbgr60060.outbound.protection.outlook.com ([40.107.6.60] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0KNE-0005nO-CS for linux-arm-kernel@lists.infradead.org; Tue, 28 Jul 2020 07:50:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QE9Y029tA2teavld/TOID9SHaPbT4632VO8TFYlnnVHy+nA8mmqSdC3HCpMM/+6GP727RKYLFM4caRtGaZdl5qH8dnkB1BKnGxHFZmllu6cgRXzFvowaJKPJKVBCgTN1TThMiLUCLlFfGWISyNLDLT84ir1qttgYOQK67p2DNuFSiaKJHBSxqWtxaKEWcRcqR43UfMeoFzyn7T9yQWwtfrVwJmA4TZ7Bk+LSepfYVn1UkfW0vBGip4XVgSk1659ACEMLlsgsRUGXZoANgY1kSu3SgRVyXVn39D4sTkzkJZFnAurwHXz9z7w6T2X8hxAtn3EfvgIU3XgXhlKWeg+Qjw== 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=y3sMgkkIIUKSIam+VxSicDlPscmfna31UE+2Wt+B/cw=; b=eDGa5hjiyVbmr5rD+dtlBigPcXIIokchlPXTvmycNd5fn4TalAb+Od5e7vLQLCuAnk6Ipy7LPV+nVcGlwYO2wChgD66Ogn9hrrQUqh11uYRXwIZA47rLI4WbKUHBBEbM7SJjBLJVUC68v6VuQn98kExO3fucUq9vMtwBSJjZR+U/qrGqZZ6LbeHmLn8T1vOPrnFqoeo/dk7b1k8kQCGNLRpbU3QXo4VjrUexQ9ZJ+PAYyoliufU31ahoGKDYuIY7EeuOh75MHiKOqW0zWU7q7CPqkwHPjf2WI5sGK1GQnBGCBtlS79VGtQVDbnumL5l/pmZBvtdiaCvoQoQoiwR/3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y3sMgkkIIUKSIam+VxSicDlPscmfna31UE+2Wt+B/cw=; b=YF4aJH5GQh8/64dceE0EFbYd6/4BL62Rm6+LZ4oYPDgC5mZyJOB6a6LU/BvILDE13WLKr+GNFVlFeWUK8a5XW1ifTY1cNlS1G9WBQzjzyNu6T5MZdMf+dOF4TbaUcmYiTHcXpXrHnTx5IoTYV7lnVucngG3n3SNvnkZwtyljN44= Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4089.eurprd04.prod.outlook.com (2603:10a6:5:1b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.26; Tue, 28 Jul 2020 07:50:05 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::2d36:b569:17c:7701]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::2d36:b569:17c:7701%4]) with mapi id 15.20.3216.033; Tue, 28 Jul 2020 07:50:04 +0000 From: Peng Fan To: Oleksij Rempel Subject: RE: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early boot Thread-Topic: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early boot Thread-Index: AQHWYY4eiJ2SF2lCSU+quq5ttXjJ16ka/gOAgAAAWJCAABTmgIAAFqiggAFz5oCAAAW9cA== Date: Tue, 28 Jul 2020 07:50:04 +0000 Message-ID: References: <20200724080813.24884-1-peng.fan@nxp.com> <20200727063839.kfgrtperzkygvjr2@pengutronix.de> <20200727075441.lgscydoj3txupeay@pengutronix.de> <20200728072651.zcflghll4wa7rm55@pengutronix.de> In-Reply-To: <20200728072651.zcflghll4wa7rm55@pengutronix.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: pengutronix.de; dkim=none (message not signed) header.d=none;pengutronix.de; dmarc=none action=none header.from=nxp.com; x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 01b9b0ba-bcd0-4258-17cf-08d832cad74b x-ms-traffictypediagnostic: DB7PR04MB4089: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tLs0atdhOzcyK5MB6tetZxRqL1v1TnJUNIhL81k5TNb26SQeYOs0CMKej/l7YfNntTrhLOKtTf1eaQFihrVcKgEw8gjaK58e3h2gAcgUbq9fGO7bhGykqneWuuLFnoSMKtVIYCMq1UY2fUq+I4jN5TCZvUBlDiJ1OJ1VemEs7/7zuGi6fjpNp7PgDIu9RQghJGkl/8enVCYGXljJ8Jnf3NwgIWeB6qPN0RsAGyzNz9Q+k/8quUVoQlHZjEFq6cT3orqFy8WIzMudMXXaa+F5/txRmskipho8i/d0gXvm/r2qzMc5K+9NuTx7wy9aojR+03LM0RjgUJiPEZvoYCdW+aZOVDYAafSZyHcsSOiCY/TRDSHfJwi2L1NUrXIrPbUL7j933diYRqGCXxrS4E/x9H3VDrZK/uSG1ptxP3RchSCHWeiqkHCmdpb479Breeo9dyVN59PXmlZQH7KAK/G9FQ== 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; SFTY:; SFS:(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(86362001)(83080400001)(8936002)(478600001)(6506007)(6916009)(186003)(4326008)(7696005)(5660300002)(54906003)(33656002)(26005)(71200400001)(2906002)(8676002)(7416002)(66446008)(64756008)(66556008)(66476007)(66946007)(966005)(76116006)(52536014)(9686003)(316002)(44832011)(55016002)(32563001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: o+GT9Nk6e0KGDoNEWrT9N33Xg/GPMidnbO9eoDDQ18K5LUZmcuKAljzdqtrlZAKkgG4wQ97KfUzy2112ve9K+pJWFVv5176JzuQJ1QfBc78et4ETwUGyOahpXFD24xmar5M9GwK7btknGH07LeXsHzXVej1y1mNkGFx08S3POYI/1aPxE+AG1iDIEs2tiFrfY86i5N6WVBixJgGmMFuSM2Ig/dQS/iqBQ7Lnh9ix66fnw0VGkihO91gJ5qiB508prKhsVUfX4/tGsp+5N2cVwnsDEz0brfy6mxGhhRe3hLWwpuHvosVG7HIwQZJ3n2gej4Wak77G7B0oZDCS0eli1hllfi9fQfic3XYRk6U8bGvkUjcNqLwTEhO7NM7yQm+KFYvKdz7HmOW9SfYLXhJRDI8uCw0kpIXTUtrAaUsbjTUmmfjMzhrkQ+J6wMyrXuDxl/I1fxko+RIfDl/I96TxVAZUT4Pa6roDtSwjXIX/pSg5U6DiMGkzwuiyMGH5VVe7 MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01b9b0ba-bcd0-4258-17cf-08d832cad74b X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jul 2020 07:50:04.8591 (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: +UDFtC+3Yy0AqRrpEBpytzqtyesUTa3bo4YHDVk2/dhXDfjD2U3Hnt+3hdDBTvaHPI0apaI/KpA86VgAQ+Wb9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4089 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200728_035008_644913_C9B6D48B X-CRM114-Status: GOOD ( 43.99 ) 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: "devicetree@vger.kernel.org" , "mathieu.poirier@linaro.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "linux-remoteproc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "bjorn.andersson@linaro.org" , "robh+dt@kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > Subject: Re: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early > boot > > On Mon, Jul 27, 2020 at 09:18:31AM +0000, Peng Fan wrote: > > > Subject: Re: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and > > > early boot > > > > > > On Mon, Jul 27, 2020 at 06:44:32AM +0000, Peng Fan wrote: > > > > Hi Oleksij, > > > > > > > > > Subject: Re: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M > > > > > and early boot > > > > > > > > > > Hi, > > > > > > > > > > On Fri, Jul 24, 2020 at 04:08:03PM +0800, Peng Fan wrote: > > > > > > This patchset is to support i.MX8MQ/M coproc booted before linux. > > > > > > Since i.MX8MQ/M was not supported, several patches are needed > > > > > > to first support the platform, then support early boot case. > > > > > > > > > > > > I intended to included i.MX8QM/QXP, but that would introduce a > > > > > > large patchset, so not included. But the clk/syscon optional > > > > > > patch for i.MX8QM/QXP was still kept here to avoid rebase error. > > > > > > > > > > Thank you for your work. > > > > > > > > > > Can you please provide more information about big picture of this > work. > > > > > > > > > > If I see it correctly, we have here support for i.MX8MM, which > > > > > seems to be able to fully control Cortex M4 (enable CPU core, etc...). > > > > > > > > Yes. > > > > > > In this case, I would recommend to mainline the i.MX8MM part > > > first/separately. > > > > Only the last patch is to support earlyboot, all others is imx8mm part. > > ok > > > > > > > > > > > > > > And other case, where remoteproc is running on application > > > > > processor and can't or should not touch M4 (i.MX7ULP, > > > > > i.MX8QM/QXP..). Since M4 provides some functionality, you are > > > > > trying to reuse remoteproc framework to get resource table > > > > > present in ELF header and to dynamically load things. For some > > > > > reasons this header provides more information then needed, so > > > > > you are changing the ELF parser in the kernel > > > to workaround it. > > > > > > > > Not exactly. > > > > > > > > For i.MX8MM, we support two cases. M4 kicked by U-Boot, M4 kicked > > > > by > > > Linux remoteproc. > > > > For i.MX8QM/QXP, the typical usecase is M4 kicked by SCFW, but we > > > > will also add M4 kicked by Linux remoteproc. > > > > For i.MX7ULP, I would only support M4 dual boot case, M4 control > > > everything. > > > > > > From current state of discussion, i'm not sure what role plays > > > remoteproc in the scenario where M4 is started before linux. > > > Especially if we are not using resource table. > > > > We are using resource table from an address, not in elf file. > > This is the new feature in Linux-next to support coproc booted early. > > > > > > > > > The reason the change the elf parser is that when M4 elf is loaded > > > > by Linux remoteproc, It use memset to clear area. > > > > > > The use of memset, depends on ELF format. Fix/change the linker > > > script on your firmware and memset will be never called. > > > > > > > However we use ioremap, memset on ARM64 will report crash to > > > > device nGnRE memory. And we could not use ioremap_wc to TCM area, > > > > since it could have data correctly written into TCM. > > > > > > I have strong feeling, that we are talking about badly or not > > > properly formatted ELF binary. I would prefer to double check it, > > > before we will apply fixes on wrong place. > > > > > > > Maintainer not wanna to drop memset in common code, and TI guys > > > > suggest add i.MX specific elf stuff. So I add elf handler in i.MX code. > > > > > > I think, removing memset may damage current users of imx_rproc driver. > > > Since, like I said: the use of memset depends on ELF format. > > > > In my elf file, the last PT_LOAD contains data/bss/heap/stack. I'll > > check with our MCU guys, we only need the specific data loaded. > > > > Elf file type is EXEC (Executable file) Entry point 0x1ffe0355 There > > are 3 program headers, starting at offset 52 > > > > Program Headers: > > Type Offset VirtAddr PhysAddr FileSiz MemSiz > Flg Align > > LOAD 0x010000 0x1ffe0000 0x1ffe0000 0x00240 0x00240 > R 0x10000 > > LOAD 0x010240 0x1ffe0240 0x1ffe0240 0x03e90 0x03e90 > RWE 0x10000 > > LOAD 0x020000 0x20000000 0x1ffe40d0 0x00068 0x0ad00 > RW 0x10000 > > > > Section to Segment mapping: > > Segment Sections... > > 00 .interrupts > > 01 .resource_table .text .ARM .init_array .fini_array > > 02 .data .bss .heap .stack > > Here is an example of formatting ELF for remoteproc: > https://git.pengutronix.de/cgit/ore/OSELAS.BSP-Pengutronix-DualKit/tree/loc > al_src/remoteproc-elf/linker.ld > https://git.pengutronix.de/cgit/ore/OSELAS.BSP-Pengutronix-DualKit/tree/loc > al_src/remoteproc-elf/imx7m4.S > > In this example I pack linux in to remoteproc elf image and start linux on > imx7d-m4 part. > Will be interesting if you can do the same on imx8* SoCs ;) In NXP release, the m4 elf files have data/bss/heap/stack in the same data area, so the linker merged them into one segment and cause memsz > filesz. I think I need to propose platform specific elf memset/memcpy, such as rproc_elf_memcpy, rproc_elf_memset, To i.MX, need use memset_io and memcpy_toio, taking TCM as device memory. Note: memset without io will cause abort when memsz>filesz. So use memset_io is safe. Thanks, Peng. > > Regards, > Oleksij > -- > Pengutronix e.K. | > | > Steuerwalder Str. 21 | > http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: > +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: > +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel