From 2986c1070e031d290c268fba039e3eac97b28467 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Thu, 21 Aug 2014 19:58:17 +0200
Subject: [PATCH 2/3] pc: Add Broadwell CPUID compatibility bits

Message-id: <1408651097-24190-3-git-send-email-ehabkost@redhat.com>
Patchwork-id: 60671
O-Subject: [RHEL7.1 qemu-kvm PATCH 2/2] pc: Add Broadwell CPUID compatibility bits
Bugzilla: 1116117
RH-Acked-by: Bandan Das <bsd@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

On RHEL-6, the Broadwell CPU model won't have the RDTSCP and SMAP
features. Add compatibility code to ensure we stay compatible when
migrating from RHEL-6.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/i386/pc_piix.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 550acd8..4ea3f67 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -935,6 +935,10 @@ 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("Broadwell", FEAT_8000_0001_EDX,
+                                0, CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Broadwell", FEAT_7_0_EBX,
+                                0, CPUID_7_0_EBX_SMAP);
 
     /* RHEL-6 kernel never supported exposing RDTSCP */
     x86_cpu_compat_set_features(NULL, FEAT_8000_0001_EDX, 0, CPUID_EXT2_RDTSCP);
-- 
1.8.3.1