virtio-ccw: check flic->adapter_routes_max_batch

Currently VIRTIO_CCW_QUEUE_MAX is defined as ADAPTER_ROUTES_MAX_GSI.
That is when checking queue max we implicitly check the constraint
concerning the number of adapter routes. This won't be satisfactory any
more (due to backward migration considerations) if ADAPTER_ROUTES_MAX_GSI
changes (ADAPTER_ROUTES_MAX_GSI is going to change because we want to
support up to VIRTIO_QUEUE_MAX queues per virtio-ccw device).

Let us introduce a check on a recently introduce flic property which
gives us the compatibility machine aware limit on adapter routes.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
Halil Pasic 2016-12-09 19:58:10 +01:00 committed by Cornelia Huck
parent e61cc6b5c6
commit 0708afa704

View File

@ -1319,6 +1319,7 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp)
CcwDevice *ccw_dev = CCW_DEVICE(d); CcwDevice *ccw_dev = CCW_DEVICE(d);
SubchDev *sch = ccw_dev->sch; SubchDev *sch = ccw_dev->sch;
int n = virtio_get_num_queues(vdev); int n = virtio_get_num_queues(vdev);
S390FLICState *flic = s390_get_flic();
if (!virtio_has_feature(vdev->host_features, VIRTIO_F_VERSION_1)) { if (!virtio_has_feature(vdev->host_features, VIRTIO_F_VERSION_1)) {
dev->max_rev = 0; dev->max_rev = 0;
@ -1330,6 +1331,12 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp)
VIRTIO_CCW_QUEUE_MAX); VIRTIO_CCW_QUEUE_MAX);
return; return;
} }
if (virtio_get_num_queues(vdev) > flic->adapter_routes_max_batch) {
error_setg(errp, "The number of virtqueues %d "
"exceeds flic adapter route limit %d", n,
flic->adapter_routes_max_batch);
return;
}
sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus);