mirror of https://github.com/xqemu/xqemu.git
kvm: Clean up irqfd API
No need to expose the fd-based interface, everyone will already be fine with the more handy EventNotifier variant. Rename the latter to clarify that we are still talking about irqfds here. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
62fe83318d
commit
b131c74a0e
|
@ -517,7 +517,7 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
|
||||||
}
|
}
|
||||||
irqfd->users++;
|
irqfd->users++;
|
||||||
|
|
||||||
ret = kvm_irqchip_add_irq_notifier(kvm_state, n, irqfd->virq);
|
ret = kvm_irqchip_add_irqfd_notifier(kvm_state, n, irqfd->virq);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (--irqfd->users == 0) {
|
if (--irqfd->users == 0) {
|
||||||
kvm_irqchip_release_virq(kvm_state, irqfd->virq);
|
kvm_irqchip_release_virq(kvm_state, irqfd->virq);
|
||||||
|
@ -538,7 +538,7 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy,
|
||||||
VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
|
VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = kvm_irqchip_remove_irq_notifier(kvm_state, n, irqfd->virq);
|
ret = kvm_irqchip_remove_irqfd_notifier(kvm_state, n, irqfd->virq);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
|
|
||||||
if (--irqfd->users == 0) {
|
if (--irqfd->users == 0) {
|
||||||
|
|
18
kvm-all.c
18
kvm-all.c
|
@ -1166,24 +1166,14 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int virq, bool assign)
|
||||||
}
|
}
|
||||||
#endif /* !KVM_CAP_IRQ_ROUTING */
|
#endif /* !KVM_CAP_IRQ_ROUTING */
|
||||||
|
|
||||||
int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq)
|
int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
|
||||||
{
|
{
|
||||||
return kvm_irqchip_assign_irqfd(s, fd, virq, true);
|
return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq)
|
int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
|
||||||
{
|
{
|
||||||
return kvm_irqchip_add_irqfd(s, event_notifier_get_fd(n), virq);
|
return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, false);
|
||||||
}
|
|
||||||
|
|
||||||
int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq)
|
|
||||||
{
|
|
||||||
return kvm_irqchip_assign_irqfd(s, fd, virq, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq)
|
|
||||||
{
|
|
||||||
return kvm_irqchip_remove_irqfd(s, event_notifier_get_fd(n), virq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvm_irqchip_create(KVMState *s)
|
static int kvm_irqchip_create(KVMState *s)
|
||||||
|
|
14
kvm-stub.c
14
kvm-stub.c
|
@ -141,22 +141,12 @@ void kvm_irqchip_release_virq(KVMState *s, int virq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq)
|
int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq)
|
int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq)
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq)
|
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
6
kvm.h
6
kvm.h
|
@ -272,8 +272,6 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
|
||||||
int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg);
|
int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg);
|
||||||
void kvm_irqchip_release_virq(KVMState *s, int virq);
|
void kvm_irqchip_release_virq(KVMState *s, int virq);
|
||||||
|
|
||||||
int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq);
|
int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
|
||||||
int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq);
|
int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
|
||||||
int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq);
|
|
||||||
int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue