From: Cornelia Huck <cohuck@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Fam Zheng" <fam@euphon.net>, "Thomas Huth" <thuth@redhat.com>,
"Jagannathan Raman" <jag.raman@oracle.com>,
qemu-block@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
"Greg Kurz" <groug@kaod.org>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
qemu-devel@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Max Reitz" <mreitz@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH-for-6.0 1/3] hw/virtio: Add configure switch to disable legacy VIRTIO
Date: Thu, 5 Nov 2020 14:06:52 +0100 [thread overview]
Message-ID: <20201105140652.6c975b9e.cohuck@redhat.com> (raw)
In-Reply-To: <20201105124353.3680057-2-philmd@redhat.com>
On Thu, 5 Nov 2020 13:43:51 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> Per [1] (Terminology):
>
> Legacy interfaces are not required; ie. don’t implement them
> unless you have a need for backwards compatibility!
>
> [2] (Version 1.0):
>
> The device configuration space uses the little-endian format
> for multi-byte fields.
>
> and [3] (Legacy Interface):
>
> for legacy interfaces, device configuration space is generally
> the guest’s native endian, rather than PCI’s little-endian.
> The correct endian-ness is documented for each device.
>
> Add the --disable-virtio-legacy configure flag to produce builds
> with VIRTIO 1.0 only, and the --enable-virtio-legacy to include
> legacy VIRTIO support (supporting legacy VIRTIO is the default).
This is only dealing with endianess issues; there are other differences
on the control plane as well.
Currently, virtio-pci has the option to make devices non-transitional,
but virtio-ccw has not (only for device types). For virtio-mmio, you
need to select one of legacy or non-transitional, IIRC.
>
> [1] http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-60001
> [2] http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-170003
> [3] http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-200003
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> configure | 10 ++++++++++
> meson.build | 1 +
> include/hw/virtio/virtio-access.h | 19 +++++--------------
> hw/virtio/virtio-legacy.c | 29 +++++++++++++++++++++++++++++
> hw/virtio/meson.build | 1 +
> 5 files changed, 46 insertions(+), 14 deletions(-)
> create mode 100644 hw/virtio/virtio-legacy.c
(...)
> diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h
> index 6818a23a2d3..b6c060f8cc6 100644
> --- a/include/hw/virtio/virtio-access.h
> +++ b/include/hw/virtio/virtio-access.h
> @@ -20,24 +20,15 @@
> #include "hw/virtio/virtio.h"
> #include "hw/virtio/virtio-bus.h"
>
> -#if defined(TARGET_PPC64) || defined(TARGET_ARM)
> -#define LEGACY_VIRTIO_IS_BIENDIAN 1
> -#endif
> -
> +#ifdef CONFIG_VIRTIO_LEGACY
> +bool virtio_access_is_big_endian(VirtIODevice *vdev);
> +#else
> static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
> {
> -#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
> - return virtio_is_big_endian(vdev);
> -#elif defined(TARGET_WORDS_BIGENDIAN)
> - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
> - /* Devices conforming to VIRTIO 1.0 or later are always LE. */
> - return false;
> - }
> - return true;
> -#else
> + /* Devices conforming to VIRTIO 1.0 or later are always LE. */
> return false;
This will make migration from a QEMU that has devices for which 1.0 has
not been negotiated fail.
> -#endif
> }
> +#endif
>
> static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa)
> {
next prev parent reply other threads:[~2020-11-05 13:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 12:43 [PATCH-for-6.0 0/3] hw/virtio: Allow to disable legacy VIRTIO Philippe Mathieu-Daudé
2020-11-05 12:43 ` [PATCH-for-6.0 1/3] hw/virtio: Add configure switch " Philippe Mathieu-Daudé
2020-11-05 13:06 ` Cornelia Huck [this message]
2020-11-05 13:53 ` Philippe Mathieu-Daudé
2020-11-05 13:08 ` Paolo Bonzini
2020-11-05 12:43 ` [PATCH-for-6.0 2/3] hw/virtio: Build most of virtio devices as arch-independent objects Philippe Mathieu-Daudé
2020-11-05 13:08 ` Paolo Bonzini
2020-11-05 14:33 ` Greg Kurz
2020-11-05 12:43 ` [PATCH-for-6.0 3/3] gitlab-ci: Test the --disable-virtio-legacy option Philippe Mathieu-Daudé
2020-11-05 13:33 ` Thomas Huth
2020-11-05 14:12 ` [PATCH-for-6.0 0/3] hw/virtio: Allow to disable legacy VIRTIO Philippe Mathieu-Daudé
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=20201105140652.6c975b9e.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=elena.ufimtseva@oracle.com \
--cc=fam@euphon.net \
--cc=groug@kaod.org \
--cc=jag.raman@oracle.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.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;
as well as URLs for NNTP newsgroup(s).