From patchwork Fri Nov 6 18:26:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 37881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 861E5B7334 for ; Sat, 7 Nov 2009 05:40:54 +1100 (EST) Received: from localhost ([127.0.0.1]:34334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6Tjv-0007ly-NF for incoming@patchwork.ozlabs.org; Fri, 06 Nov 2009 13:40:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6TWK-0000Ih-T3 for qemu-devel@nongnu.org; Fri, 06 Nov 2009 13:26:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6TWH-00009i-J3 for qemu-devel@nongnu.org; Fri, 06 Nov 2009 13:26:47 -0500 Received: from [199.232.76.173] (port=44868 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6TWF-00008c-EG for qemu-devel@nongnu.org; Fri, 06 Nov 2009 13:26:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:10889) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N6TWE-0001jW-GR for qemu-devel@nongnu.org; Fri, 06 Nov 2009 13:26:42 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA6IQfP6024519; Fri, 6 Nov 2009 13:26:41 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA6IQUhb029342; Fri, 6 Nov 2009 13:26:40 -0500 From: Glauber Costa To: qemu-devel@nongnu.org Date: Fri, 6 Nov 2009 16:26:29 -0200 Message-Id: <1257531990-19437-8-git-send-email-glommer@redhat.com> In-Reply-To: <1257531990-19437-7-git-send-email-glommer@redhat.com> References: <1257531990-19437-1-git-send-email-glommer@redhat.com> <1257531990-19437-2-git-send-email-glommer@redhat.com> <1257531990-19437-3-git-send-email-glommer@redhat.com> <1257531990-19437-4-git-send-email-glommer@redhat.com> <1257531990-19437-5-git-send-email-glommer@redhat.com> <1257531990-19437-6-git-send-email-glommer@redhat.com> <1257531990-19437-7-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 7/8] Initialize in-kernel irqchip X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 7684957..94b07bf 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -453,6 +453,22 @@ int kvm_set_irq(int irq, int level, int *status) return 1; } +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[] = @@ -539,6 +555,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;