From patchwork Tue Apr 28 10:45:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 20402 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 n3SAisgP030256 for ; Tue, 28 Apr 2009 10:44:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754262AbZD1Kow (ORCPT ); Tue, 28 Apr 2009 06:44:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753937AbZD1Kow (ORCPT ); Tue, 28 Apr 2009 06:44:52 -0400 Received: from outbound-sin.frontbridge.com ([207.46.51.80]:32306 "EHLO SG2EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753879AbZD1Kov (ORCPT ); Tue, 28 Apr 2009 06:44:51 -0400 Received: from mail82-sin-R.bigfish.com (10.3.40.3) by SG2EHSOBE004.bigfish.com (10.3.40.24) with Microsoft SMTP Server id 8.1.340.0; Tue, 28 Apr 2009 10:44:50 +0000 Received: from mail82-sin (localhost.localdomain [127.0.0.1]) by mail82-sin-R.bigfish.com (Postfix) with ESMTP id D95DC5781C3; Tue, 28 Apr 2009 10:44:49 +0000 (UTC) X-BigFish: VPS-8(zz936eQzz1202hzzz32i62h) X-Spam-TCS-SCL: 1:0 Received: by mail82-sin (MessageSwitch) id 1240915488912048_24626; Tue, 28 Apr 2009 10:44:48 +0000 (UCT) Received: from ausb3extmailp02.amd.com (ausb3extmailp02.amd.com [163.181.251.22]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail82-sin.bigfish.com (Postfix) with ESMTP id 534A5136805E; Tue, 28 Apr 2009 10:44:48 +0000 (UTC) Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n3SAigGT031700; Tue, 28 Apr 2009 05:44:45 -0500 X-WSS-ID: 0KIT4ID-02-PU0-01 Received: from sausexbh1.amd.com (sausexbh1.amd.com [163.181.22.101]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 2EB6E16A03FC; Tue, 28 Apr 2009 05:44:36 -0500 (CDT) Received: from SAUSEXMB3.amd.com ([163.181.22.202]) by sausexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Apr 2009 05:44:42 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by SAUSEXMB3.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Apr 2009 05:44:41 -0500 Received: from localhost.localdomain ([165.204.15.42]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Apr 2009 12:44:39 +0200 From: Andre Przywara To: Avi Kivity CC: kvm@vger.kernel.org, Andre Przywara Subject: [PATCH 2/2] Fix cross vendor migration issue in segment segment descriptor Date: Tue, 28 Apr 2009 12:45:43 +0200 Message-ID: <1240915543-4021-1-git-send-email-andre.przywara@amd.com> X-Mailer: git-send-email 1.6.1.3 X-OriginalArrivalTime: 28 Apr 2009 10:44:39.0302 (UTC) FILETIME=[54A51A60:01C9C7EE] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On AMD CPUs sometimes the DB bit in the stack segment descriptor is left as 1, although the whole segment has been made unusable. Clear it here to pass an Intel VMX entry check when cross vendor migrating. Signed-off-by: Andre Przywara --- arch/x86/kvm/svm.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) Avi, if possible, push this also to 2.6.30. My cross vendor migration tests do not pass without this, so if you want cross vendor migration in 2.6.30, this is a must. Regards, Andre. diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1580464..1227399 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -831,6 +831,15 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, if (!var->unusable) var->type |= 0x1; break; + case VCPU_SREG_SS: + /* On AMD CPUs sometimes the DB bit in the segment + * descriptor is left as 1, although the whole segment has + * been made unusable. Clear it here to pass an Intel VMX + * entry check when cross vendor migrating. + */ + if (var->unusable) + var->db = 0; + break; } }