On 24 Jul 2025, at 12:02, Viresh Kumar viresh.kumar@linaro.org wrote:
On 24-07-25, 09:59, Bertrand Marquis wrote:
Hi Viresh,
On 24 Jul 2025, at 11:41, Viresh Kumar viresh.kumar@linaro.org wrote:
On 22-07-25, 10:38, Bertrand Marquis wrote:
+static void virtio_msg_get(struct virtio_device *vdev, unsigned int offset,
- void *buf, unsigned int len)
+{
- struct virtio_msg_device *vmdev = to_virtio_msg_device(vdev);
- struct get_config *req_payload = virtio_msg_payload(vmdev->request);
- struct get_config_resp *res_payload = virtio_msg_payload(vmdev->response);
- BUG_ON(len > 8);
So you only allow to retrieve 64bit at a time here. Why is that ?
This was copied from mmio which accepts on 8 bytes at a time. Modified as:
Sounds good yes, same should apply to set I would say.
I just didn't paste it :)
Good, works for me then :-)
@@ -198,8 +206,7 @@ static void virtio_msg_set(struct virtio_device *vdev, unsigned int offset, { struct virtio_msg_device *vmdev = to_virtio_msg_device(vdev); struct set_config *payload = virtio_msg_payload(vmdev->request);
BUG_ON(len > 8);
u32 i = 0, max; if (offset + len > vmdev->config_size) { dev_err(&vmdev->vdev.dev,
@@ -208,22 +215,41 @@ static void virtio_msg_set(struct virtio_device *vdev, unsigned int offset, return; }
/* Max buffer size available in the request */
max = vmdev->msg_size - sizeof(*vmdev->request) - sizeof(*payload);
transport_msg_prepare(vmdev, VIRTIO_MSG_SET_CONFIG, sizeof(*payload));
payload->offset = cpu_to_le32(offset);
payload->size = cpu_to_le32(len); payload->generation = cpu_to_le32(vmdev->generation_count);
/* Buffer holds the data in little endian */
memcpy(payload->config, buf, len);
while (i != len) {
u32 size = min(max, len - i);
virtio_msg_xfer(vmdev);
payload->offset = cpu_to_le32(offset + i);
payload->size = cpu_to_le32(size);
/* Buffer holds the data in little endian */
memcpy(payload->config, buf + i, size);
i += size;
if (virtio_msg_xfer(vmdev))
return;
}
}
-- 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.