diff options
author | Greg Kurz <gkurz@linux.vnet.ibm.com> | 2016-02-16 15:59:34 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-03-02 17:02:00 +0200 |
commit | c507203756ca6303df2191c96c1385e965e2f0b7 (patch) | |
tree | a272cf68a2b2f974581b85c3cb259fd1f512c74f /include/xen/features.h | |
parent | 592002f55e6e0b198a01d4a9315f74ddfea1c403 (diff) | |
download | linux-c507203756ca6303df2191c96c1385e965e2f0b7.tar.bz2 |
vhost: rename cross-endian helpers
The default use case for vhost is when the host and the vring have the
same endianness (default native endianness). But there are cases where
they differ and vhost should byteswap when accessing the vring.
The first case is when the host is big endian and the vring belongs to
a virtio 1.0 device, which is always little endian.
This is covered by the vq->is_le field. This field is initialized when
userspace calls the VHOST_SET_FEATURES ioctl. It is reset when the device
stops.
We already have a vhost_init_is_le() helper, but the reset operation is
opencoded as follows:
vq->is_le = virtio_legacy_is_little_endian();
It isn't clear that we are resetting vq->is_le here.
This patch moves the code to a helper with a more explicit name.
The other case where we may have to byteswap is when the architecture can
switch endianness at runtime (bi-endian). If endianness differs in the host
and in the guest, then legacy devices need to be used in cross-endian mode.
This mode is available with CONFIG_VHOST_CROSS_ENDIAN_LEGACY=y, which
introduces a vq->user_be field. Userspace may enable cross-endian mode
by calling the SET_VRING_ENDIAN ioctl before the device is started. The
cross-endian mode is disabled when the device is stopped.
The current names of the helpers that manipulate vq->user_be are unclear.
This patch renames those helpers to clearly show that this is cross-endian
stuff and with explicit enable/disable semantics.
No behaviour change.
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/xen/features.h')
0 files changed, 0 insertions, 0 deletions