From patchwork Fri Mar 20 09:07:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dong, Eddie" X-Patchwork-Id: 13238 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 n2K97QQU008288 for ; Fri, 20 Mar 2009 09:07:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752762AbZCTJHZ (ORCPT ); Fri, 20 Mar 2009 05:07:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753242AbZCTJHZ (ORCPT ); Fri, 20 Mar 2009 05:07:25 -0400 Received: from mga02.intel.com ([134.134.136.20]:26441 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752229AbZCTJHY convert rfc822-to-8bit (ORCPT ); Fri, 20 Mar 2009 05:07:24 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 20 Mar 2009 02:00:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,394,1233561600"; d="scan'208";a="396106850" Received: from pgsmsx603.gar.corp.intel.com ([10.221.43.87]) by orsmga002.jf.intel.com with ESMTP; 20 Mar 2009 02:15:47 -0700 Received: from pgsmsx601.gar.corp.intel.com (10.221.43.69) by pgsmsx603.gar.corp.intel.com (10.221.43.87) with Microsoft SMTP Server (TLS) id 8.1.340.0; Fri, 20 Mar 2009 17:06:57 +0800 Received: from pdsmsx602.ccr.corp.intel.com (172.16.12.184) by pgsmsx601.gar.corp.intel.com (10.221.43.69) with Microsoft SMTP Server (TLS) id 8.1.340.0; Fri, 20 Mar 2009 17:06:57 +0800 Received: from pdsmsx503.ccr.corp.intel.com ([172.16.12.95]) by pdsmsx602.ccr.corp.intel.com ([172.16.12.184]) with mapi; Fri, 20 Mar 2009 17:06:56 +0800 From: "Dong, Eddie" To: Avi Kivity CC: "kvm@vger.kernel.org" , "Dong, Eddie" Date: Fri, 20 Mar 2009 17:07:47 +0800 Subject: RE: Fix kernel pio emulation mistake Thread-Topic: Fix kernel pio emulation mistake Thread-Index: AcmodiBW1V2jcHsxQMqBSrYHWB0IqAAxQnzQ Message-ID: <9832F13BD22FB94A829F798DA4A8280501A1D68ACD@pdsmsx503.ccr.corp.intel.com> References: <9832F13BD22FB94A829F798DA4A828050196AF5598@pdsmsx503.ccr.corp.intel.com> <49C211F1.50508@redhat.com> In-Reply-To: <49C211F1.50508@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org > 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. OK, yes. Do u mean this? I may misunderstand. Thx, eddie To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index ca91749..838fdc9 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -1838,11 +1838,11 @@ 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; + return -1; } - break; + return 0; case 0xf4: /* hlt */ ctxt->vcpu->arch.halt_request = 1; break; --