From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIHve-0004KS-A1 for qemu-devel@nongnu.org; Thu, 23 Jul 2015 10:56:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIHvb-0006h7-II for qemu-devel@nongnu.org; Thu, 23 Jul 2015 10:56:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIHvb-0006gs-Ck for qemu-devel@nongnu.org; Thu, 23 Jul 2015 10:56:55 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id BE827387D99 for ; Thu, 23 Jul 2015 14:56:54 +0000 (UTC) Date: Thu, 23 Jul 2015 17:56:52 +0300 From: "Michael S. Tsirkin" Message-ID: <20150723175516-mutt-send-email-mst@redhat.com> References: <1437559884-13532-1-git-send-email-mst@redhat.com> <55B09F15.1030808@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B09F15.1030808@redhat.com> Subject: Re: [Qemu-devel] [PATCH] virtio: hide legacy features from modern guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: qemu-devel@nongnu.org On Thu, Jul 23, 2015 at 04:00:21PM +0800, Jason Wang wrote: > > > 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 > > Should we do the same for device specific legacy feature bits? Depends on what do you refer to. > > --- > > 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: