aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-12-04 11:59:50 -0500
committerMichael S. Tsirkin <mst@redhat.com>2014-12-09 09:32:32 -0500
commitce15408f350c4b97635618692a45aedabfdd2696 (patch)
tree26cb818d379d72c914763a505fd486b2de9bc986
parentb6098c30423cb1f0f5a4d0a5495e2670e274e544 (diff)
virtio_ccw: legacy: don't negotiate rev 1/features
Legacy balloon device doesn't pretend to support revision 1 or 64 bit features. But just in case someone implements a broken one that does, let's not even try to drive legacy only devices using revision 1, and let's not give them a chance to say they support VIRTIO_F_VERSION_1 by not reading or writing high feature bits. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
-rw-r--r--drivers/s390/kvm/virtio_ccw.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 4a3e6e510294..c792b5fe0bc9 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -733,6 +733,9 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)
733 733
734 rc = le32_to_cpu(features->features); 734 rc = le32_to_cpu(features->features);
735 735
736 if (vcdev->revision == 0)
737 goto out_free;
738
736 /* Read second half of the feature bits from the host. */ 739 /* Read second half of the feature bits from the host. */
737 features->index = 1; 740 features->index = 1;
738 ccw->cmd_code = CCW_CMD_READ_FEAT; 741 ccw->cmd_code = CCW_CMD_READ_FEAT;
@@ -775,6 +778,9 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
775 ccw->cda = (__u32)(unsigned long)features; 778 ccw->cda = (__u32)(unsigned long)features;
776 ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT); 779 ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
777 780
781 if (vcdev->revision == 0)
782 goto out_free;
783
778 features->index = 1; 784 features->index = 1;
779 features->features = cpu_to_le32(vdev->features >> 32); 785 features->features = cpu_to_le32(vdev->features >> 32);
780 /* Write the second half of the feature bits to the host. */ 786 /* Write the second half of the feature bits to the host. */
@@ -1182,9 +1188,13 @@ static int virtio_ccw_online(struct ccw_device *cdev)
1182 vcdev->vdev.id.vendor = cdev->id.cu_type; 1188 vcdev->vdev.id.vendor = cdev->id.cu_type;
1183 vcdev->vdev.id.device = cdev->id.cu_model; 1189 vcdev->vdev.id.device = cdev->id.cu_model;
1184 1190
1185 ret = virtio_ccw_set_transport_rev(vcdev); 1191 if (virtio_device_is_legacy_only(vcdev->vdev.id)) {
1186 if (ret) 1192 vcdev->revision = 0;
1187 goto out_free; 1193 } else {
1194 ret = virtio_ccw_set_transport_rev(vcdev);
1195 if (ret)
1196 goto out_free;
1197 }
1188 1198
1189 ret = register_virtio_device(&vcdev->vdev); 1199 ret = register_virtio_device(&vcdev->vdev);
1190 if (ret) { 1200 if (ret) {