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 ?
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.
+#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.