From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] Call mask notifiers from pic. Date: Wed, 14 Jul 2010 14:11:31 -0300 Message-ID: <20100714171131.GF1100@amt.cnet> References: <20100714162831.GL4689@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34933 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751565Ab0GNRMW (ORCPT ); Wed, 14 Jul 2010 13:12:22 -0400 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 o6EHCLpP004094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 14 Jul 2010 13:12:21 -0400 Content-Disposition: inline In-Reply-To: <20100714162831.GL4689@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 14, 2010 at 07:28:31PM +0300, Gleb Natapov wrote: > If pit delivers interrupt while pic is masking it OS will never do EOI > and ack notifier will not be called so when pit will be unmasked no pit > interrupts will be delivered any more. Calling mask notifiers solves this > issue. > > Signed-off-by: Gleb Natapov > diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c > index 819b748..80d98cd 100644 > --- a/arch/x86/kvm/i8259.c > +++ b/arch/x86/kvm/i8259.c > @@ -363,10 +363,18 @@ 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; > 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), irq, > + !!(s->imr & (1 << irq))); irqchip/pin parameters are wrong for PIC_SLAVE.