From patchwork Mon Nov 29 16:51:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 364642 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 oATGrA9f009947 for ; Mon, 29 Nov 2010 16:53:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755179Ab0K2QxD (ORCPT ); Mon, 29 Nov 2010 11:53:03 -0500 Received: from db3ehsobe004.messaging.microsoft.com ([213.199.154.142]:46961 "EHLO DB3EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755129Ab0K2QxC (ORCPT ); Mon, 29 Nov 2010 11:53:02 -0500 Received: from mail12-db3-R.bigfish.com (10.3.81.240) by DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id 14.1.225.8; Mon, 29 Nov 2010 16:53:00 +0000 Received: from mail12-db3 (localhost.localdomain [127.0.0.1]) by mail12-db3-R.bigfish.com (Postfix) with ESMTP id E655D5501C9; Mon, 29 Nov 2010 16:52:59 +0000 (UTC) X-SpamScore: -2 X-BigFish: VPS-2(zzbb2cKzz1202hzz8275bhz32i691h668h67dh61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail12-db3 (localhost.localdomain [127.0.0.1]) by mail12-db3 (MessageSwitch) id 1291049571681125_11611; Mon, 29 Nov 2010 16:52:51 +0000 (UTC) Received: from DB3EHSMHS005.bigfish.com (unknown [10.3.81.250]) by mail12-db3.bigfish.com (Postfix) with ESMTP id 968A8A10157; Mon, 29 Nov 2010 16:52:36 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by DB3EHSMHS005.bigfish.com (10.3.87.105) with Microsoft SMTP Server id 14.1.225.8; Mon, 29 Nov 2010 16:52:03 +0000 X-WSS-ID: 0LCNO6L-01-CRZ-02 X-M-MSG: Received: from sausexedgep02.amd.com (sausexedgep02-ext.amd.com [163.181.249.73]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2DF1D1028557; Mon, 29 Nov 2010 10:51:57 -0600 (CST) Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep02.amd.com (163.181.36.59) with Microsoft SMTP Server (TLS) id 8.3.106.1; Mon, 29 Nov 2010 10:53:25 -0600 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 29 Nov 2010 10:52:00 -0600 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Mon, 29 Nov 2010 11:51:59 -0500 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id 22FA749C256; Mon, 29 Nov 2010 16:51:59 +0000 (GMT) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id AA40D100DFA; Mon, 29 Nov 2010 17:51:59 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , , Joerg Roedel Subject: [PATCH 3/3] KVM: X86: Don't report L2 emulation failures to user-space Date: Mon, 29 Nov 2010 17:51:49 +0100 Message-ID: <1291049509-3430-4-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <4CF3D093.40604@redhat.com> References: <4CF3D093.40604@redhat.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com 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, 29 Nov 2010 16:53:11 +0000 (UTC) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 410d2d1..4337a8b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4320,13 +4320,19 @@ EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt); static int handle_emulation_failure(struct kvm_vcpu *vcpu) { + int r = EMULATE_DONE; + ++vcpu->stat.insn_emulation_fail; trace_kvm_emulate_insn_failed(vcpu); - vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; - vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; - vcpu->run->internal.ndata = 0; + if (!is_guest_mode(vcpu)) { + vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; + vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; + vcpu->run->internal.ndata = 0; + r = EMULATE_FAIL; + } kvm_queue_exception(vcpu, UD_VECTOR); - return EMULATE_FAIL; + + return r; } static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)