From patchwork Tue Dec 1 14:36:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lalancette X-Patchwork-Id: 63974 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 nB1EbWa4013519 for ; Tue, 1 Dec 2009 14:37:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753169AbZLAOhP (ORCPT ); Tue, 1 Dec 2009 09:37:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752402AbZLAOhN (ORCPT ); Tue, 1 Dec 2009 09:37:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33582 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbZLAOhJ (ORCPT ); Tue, 1 Dec 2009 09:37:09 -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 nB1EbFQ9003526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 Dec 2009 09:37:16 -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 nB1Eb36U002533; Tue, 1 Dec 2009 09:37:15 -0500 From: Chris Lalancette To: kvm@vger.kernel.org Cc: Chris Lalancette Subject: [PATCH 11/12] Allow the PIC to signal CPUs other than BSP. Date: Tue, 1 Dec 2009 15:36:40 +0100 Message-Id: <1259678201-11203-12-git-send-email-clalance@redhat.com> In-Reply-To: <1259678201-11203-1-git-send-email-clalance@redhat.com> References: <1259678201-11203-1-git-send-email-clalance@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 diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 80d4705..ff20415 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c @@ -242,8 +242,6 @@ int kvm_pic_read_irq(struct kvm *kvm) static void kvm_pic_reset(struct kvm_kpic_state *s) { int irq; - struct kvm *kvm = s->pics_state->irq_request_opaque; - struct kvm_vcpu *vcpu0 = kvm->bsp_vcpu; u8 irr = s->irr, isr = s->imr; s->last_irr = 0; @@ -263,10 +261,8 @@ static void kvm_pic_reset(struct kvm_kpic_state *s) s->init4 = 0; for (irq = 0; irq < PIC_NUM_PINS/2; irq++) { - if (vcpu0 && kvm_apic_in_virtual_wire_mode(vcpu0)) - if (irr & (1 << irq) || isr & (1 << irq)) { - pic_clear_isr(s, irq); - } + if (irr & (1 << irq) || isr & (1 << irq)) + pic_clear_isr(s, irq); } } @@ -506,14 +502,19 @@ static int picdev_read(struct kvm_io_device *this, static void pic_irq_request(void *opaque, int level) { struct kvm *kvm = opaque; - struct kvm_vcpu *vcpu = kvm->bsp_vcpu; struct kvm_pic *s = pic_irqchip(kvm); int irq = pic_get_irq(&s->pics[0]); + struct kvm_vcpu *vcpu; + int i; s->output = level; - if (vcpu && level && (s->pics[0].isr_ack & (1 << irq))) { + if (level && (s->pics[0].isr_ack & (1 << irq))) { s->pics[0].isr_ack &= ~(1 << irq); - kvm_vcpu_kick(vcpu); + kvm_for_each_vcpu(i, vcpu, kvm) { + if (kvm_apic_in_virtual_wire_mode(vcpu) && + waitqueue_active(&vcpu->wq)) + wake_up_interruptible(&vcpu->wq); + } } }