Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 271

kvm-83-164.el5_5.30.src.rpm

From 34716722bf33acd7adf01f9640456e73f4d30831 Mon Sep 17 00:00:00 2001
From: Andrea Arcangeli <aarcange@redhat.com>
Date: Thu, 18 Jun 2009 19:40:44 +0200
Subject: [PATCH] enable sysenter on 32bit guests (skype fix)

NOTE: this is untested on AMD at this time, duron should work as well
as athlon, they're in the same family but giving a spin on skype over
xpsp2 on amd with this patch is good idea before commit even if review
passes.

From: Andrea Arcangeli <aarcange@redhat.com>

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 <aarcange@redhat.com>
Message-ID: <20090618174044.GU12816@random.random>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Avi Kivity <avi@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Bugzilla: 504628
---
 qemu/target-i386/helper.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/qemu/target-i386/helper.c b/qemu/target-i386/helper.c
index 9ac8b0e..a2be8d7 100644
--- a/qemu/target-i386/helper.c
+++ b/qemu/target-i386/helper.c
@@ -125,7 +125,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 */
-- 
1.6.3.rc4.29.g8146