From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v3 7/7] vhost: feature to set the vring endianness
Date: Tue, 7 Apr 2015 17:01:31 +0200 [thread overview]
Message-ID: <20150407170131.3899d62c.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20150407121557.4213.95569.stgit@bahia.lab.toulouse-stg.fr.ibm.com>
On Tue, 07 Apr 2015 14:19:31 +0200
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:
> This patch brings cross-endian support to vhost when used to implement
> legacy virtio devices. Since it is a relatively rare situation, the
> feature availability is controlled by a kernel config option (not set
> by default).
>
> The ioctls introduced by this patch are for legacy only: virtio 1.0
> devices are returned EPERM.
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
> drivers/vhost/Kconfig | 10 ++++++++
> drivers/vhost/vhost.c | 55 ++++++++++++++++++++++++++++++++++++++++++++
> drivers/vhost/vhost.h | 17 +++++++++++++-
> include/uapi/linux/vhost.h | 5 ++++
> 4 files changed, 86 insertions(+), 1 deletion(-)
> +#ifdef CONFIG_VHOST_SET_ENDIAN_LEGACY
> +static long vhost_set_vring_endian_legacy(struct vhost_virtqueue *vq,
> + void __user *argp)
> +{
> + struct vhost_vring_state s;
> +
> + if (vhost_has_feature(vq, VIRTIO_F_VERSION_1))
> + return -EPERM;
> +
> + if (copy_from_user(&s, argp, sizeof(s)))
> + return -EFAULT;
> +
> + vq->legacy_is_little_endian = !!s.num;
> + return 0;
> +}
> +
> +static long vhost_get_vring_endian_legacy(struct vhost_virtqueue *vq,
> + u32 idx,
> + void __user *argp)
> +{
> + struct vhost_vring_state s = {
> + .index = idx,
> + .num = vq->legacy_is_little_endian
> + };
> +
> + if (vhost_has_feature(vq, VIRTIO_F_VERSION_1))
> + return -EPERM;
> +
> + if (copy_to_user(argp, &s, sizeof(s)))
> + return -EFAULT;
> +
> + return 0;
> +}
> +#else
> +static long vhost_set_vring_endian_legacy(struct vhost_virtqueue *vq,
> + void __user *argp)
> +{
> + return 0;
I'm wondering whether this handler should return an error if the
feature is not configured for the kernel? How can the userspace caller
find out whether it has successfully prompted the kernel to handle the
endianness correctly?
> +}
> +
> +static long vhost_get_vring_endian_legacy(struct vhost_virtqueue *vq,
> + u32 idx,
> + void __user *argp)
> +{
> + return 0;
> +}
> +#endif /* CONFIG_VHOST_SET_ENDIAN_LEGACY */
next prev parent reply other threads:[~2015-04-07 15:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 12:09 [PATCH v3 0/7] vhost: support for cross endian guests Greg Kurz
2015-04-07 12:09 ` [PATCH v3 1/7] virtio: introduce virtio_is_little_endian() helper Greg Kurz
2015-04-07 12:09 ` [PATCH v3 2/7] tun: add tun_is_little_endian() helper Greg Kurz
2015-04-07 12:09 ` [PATCH v3 3/7] macvtap: introduce macvtap_is_little_endian() helper Greg Kurz
2015-04-07 12:15 ` [PATCH v3 4/7] vringh: introduce vringh_is_little_endian() helper Greg Kurz
2015-04-07 12:15 ` [PATCH v3 5/7] vhost: introduce vhost_is_little_endian() helper Greg Kurz
2015-04-07 12:15 ` [PATCH v3 6/7] virtio: add explicit big-endian support to memory accessors Greg Kurz
2015-04-07 15:56 ` Michael S. Tsirkin
2015-04-21 7:47 ` Greg Kurz
2015-04-07 12:19 ` [PATCH v3 7/7] vhost: feature to set the vring endianness Greg Kurz
2015-04-07 15:01 ` Cornelia Huck [this message]
2015-04-08 7:36 ` Greg Kurz
2015-04-07 15:52 ` Michael S. Tsirkin
2015-04-08 8:23 ` Greg Kurz
2015-04-07 16:11 ` Michael S. Tsirkin
2015-04-08 8:25 ` Greg Kurz
2015-04-07 15:55 ` [PATCH v3 0/7] vhost: support for cross endian guests Michael S. Tsirkin
2015-04-07 16:08 ` Greg Kurz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150407170131.3899d62c.cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=gkurz@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox