Skip to content

Commit c0275ae

Browse files
committed
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu-features updates from Ingo Molnar: "The biggest change in this cycle was a large series from Sean Christopherson to clean up the handling of VMX features. This both fixes bugs/inconsistencies and makes the code more coherent and future-proof. There are also two cleanups and a minor TSX syslog messages enhancement" * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) x86/cpu: Remove redundant cpu_detect_cache_sizes() call x86/cpu: Print "VMX disabled" error message iff KVM is enabled KVM: VMX: Allow KVM_INTEL when building for Centaur and/or Zhaoxin CPUs perf/x86: Provide stubs of KVM helpers for non-Intel CPUs KVM: VMX: Use VMX_FEATURE_* flags to define VMCS control bits KVM: VMX: Check for full VMX support when verifying CPU compatibility KVM: VMX: Use VMX feature flag to query BIOS enabling KVM: VMX: Drop initialization of IA32_FEAT_CTL MSR x86/cpufeatures: Add flag to track whether MSR IA32_FEAT_CTL is configured x86/cpu: Set synthetic VMX cpufeatures during init_ia32_feat_ctl() x86/cpu: Print VMX flags in /proc/cpuinfo using VMX_FEATURES_* x86/cpu: Detect VMX features on Intel, Centaur and Zhaoxin CPUs x86/vmx: Introduce VMX_FEATURES_* x86/cpu: Clear VMX feature flag if VMX is not fully enabled x86/zhaoxin: Use common IA32_FEAT_CTL MSR initialization x86/centaur: Use common IA32_FEAT_CTL MSR initialization x86/mce: WARN once if IA32_FEAT_CTL MSR is left unlocked x86/intel: Initialize IA32_FEAT_CTL MSR at boot tools/x86: Sync msr-index.h from kernel sources selftests, kvm: Replace manual MSR defs with common msr-index.h ...
2 parents f6170f0 + 283bab9 commit c0275ae

File tree

32 files changed

+432
-999
lines changed

32 files changed

+432
-999
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9171,7 +9171,7 @@ F: arch/x86/include/uapi/asm/svm.h
91719171
F: arch/x86/include/asm/kvm*
91729172
F: arch/x86/include/asm/pvclock-abi.h
91739173
F: arch/x86/include/asm/svm.h
9174-
F: arch/x86/include/asm/vmx.h
9174+
F: arch/x86/include/asm/vmx*.h
91759175
F: arch/x86/kernel/kvm.c
91769176
F: arch/x86/kernel/kvmclock.c
91779177

arch/x86/Kconfig.cpu

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,14 @@ config X86_DEBUGCTLMSR
387387
def_bool y
388388
depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486SX || M486) && !UML
389389

390+
config IA32_FEAT_CTL
391+
def_bool y
392+
depends on CPU_SUP_INTEL || CPU_SUP_CENTAUR || CPU_SUP_ZHAOXIN
393+
394+
config X86_VMX_FEATURE_NAMES
395+
def_bool y
396+
depends on IA32_FEAT_CTL && X86_FEATURE_NAMES
397+
390398
menuconfig PROCESSOR_SELECT
391399
bool "Supported processor vendors" if EXPERT
392400
---help---

arch/x86/boot/mkcpustr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "../include/asm/required-features.h"
1616
#include "../include/asm/disabled-features.h"
1717
#include "../include/asm/cpufeatures.h"
18+
#include "../include/asm/vmxfeatures.h"
1819
#include "../kernel/cpu/capflags.c"
1920

2021
int main(void)

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@
220220
#define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */
221221
#define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */
222222
#define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */
223+
#define X86_FEATURE_MSR_IA32_FEAT_CTL ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */
223224

224225
/* Virtualization flags: Linux defined, word 8 */
225226
#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */

arch/x86/include/asm/msr-index.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,19 +558,21 @@
558558
#define MSR_IA32_EBL_CR_POWERON 0x0000002a
559559
#define MSR_EBC_FREQUENCY_ID 0x0000002c
560560
#define MSR_SMI_COUNT 0x00000034
561-
#define MSR_IA32_FEATURE_CONTROL 0x0000003a
561+
562+
/* Referred to as IA32_FEATURE_CONTROL in Intel's SDM. */
563+
#define MSR_IA32_FEAT_CTL 0x0000003a
564+
#define FEAT_CTL_LOCKED BIT(0)
565+
#define FEAT_CTL_VMX_ENABLED_INSIDE_SMX BIT(1)
566+
#define FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX BIT(2)
567+
#define FEAT_CTL_LMCE_ENABLED BIT(20)
568+
562569
#define MSR_IA32_TSC_ADJUST 0x0000003b
563570
#define MSR_IA32_BNDCFGS 0x00000d90
564571

565572
#define MSR_IA32_BNDCFGS_RSVD 0x00000ffc
566573

567574
#define MSR_IA32_XSS 0x00000da0
568575

569-
#define FEATURE_CONTROL_LOCKED (1<<0)
570-
#define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX (1<<1)
571-
#define FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX (1<<2)
572-
#define FEATURE_CONTROL_LMCE (1<<20)
573-
574576
#define MSR_IA32_APICBASE 0x0000001b
575577
#define MSR_IA32_APICBASE_BSP (1<<8)
576578
#define MSR_IA32_APICBASE_ENABLE (1<<11)

arch/x86/include/asm/perf_event.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,10 @@ struct perf_guest_switch_msr {
322322
u64 host, guest;
323323
};
324324

325-
extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr);
326325
extern void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap);
327326
extern void perf_check_microcode(void);
328327
extern int x86_perf_rdpmc_index(struct perf_event *event);
329328
#else
330-
static inline struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
331-
{
332-
*nr = 0;
333-
return NULL;
334-
}
335-
336329
static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
337330
{
338331
memset(cap, 0, sizeof(*cap));
@@ -342,8 +335,23 @@ static inline void perf_events_lapic_init(void) { }
342335
static inline void perf_check_microcode(void) { }
343336
#endif
344337

338+
#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
339+
extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr);
340+
#else
341+
static inline struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
342+
{
343+
*nr = 0;
344+
return NULL;
345+
}
346+
#endif
347+
345348
#ifdef CONFIG_CPU_SUP_INTEL
346349
extern void intel_pt_handle_vmx(int on);
350+
#else
351+
static inline void intel_pt_handle_vmx(int on)
352+
{
353+
354+
}
347355
#endif
348356

349357
#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)

arch/x86/include/asm/processor.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct vm86;
2525
#include <asm/special_insns.h>
2626
#include <asm/fpu/types.h>
2727
#include <asm/unwind_hints.h>
28+
#include <asm/vmxfeatures.h>
2829

2930
#include <linux/personality.h>
3031
#include <linux/cache.h>
@@ -84,6 +85,9 @@ struct cpuinfo_x86 {
8485
#ifdef CONFIG_X86_64
8586
/* Number of 4K pages in DTLB/ITLB combined(in pages): */
8687
int x86_tlbsize;
88+
#endif
89+
#ifdef CONFIG_X86_VMX_FEATURE_NAMES
90+
__u32 vmx_capability[NVMXINTS];
8791
#endif
8892
__u8 x86_virt_bits;
8993
__u8 x86_phys_bits;
@@ -1015,11 +1019,4 @@ enum mds_mitigations {
10151019
MDS_MITIGATION_VMWERV,
10161020
};
10171021

1018-
enum taa_mitigations {
1019-
TAA_MITIGATION_OFF,
1020-
TAA_MITIGATION_UCODE_NEEDED,
1021-
TAA_MITIGATION_VERW,
1022-
TAA_MITIGATION_TSX_DISABLED,
1023-
};
1024-
10251022
#endif /* _ASM_X86_PROCESSOR_H */

arch/x86/include/asm/vmx.h

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,70 @@
1515
#include <linux/bitops.h>
1616
#include <linux/types.h>
1717
#include <uapi/asm/vmx.h>
18+
#include <asm/vmxfeatures.h>
19+
20+
#define VMCS_CONTROL_BIT(x) BIT(VMX_FEATURE_##x & 0x1f)
1821

1922
/*
2023
* Definitions of Primary Processor-Based VM-Execution Controls.
2124
*/
22-
#define CPU_BASED_VIRTUAL_INTR_PENDING 0x00000004
23-
#define CPU_BASED_USE_TSC_OFFSETING 0x00000008
24-
#define CPU_BASED_HLT_EXITING 0x00000080
25-
#define CPU_BASED_INVLPG_EXITING 0x00000200
26-
#define CPU_BASED_MWAIT_EXITING 0x00000400
27-
#define CPU_BASED_RDPMC_EXITING 0x00000800
28-
#define CPU_BASED_RDTSC_EXITING 0x00001000
29-
#define CPU_BASED_CR3_LOAD_EXITING 0x00008000
30-
#define CPU_BASED_CR3_STORE_EXITING 0x00010000
31-
#define CPU_BASED_CR8_LOAD_EXITING 0x00080000
32-
#define CPU_BASED_CR8_STORE_EXITING 0x00100000
33-
#define CPU_BASED_TPR_SHADOW 0x00200000
34-
#define CPU_BASED_VIRTUAL_NMI_PENDING 0x00400000
35-
#define CPU_BASED_MOV_DR_EXITING 0x00800000
36-
#define CPU_BASED_UNCOND_IO_EXITING 0x01000000
37-
#define CPU_BASED_USE_IO_BITMAPS 0x02000000
38-
#define CPU_BASED_MONITOR_TRAP_FLAG 0x08000000
39-
#define CPU_BASED_USE_MSR_BITMAPS 0x10000000
40-
#define CPU_BASED_MONITOR_EXITING 0x20000000
41-
#define CPU_BASED_PAUSE_EXITING 0x40000000
42-
#define CPU_BASED_ACTIVATE_SECONDARY_CONTROLS 0x80000000
25+
#define CPU_BASED_VIRTUAL_INTR_PENDING VMCS_CONTROL_BIT(VIRTUAL_INTR_PENDING)
26+
#define CPU_BASED_USE_TSC_OFFSETING VMCS_CONTROL_BIT(TSC_OFFSETTING)
27+
#define CPU_BASED_HLT_EXITING VMCS_CONTROL_BIT(HLT_EXITING)
28+
#define CPU_BASED_INVLPG_EXITING VMCS_CONTROL_BIT(INVLPG_EXITING)
29+
#define CPU_BASED_MWAIT_EXITING VMCS_CONTROL_BIT(MWAIT_EXITING)
30+
#define CPU_BASED_RDPMC_EXITING VMCS_CONTROL_BIT(RDPMC_EXITING)
31+
#define CPU_BASED_RDTSC_EXITING VMCS_CONTROL_BIT(RDTSC_EXITING)
32+
#define CPU_BASED_CR3_LOAD_EXITING VMCS_CONTROL_BIT(CR3_LOAD_EXITING)
33+
#define CPU_BASED_CR3_STORE_EXITING VMCS_CONTROL_BIT(CR3_STORE_EXITING)
34+
#define CPU_BASED_CR8_LOAD_EXITING VMCS_CONTROL_BIT(CR8_LOAD_EXITING)
35+
#define CPU_BASED_CR8_STORE_EXITING VMCS_CONTROL_BIT(CR8_STORE_EXITING)
36+
#define CPU_BASED_TPR_SHADOW VMCS_CONTROL_BIT(VIRTUAL_TPR)
37+
#define CPU_BASED_VIRTUAL_NMI_PENDING VMCS_CONTROL_BIT(VIRTUAL_NMI_PENDING)
38+
#define CPU_BASED_MOV_DR_EXITING VMCS_CONTROL_BIT(MOV_DR_EXITING)
39+
#define CPU_BASED_UNCOND_IO_EXITING VMCS_CONTROL_BIT(UNCOND_IO_EXITING)
40+
#define CPU_BASED_USE_IO_BITMAPS VMCS_CONTROL_BIT(USE_IO_BITMAPS)
41+
#define CPU_BASED_MONITOR_TRAP_FLAG VMCS_CONTROL_BIT(MONITOR_TRAP_FLAG)
42+
#define CPU_BASED_USE_MSR_BITMAPS VMCS_CONTROL_BIT(USE_MSR_BITMAPS)
43+
#define CPU_BASED_MONITOR_EXITING VMCS_CONTROL_BIT(MONITOR_EXITING)
44+
#define CPU_BASED_PAUSE_EXITING VMCS_CONTROL_BIT(PAUSE_EXITING)
45+
#define CPU_BASED_ACTIVATE_SECONDARY_CONTROLS VMCS_CONTROL_BIT(SEC_CONTROLS)
4346

4447
#define CPU_BASED_ALWAYSON_WITHOUT_TRUE_MSR 0x0401e172
4548

4649
/*
4750
* Definitions of Secondary Processor-Based VM-Execution Controls.
4851
*/
49-
#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
50-
#define SECONDARY_EXEC_ENABLE_EPT 0x00000002
51-
#define SECONDARY_EXEC_DESC 0x00000004
52-
#define SECONDARY_EXEC_RDTSCP 0x00000008
53-
#define SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE 0x00000010
54-
#define SECONDARY_EXEC_ENABLE_VPID 0x00000020
55-
#define SECONDARY_EXEC_WBINVD_EXITING 0x00000040
56-
#define SECONDARY_EXEC_UNRESTRICTED_GUEST 0x00000080
57-
#define SECONDARY_EXEC_APIC_REGISTER_VIRT 0x00000100
58-
#define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY 0x00000200
59-
#define SECONDARY_EXEC_PAUSE_LOOP_EXITING 0x00000400
60-
#define SECONDARY_EXEC_RDRAND_EXITING 0x00000800
61-
#define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000
62-
#define SECONDARY_EXEC_ENABLE_VMFUNC 0x00002000
63-
#define SECONDARY_EXEC_SHADOW_VMCS 0x00004000
64-
#define SECONDARY_EXEC_ENCLS_EXITING 0x00008000
65-
#define SECONDARY_EXEC_RDSEED_EXITING 0x00010000
66-
#define SECONDARY_EXEC_ENABLE_PML 0x00020000
67-
#define SECONDARY_EXEC_PT_CONCEAL_VMX 0x00080000
68-
#define SECONDARY_EXEC_XSAVES 0x00100000
69-
#define SECONDARY_EXEC_PT_USE_GPA 0x01000000
70-
#define SECONDARY_EXEC_MODE_BASED_EPT_EXEC 0x00400000
71-
#define SECONDARY_EXEC_TSC_SCALING 0x02000000
52+
#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES VMCS_CONTROL_BIT(VIRT_APIC_ACCESSES)
53+
#define SECONDARY_EXEC_ENABLE_EPT VMCS_CONTROL_BIT(EPT)
54+
#define SECONDARY_EXEC_DESC VMCS_CONTROL_BIT(DESC_EXITING)
55+
#define SECONDARY_EXEC_RDTSCP VMCS_CONTROL_BIT(RDTSCP)
56+
#define SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE VMCS_CONTROL_BIT(VIRTUAL_X2APIC)
57+
#define SECONDARY_EXEC_ENABLE_VPID VMCS_CONTROL_BIT(VPID)
58+
#define SECONDARY_EXEC_WBINVD_EXITING VMCS_CONTROL_BIT(WBINVD_EXITING)
59+
#define SECONDARY_EXEC_UNRESTRICTED_GUEST VMCS_CONTROL_BIT(UNRESTRICTED_GUEST)
60+
#define SECONDARY_EXEC_APIC_REGISTER_VIRT VMCS_CONTROL_BIT(APIC_REGISTER_VIRT)
61+
#define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY VMCS_CONTROL_BIT(VIRT_INTR_DELIVERY)
62+
#define SECONDARY_EXEC_PAUSE_LOOP_EXITING VMCS_CONTROL_BIT(PAUSE_LOOP_EXITING)
63+
#define SECONDARY_EXEC_RDRAND_EXITING VMCS_CONTROL_BIT(RDRAND_EXITING)
64+
#define SECONDARY_EXEC_ENABLE_INVPCID VMCS_CONTROL_BIT(INVPCID)
65+
#define SECONDARY_EXEC_ENABLE_VMFUNC VMCS_CONTROL_BIT(VMFUNC)
66+
#define SECONDARY_EXEC_SHADOW_VMCS VMCS_CONTROL_BIT(SHADOW_VMCS)
67+
#define SECONDARY_EXEC_ENCLS_EXITING VMCS_CONTROL_BIT(ENCLS_EXITING)
68+
#define SECONDARY_EXEC_RDSEED_EXITING VMCS_CONTROL_BIT(RDSEED_EXITING)
69+
#define SECONDARY_EXEC_ENABLE_PML VMCS_CONTROL_BIT(PAGE_MOD_LOGGING)
70+
#define SECONDARY_EXEC_PT_CONCEAL_VMX VMCS_CONTROL_BIT(PT_CONCEAL_VMX)
71+
#define SECONDARY_EXEC_XSAVES VMCS_CONTROL_BIT(XSAVES)
72+
#define SECONDARY_EXEC_MODE_BASED_EPT_EXEC VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC)
73+
#define SECONDARY_EXEC_PT_USE_GPA VMCS_CONTROL_BIT(PT_USE_GPA)
74+
#define SECONDARY_EXEC_TSC_SCALING VMCS_CONTROL_BIT(TSC_SCALING)
7275
#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE 0x04000000
7376

74-
#define PIN_BASED_EXT_INTR_MASK 0x00000001
75-
#define PIN_BASED_NMI_EXITING 0x00000008
76-
#define PIN_BASED_VIRTUAL_NMIS 0x00000020
77-
#define PIN_BASED_VMX_PREEMPTION_TIMER 0x00000040
78-
#define PIN_BASED_POSTED_INTR 0x00000080
77+
#define PIN_BASED_EXT_INTR_MASK VMCS_CONTROL_BIT(INTR_EXITING)
78+
#define PIN_BASED_NMI_EXITING VMCS_CONTROL_BIT(NMI_EXITING)
79+
#define PIN_BASED_VIRTUAL_NMIS VMCS_CONTROL_BIT(VIRTUAL_NMIS)
80+
#define PIN_BASED_VMX_PREEMPTION_TIMER VMCS_CONTROL_BIT(PREEMPTION_TIMER)
81+
#define PIN_BASED_POSTED_INTR VMCS_CONTROL_BIT(POSTED_INTR)
7982

8083
#define PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR 0x00000016
8184

@@ -114,7 +117,9 @@
114117
#define VMX_MISC_MSR_LIST_MULTIPLIER 512
115118

116119
/* VMFUNC functions */
117-
#define VMX_VMFUNC_EPTP_SWITCHING 0x00000001
120+
#define VMFUNC_CONTROL_BIT(x) BIT((VMX_FEATURE_##x & 0x1f) - 28)
121+
122+
#define VMX_VMFUNC_EPTP_SWITCHING VMFUNC_CONTROL_BIT(EPTP_SWITCHING)
118123
#define VMFUNC_EPTP_ENTRIES 512
119124

120125
static inline u32 vmx_basic_vmcs_revision_id(u64 vmx_basic)

arch/x86/include/asm/vmxfeatures.h

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_X86_VMXFEATURES_H
3+
#define _ASM_X86_VMXFEATURES_H
4+
5+
/*
6+
* Defines VMX CPU feature bits
7+
*/
8+
#define NVMXINTS 3 /* N 32-bit words worth of info */
9+
10+
/*
11+
* Note: If the comment begins with a quoted string, that string is used
12+
* in /proc/cpuinfo instead of the macro name. If the string is "",
13+
* this feature bit is not displayed in /proc/cpuinfo at all.
14+
*/
15+
16+
/* Pin-Based VM-Execution Controls, EPT/VPID, APIC and VM-Functions, word 0 */
17+
#define VMX_FEATURE_INTR_EXITING ( 0*32+ 0) /* "" VM-Exit on vectored interrupts */
18+
#define VMX_FEATURE_NMI_EXITING ( 0*32+ 3) /* "" VM-Exit on NMIs */
19+
#define VMX_FEATURE_VIRTUAL_NMIS ( 0*32+ 5) /* "vnmi" NMI virtualization */
20+
#define VMX_FEATURE_PREEMPTION_TIMER ( 0*32+ 6) /* VMX Preemption Timer */
21+
#define VMX_FEATURE_POSTED_INTR ( 0*32+ 7) /* Posted Interrupts */
22+
23+
/* EPT/VPID features, scattered to bits 16-23 */
24+
#define VMX_FEATURE_INVVPID ( 0*32+ 16) /* INVVPID is supported */
25+
#define VMX_FEATURE_EPT_EXECUTE_ONLY ( 0*32+ 17) /* "ept_x_only" EPT entries can be execute only */
26+
#define VMX_FEATURE_EPT_AD ( 0*32+ 18) /* EPT Accessed/Dirty bits */
27+
#define VMX_FEATURE_EPT_1GB ( 0*32+ 19) /* 1GB EPT pages */
28+
29+
/* Aggregated APIC features 24-27 */
30+
#define VMX_FEATURE_FLEXPRIORITY ( 0*32+ 24) /* TPR shadow + virt APIC */
31+
#define VMX_FEATURE_APICV ( 0*32+ 25) /* TPR shadow + APIC reg virt + virt intr delivery + posted interrupts */
32+
33+
/* VM-Functions, shifted to bits 28-31 */
34+
#define VMX_FEATURE_EPTP_SWITCHING ( 0*32+ 28) /* EPTP switching (in guest) */
35+
36+
/* Primary Processor-Based VM-Execution Controls, word 1 */
37+
#define VMX_FEATURE_VIRTUAL_INTR_PENDING ( 1*32+ 2) /* "" VM-Exit if INTRs are unblocked in guest */
38+
#define VMX_FEATURE_TSC_OFFSETTING ( 1*32+ 3) /* "tsc_offset" Offset hardware TSC when read in guest */
39+
#define VMX_FEATURE_HLT_EXITING ( 1*32+ 7) /* "" VM-Exit on HLT */
40+
#define VMX_FEATURE_INVLPG_EXITING ( 1*32+ 9) /* "" VM-Exit on INVLPG */
41+
#define VMX_FEATURE_MWAIT_EXITING ( 1*32+ 10) /* "" VM-Exit on MWAIT */
42+
#define VMX_FEATURE_RDPMC_EXITING ( 1*32+ 11) /* "" VM-Exit on RDPMC */
43+
#define VMX_FEATURE_RDTSC_EXITING ( 1*32+ 12) /* "" VM-Exit on RDTSC */
44+
#define VMX_FEATURE_CR3_LOAD_EXITING ( 1*32+ 15) /* "" VM-Exit on writes to CR3 */
45+
#define VMX_FEATURE_CR3_STORE_EXITING ( 1*32+ 16) /* "" VM-Exit on reads from CR3 */
46+
#define VMX_FEATURE_CR8_LOAD_EXITING ( 1*32+ 19) /* "" VM-Exit on writes to CR8 */
47+
#define VMX_FEATURE_CR8_STORE_EXITING ( 1*32+ 20) /* "" VM-Exit on reads from CR8 */
48+
#define VMX_FEATURE_VIRTUAL_TPR ( 1*32+ 21) /* "vtpr" TPR virtualization, a.k.a. TPR shadow */
49+
#define VMX_FEATURE_VIRTUAL_NMI_PENDING ( 1*32+ 22) /* "" VM-Exit if NMIs are unblocked in guest */
50+
#define VMX_FEATURE_MOV_DR_EXITING ( 1*32+ 23) /* "" VM-Exit on accesses to debug registers */
51+
#define VMX_FEATURE_UNCOND_IO_EXITING ( 1*32+ 24) /* "" VM-Exit on *all* IN{S} and OUT{S}*/
52+
#define VMX_FEATURE_USE_IO_BITMAPS ( 1*32+ 25) /* "" VM-Exit based on I/O port */
53+
#define VMX_FEATURE_MONITOR_TRAP_FLAG ( 1*32+ 27) /* "mtf" VMX single-step VM-Exits */
54+
#define VMX_FEATURE_USE_MSR_BITMAPS ( 1*32+ 28) /* "" VM-Exit based on MSR index */
55+
#define VMX_FEATURE_MONITOR_EXITING ( 1*32+ 29) /* "" VM-Exit on MONITOR (MWAIT's accomplice) */
56+
#define VMX_FEATURE_PAUSE_EXITING ( 1*32+ 30) /* "" VM-Exit on PAUSE (unconditionally) */
57+
#define VMX_FEATURE_SEC_CONTROLS ( 1*32+ 31) /* "" Enable Secondary VM-Execution Controls */
58+
59+
/* Secondary Processor-Based VM-Execution Controls, word 2 */
60+
#define VMX_FEATURE_VIRT_APIC_ACCESSES ( 2*32+ 0) /* "vapic" Virtualize memory mapped APIC accesses */
61+
#define VMX_FEATURE_EPT ( 2*32+ 1) /* Extended Page Tables, a.k.a. Two-Dimensional Paging */
62+
#define VMX_FEATURE_DESC_EXITING ( 2*32+ 2) /* "" VM-Exit on {S,L}*DT instructions */
63+
#define VMX_FEATURE_RDTSCP ( 2*32+ 3) /* "" Enable RDTSCP in guest */
64+
#define VMX_FEATURE_VIRTUAL_X2APIC ( 2*32+ 4) /* "" Virtualize X2APIC for the guest */
65+
#define VMX_FEATURE_VPID ( 2*32+ 5) /* Virtual Processor ID (TLB ASID modifier) */
66+
#define VMX_FEATURE_WBINVD_EXITING ( 2*32+ 6) /* "" VM-Exit on WBINVD */
67+
#define VMX_FEATURE_UNRESTRICTED_GUEST ( 2*32+ 7) /* Allow Big Real Mode and other "invalid" states */
68+
#define VMX_FEATURE_APIC_REGISTER_VIRT ( 2*32+ 8) /* "vapic_reg" Hardware emulation of reads to the virtual-APIC */
69+
#define VMX_FEATURE_VIRT_INTR_DELIVERY ( 2*32+ 9) /* "vid" Evaluation and delivery of pending virtual interrupts */
70+
#define VMX_FEATURE_PAUSE_LOOP_EXITING ( 2*32+ 10) /* "ple" Conditionally VM-Exit on PAUSE at CPL0 */
71+
#define VMX_FEATURE_RDRAND_EXITING ( 2*32+ 11) /* "" VM-Exit on RDRAND*/
72+
#define VMX_FEATURE_INVPCID ( 2*32+ 12) /* "" Enable INVPCID in guest */
73+
#define VMX_FEATURE_VMFUNC ( 2*32+ 13) /* "" Enable VM-Functions (leaf dependent) */
74+
#define VMX_FEATURE_SHADOW_VMCS ( 2*32+ 14) /* VMREAD/VMWRITE in guest can access shadow VMCS */
75+
#define VMX_FEATURE_ENCLS_EXITING ( 2*32+ 15) /* "" VM-Exit on ENCLS (leaf dependent) */
76+
#define VMX_FEATURE_RDSEED_EXITING ( 2*32+ 16) /* "" VM-Exit on RDSEED */
77+
#define VMX_FEATURE_PAGE_MOD_LOGGING ( 2*32+ 17) /* "pml" Log dirty pages into buffer */
78+
#define VMX_FEATURE_EPT_VIOLATION_VE ( 2*32+ 18) /* "" Conditionally reflect EPT violations as #VE exceptions */
79+
#define VMX_FEATURE_PT_CONCEAL_VMX ( 2*32+ 19) /* "" Suppress VMX indicators in Processor Trace */
80+
#define VMX_FEATURE_XSAVES ( 2*32+ 20) /* "" Enable XSAVES and XRSTORS in guest */
81+
#define VMX_FEATURE_MODE_BASED_EPT_EXEC ( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */
82+
#define VMX_FEATURE_PT_USE_GPA ( 2*32+ 24) /* "" Processor Trace logs GPAs */
83+
#define VMX_FEATURE_TSC_SCALING ( 2*32+ 25) /* Scale hardware TSC when read in guest */
84+
#define VMX_FEATURE_ENCLV_EXITING ( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */
85+
86+
#endif /* _ASM_X86_VMXFEATURES_H */

arch/x86/kernel/cpu/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ obj-y += umwait.o
2929
obj-$(CONFIG_PROC_FS) += proc.o
3030
obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
3131

32+
obj-$(CONFIG_IA32_FEAT_CTL) += feat_ctl.o
3233
ifdef CONFIG_CPU_SUP_INTEL
3334
obj-y += intel.o intel_pconfig.o tsx.o
3435
obj-$(CONFIG_PM) += intel_epb.o
@@ -53,11 +54,12 @@ obj-$(CONFIG_ACRN_GUEST) += acrn.o
5354

5455
ifdef CONFIG_X86_FEATURE_NAMES
5556
quiet_cmd_mkcapflags = MKCAP $@
56-
cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
57+
cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $@ $^
5758

5859
cpufeature = $(src)/../../include/asm/cpufeatures.h
60+
vmxfeature = $(src)/../../include/asm/vmxfeatures.h
5961

60-
$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
62+
$(obj)/capflags.c: $(cpufeature) $(vmxfeature) $(src)/mkcapflags.sh FORCE
6163
$(call if_changed,mkcapflags)
6264
endif
6365
targets += capflags.c

0 commit comments

Comments
 (0)