From 71fdfccd8ed01846c2e89d522dad3143b31b4b88 Mon Sep 17 00:00:00 2001
From: Andrew Jones <drjones@redhat.com>
Date: Tue, 14 Jan 2014 09:26:23 +0100
Subject: [PATCH 158/212] enable pvticketlocks by default

RH-Author: Andrew Jones <drjones@redhat.com>
Message-id: <1389691583-3060-1-git-send-email-drjones@redhat.com>
Patchwork-id: 56650
O-Subject: [RHEL7.0 qemu-kvm PATCH] enable pvticketlocks by default
Bugzilla: 1052340
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

RHEL-only
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1052340
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6860390

Let's turn pvticketlocks on by default. We need to get them more exposed
if we're ever going to make a final decision about them being on/off.
So we turn them on now, and if we'll have any issues during our
pre-release testing, then we'll just revert this patch. Since this is
something of a test patch, we leave it as RHEL only for now. We can post
an upstream patch later when we're sure it's the right way to go.

We only enable by default on rhel7 for now, not rhel6 and earlier,
although rhel6 kernels wouldn't enable it anyway, as they don't have
pvticketlocks. Tested by me.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 hw/i386/pc_piix.c | 2 ++
 target-i386/cpu.c | 6 ++++++
 target-i386/cpu.h | 1 +
 3 files changed, 9 insertions(+)

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

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 189d2fa..3b28360 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1080,6 +1080,8 @@ static void pc_init_rhel650(MachineState *machine)
     x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX,
                                 0, CPUID_EXT2_RDTSCP);
 
+    x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_UNHALT);
+
     pc_init_rhel700(machine);
 }
 
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index cc3ca85..ad01183 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -454,6 +454,7 @@ static uint32_t kvm_default_features[FEATURE_WORDS] = {
         (1 << KVM_FEATURE_ASYNC_PF) |
         (1 << KVM_FEATURE_STEAL_TIME) |
         (1 << KVM_FEATURE_PV_EOI) |
+        (1 << KVM_FEATURE_PV_UNHALT) |
         (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT),
     [FEAT_1_ECX] = CPUID_EXT_X2APIC,
 };
-- 
1.7.1

