From patchwork Mon Aug 20 08:55:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 1347151 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 2127ADFF0F for ; Mon, 20 Aug 2012 08:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753721Ab2HTI4H (ORCPT ); Mon, 20 Aug 2012 04:56:07 -0400 Received: from thoth.sbs.de ([192.35.17.2]:22076 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753153Ab2HTI4G (ORCPT ); Mon, 20 Aug 2012 04:56:06 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q7K8twrb020590; Mon, 20 Aug 2012 10:55:58 +0200 Received: from mchn199C.mchp.siemens.de ([139.22.41.68]) by mail1.siemens.de (8.13.6/8.13.6) with SMTP id q7K8tvR4010634; Mon, 20 Aug 2012 10:55:57 +0200 Message-ID: <5031FB9C.4050803@siemens.com> Date: Mon, 20 Aug 2012 10:55:56 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti CC: qemu-devel , kvm , Alex Williamson , Paolo Bonzini Subject: [PATCH uq/master] kvm: Clean up irqfd API Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 Acked-by: Alex Williamson --- Alex, please update your vfio patch accordingly. hw/virtio-pci.c | 4 ++-- kvm-all.c | 18 ++++-------------- kvm-stub.c | 14 ++------------ kvm.h | 6 ++---- 4 files changed, 10 insertions(+), 32 deletions(-) diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 5e6e09e..40ea7df 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -515,7 +515,7 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy, } 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 (--irqfd->users == 0) { kvm_irqchip_release_virq(kvm_state, irqfd->virq); @@ -536,7 +536,7 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy, VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector]; 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); if (--irqfd->users == 0) { diff --git a/kvm-all.c b/kvm-all.c index 34b02c1..fb02354 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1162,24 +1162,14 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int virq, bool assign) } #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); -} - -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); + return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, false); } static int kvm_irqchip_create(KVMState *s) diff --git a/kvm-stub.c b/kvm-stub.c index 94c9ea1..3c52eb5 100644 --- a/kvm-stub.c +++ b/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; } -int kvm_irqchip_add_irq_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) +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq) { return -ENOSYS; } diff --git a/kvm.h b/kvm.h index 5b8f588..37d1f81 100644 --- a/kvm.h +++ b/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); void kvm_irqchip_release_virq(KVMState *s, int virq); -int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq); -int kvm_irqchip_remove_irqfd(KVMState *s, int fd, 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); +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); #endif