From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Fix kernel pio emulation mistake Date: Thu, 19 Mar 2009 11:35:45 +0200 Message-ID: <49C211F1.50508@redhat.com> References: <9832F13BD22FB94A829F798DA4A828050196AF5598@pdsmsx503.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" To: "Dong, Eddie" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:45508 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756228AbZCSJfu (ORCPT ); Thu, 19 Mar 2009 05:35:50 -0400 In-Reply-To: <9832F13BD22FB94A829F798DA4A828050196AF5598@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Dong, Eddie wrote: > Kernel pio emulation return value is mistakenly checked, fortuantely it is not hit yet for normal OS bootup :( > > > diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c > index ca91749..0edd2e7 100644 > --- a/arch/x86/kvm/x86_emulate.c > +++ b/arch/x86/kvm/x86_emulate.c > @@ -1838,7 +1838,7 @@ special_insn: > io_dir_in = 0; > do_io: if (kvm_emulate_pio(ctxt->vcpu, NULL, io_dir_in, > (c->d & ByteOp) ? 1 : c->op_bytes, > - port) != 0) { > + port) == 0) { > c->eip = saved_eip; > goto cannot_emulate; > } kvm_emulate_pio() returns 1 when emulation is complete, and 0 when emulation needs further processing in userspace. So I think in both cases cannot_emulate is the wrong answer. I think 'in' emulation gets it right. -- error compiling committee.c: too many arguments to function