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
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
Date: Tue, 28 Apr 2015 19:51:13 +0800 [thread overview]
Message-ID: <1430221873-5788-3-git-send-email-shannon.zhao@linaro.org> (raw)
In-Reply-To: <1430221873-5788-1-git-send-email-shannon.zhao@linaro.org>
From: Shannon Zhao <shannon.zhao@linaro.org>
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 <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
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 {
--
2.1.0
next prev parent reply other threads:[~2015-04-28 11:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 11:51 [Qemu-devel] [PATCH v4 0/2] virtio: Move host features to backends shannon.zhao
2015-04-28 11:51 ` [Qemu-devel] [PATCH v4 1/2] virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net shannon.zhao
2015-04-28 11:51 ` shannon.zhao [this message]
2015-04-28 12:48 ` [Qemu-devel] [PATCH v4 0/2] virtio: Move host features to backends Michael S. Tsirkin
2015-04-28 12:52 ` Peter Maydell
2015-04-28 13:05 ` Michael S. Tsirkin
2015-04-28 13:20 ` Cornelia Huck
2015-04-28 14:03 ` Michael S. Tsirkin
2015-04-28 13:06 ` Peter Maydell
2015-04-28 13:13 ` Michael S. Tsirkin
2015-04-28 13:16 ` Peter Maydell
2015-04-28 13:24 ` Cornelia Huck
2015-04-28 14:35 ` Michael S. Tsirkin
2015-04-28 18:14 ` Michael S. Tsirkin
2015-04-28 18:32 ` Michael S. Tsirkin
2015-04-28 18:35 ` Michael S. Tsirkin
2015-04-29 8:17 ` Christian Borntraeger
2015-04-29 8:52 ` Cornelia Huck
2015-04-29 10:32 ` Michael S. Tsirkin
2015-04-29 14:33 ` Cornelia Huck
2015-04-29 18:32 ` Michael S. Tsirkin
2015-04-29 14:43 ` Christian Borntraeger
2015-04-29 18:35 ` Michael S. Tsirkin
2015-04-29 19:49 ` Christian Borntraeger
2015-04-29 20:19 ` Michael S. Tsirkin
2015-04-30 15:50 ` Christian Borntraeger
2015-04-28 18:34 ` Peter Maydell
2015-04-28 18:38 ` Michael S. Tsirkin
2015-04-29 9:55 ` Shannon Zhao
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=1430221873-5788-3-git-send-email-shannon.zhao@linaro.org \
--to=shannon.zhao@linaro.org \
--cc=christoffer.dall@linaro.org \
--cc=cornelia.huck@de.ibm.com \
--cc=hangaohuai@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhaoshenglong@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).