From patchwork Tue Jan 28 20:28:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 23811 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8466202FA for ; Tue, 28 Jan 2014 20:28:35 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id hq11sf1864449vcb.4 for ; Tue, 28 Jan 2014 12:28:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=PSa7gTwNAbZiKV8tU47RLyHCHcbj9h+FlrChL0MkQH4=; b=Nxf02fLPooIrVPBgkZiPz5MYjy0tWBABb7k5+ZMuHPK3F4fLhlzmjBNfYPtwJqx0NB NYfcHsrNC8QdjOwpPJUg6j/iblaGfVMfC1n06A9PItQH00hfK0rXl1/kvZVnC9+ep+Rx ysfE8aXFiVz6/LhCvq0NTWL0t83TEk9lM8+s99hn6KnNBphWPSu4FbL/8nlskEXfNPXG mBILBlSdsj8z+4CuLxo1nXmw3zLwYGwE3RCBTg4ZL0gvNRc/CSsRIJU89SF8lpfsmx2m TNdN99Vp3mLyMa8nkE65TT8NlhBz3rh2QGnPsP7dSg8H7YvhqdM2Ft056Sx6NB8x+8Pc 7r1A== X-Gm-Message-State: ALoCoQkiddJcYNXpmPvTOHsGvOxQ2hK/bd9Lg4+TwXH8qX9fKvKMxS/cRtn179FzfGC5Vafjmc2X X-Received: by 10.236.128.243 with SMTP id f79mr1061441yhi.27.1390940915036; Tue, 28 Jan 2014 12:28:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.201 with SMTP id e67ls2006081qga.32.gmail; Tue, 28 Jan 2014 12:28:34 -0800 (PST) X-Received: by 10.52.163.65 with SMTP id yg1mr2296640vdb.14.1390940914947; Tue, 28 Jan 2014 12:28:34 -0800 (PST) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id b20si6747146veu.98.2014.01.28.12.28.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 12:28:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.53; Received: by mail-vb0-f53.google.com with SMTP id p17so564187vbe.40 for ; Tue, 28 Jan 2014 12:28:34 -0800 (PST) X-Received: by 10.52.30.230 with SMTP id v6mr2275357vdh.6.1390940914863; Tue, 28 Jan 2014 12:28:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp59278vcz; Tue, 28 Jan 2014 12:28:34 -0800 (PST) X-Received: by 10.68.197.234 with SMTP id ix10mr3679859pbc.80.1390940913763; Tue, 28 Jan 2014 12:28:33 -0800 (PST) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by mx.google.com with ESMTPS id sj5si16745067pab.23.2014.01.28.12.28.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 12:28:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.171 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.171; Received: by mail-pd0-f171.google.com with SMTP id g10so803194pdj.2 for ; Tue, 28 Jan 2014 12:28:32 -0800 (PST) X-Received: by 10.68.218.65 with SMTP id pe1mr3629424pbc.1.1390940911146; Tue, 28 Jan 2014 12:28:31 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id bc4sm45466251pbb.2.2014.01.28.12.28.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 12:28:30 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [PATCH v4 2/4] kvm: Introduce kvm_arch_irqchip_create Date: Tue, 28 Jan 2014 12:28:08 -0800 Message-Id: <1390940890-1868-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1390940890-1868-1-git-send-email-christoffer.dall@linaro.org> References: <1390940890-1868-1-git-send-email-christoffer.dall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 a3fb8de..a890152 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; +}