Blame SOURCES/kvm-target-i386-Add-missed-features-to-Cooperlake-CPU-mo.patch

ddf19c
From 1ffeb321151b3878bcbb2229639456c0677305f5 Mon Sep 17 00:00:00 2001
ddf19c
From: "plai@redhat.com" <plai@redhat.com>
ddf19c
Date: Fri, 15 May 2020 18:02:43 +0100
ddf19c
Subject: [PATCH 17/17] target/i386: Add missed features to Cooperlake CPU
ddf19c
 model
ddf19c
ddf19c
RH-Author: plai@redhat.com
ddf19c
Message-id: <20200515180243.17488-5-plai@redhat.com>
ddf19c
Patchwork-id: 96611
ddf19c
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 4/4] target/i386: Add missed features to Cooperlake CPU model
ddf19c
Bugzilla: 1769912
ddf19c
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
ddf19c
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ddf19c
ddf19c
From: Xiaoyao Li <xiaoyao.li@intel.com>
ddf19c
ddf19c
It lacks VMX features and two security feature bits (disclosed recently) in
ddf19c
MSR_IA32_ARCH_CAPABILITIES in current Cooperlake CPU model, so add them.
ddf19c
ddf19c
Fixes: 22a866b6166d ("i386: Add new CPU model Cooperlake")
ddf19c
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
ddf19c
Message-Id: <20191225063018.20038-3-xiaoyao.li@intel.com>
ddf19c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ddf19c
(cherry picked from commit 2dea9d9ca4ea7e9afe83d0b4153b21a16987e866)
ddf19c
Signed-off-by: Paul Lai <plai@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 target/i386/cpu.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
ddf19c
 1 file changed, 50 insertions(+), 1 deletion(-)
ddf19c
ddf19c
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
ddf19c
index 996a74f..b763adc 100644
ddf19c
--- a/target/i386/cpu.c
ddf19c
+++ b/target/i386/cpu.c
ddf19c
@@ -3202,7 +3202,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
ddf19c
             CPUID_7_0_EDX_SPEC_CTRL_SSBD | CPUID_7_0_EDX_ARCH_CAPABILITIES,
ddf19c
         .features[FEAT_ARCH_CAPABILITIES] =
ddf19c
             MSR_ARCH_CAP_RDCL_NO | MSR_ARCH_CAP_IBRS_ALL |
ddf19c
-            MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO,
ddf19c
+            MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
ddf19c
+            MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
ddf19c
         .features[FEAT_7_1_EAX] =
ddf19c
             CPUID_7_1_EAX_AVX512_BF16,
ddf19c
         /*
ddf19c
@@ -3217,6 +3218,54 @@ static X86CPUDefinition builtin_x86_defs[] = {
ddf19c
             CPUID_XSAVE_XGETBV1,
ddf19c
         .features[FEAT_6_EAX] =
ddf19c
             CPUID_6_EAX_ARAT,
ddf19c
+        /* Missing: Mode-based execute control (XS/XU), processor tracing, TSC scaling */
ddf19c
+        .features[FEAT_VMX_BASIC] = MSR_VMX_BASIC_INS_OUTS |
ddf19c
+             MSR_VMX_BASIC_TRUE_CTLS,
ddf19c
+        .features[FEAT_VMX_ENTRY_CTLS] = VMX_VM_ENTRY_IA32E_MODE |
ddf19c
+             VMX_VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL | VMX_VM_ENTRY_LOAD_IA32_PAT |
ddf19c
+             VMX_VM_ENTRY_LOAD_DEBUG_CONTROLS | VMX_VM_ENTRY_LOAD_IA32_EFER,
ddf19c
+        .features[FEAT_VMX_EPT_VPID_CAPS] = MSR_VMX_EPT_EXECONLY |
ddf19c
+             MSR_VMX_EPT_PAGE_WALK_LENGTH_4 | MSR_VMX_EPT_WB | MSR_VMX_EPT_2MB |
ddf19c
+             MSR_VMX_EPT_1GB | MSR_VMX_EPT_INVEPT |
ddf19c
+             MSR_VMX_EPT_INVEPT_SINGLE_CONTEXT | MSR_VMX_EPT_INVEPT_ALL_CONTEXT |
ddf19c
+             MSR_VMX_EPT_INVVPID | MSR_VMX_EPT_INVVPID_SINGLE_ADDR |
ddf19c
+             MSR_VMX_EPT_INVVPID_SINGLE_CONTEXT | MSR_VMX_EPT_INVVPID_ALL_CONTEXT |
ddf19c
+             MSR_VMX_EPT_INVVPID_SINGLE_CONTEXT_NOGLOBALS | MSR_VMX_EPT_AD_BITS,
ddf19c
+        .features[FEAT_VMX_EXIT_CTLS] =
ddf19c
+             VMX_VM_EXIT_ACK_INTR_ON_EXIT | VMX_VM_EXIT_SAVE_DEBUG_CONTROLS |
ddf19c
+             VMX_VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL |
ddf19c
+             VMX_VM_EXIT_LOAD_IA32_PAT | VMX_VM_EXIT_LOAD_IA32_EFER |
ddf19c
+             VMX_VM_EXIT_SAVE_IA32_PAT | VMX_VM_EXIT_SAVE_IA32_EFER |
ddf19c
+             VMX_VM_EXIT_SAVE_VMX_PREEMPTION_TIMER,
ddf19c
+        .features[FEAT_VMX_MISC] = MSR_VMX_MISC_ACTIVITY_HLT |
ddf19c
+             MSR_VMX_MISC_STORE_LMA | MSR_VMX_MISC_VMWRITE_VMEXIT,
ddf19c
+        .features[FEAT_VMX_PINBASED_CTLS] = VMX_PIN_BASED_EXT_INTR_MASK |
ddf19c
+             VMX_PIN_BASED_NMI_EXITING | VMX_PIN_BASED_VIRTUAL_NMIS |
ddf19c
+             VMX_PIN_BASED_VMX_PREEMPTION_TIMER | VMX_PIN_BASED_POSTED_INTR,
ddf19c
+        .features[FEAT_VMX_PROCBASED_CTLS] = VMX_CPU_BASED_VIRTUAL_INTR_PENDING |
ddf19c
+             VMX_CPU_BASED_USE_TSC_OFFSETING | VMX_CPU_BASED_HLT_EXITING |
ddf19c
+             VMX_CPU_BASED_INVLPG_EXITING | VMX_CPU_BASED_MWAIT_EXITING |
ddf19c
+             VMX_CPU_BASED_RDPMC_EXITING | VMX_CPU_BASED_RDTSC_EXITING |
ddf19c
+             VMX_CPU_BASED_CR8_LOAD_EXITING | VMX_CPU_BASED_CR8_STORE_EXITING |
ddf19c
+             VMX_CPU_BASED_TPR_SHADOW | VMX_CPU_BASED_MOV_DR_EXITING |
ddf19c
+             VMX_CPU_BASED_UNCOND_IO_EXITING | VMX_CPU_BASED_USE_IO_BITMAPS |
ddf19c
+             VMX_CPU_BASED_MONITOR_EXITING | VMX_CPU_BASED_PAUSE_EXITING |
ddf19c
+             VMX_CPU_BASED_VIRTUAL_NMI_PENDING | VMX_CPU_BASED_USE_MSR_BITMAPS |
ddf19c
+             VMX_CPU_BASED_CR3_LOAD_EXITING | VMX_CPU_BASED_CR3_STORE_EXITING |
ddf19c
+             VMX_CPU_BASED_MONITOR_TRAP_FLAG |
ddf19c
+             VMX_CPU_BASED_ACTIVATE_SECONDARY_CONTROLS,
ddf19c
+        .features[FEAT_VMX_SECONDARY_CTLS] =
ddf19c
+             VMX_SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
ddf19c
+             VMX_SECONDARY_EXEC_WBINVD_EXITING | VMX_SECONDARY_EXEC_ENABLE_EPT |
ddf19c
+             VMX_SECONDARY_EXEC_DESC | VMX_SECONDARY_EXEC_RDTSCP |
ddf19c
+             VMX_SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
ddf19c
+             VMX_SECONDARY_EXEC_ENABLE_VPID | VMX_SECONDARY_EXEC_UNRESTRICTED_GUEST |
ddf19c
+             VMX_SECONDARY_EXEC_APIC_REGISTER_VIRT |
ddf19c
+             VMX_SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
ddf19c
+             VMX_SECONDARY_EXEC_RDRAND_EXITING | VMX_SECONDARY_EXEC_ENABLE_INVPCID |
ddf19c
+             VMX_SECONDARY_EXEC_ENABLE_VMFUNC | VMX_SECONDARY_EXEC_SHADOW_VMCS |
ddf19c
+             VMX_SECONDARY_EXEC_RDSEED_EXITING | VMX_SECONDARY_EXEC_ENABLE_PML,
ddf19c
+        .features[FEAT_VMX_VMFUNC] = MSR_VMX_VMFUNC_EPT_SWITCHING,
ddf19c
         .xlevel = 0x80000008,
ddf19c
         .model_id = "Intel Xeon Processor (Cooperlake)",
ddf19c
     },
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c