From patchwork Mon Nov 16 17:12:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 38530 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 2680EB7B63 for ; Tue, 17 Nov 2009 04:56:19 +1100 (EST) Received: from localhost ([127.0.0.1]:42074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NA5oG-0003GY-1K for incoming@patchwork.ozlabs.org; Mon, 16 Nov 2009 12:56:16 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NA57r-0007fG-QO for qemu-devel@nongnu.org; Mon, 16 Nov 2009 12:12:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NA57l-0007cl-Ky for qemu-devel@nongnu.org; Mon, 16 Nov 2009 12:12:26 -0500 Received: from [199.232.76.173] (port=36108 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NA57k-0007cC-N4 for qemu-devel@nongnu.org; Mon, 16 Nov 2009 12:12:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45543) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NA57k-0005bA-6u for qemu-devel@nongnu.org; Mon, 16 Nov 2009 12:12:20 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAGHCJku000630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Nov 2009 12:12:19 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAGHC7MC010655; Mon, 16 Nov 2009 12:12:18 -0500 From: Glauber Costa To: qemu-devel@nongnu.org Date: Mon, 16 Nov 2009 15:12:06 -0200 Message-Id: <1258391527-18840-9-git-send-email-glommer@redhat.com> In-Reply-To: <1258391527-18840-8-git-send-email-glommer@redhat.com> References: <1258391527-18840-1-git-send-email-glommer@redhat.com> <1258391527-18840-2-git-send-email-glommer@redhat.com> <1258391527-18840-3-git-send-email-glommer@redhat.com> <1258391527-18840-4-git-send-email-glommer@redhat.com> <1258391527-18840-5-git-send-email-glommer@redhat.com> <1258391527-18840-6-git-send-email-glommer@redhat.com> <1258391527-18840-7-git-send-email-glommer@redhat.com> <1258391527-18840-8-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH v2 8/9] 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 c46a411..7a3671f 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -433,6 +433,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[] = @@ -519,6 +535,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;