@@ -1121,6 +1121,12 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp)
dev->max_rev = 0;
}
+ if (!virtio_ccw_rev_max(dev) && !virtio_legacy_allowed(vdev)) {
+ error_setg(errp, "Invalid value of property max_rev "
+ "(is %d expected >= 1)", virtio_ccw_rev_max(dev));
+ return;
+ }
+
if (virtio_get_num_queues(vdev) > VIRTIO_QUEUE_MAX) {
error_setg(errp, "The number of virtqueues %d "
"exceeds virtio limit %d", n,
@@ -1581,6 +1581,10 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
}
if (legacy) {
+ if (!virtio_legacy_allowed(vdev)) {
+ error_setg(errp, "device is modern-only, use disable-legacy=on");
+ return;
+ }
if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) {
error_setg(errp, "VIRTIO_F_IOMMU_PLATFORM was supported by"
" neither legacy nor transitional device");