Skip to content

Commit dfa169b

Browse files
committed
Revert "KVM: x86: add pcommit support"
This reverts commit 8b3e34e. Given the deprecation of the pcommit instruction, the relevant VMX features and CPUID bits are not going to be rolled into the SDM. Remove their usage from KVM. Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 58cd71b commit dfa169b

5 files changed

Lines changed: 6 additions & 41 deletions

File tree

‎arch/x86/include/asm/vmx.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
#define SECONDARY_EXEC_SHADOW_VMCS 0x00004000
7373
#define SECONDARY_EXEC_ENABLE_PML 0x00020000
7474
#define SECONDARY_EXEC_XSAVES 0x00100000
75-
#define SECONDARY_EXEC_PCOMMIT 0x00200000
7675
#define SECONDARY_EXEC_TSC_SCALING 0x02000000
7776

7877
#define PIN_BASED_EXT_INTR_MASK 0x00000001

‎arch/x86/include/uapi/asm/vmx.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
#define EXIT_REASON_PML_FULL 62
7979
#define EXIT_REASON_XSAVES 63
8080
#define EXIT_REASON_XRSTORS 64
81-
#define EXIT_REASON_PCOMMIT 65
8281

8382
#define VMX_EXIT_REASONS \
8483
{ EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \
@@ -127,8 +126,7 @@
127126
{ EXIT_REASON_INVVPID, "INVVPID" }, \
128127
{ EXIT_REASON_INVPCID, "INVPCID" }, \
129128
{ EXIT_REASON_XSAVES, "XSAVES" }, \
130-
{ EXIT_REASON_XRSTORS, "XRSTORS" }, \
131-
{ EXIT_REASON_PCOMMIT, "PCOMMIT" }
129+
{ EXIT_REASON_XRSTORS, "XRSTORS" }
132130

133131
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
134132
#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4

‎arch/x86/kvm/cpuid.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
366366
F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) |
367367
F(BMI2) | F(ERMS) | f_invpcid | F(RTM) | f_mpx | F(RDSEED) |
368368
F(ADX) | F(SMAP) | F(AVX512F) | F(AVX512PF) | F(AVX512ER) |
369-
F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB) | F(PCOMMIT);
369+
F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB);
370370

371371
/* cpuid 0xD.1.eax */
372372
const u32 kvm_cpuid_D_1_eax_x86_features =

‎arch/x86/kvm/cpuid.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,6 @@ static inline bool guest_cpuid_has_rtm(struct kvm_vcpu *vcpu)
144144
return best && (best->ebx & bit(X86_FEATURE_RTM));
145145
}
146146

147-
static inline bool guest_cpuid_has_pcommit(struct kvm_vcpu *vcpu)
148-
{
149-
struct kvm_cpuid_entry2 *best;
150-
151-
best = kvm_find_cpuid_entry(vcpu, 7, 0);
152-
return best && (best->ebx & bit(X86_FEATURE_PCOMMIT));
153-
}
154-
155147
static inline bool guest_cpuid_has_rdtscp(struct kvm_vcpu *vcpu)
156148
{
157149
struct kvm_cpuid_entry2 *best;

‎arch/x86/kvm/vmx.c‎

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,8 +2705,7 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
27052705
SECONDARY_EXEC_APIC_REGISTER_VIRT |
27062706
SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
27072707
SECONDARY_EXEC_WBINVD_EXITING |
2708-
SECONDARY_EXEC_XSAVES |
2709-
SECONDARY_EXEC_PCOMMIT;
2708+
SECONDARY_EXEC_XSAVES;
27102709

27112710
if (enable_ept) {
27122711
/* nested EPT: emulate EPT also to L1 */
@@ -3268,7 +3267,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
32683267
SECONDARY_EXEC_SHADOW_VMCS |
32693268
SECONDARY_EXEC_XSAVES |
32703269
SECONDARY_EXEC_ENABLE_PML |
3271-
SECONDARY_EXEC_PCOMMIT |
32723270
SECONDARY_EXEC_TSC_SCALING;
32733271
if (adjust_vmx_controls(min2, opt2,
32743272
MSR_IA32_VMX_PROCBASED_CTLS2,
@@ -4856,9 +4854,6 @@ static u32 vmx_secondary_exec_control(struct vcpu_vmx *vmx)
48564854
if (!enable_pml)
48574855
exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
48584856

4859-
/* Currently, we allow L1 guest to directly run pcommit instruction. */
4860-
exec_control &= ~SECONDARY_EXEC_PCOMMIT;
4861-
48624857
return exec_control;
48634858
}
48644859

@@ -4902,9 +4897,10 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
49024897

49034898
vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, vmx_exec_control(vmx));
49044899

4905-
if (cpu_has_secondary_exec_ctrls())
4900+
if (cpu_has_secondary_exec_ctrls()) {
49064901
vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
49074902
vmx_secondary_exec_control(vmx));
4903+
}
49084904

49094905
if (kvm_vcpu_apicv_active(&vmx->vcpu)) {
49104906
vmcs_write64(EOI_EXIT_BITMAP0, 0);
@@ -7557,13 +7553,6 @@ static int handle_pml_full(struct kvm_vcpu *vcpu)
75577553
return 1;
75587554
}
75597555

7560-
static int handle_pcommit(struct kvm_vcpu *vcpu)
7561-
{
7562-
/* we never catch pcommit instruct for L1 guest. */
7563-
WARN_ON(1);
7564-
return 1;
7565-
}
7566-
75677556
/*
75687557
* The exit handlers return 1 if the exit was handled fully and guest execution
75697558
* may resume. Otherwise they set the kvm_run parameter to indicate what needs
@@ -7614,7 +7603,6 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
76147603
[EXIT_REASON_XSAVES] = handle_xsaves,
76157604
[EXIT_REASON_XRSTORS] = handle_xrstors,
76167605
[EXIT_REASON_PML_FULL] = handle_pml_full,
7617-
[EXIT_REASON_PCOMMIT] = handle_pcommit,
76187606
};
76197607

76207608
static const int kvm_vmx_max_exit_handlers =
@@ -7923,8 +7911,6 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
79237911
* the XSS exit bitmap in vmcs12.
79247912
*/
79257913
return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
7926-
case EXIT_REASON_PCOMMIT:
7927-
return nested_cpu_has2(vmcs12, SECONDARY_EXEC_PCOMMIT);
79287914
default:
79297915
return true;
79307916
}
@@ -9085,15 +9071,6 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
90859071

90869072
if (cpu_has_secondary_exec_ctrls())
90879073
vmcs_set_secondary_exec_control(secondary_exec_ctl);
9088-
9089-
if (static_cpu_has(X86_FEATURE_PCOMMIT) && nested) {
9090-
if (guest_cpuid_has_pcommit(vcpu))
9091-
vmx->nested.nested_vmx_secondary_ctls_high |=
9092-
SECONDARY_EXEC_PCOMMIT;
9093-
else
9094-
vmx->nested.nested_vmx_secondary_ctls_high &=
9095-
~SECONDARY_EXEC_PCOMMIT;
9096-
}
90979074
}
90989075

90999076
static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
@@ -9706,8 +9683,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
97069683
exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
97079684
SECONDARY_EXEC_RDTSCP |
97089685
SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
9709-
SECONDARY_EXEC_APIC_REGISTER_VIRT |
9710-
SECONDARY_EXEC_PCOMMIT);
9686+
SECONDARY_EXEC_APIC_REGISTER_VIRT);
97119687
if (nested_cpu_has(vmcs12,
97129688
CPU_BASED_ACTIVATE_SECONDARY_CONTROLS))
97139689
exec_control |= vmcs12->secondary_vm_exec_control;

0 commit comments

Comments
 (0)