-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Fix the openamp_rsc_table sample by specifying the IPM capability for maximum data transfer size #89016
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
base: main
Are you sure you want to change the base?
Conversation
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.
ipm_send
api specificies:
* @retval -EMSGSIZE If the supplied data size is unsupported by the driver.
Based on this, is that ok not to return an error in the driver?
Alternatively, could the sample first check driver support (be resilient to a first error EMSGSIZE received) before actually trying to send data ?
drivers/ipm/ipm_stm32_hsem.c
Outdated
if (size) | ||
LOG_WRN_ONCE("HSEM driver does not support data transfer over IPM"); |
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'm surprised CI didn't complain but please add {}
drivers/ipm/ipm_stm32_ipcc.c
Outdated
if (size) | ||
LOG_WRN_ONCE("IPCC driver does not support data transfer over IPM"); |
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.
Ditto
For me yes. This is the way of working in Linux kernel.
That would mean that the sample takes into account drivers specificity. I would prefer to keep the sample simple. That said if your concern is about HSEM driver, I can remove HSEM update. the driver is not used by the subsys/ipc/openamp_rsc_table sample. |
Ok.
My issue is that this change will prevent application to detect driver specificity. So yes user will be informed (if subsystem logs are enabled), but application won't be able to detect issue (underlying hw is not able to transmit data as expected) and report an error to higher levels.
No need, I prefer we find a consistent behavior across drivers. |
There are (at least) two types of mailbox:
We should support both. for that an alternative could be to add an IPM config to indicate the type of IPM used.
In int mailbox_notify(void *priv, uint32_t id)
{
ARG_UNUSED(priv);
LOG_DBG("%s: msg received", __func__);
- ipm_send(ipm_handle, 0, id, &id, 4);
+ if (!IS_ENABLED(CONFIG_IPM_DATA_TRANSFER)) {
+ ipm_send(ipm_handle, 0, id, NULL, 0);
+ } else {
+ ipm_send(ipm_handle, 0, id, &id, 4);
return 0;
}
Does this implementation align with your expectations? |
Yes, fine for me. Thanks! |
Finally, I replaced the |
The ipm_send() allows transferring data through the IPM device. However, depending on the platform, the mailbox peripheral may either transmit a limited amount of data or not transfer data at all. Introducing this configuration allows exposing the IPM capability to the application. This commit defines a default value of 1024 bytes to avoid impacting existing IPM drivers and sets the value to 0 for the STM32 IPCC and STM32 HSEM devices. This allows, in a next step, other devices to use this configuration to expose their capabilities instead of using proprietary configuration or a static definition. Signed-off-by: Arnaud Pouliquen <[email protected]>
…vice Some IPM devices return an error if we request to transfer data. Use IPM_MAX_DATA_SIZE to determine if the virtio ID can be transferred through the IPM device. Send data to IPM only if CONFIG_IPM_MAX_DATA_SIZE is not zero. Signed-off-by: Arnaud Pouliquen <[email protected]>
@anangl , @masz-nordic: Could you review please |
The samples/subsys/ipc/openamp_rsc_table sample requests to transfer data for mailboxes that support data transfer.
Some existing drivers return an error if size is non-null or print a warning message on each transfer.
Update these drivers to be compatible with the subsys/ipc/openamp_rsc_table sample, using LOG_WRN_ONCE to indicate only the first time that the driver does not support data transfers.
This fixes issue introduced in e50a2ba