From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH RFC v5 14/19] s390x/virtio-ccw: enable virtio 1.0 Date: Tue, 9 Dec 2014 15:46:46 +0200 Message-ID: <20141209134646.GA6897@redhat.com> References: <1417525227-14051-1-git-send-email-cornelia.huck@de.ibm.com> <1417525227-14051-15-git-send-email-cornelia.huck@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: thuth@linux.vnet.ibm.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org To: Cornelia Huck Return-path: Content-Disposition: inline In-Reply-To: <1417525227-14051-15-git-send-email-cornelia.huck@de.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: kvm.vger.kernel.org On Tue, Dec 02, 2014 at 02:00:22PM +0100, Cornelia Huck wrote: > virtio-ccw should now have everything in place to operate virtio 1.0 > devices, so let's enable revision 1. > > Signed-off-by: Cornelia Huck Looks like this will allow revision 1 for all devices, we only want this for virtio 1 devices. The following should fix it I think: Signed-off-by: Michael S. Tsirkin diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index d40e3be..f5a1d3e 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -69,9 +69,6 @@ typedef struct VirtIOCCWDeviceClass { int (*exit)(VirtioCcwDevice *dev); } VirtIOCCWDeviceClass; -/* The maximum virtio revision we support. */ -#define VIRTIO_CCW_REV_MAX 1 - /* Performance improves when virtqueue kick processing is decoupled from the * vcpu thread using ioeventfd for some devices. */ #define VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT 1 @@ -104,6 +101,12 @@ struct VirtioCcwDevice { uint64_t ind_bit; }; +/* The maximum virtio revision we support. */ +static int virtio_ccw_rev_max(VirtioCcwDevice *dev) +{ + return dev->host_features & (1ULL << VIRTIO_F_VERSION_1) ? 1 : 0; +} + /* virtual css bus type */ typedef struct VirtualCssBus { BusState parent_obj; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 3826074..922b021 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -693,7 +693,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) } cpu_physical_memory_read(ccw.cda, &revinfo, len); if (dev->revision >= 0 || - revinfo.revision > VIRTIO_CCW_REV_MAX) { + revinfo.revision > virtio_ccw_rev_max(dev)) { ret = -ENOSYS; break; }