yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Pablo Greco e6a3ae
From 968d0586936c356ca19f6f3b659ab094a2825374 Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
Date: Fri, 22 Nov 2019 11:53:42 +0000
Pablo Greco e6a3ae
Subject: [PATCH 09/16] target/i386: add VMX definitions
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
Message-id: <20191122115348.25000-10-pbonzini@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 92604
Pablo Greco e6a3ae
O-Subject: [RHEL8.2/rhel qemu-kvm PATCH 09/15] target/i386: add VMX definitions
Pablo Greco e6a3ae
Bugzilla: 1689270
Pablo Greco e6a3ae
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
These will be used to compile the list of VMX features for named
Pablo Greco e6a3ae
CPU models, and/or by the code that sets up the VMX MSRs.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit 704798add83be4ac868ffcb495480065fb665794)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RHEL: context
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 target/i386/cpu.h | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
Pablo Greco e6a3ae
 1 file changed, 130 insertions(+)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
Pablo Greco e6a3ae
index edba84e..2d1f247 100644
Pablo Greco e6a3ae
--- a/target/i386/cpu.h
Pablo Greco e6a3ae
+++ b/target/i386/cpu.h
Pablo Greco e6a3ae
@@ -459,6 +459,25 @@ typedef enum X86Seg {
Pablo Greco e6a3ae
 #define MSR_IA32_BNDCFGS                0x00000d90
Pablo Greco e6a3ae
 #define MSR_IA32_XSS                    0x00000da0
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_BASIC              0x00000480
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_PINBASED_CTLS      0x00000481
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_PROCBASED_CTLS     0x00000482
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_EXIT_CTLS          0x00000483
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_ENTRY_CTLS         0x00000484
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_MISC               0x00000485
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_CR0_FIXED0         0x00000486
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_CR0_FIXED1         0x00000487
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_CR4_FIXED0         0x00000488
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_CR4_FIXED1         0x00000489
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_VMCS_ENUM          0x0000048a
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_PROCBASED_CTLS2    0x0000048b
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_EPT_VPID_CAP       0x0000048c
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_TRUE_PINBASED_CTLS  0x0000048d
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x0000048e
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_TRUE_EXIT_CTLS      0x0000048f
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_TRUE_ENTRY_CTLS     0x00000490
Pablo Greco e6a3ae
+#define MSR_IA32_VMX_VMFUNC             0x00000491
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 #define XSTATE_FP_BIT                   0
Pablo Greco e6a3ae
 #define XSTATE_SSE_BIT                  1
Pablo Greco e6a3ae
 #define XSTATE_YMM_BIT                  2
Pablo Greco e6a3ae
@@ -749,6 +768,117 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #define MSR_CORE_CAP_SPLIT_LOCK_DETECT  (1U << 5)
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+/* VMX MSR features */
Pablo Greco e6a3ae
+#define MSR_VMX_BASIC_VMCS_REVISION_MASK             0x7FFFFFFFull
Pablo Greco e6a3ae
+#define MSR_VMX_BASIC_VMXON_REGION_SIZE_MASK         (0x00001FFFull << 32)
Pablo Greco e6a3ae
+#define MSR_VMX_BASIC_VMCS_MEM_TYPE_MASK             (0x003C0000ull << 32)
Pablo Greco e6a3ae
+#define MSR_VMX_BASIC_DUAL_MONITOR                   (1ULL << 49)
Pablo Greco e6a3ae
+#define MSR_VMX_BASIC_INS_OUTS                       (1ULL << 54)
Pablo Greco e6a3ae
+#define MSR_VMX_BASIC_TRUE_CTLS                      (1ULL << 55)
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_PREEMPTION_TIMER_SHIFT_MASK     0x1Full
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_STORE_LMA                       (1ULL << 5)
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_ACTIVITY_HLT                    (1ULL << 6)
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_ACTIVITY_SHUTDOWN               (1ULL << 7)
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_ACTIVITY_WAIT_SIPI              (1ULL << 8)
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_MAX_MSR_LIST_SIZE_MASK          0x0E000000ull
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_VMWRITE_VMEXIT                  (1ULL << 29)
Pablo Greco e6a3ae
+#define MSR_VMX_MISC_ZERO_LEN_INJECT                 (1ULL << 30)
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_EXECONLY                         (1ULL << 0)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_PAGE_WALK_LENGTH_4               (1ULL << 6)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_PAGE_WALK_LENGTH_5               (1ULL << 7)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_UC                               (1ULL << 8)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_WB                               (1ULL << 14)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_2MB                              (1ULL << 16)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_1GB                              (1ULL << 17)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVEPT                           (1ULL << 20)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_AD_BITS                          (1ULL << 21)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_ADVANCED_VMEXIT_INFO             (1ULL << 22)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVEPT_SINGLE_CONTEXT            (1ULL << 25)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVEPT_ALL_CONTEXT               (1ULL << 26)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVVPID                          (1ULL << 32)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVVPID_SINGLE_ADDR              (1ULL << 40)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVVPID_SINGLE_CONTEXT           (1ULL << 41)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVVPID_ALL_CONTEXT              (1ULL << 42)
Pablo Greco e6a3ae
+#define MSR_VMX_EPT_INVVPID_SINGLE_CONTEXT_NOGLOBALS (1ULL << 43)
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define MSR_VMX_VMFUNC_EPT_SWITCHING                 (1ULL << 0)
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+/* VMX controls */
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_VIRTUAL_INTR_PENDING          0x00000004
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_USE_TSC_OFFSETING             0x00000008
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_HLT_EXITING                   0x00000080
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_INVLPG_EXITING                0x00000200
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_MWAIT_EXITING                 0x00000400
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_RDPMC_EXITING                 0x00000800
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_RDTSC_EXITING                 0x00001000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_CR3_LOAD_EXITING              0x00008000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_CR3_STORE_EXITING             0x00010000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_CR8_LOAD_EXITING              0x00080000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_CR8_STORE_EXITING             0x00100000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_TPR_SHADOW                    0x00200000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_VIRTUAL_NMI_PENDING           0x00400000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_MOV_DR_EXITING                0x00800000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_UNCOND_IO_EXITING             0x01000000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_USE_IO_BITMAPS                0x02000000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_MONITOR_TRAP_FLAG             0x08000000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_USE_MSR_BITMAPS               0x10000000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_MONITOR_EXITING               0x20000000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_PAUSE_EXITING                 0x40000000
Pablo Greco e6a3ae
+#define VMX_CPU_BASED_ACTIVATE_SECONDARY_CONTROLS   0x80000000
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_ENABLE_EPT               0x00000002
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_DESC                     0x00000004
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_RDTSCP                   0x00000008
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE   0x00000010
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_ENABLE_VPID              0x00000020
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_WBINVD_EXITING           0x00000040
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_UNRESTRICTED_GUEST       0x00000080
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_APIC_REGISTER_VIRT       0x00000100
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY    0x00000200
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_PAUSE_LOOP_EXITING       0x00000400
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_RDRAND_EXITING           0x00000800
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_ENABLE_INVPCID           0x00001000
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_ENABLE_VMFUNC            0x00002000
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_SHADOW_VMCS              0x00004000
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_ENCLS_EXITING            0x00008000
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_RDSEED_EXITING           0x00010000
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_ENABLE_PML               0x00020000
Pablo Greco e6a3ae
+#define VMX_SECONDARY_EXEC_XSAVES                   0x00100000
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define VMX_PIN_BASED_EXT_INTR_MASK                 0x00000001
Pablo Greco e6a3ae
+#define VMX_PIN_BASED_NMI_EXITING                   0x00000008
Pablo Greco e6a3ae
+#define VMX_PIN_BASED_VIRTUAL_NMIS                  0x00000020
Pablo Greco e6a3ae
+#define VMX_PIN_BASED_VMX_PREEMPTION_TIMER          0x00000040
Pablo Greco e6a3ae
+#define VMX_PIN_BASED_POSTED_INTR                   0x00000080
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_SAVE_DEBUG_CONTROLS             0x00000004
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE            0x00000200
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL      0x00001000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_ACK_INTR_ON_EXIT                0x00008000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_SAVE_IA32_PAT                   0x00040000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_LOAD_IA32_PAT                   0x00080000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_SAVE_IA32_EFER                  0x00100000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_LOAD_IA32_EFER                  0x00200000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_SAVE_VMX_PREEMPTION_TIMER       0x00400000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_CLEAR_BNDCFGS                   0x00800000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_PT_CONCEAL_PIP                  0x01000000
Pablo Greco e6a3ae
+#define VMX_VM_EXIT_CLEAR_IA32_RTIT_CTL             0x02000000
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_LOAD_DEBUG_CONTROLS            0x00000004
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_IA32E_MODE                     0x00000200
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_SMM                            0x00000400
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_DEACT_DUAL_MONITOR             0x00000800
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL     0x00002000
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_LOAD_IA32_PAT                  0x00004000
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_LOAD_IA32_EFER                 0x00008000
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_LOAD_BNDCFGS                   0x00010000
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_PT_CONCEAL_PIP                 0x00020000
Pablo Greco e6a3ae
+#define VMX_VM_ENTRY_LOAD_IA32_RTIT_CTL             0x00040000
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 #ifndef HYPERV_SPINLOCK_NEVER_RETRY
Pablo Greco e6a3ae
 #define HYPERV_SPINLOCK_NEVER_RETRY             0xFFFFFFFF
Pablo Greco e6a3ae
 #endif
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae