Commit 4ddcc2d5 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Michael S. Tsirkin
Browse files

virtio: move ioeventfd_disabled flag to VirtioBusState



This simplifies the code and removes the ioeventfd_set_disabled
callback.

Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent ca2b413c
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -82,15 +82,7 @@ static bool virtio_ccw_ioeventfd_disabled(DeviceState *d)
{
    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,
@@ -1619,7 +1611,6 @@ static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data)
    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;
}

+0 −1
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ struct VirtioCcwDevice {
    uint32_t max_rev;
    VirtioBusState bus;
    bool ioeventfd_started;
    bool ioeventfd_disabled;
    uint32_t flags;
    uint8_t thinint_isc;
    AdapterRoutes routes;
+2 −2
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ void virtio_bus_start_ioeventfd(VirtioBusState *bus)
    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);
@@ -257,7 +257,7 @@ int virtio_bus_set_host_notifier(VirtioBusState *bus, int n, bool assign)
    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
+1 −12
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ typedef struct {
    uint32_t guest_page_shift;
    /* virtio-bus */
    VirtioBusState bus;
    bool ioeventfd_disabled;
    bool ioeventfd_started;
    bool format_transport_address;
} VirtIOMMIOProxy;
@@ -111,16 +110,7 @@ static void virtio_mmio_ioeventfd_set_started(DeviceState *d, bool started,

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,
@@ -560,7 +550,6 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data)
    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;
+1 −10
Original line number Diff line number Diff line
@@ -281,15 +281,7 @@ static bool virtio_pci_ioeventfd_disabled(DeviceState *d)
{
    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
@@ -2542,7 +2534,6 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
    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;
}

Loading