From patchwork Tue Apr 28 11:51:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 465525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7F72014012C for ; Tue, 28 Apr 2015 21:58:36 +1000 (AEST) Received: from localhost ([::1]:60864 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn49q-0006x2-Re for incoming@patchwork.ozlabs.org; Tue, 28 Apr 2015 07:58:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn49T-0006J6-J2 for qemu-devel@nongnu.org; Tue, 28 Apr 2015 07:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yn432-0003ys-O7 for qemu-devel@nongnu.org; Tue, 28 Apr 2015 07:52:25 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:32836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn432-0003yV-DB for qemu-devel@nongnu.org; Tue, 28 Apr 2015 07:51:32 -0400 Received: by pacwv17 with SMTP id wv17so140405284pac.0 for ; Tue, 28 Apr 2015 04:51:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GaocR1mKODP3+W7p/1azzjLa7nUzKFKJqqHWugaWREY=; b=bDW6FRjBvBjAIjdTTRb+bSFLDVBjw7q7N1US+AgBYLgBUa8EB+JjK3KssJzkyamMkl Lz0laC5IzuiGA8VNF79vxji0FiImcSzfIkj+xyINTGK0GaHPmF1ybEBhoy9YKnhRF0jy XIweUP9uO0C3AEM6CEHeH0XzYIGqjcQZIym08ybIx6oY0+210AClLVY59n6OKjkbvZA8 PWnitpUWSRp0mYPfkQZ0WhMwthl1d2JCGCWmi1CQTdYzXWtqTWc9rLedkhABJ0SED+Lf /iBcRLnF/6CwxXcY7nu66JTc1JgzLyXXzzMXDoTJiP7nuWe5yuvePD1EJbwH0kXBCCLt xG3Q== X-Gm-Message-State: ALoCoQmGcT2E0mGkiHGBjSDWlLpMMEi7kgPD7HSqGqhFM/kwLstxgWwQ/BtvgMV1tXsnqFCgEi/A X-Received: by 10.66.172.4 with SMTP id ay4mr31662573pac.157.1430221891705; Tue, 28 Apr 2015 04:51:31 -0700 (PDT) Received: from localhost ([167.160.116.84]) by mx.google.com with ESMTPSA id f7sm21926149pat.47.2015.04.28.04.51.29 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 28 Apr 2015 04:51:30 -0700 (PDT) From: shannon.zhao@linaro.org To: qemu-devel@nongnu.org, peter.maydell@linaro.org, cornelia.huck@de.ibm.com, mst@redhat.com, pbonzini@redhat.com, christoffer.dall@linaro.org Date: Tue, 28 Apr 2015 19:51:13 +0800 Message-Id: <1430221873-5788-3-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1430221873-5788-1-git-send-email-shannon.zhao@linaro.org> References: <1430221873-5788-1-git-send-email-shannon.zhao@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.46 Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH v4 2/2] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 - include/hw/virtio/virtio-scsi.h | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) 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 1252162..ef97fe9 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 c6b99f9..5c173c4 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1078,7 +1078,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(), }; 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 {