Blob Blame Raw
From 4c9201a83e3ff48d2a55e45a34eb27966a1e4ab0 Mon Sep 17 00:00:00 2001
From: "plai@redhat.com" <plai@redhat.com>
Date: Fri, 5 Jun 2020 18:37:33 -0400
Subject: [PATCH 3/3] target/i386: Add ARCH_CAPABILITIES related bits into
 Icelake-Server CPU model
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: plai@redhat.com
Message-id: <20200605183733.8269-1-plai@redhat.com>
Patchwork-id: 97380
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH] target/i386: Add ARCH_CAPABILITIES related bits into Icelake-Server CPU model
Bugzilla: 1840342
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Bandan Das <bsd@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>

From: Xiaoyao Li <xiaoyao.li@intel.com>

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1840342
Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=28983822
Branch: rhel-av-8.2.1

Tested on HOST: intel-whitley-09.khw1.lab.eng.bos.redhat.com

1. qemu-kvm -cpu host …
        VM guest does have arch_capabilities in cpuinfo/flags.
	[Expected success]

2. qemu-kvm -cpu Icelake-Server …
        VM guest does NOT have arch_capabilities in cpuinfo/flags.
	[Expected failure]

3. qemu-kvm -cpu Icelake-Server-v3 …
        VM guest does have arch_capabilities in cpuinfo/flags.
	[Expected success]

---

Current Icelake-Server CPU model lacks all the features enumerated by
MSR_IA32_ARCH_CAPABILITIES.

Add them, so that guest of "Icelake-Server" can see all of them.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20200316095605.12318-1-xiaoyao.li@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit d965dc35592d24c0c1519f1c566223c6277cb80e)
Signed-off-by: Paul Lai <plai@redhat.com>
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
 target/i386/cpu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b763adcdc5..7d7b016bb7 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3496,6 +3496,19 @@ static X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ }
                 },
             },
+            {
+                .version = 3,
+                .props = (PropValue[]) {
+                    { "arch-capabilities", "on" },
+                    { "rdctl-no", "on" },
+                    { "ibrs-all", "on" },
+                    { "skip-l1dfl-vmentry", "on" },
+                    { "mds-no", "on" },
+                    { "pschange-mc-no", "on" },
+                    { "taa-no", "on" },
+                    { /* end of list */ }
+                },
+            },
             { /* end of list */ }
         }
     },
-- 
2.27.0