linux-remoteproc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support
@ 2019-07-15  8:22 Richard Zhu
  2019-07-15 12:16 ` Arnaud Pouliquen
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Zhu @ 2019-07-15  8:22 UTC (permalink / raw)
  To: Arnaud Pouliquen, Oleksij Rempel, ohad, bjorn.andersson,
	linux-remoteproc
  Cc: loic.pallardy, Fabien DESSENNE, elder, linux-arm-kernel

> -----Original Message-----
> From: Arnaud Pouliquen [mailto:arnaud.pouliquen@st.com]
> Sent: 2019年7月11日 0:04
> To: Richard Zhu <hongxing.zhu@nxp.com>; Oleksij Rempel
> <o.rempel@pengutronix.de>; ohad@wizery.com; bjorn.andersson@linaro.org;
> linux-remoteproc@vger.kernel.org
> Cc: loic.pallardy@st.com; Fabien DESSENNE <fabien.dessenne@st.com>;
> elder@linaro.org; linux-arm-kernel@lists.infradead.org
> Subject: Re: Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support

> On 7/10/19 10:13 AM, Richard Zhu wrote:
> >> -----Original Message-----
> >> From: Arnaud Pouliquen [mailto:arnaud.pouliquen@st.com]
> >> Sent: 2019年7月9日 17:57
> >> To: Richard Zhu <hongxing.zhu@nxp.com>; Oleksij Rempel
> >> <o.rempel@pengutronix.de>; ohad@wizery.com;
> >> bjorn.andersson@linaro.org; linux-remoteproc@vger.kernel.org
> >> Cc: loic.pallardy@st.com; Fabien DESSENNE <fabien.dessenne@st.com>;
> >> elder@linaro.org; linux-arm-kernel@lists.infradead.org
> >> Subject: Re: Re: [RFC 2/2] rpmsg: imx: add the initial imx
> >> rpmsg support
> >>
> >> On 7/9/19 9:32 AM, Richard Zhu wrote:
> >>> Hi Arnaud:
> >>> Thanks a lot for your kindly guidance and review comments.
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Arnaud Pouliquen [mailto:arnaud.pouliquen@st.com]
> >>>> Sent: 2019年7月8日 22:12
> >>>> To: Oleksij Rempel <o.rempel@pengutronix.de>; Richard Zhu
> >>>> <hongxing.zhu@nxp.com>; ohad@wizery.com;
> >> bjorn.andersson@linaro.org;
> >>>> linux-remoteproc@vger.kernel.org
> >>>> Cc: loic.pallardy@st.com; Fabien DESSENNE
> <fabien.dessenne@st.com>;
> >>>> elder@linaro.org; linux-arm-kernel@lists.infradead.org
> >>>> Subject: Re: Re: [RFC 2/2] rpmsg: imx: add the initial imx
> >>>> rpmsg support
> >>>>
> >>>>
> >>>> Hello Richard,
> >>>>
> >>>> On 7/8/19 1:02 PM, Oleksij Rempel wrote:
> >>>>> Hi Richard,
> >>>>>
> >>>>> On 08.07.19 12:17, Richard Zhu wrote:
> >>>>>> Hi Oleksij:
> >>>>>> Thanks for your comments.
> >>>>>>
> >>>>>>
> >>>>>>> -----Original Message-----
> >>>>>>> From: Oleksij Rempel [mailto:o.rempel@pengutronix.de]
> >>>>>>> Sent: 2019年7月4日 17:36
> >>>>>>> To: Richard Zhu <hongxing.zhu@nxp.com>; ohad@wizery.com;
> >>>>>>> bjorn.andersson@linaro.org; linux-remoteproc@vger.kernel.org
> >>>>>>> Cc: linux-arm-kernel@lists.infradead.org; Fabien DESSENNE
> >>>>>>> <fabien.dessenne@st.com>; loic.pallardy@st.com;
> >>>>>>> arnaud.pouliquen@st.com; s-anna@ti.com; elder@linaro.org
> >>>>>>> Subject: Re: [RFC 2/2] rpmsg: imx: add the initial imx
> >>>>>>> rpmsg support
> >>>>>>>
> >>>>>>>
> >>>>>>> Hi Richard,
> >>>>>>>
> >>>>>>> On 01.07.19 10:34, Richard Zhu wrote:
> >>>>>>>> Based on "virtio_rpmsg_bus" driver, This patch-set is used to
> >>>>>>>> set up the communication mechanism between A core and M core
> on
> >> i.MX
> >>>>>>>> AMP
> >>>>>>> SOCs.
> >>>>>>>>
> >>>>>>>> Add the initial imx rpmsg support glue driver and one pingpong
> >>>>>>>> demo, demonstrated the data transactions between A core and
> >>>>>>>> remote
> >>>> M core.
> >>>>>>>> Distributed framework is used in IMX RPMSG implementation,
> >>>>>>>> refer to the following requirements:
> >>>>>>>>      - The CAN functions contained in M core and RTOS should be
> >>>>>>>> ready and
> >>>>>>>>        complete functional in 50ms after AMP system is turned
> on.
> >>>>>>>>      - Partition reset. System wouldn't be stalled by the
> >>>>>>>> exceptions (e.x
> >>>>>>>>        the reset triggered by the system hang) occurred at the
> >>>>>>>> other side.
> >>>>>>>>        And the RPMSG mechanism should be recovered
> automactilly
> >>>>>>>> after
> >>>>>>> the
> >>>>>>>>        partition reset is completed.
> >>>>>>>> In this scenario, the M core and RTOS would be kicked off by
> >>>>>>>> bootloader firstly, then A core and Linux would be loaded later.
> >>>>>>>> Both M core/RTOS and A core/Linux are running independly.
> >>>>>>>>
> >>>>>>>> One physical memory region used to store the vring is mandatory
> >>>>>>>> required to pre-reserved and well-knowned by both A core and M
> >>>>>>>> core
> >>>>>>>
> >>>>>>> I don't see any thing imx specific in this patch. We already
> >>>>>>> have remoteproc which would parse firmware header and create
> >>>>>>> needed devices. This driver is only needed for the case where
> >>>>>>> firmware was stared by the bootloader.
> >>>>>>>
> >>>>>> [Richard Zhu] Bootloader starts the firmware is mandatory
> >>>>>> required in these scenario refer to the reasons listed in the commit.
> >>>>>> Thus, the distributed framework has to be used, and both A
> >>>>>> core/Linux and remote core/RTOS works independently.
> >>>>>>
> >>>>>>> I personally would prefer to have generic driver or extend the
> >>>>>>> remoteproc framework. So we can notify kernel about work already
> >>>>>>> done by bootloader.
> >>>>>>>
> >>>>>> [Richard Zhu] Thanks for your suggestions.
> >>>>>> Regarding to my understand, it seems that master/slave mode is
> >>>>>> used in the remoteproc currently.
> >>>>>> A core/Linux acts as master, to controls/manipulates remote
> core/RTOS.
> >>>>>> It isn't applicable for the scenario described by this patch-set.
> >>>>>>
> >>>>>>> In general, some more issues should be solved:
> >>>>>>> - Handle or not touch idle clocks for different node used by M
> >>>>>>> core and not main system.
> >>>>>>> - pin control
> >>>>>>> - regulators
> >>>>>>>
> >>>>>>> ST devs already tried to solve this issues by creating "remoteproc:
> >>>>>>> add system
> >>>>>>> resource manager device" patch. I don't know what is current
> >>>>>>> state of it (/me adding ST devs to CC).
> >>>> The resource manager implementation as been proposed but no real
> >>>> adhesion of the community on it... Perhaps SCMI should be a
> candidate...
> >>>>
> >>>>>>>
> >>>>>> [Richard Zhu] Yes, it is. Many contributions have been made by
> Fabien.
> >>>>>> IMHO, there are some different behaviors on iMX8QXP/QM platforms,
> >> the
> >>>>>>    resources (e.x IP modules) had been assigned and managed by
> >>>>>> the
> >>>> XRDC.
> >>>>>> In the other words, the HW resources would be assigned and
> >>>>>> managed
> >>>> would
> >>>>>>    be transparent to SW.
> >>>>>>
> >>>>>> Thus, both A core/Linux and M core/RTOS can work real
> independently.
> >>>>>> System wouldn't be stalled by the exceptions (e.x the reset
> >>>>>> triggered by the system hang) occurred at the other side. And the
> >>>>>> RPMSG mechanism should
> >>>>>>    be recovered automatically after the partition reset is completed.
> >>>>>
> >>>>> It is exactly the way I did understood it in the firs mail. Any
> >>>>> way, i'm ok with this driver. Just rename imx to some thing
> >>>>> generic. This driver can and will be reused on other platforms as well.
> >>>>>
> >>>>> Kind regards,
> >>>>> Oleksij Rempel
> >>>>>
> >>>>
> >>>> I'm trying to figure out what is the interest of these drivers vs existing
> ones.
> >>>> Please find below a list of features i noticed in your driver
> >>>> (don't hesitate if i missed some of them), with some
> comments/questions.
> >>>>
> >>>> 1) The coprocessor is started before the one running Linux OS.
> >>>> Have you taken a look to this set of patches proposed by Loic:
> >>>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fl
> >>>>
> kml.or&amp;data=02%7C01%7Chongxing.zhu%40nxp.com%7C68a6ea5857d
> a4e17
> >>>>
> 6b2208d70550496a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7
> C63698
> >>>>
> 3714706565710&amp;sdata=rjhdPABVoaTe45DWxL%2BJCq3%2BxWdrv5oE0
> dAi4Tf
> >>>> RAqc%3D&amp;reserved=0
> >>>>
> >>
> g%2Flkml%2F2018%2F11%2F30%2F157&amp;data=02%7C01%7Chongxing.z
> >>>>
> >>
> hu%40nxp.com%7C6773999ac6394dfe37d008d703ae3475%7C686ea1d3bc2
> >>>>
> >>
> b4c6fa92cd99c5c301635%7C0%7C0%7C636981919064186660&amp;sdata=
> >>>>
> >>
> OUogIs2S7gLR46%2FNcAU3OqEtB4rK3sW0gRKRRSO6xpk%3D&amp;reserved
> >>>> =0
> >>>> with this patch you should be able to"attach" on the fly on a
> >>>> preloaded firmware.
> >>> [Richard Zhu] Yes, this patch-set enable to pre-load the firmware in
> >> bootloader.
> >>> The most difficulties when I try to use the current master/slave
> >>> mode are that  the remote-proc controls/management mode is not
> >>> applicable to the scenario,  especially the iMX8QXP/QM partition reset
> usage.
> >>> Both A core/Linux and M core/RTOS are working independently.
> >>> HW resources(e.x: some IP modules, DDR memory region, power
> domains,
> >>> clocks and so on)  would be pre-managed and pre-assigned to A core
> >>> or M core by SCFW through XRDC module refer to the security reasons
> >>> or
> >> something else I don't know.
> >> If i well understand the xRDC is an IP which allows hardware
> >> isolation of some resources to the A or M core. So it is set by the
> >> secure part of the bootloader, right?
> > [Richard Zhu] Yes, you're right.
> > It would be configured by SCFW.
> >
> >> We have an equivalence on the STM32MP1 named ETZPC.
> >> So we also manage this use case on stm32mp1. The bootloader
> >> configures resource isolation, and can load and start the Cortex-M
> >> firmware, before the linux firmware. That why i pointed this patch.
> >> In case of preloaded firmware the remote proc does not load the
> >> firmware but just parse the resource table (address needs to be
> >> provided by the rproc_platform driver). The rpmsg bus is probed according
> to the resource table entries.
> >> This part of code is not upstreamed for time being (waiting
> >> integration of the mentioned patch). Nevertheless You can take a look
> >> on mechanism we implemented, on ST github (we named it early_boot):
> >> https://github.
> >>
> com%2FSTMicroelectronics%2Flinux%2Fblob%2Fv4.19-stm32mp%2Fdrivers%
> >>
> 2Fremoteproc%2Fstm32_rproc.c&amp;data=02%7C01%7Chongxing.zhu%40n
> >>
> xp.com%7Ce47bde268f3c4290b91708d70453c995%7C686ea1d3bc2b4c6fa9
> >>
> 2cd99c5c301635%7C0%7C0%7C636982630222216880&amp;sdata=1dtIyIVYf
> >> sg693v6UjM%2BFEk7TYHxgg6RDX611%2FKfjqA%3D&amp;reserved=0
> >>>
> >>> M core/RTOS insists to run and manage its resources assigned by XRDC
> >> standalone.
> >>> All the interactions between A core and M core are transferred on
> >>> RPMSG
> >> channels.
> >>> For example, the audio codec configuration and so on.
> >>> So, what I do here is just setup the communication RPMSG channels
> >>> between A core/Linux and M core/RTOS.
> >>>
> >>> One more concern, I'm afraid that I may mess up the current solid
> >>> reproc flow and framework if  I force this implementation into the
> >>> current
> >> reproc drivers.
> >>> So, I summit this patch-set in the end. Pre-reserved vring buffer,
> >>> register virtio_device, establish the RPMSG channels lets A
> >>> core/Linux and
> >> M Core/RTOS can communicate with each other.
> >>> That's all.
> >> Your concern is valid, and as we have the same requirement, it would
> >> be nice to find a common solution. That's why i propose this
> >> alternative, which would have the advantage of reusing existing rpmsg
> implementation.
> >>
> >   [Richard Zhu] I looked through the codes briefly. Correct me if my
> understand
> >   is wrong.
> > It seems that the A core side does a lot of manipulations to the remote M4
> core
> >   on ST32M.
> > During the start/stop/recovery operations, M4 acted as slave and waiting
> for the
> >   control constructions sent from the master A core/Linux side although
> the
> >   early_boot is set.
> >
> > There are some differences in the relationship between A core and M core.
> > On ST32M: M4/RTOS would started/stopped/recovered by A core/Linux
> side.
> >
> > In my purposed implementation, both A core/Linux and M core/RTOS
> working in the real
> >   independent mode.
> > - M4/RTOS complete the start/stop/recovery and son on operations by itself,
> it wouldn't
> >   accept any start/stop/reset interactions from A core/Linux side. Same to
> A core/Linux side.
> > - SCFW monitors the running status of each side, would notify the other side,
> if there is a
> >   system stall at one side.
> >   when the lived side receives the notification and know the other side is
> reset,
> >   It would only recover its own rpmsg stack, wait the rpmsg "ready" signal
> of the opposite side,
> >   then re-establish the rpmsg channels again.
> >   A core/Linux or M core/RTOS wouldn't do the start/stop/recovery
> operations on the opposite side.
> On STM32MP1 we have not exactly the same strategy but it only a ST design
> choice, implemented in our stm32 remoteproc driver. You should be able to
> implement your expected behavior in your the imx remoteproc driver.
> 
> On STM32MP1 we manage the M4 preloaded firmware in this way:
> -  On Linux stm32 remoteproc probe:
>         We detect that the firmware is preloaded (early-booted filed in DT)
> and set the earl_boot variable.
>         we provide the resource table address to the remoteproc core that
> parses it an call the stm32_rproc_start. here we do nothing as M4 already
> started we just set the hold boot to freeze the M4 in case of crash
> 
> - On M4 crash we have not the same strategy as your one. We consider that
> the M4 firmware can be corrupted and either we try to reload a firmware
> which as been provided by application, or we don't let it restarting (hold boot
> set on start).
> 
> -We allow userland to stop the preloaded firmware to load and to run a new
> one.
> 
> >
> > Anyway, let me do some more homework, and figure out that whether I
> > can fit these into the existing remoteproc framework or not.
> Sorry to give you homework... but seems (IMHO) possible to integrate your
> constraint in rpmsg/remoteproc current design.
>
[Richard Zhu] Hi Arnaud, I still can't find a way to combine this patch-set with the master/slave mode.
Regarding to my understand, almost all the defined items of the struct rproc is used by the master(A core/Linux) to control/manipulate the slave remote slave processor.
It's fine when the master(A core)/Slave(remote processor) mode is used.

But it's too hard to apply the slave/master mode into this scenario.
- M core/RTOS insists to run and manage its resources assigned by XRDC standalone.
- M core/RTOS wouldn't accept the start/stop/recover/reset operations issued from A core/Linux side.

So the parallel mode is used in my proposal, both A core/Linux and M core/RTOS works in real independent mode. There is no slave/master in this implementation. 
All the items defined in the struct rproc can't be used in this scenario.
IMHO, this patch-set is just to setup one communication channel between A core and M core.
There are no salve remote processor instances at A core/Linux side, that can be controlled and manipulated by A core/Linux.

Is it possible to add another folder(e.x parallel_proc) under drivers/remoteproc/ to extend the current remoteproc work mode?
Then, the parallel work mode can be setup in it. And the original master/slave mode wouldn't messed up by the parallel mode extension.
Please to feel free to give the comments.
Any comments and suggestions are appreciated.

Thanks in advanced.

Best Regards
Richard Zhu
 
> >
> >>>>
> >>>> 2) RPMSG recovery
> >>>> Agree with you, this feature is important in AMP systems, as cores
> >>>> can have their own live cycle.
> >>>>
> >>>> But I can not see related code, could you point out it to me?
> >>>>
> >>> [Richard Zhu] This feature had been validated in the local repos.
> >>> But these codes are not contained in this patch-set, because this
> >>> feature is relied on the SCFW(system control firm ware) used to
> >>> monitor the status of  both side, and trigger one irq to the other
> >>> side, if one
> >> side is stall.
> >>> Unfortunately, it is not up streamed yet. So, these codes would be
> >>> updated later If the SCFW is ready.
> >>>
> >>>> Could you explain How do you recover the rpmsg channels that has
> >>>> been already established?
> >>>> For instance what happen if your coprocessor crash during the rpmsg
> >>>> pingpong demo?
> >>> [Richard Zhu] SCFW would inform the other side, if one core/OS is
> crashed.
> >>> Then, the RPMSG stack would be re-initialized itself on the lived
> >>> core/OS, and clarify that It's ready to re-establish the channels again.
> >>> For example, M4/RTOS is crashed when pingpong demo is running.
> >>> 1. Pingpong demo is stopped.
> >>> 2. Lived A core/Linux would receive one irq from SCFW indicated that
> >>> remote M4/RTOS is  reset, then all the virtio_device registered in A
> >>> core/Linux side, would be un-registered,  and these virtio_devices
> >>> would be registered again after receive the signal(e.x the mailbox
> >>> rdb)
> >> that M4/RTOS RPMSG stack is ready again.
> >>> 3. Thus RPMS channels can be re-established in this situation.
> >>> 4. Accordingly, the consumer of the rpmsg glue driver should be
> >>> re-initialized
> >> too.
> >>> For example, remove the pingpond demo module, and insmod it again.
> >>
> >> Thanks for the clarification, i think this is no so far from the
> >> recovery already implemented in remoteproc. Seems you remote proc
> >> driver handles the
> >> recovery:
> >>   -stop rproc on irq reception, restart it ( in preloaded mode) on mailbox
> rdb.
> >> On stm32MP1 we have a similar mechanism based on a Watchdog.
> >>
> > [Richard Zhu] Regarding to my understand, STM32MP1 stop/restart the
> remote
> >   M core/RTOS although the preloaded mode is used, right?
> Yes as explained above we allow to reload a firmware if recovery mode is
> enabled or simply if application when to load a new one.
> >
> >
> >>>
> >>>>
> >>>> 3) ping-pong demo sample
> >>>> Perhaps you could re-use the rpmsg sample available here:
> >>>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fe
> >>>>
> lixir.b&amp;data=02%7C01%7Chongxing.zhu%40nxp.com%7C68a6ea5857da
> 4e1
> >>>>
> 76b2208d70550496a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%
> 7C6369
> >>>>
> 83714706565710&amp;sdata=qGCmnQOtLnRUZdY8nmBYOKlleFueTrOliARbx
> WSqD7
> >>>> 8%3D&amp;reserved=0
> >>>>
> >>
> ootlin.com%2Flinux%2Fv5.2%2Fsource%2Fsamples%2Frpmsg&amp;data=02
> >>>> %7C01%7Chongxing.zhu%40nxp.com%7C6773999ac6394dfe37d008d70
> 3a
> >> e3
> >>>>
> >>
> 475%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636981919064
> >>>>
> >>
> 186660&amp;sdata=mSV3YsoyhAO%2FROfWX79X0woGQN3jx%2Fv4pL8LRUf
> >>>> bHUM%3D&amp;reserved=0
> >>> [Richard Zhu] Thanks a lot.
> >>> This demo sample can be used. Sorry about that I didn't notice it before.
> >>>
> >>>>
> >>>> 4) No use of the resource table
> >>>> Is there a reason to not use the resource table to declare the the
> >>>> vrings? Your implementation seems to impose the same definition in
> >>>> both firmware while resource table allow to share them.
> >>>> Furthermore the resource table could be updated by the Linux before
> >>>> the remote proc is started (in case of Linux booting first)
> >>>>
> >>> [Richard Zhu] Regarding to the auto industry requirements, the M
> >>> core/RTOS is always started firstly, because that the CAN functions
> >>> should be ready in 50ms after system is power up.
> >>> BTW, resource table is a great idea in the case when Linux is booting
> firstly.
> >> As explained before We also use it when cortex-M4 is booted firstly.
> >> A constraint is that the resource table address should be known by
> >> the remoteproc driver: either the resource table address is defined
> >> in DT, or provided by the bootloader which loads the firmware so parses it.
> >>
> > [Richard Zhu] Up to now, the pre-defined vring address and the mailbox
> channels
> >   are defined in the DT in my local implementation.
> > FYI. Here are the details.
> "https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.kernel.org%2Fpatch%2F11031059%2F&amp;data=02%7C01%7Chongxi
> ng.zhu%40nxp.com%7C68a6ea5857da4e176b2208d70550496a%7C686ea1d
> 3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636983714706565710&amp;sd
> ata=mWMqlapTkol7qDVX2isOHfv97t5WoBgN39kB68sG3OQ%3D&amp;reser
> ved=0"
> >
> Thanks, we have similar use of the reserved memory to declare the vring
> (vdev0vring0, vdev0vring1, vdev0buffer) according to remoteproc core
> requirement:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
> com%2FSTMicroelectronics%2Flinux%2Fblob%2Fv4.19-stm32mp%2Farch%2F
> arm%2Fboot%2Fdts%2Fstm32mp157a-dk1.dts&amp;data=02%7C01%7Chon
> gxing.zhu%40nxp.com%7C68a6ea5857da4e176b2208d70550496a%7C686ea
> 1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636983714706565710&amp;
> sdata=7UJdPxQNmx3wOmXwyWP2ZQ47XOeDFDvQVEIDaqmsPUU%3D&amp
> ;reserved=0
> 
> >>>
> >>>> 5) slave and master mode support.
> >>>> Seems that this drivers not fully respect the virtio protocol (for
> >>>> instance status field). If you use a synchro mechanism (mailbox...)
> >>>> not sure that you really need to be virtio slave on Linux.
> >>> [Richard Zhu] Sorry about that. I used trying to keep this driver
> >>> compatible with the current slave-master mode, but I'm failed to
> >>> achieve
> >> that. ☹.
> >>> - Partition reset feature is mandatory required.
> >>> - M4 side insists that they should run and manage its resources
> standalone.
> >> No problem, it is an RFC.
> >> Anyway regarding you requirements and concerns, it seems that we have
> >> the same ones. I don't know if the solution we propose can fit with
> >> your needs, but i would be nice to have a common implementation.
> >>
> > [Richard Zhu] Agree. It's great if there is a common solution taking the
> advantage of
> >   reusing existing rpmsg implementation.
> >
> > Thanks a lot for your kindly review comments.
> Thanks a lot to you for considering an alternative proposal!
> 
> Best regards
> Arnaud
> 
> > Best Regards
> > Richard
> >
> >> Best Regards,
> >> Arnaud
> >>
> >>>
> >>> Best Regards
> >>> Richard Zhu
> >>>>
> >>>> Thanks,
> >>>> Arnaud

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support
  2019-07-15  8:22 Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support Richard Zhu
@ 2019-07-15 12:16 ` Arnaud Pouliquen
  2019-07-16  8:04   ` [EXT] " Richard Zhu
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Pouliquen @ 2019-07-15 12:16 UTC (permalink / raw)
  To: Richard Zhu, Oleksij Rempel, ohad, bjorn.andersson, linux-remoteproc
  Cc: loic.pallardy, Fabien DESSENNE, elder, linux-arm-kernel



On 7/15/19 10:22 AM, Richard Zhu wrote:

<snip>

>>>> sg693v6UjM%2BFEk7TYHxgg6RDX611%2FKfjqA%3D&amp;reserved=0
>>>>>
>>>>> M core/RTOS insists to run and manage its resources assigned by XRDC
>>>> standalone.
>>>>> All the interactions between A core and M core are transferred on
>>>>> RPMSG
>>>> channels.
>>>>> For example, the audio codec configuration and so on.
>>>>> So, what I do here is just setup the communication RPMSG channels
>>>>> between A core/Linux and M core/RTOS.
>>>>>
>>>>> One more concern, I'm afraid that I may mess up the current solid
>>>>> reproc flow and framework if  I force this implementation into the
>>>>> current
>>>> reproc drivers.
>>>>> So, I summit this patch-set in the end. Pre-reserved vring buffer,
>>>>> register virtio_device, establish the RPMSG channels lets A
>>>>> core/Linux and
>>>> M Core/RTOS can communicate with each other.
>>>>> That's all.
>>>> Your concern is valid, and as we have the same requirement, it would
>>>> be nice to find a common solution. That's why i propose this
>>>> alternative, which would have the advantage of reusing existing rpmsg
>> implementation.
>>>>
>>>    [Richard Zhu] I looked through the codes briefly. Correct me if my
>> understand
>>>    is wrong.
>>> It seems that the A core side does a lot of manipulations to the remote M4
>> core
>>>    on ST32M.
>>> During the start/stop/recovery operations, M4 acted as slave and waiting
>> for the
>>>    control constructions sent from the master A core/Linux side although
>> the
>>>    early_boot is set.
>>>
>>> There are some differences in the relationship between A core and M core.
>>> On ST32M: M4/RTOS would started/stopped/recovered by A core/Linux
>> side.
>>>
>>> In my purposed implementation, both A core/Linux and M core/RTOS
>> working in the real
>>>    independent mode.
>>> - M4/RTOS complete the start/stop/recovery and son on operations by itself,
>> it wouldn't
>>>    accept any start/stop/reset interactions from A core/Linux side. Same to
>> A core/Linux side.
>>> - SCFW monitors the running status of each side, would notify the other side,
>> if there is a
>>>    system stall at one side.
>>>    when the lived side receives the notification and know the other side is
>> reset,
>>>    It would only recover its own rpmsg stack, wait the rpmsg "ready" signal
>> of the opposite side,
>>>    then re-establish the rpmsg channels again.
>>>    A core/Linux or M core/RTOS wouldn't do the start/stop/recovery
>> operations on the opposite side.
>> On STM32MP1 we have not exactly the same strategy but it only a ST design
>> choice, implemented in our stm32 remoteproc driver. You should be able to
>> implement your expected behavior in your the imx remoteproc driver.
>>
>> On STM32MP1 we manage the M4 preloaded firmware in this way:
>> -  On Linux stm32 remoteproc probe:
>>          We detect that the firmware is preloaded (early-booted filed in DT)
>> and set the earl_boot variable.
>>          we provide the resource table address to the remoteproc core that
>> parses it an call the stm32_rproc_start. here we do nothing as M4 already
>> started we just set the hold boot to freeze the M4 in case of crash
>>
>> - On M4 crash we have not the same strategy as your one. We consider that
>> the M4 firmware can be corrupted and either we try to reload a firmware
>> which as been provided by application, or we don't let it restarting (hold boot
>> set on start).
>>
>> -We allow userland to stop the preloaded firmware to load and to run a new
>> one.
>>
>>>
>>> Anyway, let me do some more homework, and figure out that whether I
>>> can fit these into the existing remoteproc framework or not.
>> Sorry to give you homework... but seems (IMHO) possible to integrate your
>> constraint in rpmsg/remoteproc current design.
>>
> [Richard Zhu] Hi Arnaud, I still can't find a way to combine this patch-set with the master/slave mode.
> Regarding to my understand, almost all the defined items of the struct rproc is used by the master(A core/Linux) to control/manipulate the slave remote slave processor.
> It's fine when the master(A core)/Slave(remote processor) mode is used.
> 
> But it's too hard to apply the slave/master mode into this scenario.
> - M core/RTOS insists to run and manage its resources assigned by XRDC standalone.
Please could you explain the dependency between XRDC management and the 
RPMsg protocol, i don't figure out the blocking point here. So maybe i 
missed something important.
> - M core/RTOS wouldn't accept the start/stop/recover/reset operations issued from A core/Linux side.
in addition with the patch https://lkml.org/lkml/2018/11/30/159 you can 
control this in your platform driver using the rproc->preloaded variable
> 
> So the parallel mode is used in my proposal, both A core/Linux and M core/RTOS works in real independent mode. There is no slave/master in this implementation.
They are independent in terms of live cycle but not in terms of 
communication. So you still need synchronization.
For instance your implementation uses a mailbox to synchronize both 
(mailbox rdb). In existing rpmsg/virtio driver similar synchronization 
is done through a status register in the resource table plus an optional 
mailbox kick from Linux to remote processor.

In case the Cortex-M4 starts first:
- The M4 firmware starts first (managing CAN)
- The Linux OS starts: it just parses the resource table, 
creates/allocates virtio rings and buffers, update the vdev status flag 
in the resource table and kick the M4 via mailbox.
- The M4 receive the mailbox kick, checks the vdev status and start the 
rpmsg communication.
This is what we have implemented on STM32MP1. And we are able to re-use 
the same M4 firmware booted first (independent mode) or loaded by Linux.

> All the items defined in the struct rproc can't be used in this scenario.
I would say can be ignored, but the idea is that same rproc manages both 
scenarios.
> IMHO, this patch-set is just to setup one communication channel between A core and M core.
> There are no salve remote processor instances at A core/Linux side, that can be controlled and manipulated by A core/Linux.
Yes i agree with you, no need to manage the remote processor in your case.
But the goal of remoteproc is not only the management of the remote 
processor but also the management of the shared resources (rpmsg, 
carveout, remote processor traces...). My proposal is to bypass the 
management of the remote processor live cycle using Loic's patches, but 
to keep the remoteproc part handling the associated resources to be able 
to probe RPMsg bus driver.

> 
> Is it possible to add another folder(e.x parallel_proc) under drivers/remoteproc/ to extend the current remoteproc work mode?
> Then, the parallel work mode can be setup in it. And the original master/slave mode wouldn't messed up by the parallel mode extension.
> Please to feel free to give the comments.
> Any comments and suggestions are appreciated.
IMHO, That's seems to be useless, if existing solution could be adapted. 
But I'm not the maintainer... just a contributor.


Best Regards
Arnaud

> 
> Thanks in advanced.
> 
> Best Regards
> Richard Zhu
>   

<Snip>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXT] Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support
  2019-07-15 12:16 ` Arnaud Pouliquen
@ 2019-07-16  8:04   ` Richard Zhu
  2019-07-16 13:53     ` Arnaud Pouliquen
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Zhu @ 2019-07-16  8:04 UTC (permalink / raw)
  To: Arnaud Pouliquen, Oleksij Rempel, ohad, bjorn.andersson,
	linux-remoteproc
  Cc: loic.pallardy, Fabien DESSENNE, elder, linux-arm-kernel

> -----Original Message-----
> From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Sent: 2019年7月15日 20:16
> To: Richard Zhu <hongxing.zhu@nxp.com>; Oleksij Rempel
> <o.rempel@pengutronix.de>; ohad@wizery.com; bjorn.andersson@linaro.org;
> linux-remoteproc@vger.kernel.org
> Cc: loic.pallardy@st.com; Fabien DESSENNE <fabien.dessenne@st.com>;
> elder@linaro.org; linux-arm-kernel@lists.infradead.org
> Subject: [EXT] Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support
> 
> On 7/15/19 10:22 AM, Richard Zhu wrote:
> 
> <snip>
> 
> >>>> sg693v6UjM%2BFEk7TYHxgg6RDX611%2FKfjqA%3D&amp;reserved=0
> >>>>>
> >>>>> M core/RTOS insists to run and manage its resources assigned by
> >>>>> XRDC
> >>>> standalone.
> >>>>> All the interactions between A core and M core are transferred on
> >>>>> RPMSG
> >>>> channels.
> >>>>> For example, the audio codec configuration and so on.
> >>>>> So, what I do here is just setup the communication RPMSG channels
> >>>>> between A core/Linux and M core/RTOS.
> >>>>>
> >>>>> One more concern, I'm afraid that I may mess up the current solid
> >>>>> reproc flow and framework if  I force this implementation into the
> >>>>> current
> >>>> reproc drivers.
> >>>>> So, I summit this patch-set in the end. Pre-reserved vring buffer,
> >>>>> register virtio_device, establish the RPMSG channels lets A
> >>>>> core/Linux and
> >>>> M Core/RTOS can communicate with each other.
> >>>>> That's all.
> >>>> Your concern is valid, and as we have the same requirement, it
> >>>> would be nice to find a common solution. That's why i propose this
> >>>> alternative, which would have the advantage of reusing existing
> >>>> rpmsg
> >> implementation.
> >>>>
> >>>    [Richard Zhu] I looked through the codes briefly. Correct me if
> >>> my
> >> understand
> >>>    is wrong.
> >>> It seems that the A core side does a lot of manipulations to the
> >>> remote M4
> >> core
> >>>    on ST32M.
> >>> During the start/stop/recovery operations, M4 acted as slave and
> >>> waiting
> >> for the
> >>>    control constructions sent from the master A core/Linux side
> >>> although
> >> the
> >>>    early_boot is set.
> >>>
> >>> There are some differences in the relationship between A core and M
> core.
> >>> On ST32M: M4/RTOS would started/stopped/recovered by A core/Linux
> >> side.
> >>>
> >>> In my purposed implementation, both A core/Linux and M core/RTOS
> >> working in the real
> >>>    independent mode.
> >>> - M4/RTOS complete the start/stop/recovery and son on operations by
> >>> itself,
> >> it wouldn't
> >>>    accept any start/stop/reset interactions from A core/Linux side.
> >>> Same to
> >> A core/Linux side.
> >>> - SCFW monitors the running status of each side, would notify the
> >>> other side,
> >> if there is a
> >>>    system stall at one side.
> >>>    when the lived side receives the notification and know the other
> >>> side is
> >> reset,
> >>>    It would only recover its own rpmsg stack, wait the rpmsg "ready"
> >>> signal
> >> of the opposite side,
> >>>    then re-establish the rpmsg channels again.
> >>>    A core/Linux or M core/RTOS wouldn't do the start/stop/recovery
> >> operations on the opposite side.
> >> On STM32MP1 we have not exactly the same strategy but it only a ST
> >> design choice, implemented in our stm32 remoteproc driver. You should
> >> be able to implement your expected behavior in your the imx remoteproc
> driver.
> >>
> >> On STM32MP1 we manage the M4 preloaded firmware in this way:
> >> -  On Linux stm32 remoteproc probe:
> >>          We detect that the firmware is preloaded (early-booted filed
> >> in DT) and set the earl_boot variable.
> >>          we provide the resource table address to the remoteproc core
> >> that parses it an call the stm32_rproc_start. here we do nothing as
> >> M4 already started we just set the hold boot to freeze the M4 in case
> >> of crash
> >>
> >> - On M4 crash we have not the same strategy as your one. We consider
> >> that the M4 firmware can be corrupted and either we try to reload a
> >> firmware which as been provided by application, or we don't let it
> >> restarting (hold boot set on start).
> >>
> >> -We allow userland to stop the preloaded firmware to load and to run
> >> a new one.
> >>
> >>>
> >>> Anyway, let me do some more homework, and figure out that whether I
> >>> can fit these into the existing remoteproc framework or not.
> >> Sorry to give you homework... but seems (IMHO) possible to integrate
> >> your constraint in rpmsg/remoteproc current design.
> >>
> > [Richard Zhu] Hi Arnaud, I still can't find a way to combine this patch-set
> with the master/slave mode.
> > Regarding to my understand, almost all the defined items of the struct rproc
> is used by the master(A core/Linux) to control/manipulate the slave remote
> slave processor.
> > It's fine when the master(A core)/Slave(remote processor) mode is used.
> >
> > But it's too hard to apply the slave/master mode into this scenario.
> > - M core/RTOS insists to run and manage its resources assigned by XRDC
> standalone.
> Please could you explain the dependency between XRDC management and
> the RPMsg protocol, i don't figure out the blocking point here. So maybe i
> missed something important.
[Richard Zhu] There are access control managements in this use case.
Regarding to the security reasons or something else, the XRDC arranges the HW access control managements.
It would assign the access capabilities of the HW resources to different domains.
Thus, the HW resource required by M4 can be reserved for M4 by XRDC.
Same to A core/Linux side.
Both of them, manipulate their HW resources independently, and wouldn't have the HW conflictions.
SCFW wouldn't allow the cross-the border access.
All of this is preconfigured in SCFW, one system control firmware on top of bootloader/Linux/and RTOS.

RPMSG protocol is used to setup the communication between A core/Linux and M core/RTOS,
when the A core/Linux wants to use some HW resources under controlled by M core/RTOS.
- A core/Linux would send the RPMSG to M core/RTOS.
- Receive the results after M core/RTOS finish the execution.

> > - M core/RTOS wouldn't accept the start/stop/recover/reset operations
> issued from A core/Linux side.
> in addition with the patch
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.or
> g%2Flkml%2F2018%2F11%2F30%2F159&amp;data=02%7C01%7Chongxing.z
> hu%40nxp.com%7C532e75444add4475036208d7091e426d%7C686ea1d3bc2
> b4c6fa92cd99c5c301635%7C0%7C0%7C636987897883960797&amp;sdata=
> Ht3%2BKbdqLn%2BIFUO8Qj23ev8uFAtd9FffOGkssm1QmlQ%3D&amp;reserv
> ed=0 you can control this in your platform driver using the rproc->preloaded
> variable
> >
> > So the parallel mode is used in my proposal, both A core/Linux and M
> core/RTOS works in real independent mode. There is no slave/master in this
> implementation.
> They are independent in terms of live cycle but not in terms of communication.
> So you still need synchronization.
> For instance your implementation uses a mailbox to synchronize both
> (mailbox rdb). In existing rpmsg/virtio driver similar synchronization is done
> through a status register in the resource table plus an optional mailbox kick
> from Linux to remote processor.
> 
> In case the Cortex-M4 starts first:
> - The M4 firmware starts first (managing CAN)
> - The Linux OS starts: it just parses the resource table, creates/allocates virtio
> rings and buffers, update the vdev status flag in the resource table and kick
> the M4 via mailbox.
[Richard Zhu] The vring and buffer address are defined in the DTS files.
So, the resource table contains the clks/pwr or some other HW resources required by M4.
It seems that the resource table is not mandatory required in this scenario, because that all the HW resources are pre-assigned and managed by XRDC already.

The vdev status flag is an interesting synchronization mechanism in the resource table.

> - The M4 receive the mailbox kick, checks the vdev status and start the rpmsg
> communication.
> This is what we have implemented on STM32MP1. And we are able to re-use
> the same M4 firmware booted first (independent mode) or loaded by Linux.
> 
[Richard Zhu] Thanks a lot for your kindly clarification.

> > All the items defined in the struct rproc can't be used in this scenario.
> I would say can be ignored, but the idea is that same rproc manages both
> scenarios.
> > IMHO, this patch-set is just to setup one communication channel between A
> core and M core.
> > There are no salve remote processor instances at A core/Linux side, that can
> be controlled and manipulated by A core/Linux.
> Yes i agree with you, no need to manage the remote processor in your case.
> But the goal of remoteproc is not only the management of the remote
> processor but also the management of the shared resources (rpmsg, carveout,
> remote processor traces...). My proposal is to bypass the management of the
> remote processor live cycle using Loic's patches, but to keep the remoteproc
> part handling the associated resources to be able to probe RPMsg bus driver.
> 
[Richard Zhu] Got that, would try to follow that direction.
Thanks.

> >
> > Is it possible to add another folder(e.x parallel_proc) under
> drivers/remoteproc/ to extend the current remoteproc work mode?
> > Then, the parallel work mode can be setup in it. And the original
> master/slave mode wouldn't messed up by the parallel mode extension.
> > Please to feel free to give the comments.
> > Any comments and suggestions are appreciated.
> IMHO, That's seems to be useless, if existing solution could be adapted.
> But I'm not the maintainer... just a contributor.
> 
[Richard Zhu] Understand. Thanks. 😊

Best Regards
Richard
> 
> Best Regards
> Arnaud
> 
> >
> > Thanks in advanced.
> >
> > Best Regards
> > Richard Zhu
> >
> 
> <Snip>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXT] Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support
  2019-07-16  8:04   ` [EXT] " Richard Zhu
@ 2019-07-16 13:53     ` Arnaud Pouliquen
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaud Pouliquen @ 2019-07-16 13:53 UTC (permalink / raw)
  To: Richard Zhu, Oleksij Rempel, ohad, bjorn.andersson, linux-remoteproc
  Cc: loic.pallardy, Fabien DESSENNE, elder, linux-arm-kernel



On 7/16/19 10:04 AM, Richard Zhu wrote:
>> -----Original Message-----
>> From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> Sent: 2019年7月15日 20:16
>> To: Richard Zhu <hongxing.zhu@nxp.com>; Oleksij Rempel
>> <o.rempel@pengutronix.de>; ohad@wizery.com; bjorn.andersson@linaro.org;
>> linux-remoteproc@vger.kernel.org
>> Cc: loic.pallardy@st.com; Fabien DESSENNE <fabien.dessenne@st.com>;
>> elder@linaro.org; linux-arm-kernel@lists.infradead.org
>> Subject: [EXT] Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support
>>
>> On 7/15/19 10:22 AM, Richard Zhu wrote:
>>
>> <snip>
>>
>>>>>> sg693v6UjM%2BFEk7TYHxgg6RDX611%2FKfjqA%3D&amp;reserved=0
>>>>>>>
>>>>>>> M core/RTOS insists to run and manage its resources assigned by
>>>>>>> XRDC
>>>>>> standalone.
>>>>>>> All the interactions between A core and M core are transferred on
>>>>>>> RPMSG
>>>>>> channels.
>>>>>>> For example, the audio codec configuration and so on.
>>>>>>> So, what I do here is just setup the communication RPMSG channels
>>>>>>> between A core/Linux and M core/RTOS.
>>>>>>>
>>>>>>> One more concern, I'm afraid that I may mess up the current solid
>>>>>>> reproc flow and framework if  I force this implementation into the
>>>>>>> current
>>>>>> reproc drivers.
>>>>>>> So, I summit this patch-set in the end. Pre-reserved vring buffer,
>>>>>>> register virtio_device, establish the RPMSG channels lets A
>>>>>>> core/Linux and
>>>>>> M Core/RTOS can communicate with each other.
>>>>>>> That's all.
>>>>>> Your concern is valid, and as we have the same requirement, it
>>>>>> would be nice to find a common solution. That's why i propose this
>>>>>> alternative, which would have the advantage of reusing existing
>>>>>> rpmsg
>>>> implementation.
>>>>>>
>>>>>     [Richard Zhu] I looked through the codes briefly. Correct me if
>>>>> my
>>>> understand
>>>>>     is wrong.
>>>>> It seems that the A core side does a lot of manipulations to the
>>>>> remote M4
>>>> core
>>>>>     on ST32M.
>>>>> During the start/stop/recovery operations, M4 acted as slave and
>>>>> waiting
>>>> for the
>>>>>     control constructions sent from the master A core/Linux side
>>>>> although
>>>> the
>>>>>     early_boot is set.
>>>>>
>>>>> There are some differences in the relationship between A core and M
>> core.
>>>>> On ST32M: M4/RTOS would started/stopped/recovered by A core/Linux
>>>> side.
>>>>>
>>>>> In my purposed implementation, both A core/Linux and M core/RTOS
>>>> working in the real
>>>>>     independent mode.
>>>>> - M4/RTOS complete the start/stop/recovery and son on operations by
>>>>> itself,
>>>> it wouldn't
>>>>>     accept any start/stop/reset interactions from A core/Linux side.
>>>>> Same to
>>>> A core/Linux side.
>>>>> - SCFW monitors the running status of each side, would notify the
>>>>> other side,
>>>> if there is a
>>>>>     system stall at one side.
>>>>>     when the lived side receives the notification and know the other
>>>>> side is
>>>> reset,
>>>>>     It would only recover its own rpmsg stack, wait the rpmsg "ready"
>>>>> signal
>>>> of the opposite side,
>>>>>     then re-establish the rpmsg channels again.
>>>>>     A core/Linux or M core/RTOS wouldn't do the start/stop/recovery
>>>> operations on the opposite side.
>>>> On STM32MP1 we have not exactly the same strategy but it only a ST
>>>> design choice, implemented in our stm32 remoteproc driver. You should
>>>> be able to implement your expected behavior in your the imx remoteproc
>> driver.
>>>>
>>>> On STM32MP1 we manage the M4 preloaded firmware in this way:
>>>> -  On Linux stm32 remoteproc probe:
>>>>           We detect that the firmware is preloaded (early-booted filed
>>>> in DT) and set the earl_boot variable.
>>>>           we provide the resource table address to the remoteproc core
>>>> that parses it an call the stm32_rproc_start. here we do nothing as
>>>> M4 already started we just set the hold boot to freeze the M4 in case
>>>> of crash
>>>>
>>>> - On M4 crash we have not the same strategy as your one. We consider
>>>> that the M4 firmware can be corrupted and either we try to reload a
>>>> firmware which as been provided by application, or we don't let it
>>>> restarting (hold boot set on start).
>>>>
>>>> -We allow userland to stop the preloaded firmware to load and to run
>>>> a new one.
>>>>
>>>>>
>>>>> Anyway, let me do some more homework, and figure out that whether I
>>>>> can fit these into the existing remoteproc framework or not.
>>>> Sorry to give you homework... but seems (IMHO) possible to integrate
>>>> your constraint in rpmsg/remoteproc current design.
>>>>
>>> [Richard Zhu] Hi Arnaud, I still can't find a way to combine this patch-set
>> with the master/slave mode.
>>> Regarding to my understand, almost all the defined items of the struct rproc
>> is used by the master(A core/Linux) to control/manipulate the slave remote
>> slave processor.
>>> It's fine when the master(A core)/Slave(remote processor) mode is used.
>>>
>>> But it's too hard to apply the slave/master mode into this scenario.
>>> - M core/RTOS insists to run and manage its resources assigned by XRDC
>> standalone.
>> Please could you explain the dependency between XRDC management and
>> the RPMsg protocol, i don't figure out the blocking point here. So maybe i
>> missed something important.
> [Richard Zhu] There are access control managements in this use case.
> Regarding to the security reasons or something else, the XRDC arranges the HW access control managements.
> It would assign the access capabilities of the HW resources to different domains.
> Thus, the HW resource required by M4 can be reserved for M4 by XRDC.
> Same to A core/Linux side.
> Both of them, manipulate their HW resources independently, and wouldn't have the HW conflictions.
> SCFW wouldn't allow the cross-the border access.
> All of this is preconfigured in SCFW, one system control firmware on top of bootloader/Linux/and RTOS.
> 
> RPMSG protocol is used to setup the communication between A core/Linux and M core/RTOS,
> when the A core/Linux wants to use some HW resources under controlled by M core/RTOS.
> - A core/Linux would send the RPMSG to M core/RTOS.
> - Receive the results after M core/RTOS finish the execution.
> 
Ok this similar to what we proposed and has been mentioned by Oleksij:
"remoteproc: add system resource manager device" patch set
So this is handled by a client on top of rpmsg, no impact on the rpmsg 
vrings initialization and management.

>>> - M core/RTOS wouldn't accept the start/stop/recover/reset operations
>> issued from A core/Linux side.
>> in addition with the patch
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.or
>> g%2Flkml%2F2018%2F11%2F30%2F159&amp;data=02%7C01%7Chongxing.z
>> hu%40nxp.com%7C532e75444add4475036208d7091e426d%7C686ea1d3bc2
>> b4c6fa92cd99c5c301635%7C0%7C0%7C636987897883960797&amp;sdata=
>> Ht3%2BKbdqLn%2BIFUO8Qj23ev8uFAtd9FffOGkssm1QmlQ%3D&amp;reserv
>> ed=0 you can control this in your platform driver using the rproc->preloaded
>> variable
>>>
>>> So the parallel mode is used in my proposal, both A core/Linux and M
>> core/RTOS works in real independent mode. There is no slave/master in this
>> implementation.
>> They are independent in terms of live cycle but not in terms of communication.
>> So you still need synchronization.
>> For instance your implementation uses a mailbox to synchronize both
>> (mailbox rdb). In existing rpmsg/virtio driver similar synchronization is done
>> through a status register in the resource table plus an optional mailbox kick
>> from Linux to remote processor.
>>
>> In case the Cortex-M4 starts first:
>> - The M4 firmware starts first (managing CAN)
>> - The Linux OS starts: it just parses the resource table, creates/allocates virtio
>> rings and buffers, update the vdev status flag in the resource table and kick
>> the M4 via mailbox.
> [Richard Zhu] The vring and buffer address are defined in the DTS files.
> So, the resource table contains the clks/pwr or some other HW resources required by M4.
> It seems that the resource table is not mandatory required in this scenario, because that all the HW resources are pre-assigned and managed by XRDC already.
> 
The resource table mainly contains definitions related to the shared 
memories, no HW Peripheral (but could be used in future for this kind of 
declaration should be possible soon; https://lkml.org/lkml/2019/6/29/187).
Resource table is not mandatory, but it is the generic way to define 
rpmsg memories and probe the rpmsg bus driver. Here is an exemple of 
resource table:
https://github.com/zephyrproject-rtos/open-amp/pull/2/files#diff-65def9751b4fbc10973e184b5daa80e9

kind regards
Arnaud
> The vdev status flag is an interesting synchronization mechanism in the resource table.
> 
>> - The M4 receive the mailbox kick, checks the vdev status and start the rpmsg
>> communication.
>> This is what we have implemented on STM32MP1. And we are able to re-use
>> the same M4 firmware booted first (independent mode) or loaded by Linux.
>>
> [Richard Zhu] Thanks a lot for your kindly clarification.
> 
>>> All the items defined in the struct rproc can't be used in this scenario.
>> I would say can be ignored, but the idea is that same rproc manages both
>> scenarios.
>>> IMHO, this patch-set is just to setup one communication channel between A
>> core and M core.
>>> There are no salve remote processor instances at A core/Linux side, that can
>> be controlled and manipulated by A core/Linux.
>> Yes i agree with you, no need to manage the remote processor in your case.
>> But the goal of remoteproc is not only the management of the remote
>> processor but also the management of the shared resources (rpmsg, carveout,
>> remote processor traces...). My proposal is to bypass the management of the
>> remote processor live cycle using Loic's patches, but to keep the remoteproc
>> part handling the associated resources to be able to probe RPMsg bus driver.
>>
> [Richard Zhu] Got that, would try to follow that direction.
> Thanks.
> 
>>>
>>> Is it possible to add another folder(e.x parallel_proc) under
>> drivers/remoteproc/ to extend the current remoteproc work mode?
>>> Then, the parallel work mode can be setup in it. And the original
>> master/slave mode wouldn't messed up by the parallel mode extension.
>>> Please to feel free to give the comments.
>>> Any comments and suggestions are appreciated.
>> IMHO, That's seems to be useless, if existing solution could be adapted.
>> But I'm not the maintainer... just a contributor.
>>
> [Richard Zhu] Understand. Thanks. 😊
> 
> Best Regards
> Richard
>>
>> Best Regards
>> Arnaud
>>
>>>
>>> Thanks in advanced.
>>>
>>> Best Regards
>>> Richard Zhu
>>>
>>
>> <Snip>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-16 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15  8:22 Re: [RFC 2/2] rpmsg: imx: add the initial imx rpmsg support Richard Zhu
2019-07-15 12:16 ` Arnaud Pouliquen
2019-07-16  8:04   ` [EXT] " Richard Zhu
2019-07-16 13:53     ` Arnaud Pouliquen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).