From patchwork Mon May 11 12:48:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 48280 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29E062121F for ; Mon, 11 May 2015 13:06:13 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf39412098wgt.1 for ; Mon, 11 May 2015 06:06:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:message-id:references :mime-version:content-type:content-disposition:in-reply-to:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=HMnGMlVFva/lPvSh/JmYlvk3tPvVvWNOmE733LhYRbk=; b=TheOsY7Fp0i3F//luYq2mAAngLFyYv8Dji22TeQ2NPrXulYCIL5DSKlBqH6JsQwuJR Hdn4blE2kxz3r53+1v0rL8RakWYCX4B7AFG/jYu8fBmtWl0dus0oEUcvOuj1bRR7babw rwrnt+1oE0ir9r23q89VdbQnmVdg1NQ9nNHPKYrfiw6pwhjGCjX6pjE/61tDcqPOWr93 80otzKVUs3PFc+1Fyuvyal2hDKoudlDumeItyFnf8E5nZKFnN81KC/rkfmK9vvdkVST9 0OhrYxi5T2/5z8wMx3f9eHgNoFaLwTE7Olvyo87yCxGjyEJj7nB8ifw+EiO402zyTKLF 7fdQ== X-Gm-Message-State: ALoCoQmMcqVzmCfk/5zJ8VQjwVSKPFN1ESpCw98UVnjT6YaIxWO/XIyjO2q6OYFDjGy6sM27Bj2I X-Received: by 10.112.166.137 with SMTP id zg9mr7359772lbb.11.1431349572337; Mon, 11 May 2015 06:06:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.162 with SMTP id g2ls635418lae.80.gmail; Mon, 11 May 2015 06:06:12 -0700 (PDT) X-Received: by 10.152.25.227 with SMTP id f3mr7831539lag.67.1431349572162; Mon, 11 May 2015 06:06:12 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id j11si8328241lbg.95.2015.05.11.06.06.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 06:06:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by laat2 with SMTP id t2so92625061laa.1 for ; Mon, 11 May 2015 06:06:12 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr8239841lad.56.1431349572041; Mon, 11 May 2015 06:06:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1494506lbb; Mon, 11 May 2015 06:06:11 -0700 (PDT) X-Received: by 10.55.23.78 with SMTP id i75mr21144880qkh.82.1431349569906; Mon, 11 May 2015 06:06:09 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e2si12942417qci.5.2015.05.11.06.06.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 06:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:37207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrnPL-0006fd-Pa for patch@linaro.org; Mon, 11 May 2015 09:06:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrn8i-0003w8-JM for qemu-devel@nongnu.org; Mon, 11 May 2015 08:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yrn8e-0002mP-Fb for qemu-devel@nongnu.org; Mon, 11 May 2015 08:48:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrn8e-0002lz-8U for qemu-devel@nongnu.org; Mon, 11 May 2015 08:48:52 -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 (8.14.4/8.14.4) with ESMTP id t4BCmg9g011496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 May 2015 08:48:42 -0400 Received: from redhat.com (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t4BCmdoA029832; Mon, 11 May 2015 08:48:39 -0400 Date: Mon, 11 May 2015 14:48:38 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1431329108-2605-28-git-send-email-mst@redhat.com> References: <1431329108-2605-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1431329108-2605-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Alexander Graf , Christian Borntraeger , Shannon Zhao , Shannon Zhao , Cornelia Huck , Paolo Bonzini , Richard Henderson Subject: [Qemu-devel] [PULL 27/28] virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to virtio-scsi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mst@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao So far virtio-scsi-device can't expose host features to guest while using virtio-mmio because it doesn't set DEFINE_VIRTIO_SCSI_FEATURES on backend or transport. The host features belong to the backends while virtio-scsi-pci, virtio-scsi-s390 and virtio-scsi-ccw set the DEFINE_VIRTIO_SCSI_FEATURES on transports. But they already have the ability to forward property accesses to the backend child. So if we move the host features to backends, it doesn't break the backwards compatibility for them and make host features work while using virtio-mmio. Move DEFINE_VIRTIO_SCSI_FEATURES to the backend virtio-scsi. The transports just sync the host features from backends. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Peter Maydell --- include/hw/virtio/virtio-scsi.h | 1 + hw/s390x/s390-virtio-bus.c | 1 - hw/s390x/virtio-ccw.c | 1 - hw/scsi/virtio-scsi.c | 5 +++++ hw/virtio/virtio-pci.c | 1 - 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index f93b57d..b42e7f1 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -98,6 +98,7 @@ typedef struct VirtIOSCSI { bool dataplane_fenced; Error *blocker; Notifier migration_state_notifier; + uint32_t host_features; } VirtIOSCSI; typedef struct VirtIOSCSIReq { diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index b893e02..c8a78ba 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -622,7 +622,6 @@ static const TypeInfo virtio_s390_device_info = { static Property s390_virtio_scsi_properties[] = { DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), - DEFINE_VIRTIO_SCSI_FEATURES(VirtIOS390Device, host_features), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index e6e9f9d..db798a8 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1506,7 +1506,6 @@ static const TypeInfo virtio_ccw_balloon = { static Property virtio_ccw_scsi_properties[] = { DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id), - DEFINE_VIRTIO_SCSI_FEATURES(VirtioCcwDevice, host_features[0]), DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index c9bea06..e242fef 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -631,6 +631,10 @@ static void virtio_scsi_set_config(VirtIODevice *vdev, static uint32_t virtio_scsi_get_features(VirtIODevice *vdev, uint32_t requested_features) { + VirtIOSCSI *s = VIRTIO_SCSI(vdev); + + /* Firstly sync all virtio-scsi possible supported features */ + requested_features |= s->host_features; return requested_features; } @@ -945,6 +949,7 @@ static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp) static Property virtio_scsi_properties[] = { DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOSCSI, parent_obj.conf), + DEFINE_VIRTIO_SCSI_FEATURES(VirtIOSCSI, host_features), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 07b2a67..867c9d1 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1087,7 +1087,6 @@ static Property virtio_scsi_pci_properties[] = { VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, DEV_NVECTORS_UNSPECIFIED), - DEFINE_VIRTIO_SCSI_FEATURES(VirtIOPCIProxy, host_features), DEFINE_PROP_END_OF_LIST(), };