From patchwork Thu Jun 18 17:38:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Arcangeli X-Patchwork-Id: 31191 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 n5IHcvne018218 for ; Thu, 18 Jun 2009 17:38:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753202AbZFRRiw (ORCPT ); Thu, 18 Jun 2009 13:38:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753348AbZFRRiw (ORCPT ); Thu, 18 Jun 2009 13:38:52 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59293 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbZFRRiv (ORCPT ); Thu, 18 Jun 2009 13:38:51 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5IHcsRu030625 for ; Thu, 18 Jun 2009 13:38:54 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5IHcrGK024399; Thu, 18 Jun 2009 13:38:53 -0400 Received: from random.random (vpn-10-186.str.redhat.com [10.32.10.186]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5IHcquI010413; Thu, 18 Jun 2009 13:38:52 -0400 Date: Thu, 18 Jun 2009 19:38:52 +0200 From: Andrea Arcangeli To: Avi Kivity Cc: kvm@vger.kernel.org Subject: enable sysenter on 32bit guests Message-ID: <20090618173852.GT12816@random.random> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Andrea Arcangeli model=2 is not existent when vendor is intel and an errata of P6 says that any model <= 2 when family is 6 lack sap feature, so windows and linux 32bit guests disable sap in software and slowdown for no good reason when running inside kvm on intel CPU. Fix is to set model = 3 so it'll be the duron cpu when kvm runs on amd bare metal (not anymore athlon but userland doesn't see the difference) and it'll be PII that has sysenter functional like all cpus that run KVM have too when on intel bare metal. Patch will follow, workaround without this fix is -cpu qemu64,model=3. There is a bug in skype that it checks if the sep feature is set to run sysenter on intel chip inside its binary without passing through ntdll, without verifying the model was <= 2 like windows does, so windows forbids sysenter but skype calls it anyway. This is skype bug and it would trigger on real P6 hardware too (but nobody tests skype on P6). qemu64,-sep fixed skype. But because every time we have an intel cpu running kvm, we also have sysenter functioning, we boots the model to 3 so windows 32bit (and linux32bit) gets a boost with sysenter too. Signed-off-by: Andrea Arcangeli --- -- 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/target-i386/helper.c b/target-i386/helper.c index 6dc0111..82aef93 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -126,7 +126,8 @@ static x86_def_t x86_defs[] = { .vendor2 = CPUID_VENDOR_AMD_2, .vendor3 = CPUID_VENDOR_AMD_3, .family = 6, - .model = 2, + /* AMD Duron || PII Intel with sep capbility - P6 has no sep */ + .model = 3, .stepping = 3, .features = PPRO_FEATURES | /* these features are needed for Win64 and aren't fully implemented */