All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio: hide legacy features from modern guests
Date: Thu, 23 Jul 2015 16:00:21 +0800	[thread overview]
Message-ID: <55B09F15.1030808@redhat.com> (raw)
In-Reply-To: <1437559884-13532-1-git-send-email-mst@redhat.com>



On 07/22/2015 06:11 PM, Michael S. Tsirkin wrote:
> NOTIFY_ON_EMPTY, ANY_LAYOUT and BAD are only valid on the legacy
> interface.
>
> Hide them from modern guests.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Should we do the same for device specific legacy feature bits?

> ---
>  include/hw/virtio/virtio.h | 4 ++++
>  hw/virtio/virtio-pci.c     | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index fbb3c06..cbe3a5a 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -25,6 +25,10 @@
>  /* A guest should never accept this.  It implies negotiation is broken. */
>  #define VIRTIO_F_BAD_FEATURE		30
>  
> +#define VIRTIO_LEGACY_FEATURES ((0x1ULL << VIRTIO_F_BAD_FEATURE) | \
> +                                (0x1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \
> +                                (0x1ULL << VIRTIO_F_ANY_LAYOUT))
> +
>  struct VirtQueue;
>  
>  static inline hwaddr vring_align(hwaddr addr,
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 283401a..db8f27c 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1095,7 +1095,8 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
>          break;
>      case VIRTIO_PCI_COMMON_DF:
>          if (proxy->dfselect <= 1) {
> -            val = vdev->host_features >> (32 * proxy->dfselect);
> +            val = (vdev->host_features & ~VIRTIO_LEGACY_FEATURES) >>
> +                (32 * proxy->dfselect);
>          }
>          break;
>      case VIRTIO_PCI_COMMON_GFSELECT:

  reply	other threads:[~2015-07-23  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 10:11 [Qemu-devel] [PATCH] virtio: hide legacy features from modern guests Michael S. Tsirkin
2015-07-23  8:00 ` Jason Wang [this message]
2015-07-23 14:56   ` Michael S. Tsirkin

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=55B09F15.1030808@redhat.com \
    --to=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.