Blame SOURCES/kvm-target-i386-Add-support-for-UMIP-and-RDPID-CPUID-bit.patch

9ae3a8
From 9349e4be5ecf8b70dfc36f6cad56297cd7aa5fc9 Mon Sep 17 00:00:00 2001
9ae3a8
From: "plai@redhat.com" <plai@redhat.com>
9ae3a8
Date: Wed, 27 Jun 2018 07:53:07 +0200
9ae3a8
Subject: [PATCH 02/17] target-i386: Add support for UMIP and RDPID CPUID bits
9ae3a8
9ae3a8
RH-Author: plai@redhat.com
9ae3a8
Message-id: <1526495303-9837-1-git-send-email-plai@redhat.com>
9ae3a8
Patchwork-id: 80372
9ae3a8
O-Subject: [RHEL7.6 PATCH BZ 1526638] target-i386: Add support for UMIP and RDPID CPUID bits
9ae3a8
Bugzilla: 1526638
9ae3a8
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
Tested by Intel OTC QA on icelake client hw.
9ae3a8
Tested by Intel OTC Virtualization QA. Test Result:
9ae3a8
   XEN_UMIP_ENABLE : Check if UMIP has been enabled on the feature supported machine / PASS
9ae3a8
   XEN_UMIP_DISABLE: Verify if the UMIP can be turned off by boot. / PASS
9ae3a8
   XEN_UMIP_TEST : Check if the protection effect on the instructions of sgdt/sidt/sldt/smsw/str / PASS
9ae3a8
   XEN_UMIP_EX_TEST :Check if the protection effects on instruction of str, sldtand smsw for register and memory operands. /PASS
9ae3a8
   XEN_UMIP_TEST: Check if the protection effect on the instructions of sgdt/sidt/sldt/smsw/str / PASS
9ae3a8
   XEN_UMIP_EX_TEST: Check if the protection effects on instruction of str, sldtand smsw for register and memory operands / PASS
9ae3a8
   XEN_UMIP_LDT: Verify all the possible 32-bit address encodings / PASS
9ae3a8
9ae3a8
These are both stored in CPUID[EAX=7,EBX=0].ECX.  KVM is going to
9ae3a8
be able to emulate both (albeit with a performance loss in the case
9ae3a8
of RDPID, which therefore will be in KVM_GET_EMULATED_CPUID rather
9ae3a8
than KVM_GET_SUPPORTED_CPUID).
9ae3a8
9ae3a8
It's also possible to implement both in TCG, but this is for 2.8.
9ae3a8
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
(cherry picked from commit c2f193b538032accb9db504998bf2ea7c0ef65af)
9ae3a8
Signed-off-by: Paul Lai <plai@redhat.com>
9ae3a8
9ae3a8
Resolved Conflicts:
9ae3a8
	target-i386/cpu.c
9ae3a8
---
9ae3a8
 target-i386/cpu.c | 4 ++--
9ae3a8
 target-i386/cpu.h | 2 ++
9ae3a8
 2 files changed, 4 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
9ae3a8
index 48a5507..0254747 100644
9ae3a8
--- a/target-i386/cpu.c
9ae3a8
+++ b/target-i386/cpu.c
9ae3a8
@@ -155,12 +155,12 @@ static const char *cpuid_7_0_ebx_feature_name[] = {
9ae3a8
 };
9ae3a8
 
9ae3a8
 static const char *cpuid_7_0_ecx_feature_name[] = {
9ae3a8
-    NULL, "avx512vbmi", NULL, "pku",
9ae3a8
+    NULL, "avx512vbmi", "umip", "pku",
9ae3a8
     "ospke", NULL, "avx512vbmi2", NULL,
9ae3a8
     "gfni", "vaes", "vpclmulqdq", "avx512vnni",
9ae3a8
     "avx512bitalg", NULL, "avx512-vpopcntdq", NULL,
9ae3a8
     NULL, NULL, NULL, NULL,
9ae3a8
-    NULL, NULL, NULL, NULL,
9ae3a8
+    NULL, NULL, "rdpid", NULL,
9ae3a8
     NULL, NULL, NULL, NULL,
9ae3a8
     NULL, NULL, NULL, NULL,
9ae3a8
 };
9ae3a8
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
9ae3a8
index a781639..c72b545 100644
9ae3a8
--- a/target-i386/cpu.h
9ae3a8
+++ b/target-i386/cpu.h
9ae3a8
@@ -600,8 +600,10 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
9ae3a8
 
9ae3a8
 #define CPUID_8000_0008_EBX_IBPB    (1U << 12) /* Indirect Branch Prediction Barrier */
9ae3a8
 
9ae3a8
+#define CPUID_7_0_ECX_UMIP     (1U << 2)
9ae3a8
 #define CPUID_7_0_ECX_PKU      (1U << 3)
9ae3a8
 #define CPUID_7_0_ECX_OSPKE    (1U << 4)
9ae3a8
+#define CPUID_7_0_ECX_RDPID    (1U << 22)
9ae3a8
 
9ae3a8
 #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
9ae3a8
 #define CPUID_XSAVE_XSAVEC     (1U << 1)
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8