{
VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
- return dev->ioeventfd_disabled ||
- !(dev->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD);
-}
-
-static void virtio_ccw_ioeventfd_set_disabled(DeviceState *d, bool disabled)
-{
- VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
-
- dev->ioeventfd_disabled = disabled;
+ return !(dev->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD);
}
static int virtio_ccw_ioeventfd_assign(DeviceState *d, EventNotifier *notifier,
k->ioeventfd_started = virtio_ccw_ioeventfd_started;
k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started;
k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled;
- k->ioeventfd_set_disabled = virtio_ccw_ioeventfd_set_disabled;
k->ioeventfd_assign = virtio_ccw_ioeventfd_assign;
}
uint32_t max_rev;
VirtioBusState bus;
bool ioeventfd_started;
- bool ioeventfd_disabled;
uint32_t flags;
uint8_t thinint_isc;
AdapterRoutes routes;
if (!k->ioeventfd_started || k->ioeventfd_started(proxy)) {
return;
}
- if (k->ioeventfd_disabled(proxy)) {
+ if (bus->ioeventfd_disabled || k->ioeventfd_disabled(proxy)) {
return;
}
vdev = virtio_bus_get_device(bus);
if (!k->ioeventfd_started) {
return -ENOSYS;
}
- k->ioeventfd_set_disabled(proxy, assign);
+ bus->ioeventfd_disabled = assign;
if (assign) {
/*
* Stop using the generic ioeventfd, we are doing eventfd handling
uint32_t guest_page_shift;
/* virtio-bus */
VirtioBusState bus;
- bool ioeventfd_disabled;
bool ioeventfd_started;
bool format_transport_address;
} VirtIOMMIOProxy;
static bool virtio_mmio_ioeventfd_disabled(DeviceState *d)
{
- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
-
- return !kvm_eventfds_enabled() || proxy->ioeventfd_disabled;
-}
-
-static void virtio_mmio_ioeventfd_set_disabled(DeviceState *d, bool disabled)
-{
- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
-
- proxy->ioeventfd_disabled = disabled;
+ return !kvm_eventfds_enabled();
}
static int virtio_mmio_ioeventfd_assign(DeviceState *d,
k->ioeventfd_started = virtio_mmio_ioeventfd_started;
k->ioeventfd_set_started = virtio_mmio_ioeventfd_set_started;
k->ioeventfd_disabled = virtio_mmio_ioeventfd_disabled;
- k->ioeventfd_set_disabled = virtio_mmio_ioeventfd_set_disabled;
k->ioeventfd_assign = virtio_mmio_ioeventfd_assign;
k->has_variable_vring_alignment = true;
bus_class->max_dev = 1;
{
VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
- return proxy->ioeventfd_disabled ||
- !(proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD);
-}
-
-static void virtio_pci_ioeventfd_set_disabled(DeviceState *d, bool disabled)
-{
- VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
-
- proxy->ioeventfd_disabled = disabled;
+ return !(proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD);
}
#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000
k->ioeventfd_started = virtio_pci_ioeventfd_started;
k->ioeventfd_set_started = virtio_pci_ioeventfd_set_started;
k->ioeventfd_disabled = virtio_pci_ioeventfd_disabled;
- k->ioeventfd_set_disabled = virtio_pci_ioeventfd_set_disabled;
k->ioeventfd_assign = virtio_pci_ioeventfd_assign;
}
uint32_t guest_features[2];
VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
- bool ioeventfd_disabled;
bool ioeventfd_started;
VirtIOIRQFD *vector_irqfd;
int nvqs_with_notifiers;
void (*ioeventfd_set_started)(DeviceState *d, bool started, bool err);
/* Returns true if the ioeventfd has been disabled for the device. */
bool (*ioeventfd_disabled)(DeviceState *d);
- /* Sets the 'ioeventfd disabled' state for the device. */
- void (*ioeventfd_set_disabled)(DeviceState *d, bool disabled);
/*
* Assigns/deassigns the ioeventfd backing for the transport on
* the device for queue number n. Returns an error value on
struct VirtioBusState {
BusState parent_obj;
+
+ /*
+ * Set if the default ioeventfd handlers are disabled by vhost
+ * or dataplane.
+ */
+ bool ioeventfd_disabled;
};
void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp);