From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFZhV-00037x-PR for qemu-devel@nongnu.org; Mon, 17 Feb 2014 20:42:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFZhP-0005vC-PK for qemu-devel@nongnu.org; Mon, 17 Feb 2014 20:42:21 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:34824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFZhP-0005v2-JJ for qemu-devel@nongnu.org; Mon, 17 Feb 2014 20:42:15 -0500 Received: by mail-pb0-f48.google.com with SMTP id rr13so16057162pbb.35 for ; Mon, 17 Feb 2014 17:42:14 -0800 (PST) From: Christoffer Dall Date: Mon, 17 Feb 2014 17:41:58 -0800 Message-Id: <1392687720-26806-3-git-send-email-christoffer.dall@linaro.org> In-Reply-To: <1392687720-26806-1-git-send-email-christoffer.dall@linaro.org> References: <1392687720-26806-1-git-send-email-christoffer.dall@linaro.org> Subject: [Qemu-devel] [PATCH v6 2/4] kvm: Introduce kvm_arch_irqchip_create List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, Christoffer Dall Introduce kvm_arch_irqchip_create an arch-specific hook in preparation for architecture-specific use of the device control API to create IRQ chips. Following patches will implement the ARM irqchip create method to prefer the device control API over the older KVM_CREATE_IRQCHIP API. Reviewed-by: Peter Maydell Signed-off-by: Christoffer Dall --- Changelog[v1 -> v2]: - Proper formatted function comments - Use QEMU's stubs mechanism for KVM stubs include/sysemu/kvm.h | 12 ++++++++++++ kvm-all.c | 11 +++++++++-- stubs/Makefile.objs | 1 + stubs/kvm.c | 7 +++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 stubs/kvm.c diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 3b25f27..e4e43b8 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -319,4 +319,16 @@ int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); void kvm_pc_gsi_handler(void *opaque, int n, int level); void kvm_pc_setup_irq_routing(bool pci_enabled); void kvm_init_irq_routing(KVMState *s); + +/** + * kvm_arch_irqchip_create: + * @KVMState: The KVMState pointer + * + * Allow architectures to create an in-kernel irq chip themselves. + * + * Returns: < 0: error + * 0: irq chip was not created + * > 0: irq chip was created + */ +int kvm_arch_irqchip_create(KVMState *s); #endif diff --git a/kvm-all.c b/kvm-all.c index 2ca9143..8670878 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1298,10 +1298,17 @@ static int kvm_irqchip_create(KVMState *s) return 0; } - ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); + /* First probe and see if there's a arch-specific hook to create the + * in-kernel irqchip for us */ + ret = kvm_arch_irqchip_create(s); if (ret < 0) { - fprintf(stderr, "Create kernel irqchip failed\n"); return ret; + } else if (ret == 0) { + ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); + if (ret < 0) { + fprintf(stderr, "Create kernel irqchip failed\n"); + return ret; + } } kvm_kernel_irqchip = true; diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index df92fe5..df3aa7a 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -27,3 +27,4 @@ stub-obj-y += vm-stop.o stub-obj-y += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.o stub-obj-y += cpus.o +stub-obj-y += kvm.o diff --git a/stubs/kvm.c b/stubs/kvm.c new file mode 100644 index 0000000..e7c60b6 --- /dev/null +++ b/stubs/kvm.c @@ -0,0 +1,7 @@ +#include "qemu-common.h" +#include "sysemu/kvm.h" + +int kvm_arch_irqchip_create(KVMState *s) +{ + return 0; +} -- 1.8.5.2