Skip to content

Conversation

@pszkotak
Copy link
Contributor

@pszkotak pszkotak commented Jan 5, 2021

Multiprotocol on the nRF53 requires multiple IPC channels to communicate
between the APP and the NET core. One way is to duplicate the entire openamp
instance, the other one is to use a single instance with multiple endpoints.

Aim of this PR is to achieve the goal using the simpler single instance
with the multiple endpoints.

At this point hci_rpmsg net core sample and peripheral_hr app core sample link with the new implementation.

To build:

cd ncs/zephyr/samples/bluetooth/hci_rpmsg
west build -b nrf5340dk_nrf5340_cpunet -- -DCONF_FILE="prj.conf overlay-multiendpoint-ipc.conf"

cd ncs/zephyr/samples/bluetooth/peripheral_hr
west build -b nrf5340dk_nrf5340_cpuapp -- -DCONF_FILE="prj.conf overlay-multiendpoint-ipc.conf"

For now we are aware of the following issues that may need addressing:

  • All samples build without the need for the overlay (use the rpmsg_service across all samples?)
  • Do not directly depend on the IPM peripheral. How to do it?

Signed-off-by: Piotr Szkotak [email protected]

@github-actions
Copy link

github-actions bot commented Jan 5, 2021

The following projects have a revision update in this Pull Request:

Name Old Revision New Revision
hal_nordic zephyrproject-rtos/hal_nordic@f163c53 zephyrproject-rtos/hal_nordic@74e4ab0 (master)

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@pszkotak pszkotak force-pushed the ipc_single_instance_multi_endpoint_rebased branch from 279c8bd to 5cb78fe Compare January 5, 2021 23:32
@hubertmis
Copy link
Member

Thanks @pszkotak for posting this PR! It's crucial to enable multiple services on nRF53 network core. Currently only HCI, or 802.15.4 serialization is available (not simultaneously), what is a limitation preventing many use-cases.

I've noticed that apart from hci_rpmsg and peripheral_hr samples, this PR also enables the use of the new IPC service for all 802.15.4 samples built for nRF53 SoC.

It looks that this PR partially fixes #20419. The missing part are priorities of endpoints requested by @nordic-krch. But for the use-case described by @pszkotak (simultaneous HCI and 802.15.4 serialization) the priorities support is not required. Because of that I think it is worth to merge this PR and add extend this module with priorities support later.

@hubertmis hubertmis force-pushed the ipc_single_instance_multi_endpoint_rebased branch from 5cb78fe to eb115ac Compare January 6, 2021 07:45
@hubertmis
Copy link
Member

@ioannisg, while clearing Compliance errors I've added you as a code owner for the new IPC service. I've chosen you, because you are already code owner of some IPM drivers. Based on that I've assumed you have expertise in IPC area. If I chose poorly, please advice us who would be a better candidate to own this module.

@hubertmis hubertmis added the area: IPC Inter-Process Communication label Jan 6, 2021
@arnopo
Copy link
Contributor

arnopo commented Jan 7, 2021

Very interesting PR! this is something that was clearly missing...

It would be interesting to split the rpmsg-service.c into 2 separate files

  • rpmsg-service.c:
    • rpmsg_init_vdev
    • services related to the rpmsg endpoint
    • IPM callback and process
  • rpmsg_backend.c ( or another name):
    • metal initialization
    • vrings initialization
    • IPM initilaization

The reason of this suggestion is that there are 2 different topologies supported in Zephyr.

Splitting code in 2 files would allow to extend your dev in a next step to support the second topology and potentially new ones.

@hubertmis
Copy link
Member

It would be interesting to split the rpmsg-service.c into 2 separate files

I've added a commit splitting the module. @arnopo, please have a look if this is what you had in mind.

Copy link
Contributor

@arnopo arnopo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to split the rpmsg-service.c into 2 separate files

I've added a commit splitting the module. @arnopo, please have a look if this is what you had in mind.

It would be interesting to split the rpmsg-service.c into 2 separate files

I've added a commit splitting the module. @arnopo, please have a look if this is what you had in mind.

Thanks! Yes this is what i had in mind.
Perhaps something is missing regarding the IO struct that seems used uninitialized in rpmsg_init_vdev call...

@hubertmis
Copy link
Member

this function should at least return an error if called after the init step for the slave

Fixed, verifying order of execution using a simple flag. Returning -EINPROGRESS if endpoint registration is requested too late.

Copy link
Contributor

@kapi-no kapi-no left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as an intermediate step, As discussed with @hubertmis, I am hoping to see my review suggestions for API improvements implemented in the subsequent PRs.

@nashif
Copy link
Member

nashif commented Jan 19, 2021

Looks much better now, one last minor request. Can you move rpmsg_service into subsys/ipc/rpmsg_service ? Subsystems need to be generic, rpmsg_service is an implementation of an IPC, and we will have others.

@hubertmis
Copy link
Member

Can you move rpmsg_service into subsys/ipc/rpmsg_service ?

Sure. Just pushed changes. Should be ready for review.

@hubertmis hubertmis force-pushed the ipc_single_instance_multi_endpoint_rebased branch 2 times, most recently from b3471a1 to 88a5418 Compare January 19, 2021 14:11
@ioannisg
Copy link
Member

Needs to get the right SHA for the nRF module

@hubertmis hubertmis force-pushed the ipc_single_instance_multi_endpoint_rebased branch from bd315a3 to c7e29d0 Compare January 19, 2021 15:45
@github-actions github-actions bot removed the DNM This PR should not be merged (Do Not Merge) label Jan 19, 2021
@hubertmis hubertmis force-pushed the ipc_single_instance_multi_endpoint_rebased branch from c7e29d0 to 9714ffb Compare January 19, 2021 16:13
@hubertmis
Copy link
Member

This PR is now blocked by #31224 , because of hal_nordic dependency

hubertmis and others added 3 commits January 19, 2021 17:39
This patch implements a service that adds multiendpoint
capabilities to RPMsg. Multiple endpoints are intended to be used
when multiple modules need services from a remote processor. Each
module may register one or more RPMsg endpoints.

The implementation separates backend from the service, what
allows to extend this module to support other topologies like
Linux <-> Zephyr.

Co-authored-by: Piotr Szkotak <[email protected]>
Signed-off-by: Hubert Miś <[email protected]>
This patch adds Kconfig entries to nRF5340-DK description that
automatically configure RPMsg Service if it is enabled for the build.

Co-authored-by: Piotr Szkotak <[email protected]>
Signed-off-by: Hubert Miś <[email protected]>
This patch modifies Bluetooth HCI RPMsg drivers and samples to use
RPMsg Service instead of configuring OpenAMP directly in the driver
or the sample.

Co-authored-by: Piotr Szkotak <[email protected]>
Signed-off-by: Hubert Miś <[email protected]>
@hubertmis hubertmis force-pushed the ipc_single_instance_multi_endpoint_rebased branch from 9714ffb to 834a500 Compare January 19, 2021 17:01
@github-actions github-actions bot added the DNM This PR should not be merged (Do Not Merge) label Jan 19, 2021
@ioannisg
Copy link
Member

@ioannisg, while clearing Compliance errors I've added you as a code owner for the new IPC service. I've chosen you, because you are already code owner of some IPM drivers. Based on that I've assumed you have expertise in IPC area. If I chose poorly, please advice us who would be a better candidate to own this module.

Thanks, that should be fine for now :)

This patch updates hal_nordic module revision to start using RPMsg
Service for serialization of 802.15.4. The serialization module is
implemented in the hal_nordic module.

Signed-off-by: Hubert Miś <[email protected]>
This patch adds a new sample presenting usage of RPMsg Service
subsystem.

Signed-off-by: Hubert Miś <[email protected]>
@carlescufi carlescufi force-pushed the ipc_single_instance_multi_endpoint_rebased branch from 834a500 to 2c6d99d Compare January 19, 2021 18:36
@github-actions github-actions bot removed the DNM This PR should not be merged (Do Not Merge) label Jan 19, 2021
@carlescufi carlescufi merged commit 2674828 into zephyrproject-rtos:master Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants