Linux-remoteproc Archive on lore.kernel.org
 help / color / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"mathieu.poirier@linaro.org" <mathieu.poirier@linaro.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-remoteproc@vger.kernel.org"
	<linux-remoteproc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early boot
Date: Tue, 28 Jul 2020 09:36:29 +0000
Message-ID: <DB6PR0402MB27607A931913DE24FEFA0D1488730@DB6PR0402MB2760.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200728075547.u7bk22xnmu5jjpoo@pengutronix.de>

> Subject: Re: [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early
> boot
> 
> On Tue, Jul 28, 2020 at 07:50:04AM +0000, Peng Fan wrote:
> > > 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/t
> > > ree/loc
> > > al_src/remoteproc-elf/linker.ld
> > > https://git.pengutronix.de/cgit/ore/OSELAS.BSP-Pengutronix-DualKit/t
> > > ree/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.
> 
> Sounds good, i would prefer this way.

Just sent out, please help review there.
https://patchwork.kernel.org/patch/11688751/
https://patchwork.kernel.org/patch/11688753/


Thanks,
Peng.

> 
> --
> 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 |

      reply index

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24  8:08 Peng Fan
2020-07-24  8:08 ` [PATCH 01/10] dt-bindings: remoteproc: imx_rproc: add i.MX8MQ/M Peng Fan
2020-07-31 20:14   ` Rob Herring
2020-07-24  8:08 ` [PATCH 02/10] remoteproc: imx_rproc: correct err message Peng Fan
2020-08-11 19:56   ` Mathieu Poirier
2020-07-24  8:08 ` [PATCH 03/10] remoteproc: imx: use devm_ioremap Peng Fan
2020-07-27  6:23   ` Oleksij Rempel
2020-07-27  6:28     ` Peng Fan
2020-07-27  6:41       ` Oleksij Rempel
2020-07-27  6:51         ` Peng Fan
2020-07-27  7:37           ` Oleksij Rempel
2020-07-27  8:11             ` Peng Fan
2020-07-28  7:20               ` Oleksij Rempel
2020-07-24  8:08 ` [PATCH 04/10] remoteproc: imx_rproc: make syscon optional Peng Fan
2020-08-11 22:40   ` Mathieu Poirier
2020-08-18 21:43   ` Mathieu Poirier
2020-08-19  0:51     ` Peng Fan
2020-08-19 19:45       ` Mathieu Poirier
2020-08-20  2:04         ` Peng Fan
2020-08-20 19:27           ` Mathieu Poirier
2020-07-24  8:08 ` [PATCH 05/10] remoteproc: imx_rproc: make clk optional Peng Fan
2020-07-24  8:08 ` [PATCH 06/10] remoteproc: imx_rproc: add load hook Peng Fan
2020-07-27  5:20   ` Oleksij Rempel
2020-08-11 21:40   ` Mathieu Poirier
2020-07-24  8:08 ` [PATCH 07/10] remoteproc: imx_rproc: add i.MX specific parse fw hook Peng Fan
2020-08-11 21:56   ` Mathieu Poirier
2020-07-24  8:08 ` [PATCH 08/10] remoteproc: imx_rproc: support i.MX8MQ/M Peng Fan
2020-07-24  8:08 ` [PATCH 09/10] remoteproc: imx_proc: enable virtio/mailbox Peng Fan
2020-07-24  8:08 ` [PATCH 10/10] remoteproc: imx_rproc: support coproc booting before Linux Peng Fan
2020-08-11 22:36   ` Mathieu Poirier
2020-07-27  6:38 ` [PATCH 00/10] remoteproc: imx_rproc: support iMX8M and early boot Oleksij Rempel
2020-07-27  6:44   ` Peng Fan
2020-07-27  7:54     ` Oleksij Rempel
2020-07-27  9:18       ` Peng Fan
2020-07-28  7:26         ` Oleksij Rempel
2020-07-28  7:50           ` Peng Fan
2020-07-28  7:55             ` Oleksij Rempel
2020-07-28  9:36               ` Peng Fan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB6PR0402MB27607A931913DE24FEFA0D1488730@DB6PR0402MB2760.eurprd04.prod.outlook.com \
    --to=peng.fan@nxp.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=o.rempel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-remoteproc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-remoteproc/0 linux-remoteproc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-remoteproc linux-remoteproc/ https://lore.kernel.org/linux-remoteproc \
		linux-remoteproc@vger.kernel.org
	public-inbox-index linux-remoteproc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-remoteproc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git