@@ -2980,6 +2980,20 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
return ret;
}
+static void virtio_device_check_notification_compatibility(VirtIODevice *vdev,
+ Error **errp)
+{
+ VirtioBusState *bus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev)));
+ VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(bus);
+ DeviceState *proxy = DEVICE(BUS(bus)->parent);
+
+ if (virtio_host_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA) &&
+ k->ioeventfd_enabled(proxy)) {
+ error_setg(errp,
+ "notification_data=on without ioeventfd=off is not supported");
+ }
+}
+
size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
uint64_t host_features)
{
@@ -3740,6 +3754,14 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)
}
}
+ /* Devices should not use both ioeventfd and notification data feature */
+ virtio_device_check_notification_compatibility(vdev, &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ vdc->unrealize(dev);
+ return;
+ }
+
virtio_bus_device_plugged(vdev, &err);
if (err != NULL) {
error_propagate(errp, err);