From patchwork Mon Sep 6 15:55:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 158671 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o86Fvfqa022492 for ; Mon, 6 Sep 2010 15:57:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753824Ab0IFP50 (ORCPT ); Mon, 6 Sep 2010 11:57:26 -0400 Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:37973 "EHLO VA3EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751105Ab0IFP5Z (ORCPT ); Mon, 6 Sep 2010 11:57:25 -0400 Received: from mail194-va3-R.bigfish.com (10.7.14.252) by VA3EHSOBE003.bigfish.com (10.7.40.23) with Microsoft SMTP Server id 8.1.340.0; Mon, 6 Sep 2010 15:57:24 +0000 Received: from mail194-va3 (localhost.localdomain [127.0.0.1]) by mail194-va3-R.bigfish.com (Postfix) with ESMTP id CB289E58755; Mon, 6 Sep 2010 15:57:24 +0000 (UTC) X-SpamScore: 1 X-BigFish: VS1(zzzz1202hzz8275bhz32i87h2a8h43h61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail194-va3 (localhost.localdomain [127.0.0.1]) by mail194-va3 (MessageSwitch) id 1283788644473898_10867; Mon, 6 Sep 2010 15:57:24 +0000 (UTC) Received: from VA3EHSMHS022.bigfish.com (unknown [10.7.14.239]) by mail194-va3.bigfish.com (Postfix) with ESMTP id 6E62B9D004C; Mon, 6 Sep 2010 15:57:24 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by VA3EHSMHS022.bigfish.com (10.7.99.32) with Microsoft SMTP Server (TLS) id 14.0.482.44; Mon, 6 Sep 2010 15:57:14 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o86Fw40h024247; Mon, 6 Sep 2010 10:58:48 -0500 X-WSS-ID: 0L8C1L8-02-7A3-02 X-M-MSG: Received: from sausexhtp02.amd.com (sausexhtp02.amd.com [163.181.3.152]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2E56AC8964; Mon, 6 Sep 2010 10:55:55 -0500 (CDT) Received: from storexhtp01.amd.com (172.24.4.3) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 6 Sep 2010 10:56:00 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp01.amd.com (172.24.4.3) with Microsoft SMTP Server id 8.3.83.0; Mon, 6 Sep 2010 11:55:58 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id 8496D49C264; Mon, 6 Sep 2010 16:55:58 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 2BB7BA05E1; Mon, 6 Sep 2010 17:56:29 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: Alexander Graf , , , , Joerg Roedel Subject: [PATCH 19/27] KVM: X86: Propagate fetch faults Date: Mon, 6 Sep 2010 17:55:58 +0200 Message-ID: <1283788566-29186-20-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1283788566-29186-1-git-send-email-joerg.roedel@amd.com> References: <1283788566-29186-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-Reverse-DNS: unknown 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 (demeter1.kernel.org [140.211.167.41]); Mon, 06 Sep 2010 15:57:42 +0000 (UTC) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2b08b78..aead72e 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1198,6 +1198,9 @@ static int emulate_popf(struct x86_emulate_ctxt *ctxt, *(unsigned long *)dest = (ctxt->eflags & ~change_mask) | (val & change_mask); + if (rc == X86EMUL_PROPAGATE_FAULT) + emulate_pf(ctxt); + return rc; } diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 65b00f0..ca69dcc 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4237,6 +4237,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu, vcpu->arch.emulate_ctxt.perm_ok = false; r = x86_decode_insn(&vcpu->arch.emulate_ctxt); + if (r == X86EMUL_PROPAGATE_FAULT) + goto done; + trace_kvm_emulate_insn_start(vcpu); /* Only allow emulation of specific instructions on #UD @@ -4295,6 +4298,7 @@ restart: return handle_emulation_failure(vcpu); } +done: if (vcpu->arch.emulate_ctxt.exception >= 0) { inject_emulated_exception(vcpu); r = EMULATE_DONE;