From patchwork Thu Sep 26 19:56:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 278256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7D7542C019B for ; Fri, 27 Sep 2013 05:58:30 +1000 (EST) Received: from localhost ([::1]:59731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPHhk-0004P3-Ew for incoming@patchwork.ozlabs.org; Thu, 26 Sep 2013 15:58:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPHft-0001xc-3S for qemu-devel@nongnu.org; Thu, 26 Sep 2013 15:56:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPHfj-000673-05 for qemu-devel@nongnu.org; Thu, 26 Sep 2013 15:56:33 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:58064) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPHfi-00066b-Q4 for qemu-devel@nongnu.org; Thu, 26 Sep 2013 15:56:22 -0400 Received: by mail-pd0-f171.google.com with SMTP id g10so1608879pdj.2 for ; Thu, 26 Sep 2013 12:56:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ESj0FPXMLCOXV/wF8kd3GhmcX3e7cSuMLjZj+a8FXNw=; b=Txgi89XRPV2C1Vh4dja171tDTcaT3+LqUPvvtcMWcVJ0/ZUz/bbRZZFSLzpmnvPfwT I+np3XV1A7/XK9WhDJFXH6sBmKETTXfwoqvoMdapVLQ9VWGTUe5skhozGhwqx1+Eqoin X2W15cNJbT/PsQQqEeMGSIJoL4Sq3SbILcg006oPgJV2i0+YRG/OPlOKMjN7Ll5I/GrQ OinbxPXIuA8S3p/y0c4l8PaJMmManvSjLnAR1bvZfVh7+XKgyn0VLrXqLhQhOTNjTAsP Zpsszycqu/yQS7qNRXGL8ztKSDi4uLLRKCqxeExUAaJek5g24WsOV+BhrHKXuQ9kqUM+ 6lzw== X-Gm-Message-State: ALoCoQk8KBZHvJMEJu7f89qveEtQv5wwli5Me269g1Eqc3SmwoB2xOKwT9BnNSLz7rkQ+amrO5uu X-Received: by 10.68.192.195 with SMTP id hi3mr3236374pbc.18.1380225382031; Thu, 26 Sep 2013 12:56:22 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id l8sm4026272pbl.22.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 12:56:21 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Date: Thu, 26 Sep 2013 12:56:11 -0700 Message-Id: <1380225373-22132-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380225373-22132-1-git-send-email-christoffer.dall@linaro.org> References: <1380225373-22132-1-git-send-email-christoffer.dall@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.171 Cc: kvmarm@lists.cs.columbia.edu, Christoffer Dall , patches@linaro.org Subject: [Qemu-devel] [RFC PATCH v2 2/4] kvm: Introduce kvm_arch_irqchip_create X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Signed-off-by: Christoffer Dall Reviewed-by: Peter Maydell --- Changelog[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 de74411..fbb2776 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -314,4 +314,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 716860f..fe64f3b 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1295,10 +1295,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 f306cba..f3eba26 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -26,3 +26,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; +}