On Fri, Sep 18, 2020 at 11:47:20AM +0200, Guennadi Liakhovetski wrote:
On Fri, Sep 18, 2020 at 09:47:45AM +0200, Arnaud POULIQUEN wrote:
IMO, as this API is defined in the Linux documentation [5] we should respect it, to ensure one generic implementation. The RPMsg sample client[4] uses this user API, so seems to me a good candidate to verify this.
That's said, shall we multiple the RPMsg implementations in Linux with several APIs, With the risk to make the RPMsg clients devices dependent on these implementations? That could lead to complex code or duplications...
So, no, in my understanding there aren't two competing alternative APIs, you'd never have to choose between them. If you're writing a driver for Linux to communicate with remote processors or to run on VMs, you use the existing API. If you're writing a driver for Linux to communicate with those VMs, you use the vhost API and whatever help is available for RPMsg processing.
However, I can in principle imagine a single driver, written to work on both sides. Something like the rpmsg_char.c or maybe some networking driver. Is that what you're referring to? I can see that as a fun exercise, but are there any real uses for that?
I hinted at a real use case for this in the previous mail thread[0]. I'm exploring using rpmsg-char to allow communication between two chips, both running Linux. rpmsg-char can be used pretty much as-is for both sides of the userspace-to-userspace communication and (the userspace side of the) userspace-to-kernel communication between the two chips.
You could do the same with VirtIO, however, it has been decided to go with two distinct APIs: virtio for guests and vhost for the host, noone bothered to create a single API for both and nobody seems to miss one. Why would we want one with RPMsg?
I think I answered this question in the previous mail thread as well[1]: | virtio has distinct driver and device roles so the completely different | APIs on each side are understandable. But I don't see that distinction | in the rpmsg API which is why it seems like a good idea to me to make it | work from both sides of the link and allow the reuse of drivers like | rpmsg-char, instead of imposing virtio's distinction on rpmsg.
[0] https://www.spinics.net/lists/linux-virtualization/msg43799.html [1] https://www.spinics.net/lists/linux-virtualization/msg43802.html