In the current implementation, the rpmsg driver is built into the kernel. The remote processors (M4 in the iMX8 context) are probed when the kernel boots. More specifically, the remote processors communication channels are detected only if their rpmsg side is ready _before_ Linux boots.
This is probably the case in the context of the ping-pong and tty string demos, and they work fine.
However, if Linux probes the remote processors (M4) before are ready, the rpmsg structures are not initialized. Since the virtio_rpmsg_bus is built-in, there's no way to initialize the structures later. This scenario is quite common, e.g.:
- the M4 init takes a long time for some reason (i.e. longer than Linux startup time)
- an M4 software is loaded run-time by Linux
- an M4 software is loaded by JTAG, which leaves enough time for Linux to boot
- the M4 restarts because of a watchdog event or some other exception
One solution could be to modularize virtio_rpmsg_bus as described in this thread. Removing/inserting the module would re-initialize the rpmsg structures. However I've been unable to get the expected result.
I'd appreciate it if you provide a solution to this synchronization issue. This could be by modularizing a built-in driver (I failed so far) or something else.