From: Will Deacon <will.deacon@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Sasha Levin <sasha.levin@oracle.com>,
Pekka Enberg <penberg@kernel.org>,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] virtio: fix endianness check for vhost support
Date: Wed, 2 Mar 2016 01:27:54 +0000 [thread overview]
Message-ID: <20160302012753.GF14022@arm.com> (raw)
In-Reply-To: <1456850978-14091-4-git-send-email-andre.przywara@arm.com>
On Tue, Mar 01, 2016 at 04:49:38PM +0000, Andre Przywara wrote:
> Currently we deny any VHOST_* functionality if the architecture
> supports guests with different endianness than the host. Most of the
> time even on those architectures the endianness of guest and host are
> the same, though, so we are denying the glory of VHOST needlessly.
> Switch from compile time determination to a run time scheme, which
> takes the actual endianness of the guest into account.
> For this we change the semantics of VIRTIO_ENDIAN_HOST to return the
> actual endianness of the host (the endianness of kvmtool at compile
> time, really). The actual check in vhost_net now compares this against
> the guest endianness.
> This enables vhost support on ARM and ARM64.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> include/kvm/virtio.h | 9 +++++++--
> virtio/net.c | 2 +-
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/include/kvm/virtio.h b/include/kvm/virtio.h
> index 768ee96..66530fd 100644
> --- a/include/kvm/virtio.h
> +++ b/include/kvm/virtio.h
> @@ -17,10 +17,15 @@
> #define VIRTIO_PCI_O_CONFIG 0
> #define VIRTIO_PCI_O_MSIX 1
>
> -#define VIRTIO_ENDIAN_HOST 0
> #define VIRTIO_ENDIAN_LE (1 << 0)
> #define VIRTIO_ENDIAN_BE (1 << 1)
>
> +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> +#define VIRTIO_ENDIAN_HOST VIRTIO_ENDIAN_LE
> +#else
> +#define VIRTIO_ENDIAN_HOST VIRTIO_ENDIAN_BE
> +#endif
pci.h already uses __BYTE_ORDER and __LITTLE_ENDIAN, so we should at least
be consistent here.
Will
prev parent reply other threads:[~2016-03-02 1:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 16:49 [PATCH 0/3] kvmtool: fix vhost-net support Andre Przywara
2016-03-01 16:49 ` [PATCH 1/3] irq: move IRQ routing into irq.c Andre Przywara
2016-03-02 0:37 ` Will Deacon
2016-03-01 16:49 ` [PATCH 2/3] MSI-X: update GSI routing after changed MSI-X configuration Andre Przywara
2016-03-02 1:16 ` Will Deacon
2016-03-02 22:20 ` André Przywara
2016-03-01 16:49 ` [PATCH 3/3] virtio: fix endianness check for vhost support Andre Przywara
2016-03-02 1:27 ` Will Deacon [this message]
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=20160302012753.GF14022@arm.com \
--to=will.deacon@arm.com \
--cc=andre.przywara@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=sasha.levin@oracle.com \
/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