cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-target-i386-Set-model-6-on-qemu64-qemu32-CPU-models.patch

218e99
From 9baf8dbaac5707b25f9126a5ba06716efe6793d5 Mon Sep 17 00:00:00 2001
218e99
From: Miroslav Rezanina <mrezanin@redhat.com>
218e99
Date: Thu, 17 Oct 2013 10:38:42 +0200
218e99
Subject: [PATCH 05/25] target-i386: Set model=6 on qemu64 & qemu32 CPU models
218e99
MIME-Version: 1.0
218e99
Content-Type: text/plain; charset=UTF-8
218e99
Content-Transfer-Encoding: 8bit
218e99
218e99
Message-id: <1379363997-11783-2-git-send-email-ehabkost@redhat.com>
218e99
Patchwork-id: 54398
218e99
O-Subject: [RHEL7 PATCH 1/4] target-i386: Set model=6 on qemu64 & qemu32 CPU models
218e99
Bugzilla: 1004290
218e99
RH-Acked-by: Bandan Das <bsd@redhat.com>
218e99
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
Bugzilla: 1004290
218e99
Upstream status: commit f8e6a11aecc96e9d8a84f17d7c07019471714e20.
218e99
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6290888
218e99
218e99
There's no Intel CPU with family=6,model=2, and Linux and Windows guests
218e99
disable SEP when seeing that combination due to Pentium Pro erratum #82.
218e99
218e99
In addition to just having SEP ignored by guests, Skype (and maybe other
218e99
applications) runs sysenter directly without passing through ntdll on
218e99
Windows, and crashes because Windows ignored the SEP CPUID bit.
218e99
218e99
So, having model > 2 is a better default on qemu64 and qemu32 for two
218e99
reasons: making SEP really available for guests, and avoiding crashing
218e99
applications that work on bare metal.
218e99
218e99
model=3 would fix the problem, but it causes CPU enumeration problems
218e99
for Windows guests[1]. So let's set model=6, that matches "Athlon
218e99
(PM core)" on AMD and "P2 with on-die L2 cache" on Intel and it allows
218e99
Windows to use all CPUs as well as fixing sysenter.
218e99
218e99
[1] https://bugzilla.redhat.com/show_bug.cgi?id=508623
218e99
218e99
Cc: Andrea Arcangeli <aarcange@redhat.com>
218e99
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
218e99
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
218e99
Signed-off-by: Andreas Färber <afaerber@suse.de>
218e99
(cherry picked from commit 5cb6eb263d92972b54f84e0acf75e7159de20498)
218e99
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
218e99
218e99
Conflicts:
218e99
	include/hw/i386/pc.h
218e99
218e99
Backport notes:
218e99
 * PC_COMPAT_1_6 does not exist on the RHEL-7 tree
218e99
 * RHEL-6 already have model=6 on qemu64 since RHEL-6.0, but not on
218e99
   qemu32, so PC_RHEL6_5_COMPAT includes only the qemu32 compat change
218e99
218e99
Maintainer's notes:
218e99
 * Cherry-picked from Andreas Färber's qom-cpu tree
218e99
 * Upstream status valid for qemu tree
218e99
---
218e99
 hw/i386/pc_piix.c | 4 ++++
218e99
 target-i386/cpu.c | 4 ++--
218e99
 2 files changed, 6 insertions(+), 2 deletions(-)
218e99
---
218e99
 hw/i386/pc_piix.c |    4 ++++
218e99
 target-i386/cpu.c |    4 ++--
218e99
 2 files changed, 6 insertions(+), 2 deletions(-)
218e99
218e99
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
218e99
index a19f155..39be127 100644
218e99
--- a/hw/i386/pc_piix.c
218e99
+++ b/hw/i386/pc_piix.c
218e99
@@ -861,6 +861,10 @@ static QEMUMachine pc_machine_rhel700 = {
218e99
         .property = "level",\
218e99
         .value = stringify(0),\
218e99
     },{\
218e99
+        .driver   = "qemu32-" TYPE_X86_CPU,\
218e99
+        .property = "model",\
218e99
+        .value    = stringify(3),\
218e99
+    },{\
218e99
         .driver   = "usb-ccid",\
218e99
         .property = "serial",\
218e99
         .value    = "1",\
218e99
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
218e99
index a0358c0..170a46c 100644
218e99
--- a/target-i386/cpu.c
218e99
+++ b/target-i386/cpu.c
218e99
@@ -434,7 +434,7 @@ static x86_def_t builtin_x86_defs[] = {
218e99
         .level = 4,
218e99
         .vendor = CPUID_VENDOR_AMD,
218e99
         .family = 6,
218e99
-        .model = 2,
218e99
+        .model = 6,
218e99
         .stepping = 3,
218e99
         .features[FEAT_1_EDX] =
218e99
             PPRO_FEATURES |
218e99
@@ -537,7 +537,7 @@ static x86_def_t builtin_x86_defs[] = {
218e99
         .level = 4,
218e99
         .vendor = CPUID_VENDOR_INTEL,
218e99
         .family = 6,
218e99
-        .model = 3,
218e99
+        .model = 6,
218e99
         .stepping = 3,
218e99
         .features[FEAT_1_EDX] =
218e99
             PPRO_FEATURES,
218e99
-- 
218e99
1.7.1
218e99