From: Cornelia Huck <cohuck@redhat.com>
To: Sergio Lopez <slp@redhat.com>
Cc: stefanha@gmail.com, peter.maydell@linaro.org,
qemu-devel@nongnu.org, abologna@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] virtio-mmio: implement modern (v2) personality (virtio-1)
Date: Mon, 2 Sep 2019 15:41:35 +0200 [thread overview]
Message-ID: <20190902154135.39043595.cohuck@redhat.com> (raw)
In-Reply-To: <20190829165026.225173-1-slp@redhat.com>
On Thu, 29 Aug 2019 18:50:27 +0200
Sergio Lopez <slp@redhat.com> wrote:
> Implement the modern (v2) personality, according to the VirtIO 1.0
> specification.
>
> Support for v2 among guests is not as widespread as it'd be
> desirable. While the Linux driver has had it for a while, support is
> missing, at least, from Tianocore EDK II, NetBSD and FreeBSD.
>
> For this reason, the v2 personality is disabled, keeping the legacy
> behavior as default. Machine types willing to use v2, can enable it
> using MachineClass's compat_props.
>
> Signed-off-by: Sergio Lopez <slp@redhat.com>
> ---
> Changelog:
>
> v2:
> - Switch from RFC to PATCH.
> - Avoid the modern vs. legacy dichotomy. Use legacy or non-legacy
> instead. (Andrea Bolognani, Cornelia Huck)
> - Include the register offset in the warning messages. (Stefan
> Hajnoczi)
> - Fix device endianness for the non-legacy mode. (Michael S. Tsirkin)
> - Honor the specs in VIRTIO_MMIO_QUEUE_READY. (Michael S. Tsirkin)
> ---
> hw/virtio/virtio-mmio.c | 296 +++++++++++++++++++++++++++++++++++++---
> 1 file changed, 279 insertions(+), 17 deletions(-)
>
> @@ -146,28 +163,51 @@ static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size)
> case VIRTIO_MMIO_MAGIC_VALUE:
> return VIRT_MAGIC;
> case VIRTIO_MMIO_VERSION:
> - return VIRT_VERSION;
> + if (proxy->legacy) {
> + return VIRT_VERSION_LEGACY;
> + } else {
> + return VIRT_VERSION;
> + }
> case VIRTIO_MMIO_DEVICE_ID:
> return vdev->device_id;
> case VIRTIO_MMIO_VENDOR_ID:
> return VIRT_VENDOR;
> case VIRTIO_MMIO_DEVICE_FEATURES:
> - if (proxy->host_features_sel) {
> - return 0;
> - }
> - return vdev->host_features;
> + return vdev->host_features >> (32 * proxy->host_features_sel);
Hm... I think you want to return 0 for host_features_sel > 0 on legacy
devices.
Also, there's VirtIODeviceClass->legacy_features, which probably should
be masked out for non-legacy devices?
(...)
> @@ -229,17 +275,33 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value,
> }
> switch (offset) {
> case VIRTIO_MMIO_DEVICE_FEATURES_SEL:
> - proxy->host_features_sel = value;
> + if (value) {
> + proxy->host_features_sel = 1;
> + } else {
> + proxy->host_features_sel = 0;
> + }
> break;
> case VIRTIO_MMIO_DRIVER_FEATURES:
> - if (!proxy->guest_features_sel) {
> + if (!proxy->legacy) {
> + proxy->guest_features[proxy->guest_features_sel] = value;
> + } else if (!proxy->guest_features_sel) {
> virtio_set_features(vdev, value);
If the guest tries to set something !0 for guest_features_sel > 0 on a
legacy device, should that be logged as a guest bug?
> }
> break;
(...)
Otherwise, looks good to me.
next prev parent reply other threads:[~2019-09-02 13:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 16:50 [Qemu-devel] [PATCH v2] virtio-mmio: implement modern (v2) personality (virtio-1) Sergio Lopez
2019-09-02 9:35 ` Stefan Hajnoczi
2019-09-03 10:23 ` Sergio Lopez
2019-09-02 13:41 ` Cornelia Huck [this message]
2019-09-03 10:22 ` Sergio Lopez
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=20190902154135.39043595.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=abologna@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=slp@redhat.com \
--cc=stefanha@gmail.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).