From patchwork Mon Apr 18 09:42:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 714671 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 p3I9hAnb011049 for ; Mon, 18 Apr 2011 09:43:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753304Ab1DRJnG (ORCPT ); Mon, 18 Apr 2011 05:43:06 -0400 Received: from tx2ehsobe002.messaging.microsoft.com ([65.55.88.12]:18858 "EHLO TX2EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752205Ab1DRJnC (ORCPT ); Mon, 18 Apr 2011 05:43:02 -0400 Received: from mail189-tx2-R.bigfish.com (10.9.14.240) by TX2EHSOBE004.bigfish.com (10.9.40.24) with Microsoft SMTP Server id 14.1.225.8; Mon, 18 Apr 2011 09:43:00 +0000 Received: from mail189-tx2 (localhost.localdomain [127.0.0.1]) by mail189-tx2-R.bigfish.com (Postfix) with ESMTP id 207C91B5823A; Mon, 18 Apr 2011 09:43:00 +0000 (UTC) X-SpamScore: -2 X-BigFish: VPS-2(zzbb2cKzz1202hzz8275bhz32i668h839h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp02.amd.com; RD:none; EFVD:NLI Received: from mail189-tx2 (localhost.localdomain [127.0.0.1]) by mail189-tx2 (MessageSwitch) id 13031197802490_3099; Mon, 18 Apr 2011 09:43:00 +0000 (UTC) Received: from TX2EHSMHS020.bigfish.com (unknown [10.9.14.248]) by mail189-tx2.bigfish.com (Postfix) with ESMTP id F1506367804F; Mon, 18 Apr 2011 09:42:59 +0000 (UTC) Received: from ausb3twp02.amd.com (163.181.249.109) by TX2EHSMHS020.bigfish.com (10.9.99.120) with Microsoft SMTP Server id 14.1.225.8; Mon, 18 Apr 2011 09:42:59 +0000 X-WSS-ID: 0LJUDNK-02-0LC-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Axway MailGate 3.8.1) with ESMTP id 2B786C8345; Mon, 18 Apr 2011 04:42:55 -0500 (CDT) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Mon, 18 Apr 2011 04:42:57 -0500 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 18 Apr 2011 04:42:57 -0500 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, 18 Apr 2011 05:42:56 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id CD52449C599; Mon, 18 Apr 2011 10:42:55 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id AC907FFCFA; Mon, 18 Apr 2011 11:42:55 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , Joerg Roedel Subject: [PATCH 1/2] KVM: SVM: Fix nested sel_cr0 intercept path with decode-assists Date: Mon, 18 Apr 2011 11:42:52 +0200 Message-ID: <1303119773-3436-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1303119773-3436-1-git-send-email-joerg.roedel@amd.com> References: <1303119773-3436-1-git-send-email-joerg.roedel@amd.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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 18 Apr 2011 09:43:10 +0000 (UTC) This patch fixes a bug in the nested-svm path when decode-assists is available on the machine. After a selective-cr0 intercept is detected the rip is advanced unconditionally. This causes the l1-guest to continue running with an l2-rip. This bug was with the sel_cr0 unit-test on decode-assists capable hardware. Signed-off-by: Joerg Roedel --- arch/x86/kvm/svm.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index a6bf2ad..de4bba9 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -2799,6 +2799,9 @@ static int cr_interception(struct vcpu_svm *svm) case 0: if (!check_selective_cr0_intercepted(svm, val)) err = kvm_set_cr0(&svm->vcpu, val); + else + return 1; + break; case 3: err = kvm_set_cr3(&svm->vcpu, val);