From patchwork Fri Feb 26 20:12:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 82445 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1QKD36h019498 for ; Fri, 26 Feb 2010 20:13:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966013Ab0BZUMj (ORCPT ); Fri, 26 Feb 2010 15:12:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14538 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965998Ab0BZUMh (ORCPT ); Fri, 26 Feb 2010 15:12:37 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1QKCbV5001909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Feb 2010 15:12:37 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1QKCMPS012766; Fri, 26 Feb 2010 15:12:36 -0500 From: Glauber Costa To: kvm@vger.kernel.org Cc: mtosatti@redhat.com Subject: [PATCH 09/10] Initialize in-kernel irqchip Date: Fri, 26 Feb 2010 17:12:20 -0300 Message-Id: <1267215141-13629-10-git-send-email-glommer@redhat.com> In-Reply-To: <1267215141-13629-9-git-send-email-glommer@redhat.com> References: <1267215141-13629-1-git-send-email-glommer@redhat.com> <1267215141-13629-2-git-send-email-glommer@redhat.com> <1267215141-13629-3-git-send-email-glommer@redhat.com> <1267215141-13629-4-git-send-email-glommer@redhat.com> <1267215141-13629-5-git-send-email-glommer@redhat.com> <1267215141-13629-6-git-send-email-glommer@redhat.com> <1267215141-13629-7-git-send-email-glommer@redhat.com> <1267215141-13629-8-git-send-email-glommer@redhat.com> <1267215141-13629-9-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 26 Feb 2010 20:13:05 +0000 (UTC) diff --git a/kvm-all.c b/kvm-all.c index 0527e0f..3038465 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -592,6 +592,25 @@ 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 (!kvm_use_kernel_chip) + return ret; +#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[] = @@ -683,6 +702,10 @@ int kvm_init(int smp_cpus) s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS); #endif + ret = kvm_create_irqchip(s); + if (ret < 0) + goto err; + ret = kvm_arch_init(s, smp_cpus); if (ret < 0) goto err;