From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: i8259: initialize IMR to 0xff on reset Date: Mon, 30 Aug 2010 15:36:16 +0200 Message-ID: <4C7BB3D0.3050906@redhat.com> References: <1283160031-13505-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Marcelo Tosatti To: Avi Kivity Return-path: Received: from mail-vw0-f46.google.com ([209.85.212.46]:54507 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753718Ab0H3Nhc (ORCPT ); Mon, 30 Aug 2010 09:37:32 -0400 Received: by vws3 with SMTP id 3so5000053vws.19 for ; Mon, 30 Aug 2010 06:37:21 -0700 (PDT) In-Reply-To: <1283160031-13505-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/30/2010 11:20 AM, Avi Kivity wrote: > Otherwise, a wily interrupt can slip through while the guest isn't prepared > for it (and while the irq base is zero). > > Signed-off-by: Avi Kivity > --- > arch/x86/kvm/i8259.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c > index 8d10c06..5de9ee0 100644 > --- a/arch/x86/kvm/i8259.c > +++ b/arch/x86/kvm/i8259.c > @@ -275,7 +275,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s) > > s->last_irr = 0; > s->irr = 0; > - s->imr = 0; > + s->imr = 0xff; > s->isr = 0; > s->isr_ack = 0xff; > s->priority_add = 0; Sounds sane, but the datasheet says explicitly that upon reset "The Interrupt Mask Register is cleared"... (FWIW, I checked because it looked like QEMU and Xen also had the same behavior of setting IMR to zero). Paolo