Hi Viresh
On 24 Jul 2025, at 08:45, Viresh Kumar viresh.kumar@linaro.org wrote:
On 22-07-25, 10:38, Bertrand Marquis wrote:
+static int virtio_msg_xfer(struct virtio_msg_device *vmdev) +{
- int ret;
- memset(vmdev->response, 0, vmdev->msg_size);
- ret = vmdev->ops->transfer(vmdev, vmdev->request, vmdev->response);
- if (ret)
- dev_err(&vmdev->vdev.dev, "Transfer request failed (%d)\n", ret);
Here a bus can report an error when sending a message. I think the idea in the transport was to not have this case and we kind of say that the bus is responsible to give back a valid message back.
Right, but this isn't just about the virtio-msg error. There can be an FF-A error as well, or something else. If a routine in kernel is returning an error, it better be propagated. Isn't it ?
This is something we will need to discuss during the HVAC meeting. The spec says that all errors are to be handled inside the bus and that an empty/zero message should be generated back instead to have the same behaviour as other transports. If this is something that can be handled somehow at transport level it could definitely make the bus implementation easier.
I am definitely open to this possibility but here I wonder what is actually happening as you print an error but how will it be handled after ?
This depends on the caller of the operation, for bus-init functions, if they fail for some reason, they abort. For individual Virtio devices, they also do some kind of abort.
We need to check for operations like feature or config space read as I do not see how an error can be signaled back to the driver when it is reading a register/
+#define VIRTIO_MSG_MIN_SIZE 44
In lots of function you do not test if the message length is not smaller than this. It could be a good idea to have compilation time asserts in your code when functions are making an assumption on the minimum message length required.
This is the minimum message size that a bus implementation must support. Messages can be shorter than this, but this is the largest transport message we need to support for now.
We will need to check that this is mentioned in the spec. Would be a good idea anyway to have a build time assert checking that this value is not smaller than that as a lot of the code is working on this assumption without checking it.
Cheers Bertrand
-- viresh
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.