From 9ea004168c86e97a199f12376e13aa24468c739d Mon Sep 17 00:00:00 2001
From: Gleb Natapov <gleb@redhat.com>
Date: Wed, 12 May 2010 16:57:25 -0300
Subject: [PATCH 20/20] fix CPUID vendor override

RH-Author: Gleb Natapov <gleb@redhat.com>
Message-id: <20100512165725.GA7757@redhat.com>
Patchwork-id: 9223
O-Subject: [PATCH RHEL6 KVM] fix CPUID vendor override
Bugzilla: 591604
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Avi Kivity <avi@redhat.com>

the meaning of vendor_override is actually the opposite of how it is
currently used :-( This fix reverts the workaround 4dad7ff3 and replaces
it with the correct version.  Fix it to allow KVM to export the non-native
CPUID vendor if explicitly requested by the user.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

BZ: 591604
Upstream status: 39dd091b1ca02fb250f5c6948bc802e6f0b85aa7

Signed-off-by: Gleb Natapov <gleb@redhat.com>
--
			Gleb.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-i386/helper.c b/target-i386/helper.c
index e79cf95..b979d5d 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -733,7 +733,7 @@ static int cpu_x86_register (CPUX86State *env, const char *cpu_model)
         env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2;
         env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3;
     }
-    env->cpuid_vendor_override = def->vendor_override || kvm_enabled();
+    env->cpuid_vendor_override = def->vendor_override;
     env->cpuid_level = def->level;
     if (def->family > 0x0f)
         env->cpuid_version = 0xf00 | ((def->family - 0x0f) << 20);
@@ -1999,7 +1999,7 @@ static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx,
      * this if you want to use KVM's sysenter/syscall emulation
      * in compatibility mode and when doing cross vendor migration
      */
-    if (kvm_enabled() && env->cpuid_vendor_override) {
+    if (kvm_enabled() && !env->cpuid_vendor_override) {
         host_cpuid(0, 0, NULL, ebx, ecx, edx);
     }
 }
-- 
1.7.0.3

