-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipm: imx: send firmware ready reply #61709
ipm: imx: send firmware ready reply #61709
Conversation
2e2f021
to
9740e3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this PR is not problematic per se my impression is that we are kinda cheating here. Wouldn't much better just to introduce a new REMOTEPROC API class / subsystem in Zephyr and use that instead?
This is not a standard - to send a fw ready reply after the remote core is up. This is just for imx use-case. Others remoteproc Linux drivers (e.g. omap_remoteproc) are sending an echo request and this message will wait in the mailbox fifo until the remote core is up. Others are doing nothing. Therefore, there is no "one way fits all" for host-remote handshake communication. |
9740e3c
to
696ac6c
Compare
What about the I'm not going to NACK this PR, this is fine to me. I'm just trying to understand if there is a generic way to do this. |
This might work if I would have openAMP on host side.
In my opinion, the generic way is to remove the limitation, from imx_dsp_rproc, of waiting for a fw_ready reply - this is not standard and is used only for an internal use case. But, there are still open discussions in upstream on how to handle this in Linux - https://patchwork.kernel.org/project/linux-remoteproc/patch/20230712224251.26482-1-iuliana.prodan@oss.nxp.com/ |
696ac6c
to
0cfbd5f
Compare
Agree with @carlocaione, The handshake should be performed at the application level. It probably relies on a mailbox, but Today, similar mechanism is done in Linux but from the main to the remote processor. When the virtio device status has been updated. A kick (notify) is sent by Linux rpmsg virtio driver to the coprocessor. The Linux remoteproc is in charge of sending this kick through the mailbox. Associated code is available here: https://elixir.bootlin.com/linux/latest/source/drivers/rpmsg/virtio_rpmsg_bus.c#L995 In this PR the inverse is requested. Using a config is nice for compatibility with other hardwares |
0cfbd5f
to
4c05289
Compare
The i.MX DSP remoteproc (imx_dsp_rproc) driver is implementing the generic kick callback - https://elixir.bootlin.com/linux/latest/source/drivers/remoteproc/imx_dsp_rproc.c and is called after starting the remote core - see https://elixir.bootlin.com/linux/latest/source/drivers/remoteproc/imx_dsp_rproc.c#L316.
It does, as mentioned above (https://elixir.bootlin.com/linux/latest/source/drivers/remoteproc/imx_dsp_rproc.c#L344)
So, @arnopo you're saying I should update the openamp_rsc_table sample? Now, in
|
I thought a little bit more and I can expand the IPM API with an Thanks! PS: If I won't be able to send it by Friday, I'll do it next week since I'll be OOO :) |
Why? Please don't. A |
But then how can I send (actually just set the interrupts I need) the fw reply? This is platform specific. As mention, I cannot use the |
You realize that we cannot arbitrary extend every API device class because some random platform needs something on top right? This being platform specific is exactly the reason this hook makes no sense in the general API class. You extend an API when the new API is going to support a wide variety of hardware and platforms and, to me, it looks like this is not the case. The IPM class is about hardware, how do you use this hardware is not the driver concern really. You want something on top of that, an application, a subsystem, a framework, etc... that is using that driver to do something with it (notify, build packets, etc...). |
What about considering the GP interrupt as a specific channel of the Then in application you could define a config that is set to the channel ID value. |
b22aa93
to
d565a28
Compare
drivers/ipm/Kconfig
Outdated
config IPM_SEND_FW_READY_REPLY | ||
hex "Send a FW_READY reply message" | ||
default 0xFFFF | ||
help | ||
Send FW_READY reply to check for FW boot completion | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, so let's say that tomorrow I have a different platform (something custom of course) that needs a new reply type, for example an error messaging kind of thing. Should I add a new Kconfig symbol for that?
This doesn't scale and it is plain wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want you can move this into Kconfig.imx
, that would be acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want you can move this into
Kconfig.imx
, that would be acceptable.
Yes, I can add it to imx and not modify the openamp_rsc_table sample (main_remote.c) at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iuliana-prodan
Regarding your patch seems that my suggestion is not my best one... :(
This solution is not cleaner that your solution.
More than that looking at Shengju comment on Linux remote proc mailing list:
"The reason why wait for a reply in IMX DSP driver is to make sure the DSP
boot successfully and the firmware is correct. ", it looks to me that you need to trig the signal whatever the sample you are running on the remote processor.For instance, the "hello word" sample should also work so trig the signal.
In this case the implementation in IPM or in the openamp_rsc_table application seems not the good solutions.
Is it a way to do it at SoC or board level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted to my previous version (with small changes on commit message and CONFIG description).
I added the config only for i.MX family.
I enable it only for the board I need (right now this is only for the openamp_rsc_table
sample compiled for nxp_adsp_imx8m
)
d565a28
to
1f9d7ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still not convinced that the solution is reliable in the long term (for instance, for a Zephyr project that does not use ipm driver). However, the patch should be able to respond in the short term.
I'm OK with this for now, as it seems there is no general agreement with Linux folks. On the long run I think we can make use of We could define a new All application will need to fill this struct with information about expected behavior. Like, kernel should wait for firmware to boot (or not). It looks like the Linux kernel infrastructure is already in place. What we need to figure out is how to define such structure with open-amp and zephyr. |
Yes that a way to do it. I don't know if that would cover all use cases (XIP, start by U-boot or secure context, Zephyr <->Zephyr IPC, ...). This would also imply that the resource table is defined for all zephyr samples. But also, that we respect cache line to make the resource table R/W for both processors during the initialization phase. For your information we started a work in openAMP community to integrate virtio drivers/devices for IPC and the virtio-mmio transport in place of the virtio remoteproc (so no resource table). We identify similar handshake need to ensure that the coprocessor is running before probing the Linux virtio-mmio driver. That's why synchronization using signaling seems to me more generic. But perhaps we will need different solutions to address all hardwares and use cases. |
The resource table, both in Linux and Zephyr, uses fw_rsc_vdev struct (meaning RSC_VDEV). Probably, a solution will be to use the config space from fw_rsc_vdev struct,
Where is this? Can you please give me some links? There is nothing in place, otherwise I would have used it. |
* FW_READY reply. | ||
*/ | ||
MU_Type *base = MU(config); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a false positive.
@nashif, We appear to have a false-positive on the compliance. What should we do here? |
Send a fw ready reply message as soon as possible. This is usually used on host side which is waiting for this message in order to establish the communication with the remote processor - see imx_dsp_rproc driver from Linux. This can be enabled by IPM_IMX_FW_READY_REPLY config, which is by default N. Set CONFIG_IPM_IMX_FW_READY_REPLY as Y for openamp_rsc_table sample, running on nxp_adsp_imx8m. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
01ab719
1f9d7ab
to
01ab719
Compare
I've added a new version where I've fixed the (false positive) compliance check -https://github.com/zephyrproject-rtos/zephyr/pull/61709/files#diff-7a9de38974d6ca2f0d251849b385035241af755de445ddee41ab93fb33cd5d25R332 |
@arnopo could you please take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one minor comment else LGTM
* after starting the remote processor, the host is waiting for a | ||
* FW_READY reply. | ||
*/ | ||
MU_Type * base = MU(config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space between *
and base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add an extra space to fix a compliance issue - a false positive one - see also this comment #61709 (comment)
I didn't know what else to do in order to have this merged :)
Send a fw ready reply message as soon as possible.
This is usually used on host side which is waiting for this message in order to establish the communication with the remote processor - see
imx_dsp_rproc
driver from Linux.This can be enabled by
IPM_IMX_FW_READY_REPLY
config, which is by default N.Set
CONFIG_IPM_IMX_FW_READY_REPLY
as Y foropenamp_rsc_table
sample, running on nxp_adsp_imx8m.