From patchwork Wed Jan 14 13:53:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 2318 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0EDnC7g015722 for ; Wed, 14 Jan 2009 05:49:13 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756852AbZANNxS (ORCPT ); Wed, 14 Jan 2009 08:53:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756227AbZANNxR (ORCPT ); Wed, 14 Jan 2009 08:53:17 -0500 Received: from mx2.redhat.com ([66.187.237.31]:50939 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756852AbZANNxP (ORCPT ); Wed, 14 Jan 2009 08:53:15 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0EDrE09008667; Wed, 14 Jan 2009 08:53:14 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0EDrEIP019333; Wed, 14 Jan 2009 08:53:14 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0EDrDTx015631; Wed, 14 Jan 2009 08:53:13 -0500 Received: from localhost.localdomain (cleopatra [10.35.255.11]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id B5F69250011; Wed, 14 Jan 2009 15:53:11 +0200 (IST) From: Avi Kivity To: Sheng Yang Cc: kvm@vger.kernel.org Subject: [PATCH 2/2] kvm: qemu: initialize irq routing table Date: Wed, 14 Jan 2009 15:53:11 +0200 Message-Id: <1231941191-966-3-git-send-email-avi@redhat.com> In-Reply-To: <1231941191-966-1-git-send-email-avi@redhat.com> References: <1231941191-966-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Avi Kivity --- qemu/qemu-kvm.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index e4fba78..e67b698 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -783,6 +783,8 @@ static int destroy_region_works = 0; int kvm_qemu_create_context(void) { int r; + int i; + if (!kvm_irqchip) { kvm_disable_irqchip_creation(kvm_context); } @@ -805,6 +807,28 @@ int kvm_qemu_create_context(void) #ifdef TARGET_I386 destroy_region_works = kvm_destroy_memory_region_works(kvm_context); #endif + + if (kvm_irqchip && kvm_has_gsi_routing(kvm_context)) { + kvm_clear_gsi_routes(kvm_context); + for (i = 0; i < 8; ++i) { + if (i == 2) + continue; + r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_MASTER, i); + if (r < 0) + return r; + } + for (i = 8; i < 16; ++i) { + r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_SLAVE, i - 8); + if (r < 0) + return r; + } + for (i = 0; i < 24; ++i) { + r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i); + if (r < 0) + return r; + } + kvm_commit_irq_routes(kvm_context); + } return 0; }