From 26653f89373a3439d6dba73c660d00116c0dbbc0 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Mon, 27 Jan 2014 16:07:42 +0100
Subject: [PATCH 20/22] pc: Disable RDTSCP unconditionally on rhel6.* machine-types

RH-Author: Eduardo Habkost <ehabkost@redhat.com>
Message-id: <1390838863-11030-2-git-send-email-ehabkost@redhat.com>
Patchwork-id: 56960
O-Subject: [RHEL7 qemu-kvm PATCH 1/2] pc: Disable RDTSCP unconditionally on rhel6.* machine-types
Bugzilla: 918907
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>

Bugzilla: 918907
Upstream status: not applicable
Brew scratch build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6953316

The RHEL-6 kernel didn't support exposing RDTSCP at all, so we need to
disable RDTSCP on all CPU models.

The previous rhel6.5.0 compat code wasn't complete, because Opteron_G4
and Opteron_G5 were not being changed.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc_piix.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/i386/pc_piix.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 641f3d9..b918f69 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -906,10 +906,9 @@ static void pc_compat_rhel650(QEMUMachineInitArgs *args)
              CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR |
              CPUID_EXT2_TSC | CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU,
              0);
-    x86_cpu_compat_set_features("SandyBridge", FEAT_8000_0001_EDX,
-                                0, CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Haswell", FEAT_8000_0001_EDX,
-                                0, CPUID_EXT2_RDTSCP);
+
+    /* RHEL-6 kernel never supported exposing RDTSCP */
+    x86_cpu_compat_set_features(NULL, FEAT_8000_0001_EDX, 0, CPUID_EXT2_RDTSCP);
 
     x86_cpu_compat_set_features("Opteron_G1", FEAT_1_ECX, CPUID_EXT_X2APIC, 0);
     x86_cpu_compat_set_features("Opteron_G2", FEAT_1_ECX, CPUID_EXT_X2APIC, 0);
@@ -917,15 +916,6 @@ static void pc_compat_rhel650(QEMUMachineInitArgs *args)
     x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, 0, CPUID_EXT_X2APIC);
     x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, 0, CPUID_EXT_X2APIC);
 
-    x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX,
-                                0, CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G1", FEAT_8000_0001_EDX,
-                                0, CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX,
-                                0, CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX,
-                                0, CPUID_EXT2_RDTSCP);
-
     /* RHEL-6 had 3dnow & 3dnowext unconditionally disabled on all models */
     x86_cpu_compat_set_features(NULL, FEAT_8000_0001_EDX, 0,
                                 CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT);
-- 
1.7.1