Re: [PATCH v4 1/1] vringh: IOMEM support

From: Shunsuke Mie
Date: Sun Jun 04 2023 - 21:52:00 EST


Hi Simon-san,

On 2023/06/03 23:40, Simon Horman wrote:
On Fri, Jun 02, 2023 at 02:52:11PM +0900, Shunsuke Mie wrote:
Introduce a new memory accessor for vringh. It is able to use vringh to
virtio rings located on io-memory region.

Signed-off-by: Shunsuke Mie <mie@xxxxxxxxxx>
...

+/**
+ * vringh_iov_pull_iomem - copy bytes from vring_iov.
Hi Mie-san,

as it looks like there will be a v2,
please consider documenting the vrh parameter here.
It was missing an explanation. I will address that and review this patch.
Thank you.

+ * @riov: the riov as passed to vringh_getdesc_iomem() (updated as we consume)
+ * @dst: the place to copy.
+ * @len: the maximum length to copy.
+ *
+ * Returns the bytes copied <= len or a negative errno.
+ */
+ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov *riov,
+ void *dst, size_t len)
+{
+ return vringh_iov_xfer(vrh, riov, dst, len, xfer_from_iomem);
+}
+EXPORT_SYMBOL(vringh_iov_pull_iomem);
+
+/**
+ * vringh_iov_push_iomem - copy bytes into vring_iov.
And here.
I do the same.
+ * @wiov: the wiov as passed to vringh_getdesc_iomem() (updated as we consume)
+ * @src: the place to copy from.
+ * @len: the maximum length to copy.
+ *
+ * Returns the bytes copied <= len or a negative errno.
+ */
+ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov *wiov,
+ const void *src, size_t len)
+{
+ return vringh_iov_xfer(vrh, wiov, (void *)src, len, xfer_to_iomem);
+}
+EXPORT_SYMBOL(vringh_iov_push_iomem);
...

Best regards,

Shunsuke