summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHalil Pasic <pasic@linux.vnet.ibm.com>2017-02-14 14:06:07 +0100
committerCornelia Huck <cornelia.huck@de.ibm.com>2017-02-24 10:15:18 +0100
commit47e13dfd86e33397d55bc3c3d08ac0ec3088b138 (patch)
tree6459fcc80a3190a35aa88cbe9589b26587d78632 /hw
parentba690c7171cb863643c21ab9f7e7116ad5df1c63 (diff)
downloadqemu-47e13dfd86e33397d55bc3c3d08ac0ec3088b138.zip
virtio-ccw: handle virtio 1 only devices
As a preparation for wiring-up virtio-crypto, the first non-transitional virtio device on the ccw transport, let us introduce a mechanism for disabling revision 0. This is more or less equivalent with disabling legacy as revision 0 is legacy only, and legacy drivers use the revision 0 exclusively. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/s390x/virtio-ccw.c18
-rw-r--r--hw/s390x/virtio-ccw.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 63c46373fb..32c414f23d 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -280,6 +280,15 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
ccw.cmd_code);
check_len = !((ccw.flags & CCW_FLAG_SLI) && !(ccw.flags & CCW_FLAG_DC));
+ if (dev->force_revision_1 && dev->revision < 0 &&
+ ccw.cmd_code != CCW_CMD_SET_VIRTIO_REV) {
+ /*
+ * virtio-1 drivers must start with negotiating to a revision >= 1,
+ * so post a command reject for all other commands
+ */
+ return -ENOSYS;
+ }
+
/* Look at the command. */
switch (ccw.cmd_code) {
case CCW_CMD_SET_VQ:
@@ -638,7 +647,8 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
* need to fetch it here. Nothing to do for now, though.
*/
if (dev->revision >= 0 ||
- revinfo.revision > virtio_ccw_rev_max(dev)) {
+ revinfo.revision > virtio_ccw_rev_max(dev) ||
+ (dev->force_revision_1 && !revinfo.revision)) {
ret = -ENOSYS;
break;
}
@@ -669,6 +679,12 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp)
if (!sch) {
return;
}
+ if (!virtio_ccw_rev_max(dev) && dev->force_revision_1) {
+ error_setg(&err, "Invalid value of property max_rev "
+ "(is %d expected >= 1)", virtio_ccw_rev_max(dev));
+ error_propagate(errp, err);
+ return;
+ }
sch->driver_data = dev;
sch->ccw_cb = virtio_ccw_cb;
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index 77d10f1671..6a04e94f66 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -94,6 +94,7 @@ struct VirtioCcwDevice {
IndAddr *indicators2;
IndAddr *summary_indicator;
uint64_t ind_bit;
+ bool force_revision_1;
};
/* The maximum virtio revision we support. */