From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFpXS-0004iW-4Y for qemu-devel@nongnu.org; Wed, 02 Dec 2009 08:46:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFpXL-0004Z9-DY for qemu-devel@nongnu.org; Wed, 02 Dec 2009 08:46:35 -0500 Received: from [199.232.76.173] (port=58100 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFpXK-0004Yt-RC for qemu-devel@nongnu.org; Wed, 02 Dec 2009 08:46:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63920) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFpXK-00042i-GX for qemu-devel@nongnu.org; Wed, 02 Dec 2009 08:46:30 -0500 From: Glauber Costa Date: Wed, 2 Dec 2009 11:46:14 -0200 Message-Id: <1259761575-3953-9-git-send-email-glommer@redhat.com> In-Reply-To: <1259761575-3953-8-git-send-email-glommer@redhat.com> References: <1259761575-3953-1-git-send-email-glommer@redhat.com> <1259761575-3953-2-git-send-email-glommer@redhat.com> <1259761575-3953-3-git-send-email-glommer@redhat.com> <1259761575-3953-4-git-send-email-glommer@redhat.com> <1259761575-3953-5-git-send-email-glommer@redhat.com> <1259761575-3953-6-git-send-email-glommer@redhat.com> <1259761575-3953-7-git-send-email-glommer@redhat.com> <1259761575-3953-8-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 8/9] Initialize in-kernel irqchip List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, avi@redhat.com Now that we have all devices set up, this patch initializes the irqchip. This is dependant on the io-thread, since we need someone to pull ourselves out of the halted state. I believe this should be the default when we are running over the io-thread. Later on, I plan to post a patch that makes it optional. Signed-off-by: Glauber Costa --- kvm-all.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index e46093f..0c6aba7 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -416,6 +416,22 @@ int kvm_set_irq(int irq, int level, int *status) return kvm_arch_set_irq(kvm_state, irq, level, status); } +static int kvm_create_irqchip(KVMState *s) +{ + int ret = 0; +#if defined(CONFIG_IOTHREAD) + if (!kvm_check_extension(s, KVM_CAP_IRQCHIP)) + return -1; + + ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); + if (ret < 0) + return ret; + + s->irqchip_in_kernel = 1; +#endif + return ret; +} + int kvm_init(int smp_cpus) { static const char upgrade_note[] = @@ -502,6 +518,10 @@ int kvm_init(int smp_cpus) } #endif + ret = kvm_create_irqchip(s); + if (ret < 0) + goto err; + ret = kvm_arch_init(s, smp_cpus); if (ret < 0) goto err; -- 1.6.5.2