From patchwork Thu Jul 15 09:24:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 112213 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6F9Ofgl002275 for ; Thu, 15 Jul 2010 09:24:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932865Ab0GOJYj (ORCPT ); Thu, 15 Jul 2010 05:24:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2700 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932774Ab0GOJYi (ORCPT ); Thu, 15 Jul 2010 05:24:38 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6F9Ocxi019613 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Jul 2010 05:24:38 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6F9ObAL025681; Thu, 15 Jul 2010 05:24:37 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 2A6C418D3BA; Thu, 15 Jul 2010 12:24:37 +0300 (IDT) Date: Thu, 15 Jul 2010 12:24:37 +0300 From: Gleb Natapov To: mtosatti@redhat.com, avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH v2] KVM: x86: Call mask notifiers from pic. Message-ID: <20100715092437.GP4689@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 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]); Thu, 15 Jul 2010 09:24:41 +0000 (UTC) diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 819b748..8d10c06 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c @@ -363,10 +363,20 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) } } else switch (s->init_state) { - case 0: /* normal mode */ + case 0: { /* normal mode */ + u8 imr_diff = s->imr ^ val, + off = (s == &s->pics_state->pics[0]) ? 0 : 8; s->imr = val; + for (irq = 0; irq < PIC_NUM_PINS/2; irq++) + if (imr_diff & (1 << irq)) + kvm_fire_mask_notifiers( + s->pics_state->kvm, + SELECT_PIC(irq + off), + irq + off, + !!(s->imr & (1 << irq))); pic_update_irq(s->pics_state); break; + } case 1: s->irq_base = val & 0xf8; s->init_state = 2;