Hi Ayrton / Armelle,
I tried to investigate about how to make VIRTIO_MSG_EVENT_USED work without indirect FFA messages.
- Firstly, I am still not sure if I fully understand why indirect messages can't be implemented on Trustee side ? I know it was discussed a bit in the call, but I don't remember any of it :(
- If we want to do polling of the virtqueues, then it needs to be done on the driver side (vsock), I don't see how I can generalize it and do it from virtio-msg-ffa layer. The driver needs to do something like this for the virtqueue:
while (1) { /* Try to get a buffer from the virtqueue */ buf = virtqueue_get_buf(vq, &len); if (buf) { // Handle the received buffer break; }
/* Avoid busy looping with a small delay */ cpu_relax(); }
- The other idea discussed on the call was about always queuing a direct message for a FFA device (not virtio device) for EVENT_USED message. Once the trustee side has an event to send, it can respond to this request.
I was thinking if this may block the CPU for ever with the SMC call, but I don't think that is the case. The FFA layer makes the SMC call, checks its return value and sleeps for a ms, and tries again. With this the CPU will schedule other work as soon as it can. And looks like we support sending multiple direct messages concurrently too, so while a thread is waiting for a response to EVENT_USED message, we can keep sending other messages.
If we want to support this, will this be part of the spec ? Bertrand ?
- Any other ideas on how to get this solved ?