From b2042020c32b74069fa5365b5e966537aaba8cf6 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 9 Jan 2018 21:41:31 +0100
Subject: [PATCH 14/15] cpu: Add Skylake-Client-IBRS CPU model

This is a variant of Skylake-Client with indirect branch prediction
protection. The only difference between Skylake-Client and
Skylake-Client-IBRS is the added "spec-ctrl" feature.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/cpu/cpu_map.xml                                | 69 ++++++++++++++++++++++
 .../x86_64-cpuid-Xeon-E5-2623-v4-guest.xml         |  3 +-
 .../x86_64-cpuid-Xeon-E5-2623-v4-json.xml          |  3 +-
 3 files changed, 71 insertions(+), 4 deletions(-)

Index: libvirt-3.3.0/src/cpu/cpu_map.xml
===================================================================
--- libvirt-3.3.0.orig/src/cpu/cpu_map.xml
+++ libvirt-3.3.0/src/cpu/cpu_map.xml
@@ -1679,6 +1679,75 @@
       <feature name='xsaveopt'/>
     </model>
 
+    <model name='Skylake-Client-IBRS'>
+      <signature family='6' model='94'/>
+      <vendor name='Intel'/>
+      <feature name='3dnowprefetch'/>
+      <feature name='abm'/>
+      <feature name='adx'/>
+      <feature name='aes'/>
+      <feature name='apic'/>
+      <feature name='arat'/>
+      <feature name='avx'/>
+      <feature name='avx2'/>
+      <feature name='bmi1'/>
+      <feature name='bmi2'/>
+      <feature name='clflush'/>
+      <feature name='cmov'/>
+      <feature name='cx16'/>
+      <feature name='cx8'/>
+      <feature name='de'/>
+      <feature name='erms'/>
+      <feature name='f16c'/>
+      <feature name='fma'/>
+      <feature name='fpu'/>
+      <feature name='fsgsbase'/>
+      <feature name='fxsr'/>
+      <feature name='hle'/>
+      <feature name='invpcid'/>
+      <feature name='lahf_lm'/>
+      <feature name='lm'/>
+      <feature name='mca'/>
+      <feature name='mce'/>
+      <feature name='mmx'/>
+      <feature name='movbe'/>
+      <feature name='mpx'/>
+      <feature name='msr'/>
+      <feature name='mtrr'/>
+      <feature name='nx'/>
+      <feature name='pae'/>
+      <feature name='pat'/>
+      <feature name='pcid'/>
+      <feature name='pclmuldq'/>
+      <feature name='pge'/>
+      <feature name='pni'/>
+      <feature name='popcnt'/>
+      <feature name='pse'/>
+      <feature name='pse36'/>
+      <feature name='rdrand'/>
+      <feature name='rdseed'/>
+      <feature name='rdtscp'/>
+      <feature name='rtm'/>
+      <feature name='sep'/>
+      <feature name='smap'/>
+      <feature name='smep'/>
+      <feature name='spec-ctrl'/>
+      <feature name='sse'/>
+      <feature name='sse2'/>
+      <feature name='sse4.1'/>
+      <feature name='sse4.2'/>
+      <feature name='ssse3'/>
+      <feature name='syscall'/>
+      <feature name='tsc'/>
+      <feature name='tsc-deadline'/>
+      <feature name='vme'/>
+      <feature name='x2apic'/>
+      <feature name='xgetbv1'/>
+      <feature name='xsave'/>
+      <feature name='xsavec'/>
+      <feature name='xsaveopt'/>
+    </model>
+
     <!-- AMD CPUs -->
     <model name='athlon'>
       <vendor name='AMD'/>
Index: libvirt-3.3.0/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
===================================================================
--- libvirt-3.3.0.orig/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
+++ libvirt-3.3.0/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
@@ -1,5 +1,5 @@
 <cpu mode='custom' match='exact'>
-  <model fallback='forbid'>Skylake-Client</model>
+  <model fallback='forbid'>Skylake-Client-IBRS</model>
   <vendor>Intel</vendor>
   <feature policy='require' name='ds'/>
   <feature policy='require' name='acpi'/>
@@ -20,7 +20,6 @@
   <feature policy='require' name='osxsave'/>
   <feature policy='require' name='tsc_adjust'/>
   <feature policy='require' name='cmt'/>
-  <feature policy='require' name='spec-ctrl'/>
   <feature policy='require' name='mbm_total'/>
   <feature policy='require' name='mbm_local'/>
   <feature policy='require' name='pdpe1gb'/>
Index: libvirt-3.3.0/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml
===================================================================
--- libvirt-3.3.0.orig/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml
+++ libvirt-3.3.0/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml
@@ -1,10 +1,9 @@
 <cpu mode='custom' match='exact'>
-  <model fallback='forbid'>Skylake-Client</model>
+  <model fallback='forbid'>Skylake-Client-IBRS</model>
   <vendor>Intel</vendor>
   <feature policy='require' name='ss'/>
   <feature policy='require' name='hypervisor'/>
   <feature policy='require' name='tsc_adjust'/>
-  <feature policy='require' name='spec-ctrl'/>
   <feature policy='require' name='pdpe1gb'/>
   <feature policy='disable' name='mpx'/>
   <feature policy='disable' name='xsavec'/>
