@@ -3071,13 +3071,6 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
30713071
30723072 vmx -> rmode .vm86_active = 1 ;
30733073
3074- /*
3075- * Very old userspace does not call KVM_SET_TSS_ADDR before entering
3076- * vcpu. Warn the user that an update is overdue.
3077- */
3078- if (!kvm_vmx -> tss_addr )
3079- pr_warn_once ("KVM_SET_TSS_ADDR needs to be called before running vCPU\n" );
3080-
30813074 vmx_segment_cache_clear (vmx );
30823075
30833076 vmcs_writel (GUEST_TR_BASE , kvm_vmx -> tss_addr );
@@ -3350,7 +3343,7 @@ void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
33503343 vmx -> emulation_required = vmx_emulation_required (vcpu );
33513344}
33523345
3353- static int vmx_get_max_tdp_level (void )
3346+ static int vmx_get_max_ept_level (void )
33543347{
33553348 if (cpu_has_vmx_ept_5levels ())
33563349 return 5 ;
@@ -6796,8 +6789,10 @@ static void vmx_set_apic_access_page_addr(struct kvm_vcpu *vcpu)
67966789 vmcs_write64 (APIC_ACCESS_ADDR , pfn_to_hpa (pfn ));
67976790 read_unlock (& vcpu -> kvm -> mmu_lock );
67986791
6799- vmx_flush_tlb_current (vcpu );
6800-
6792+ /*
6793+ * No need for a manual TLB flush at this point, KVM has already done a
6794+ * flush if there were SPTEs pointing at the previous page.
6795+ */
68016796out :
68026797 /*
68036798 * Do not pin apic access page in memory, the MMU notifier
@@ -7243,13 +7238,20 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,
72437238 flags );
72447239
72457240 vcpu -> arch .cr2 = native_read_cr2 ();
7241+ vcpu -> arch .regs_avail &= ~VMX_REGS_LAZY_LOAD_SET ;
7242+
7243+ vmx -> idt_vectoring_info = 0 ;
72467244
72477245 vmx_enable_fb_clear (vmx );
72487246
7249- if (unlikely (vmx -> fail ))
7247+ if (unlikely (vmx -> fail )) {
72507248 vmx -> exit_reason .full = 0xdead ;
7251- else
7252- vmx -> exit_reason .full = vmcs_read32 (VM_EXIT_REASON );
7249+ goto out ;
7250+ }
7251+
7252+ vmx -> exit_reason .full = vmcs_read32 (VM_EXIT_REASON );
7253+ if (likely (!vmx -> exit_reason .failed_vmentry ))
7254+ vmx -> idt_vectoring_info = vmcs_read32 (IDT_VECTORING_INFO_FIELD );
72537255
72547256 if ((u16 )vmx -> exit_reason .basic == EXIT_REASON_EXCEPTION_NMI &&
72557257 is_nmi (vmx_get_intr_info (vcpu ))) {
@@ -7258,6 +7260,7 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,
72587260 kvm_after_interrupt (vcpu );
72597261 }
72607262
7263+ out :
72617264 guest_state_exit_irqoff ();
72627265}
72637266
@@ -7379,8 +7382,6 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
73797382 loadsegment (es , __USER_DS );
73807383#endif
73817384
7382- vcpu -> arch .regs_avail &= ~VMX_REGS_LAZY_LOAD_SET ;
7383-
73847385 pt_guest_exit (vmx );
73857386
73867387 kvm_load_host_xsave_state (vcpu );
@@ -7397,17 +7398,12 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
73977398 vmx -> nested .nested_run_pending = 0 ;
73987399 }
73997400
7400- vmx -> idt_vectoring_info = 0 ;
7401-
74027401 if (unlikely (vmx -> fail ))
74037402 return EXIT_FASTPATH_NONE ;
74047403
74057404 if (unlikely ((u16 )vmx -> exit_reason .basic == EXIT_REASON_MCE_DURING_VMENTRY ))
74067405 kvm_machine_check ();
74077406
7408- if (likely (!vmx -> exit_reason .failed_vmentry ))
7409- vmx -> idt_vectoring_info = vmcs_read32 (IDT_VECTORING_INFO_FIELD );
7410-
74117407 trace_kvm_exit (vcpu , KVM_ISA_VMX );
74127408
74137409 if (unlikely (vmx -> exit_reason .failed_vmentry ))
@@ -8526,7 +8522,7 @@ static __init int hardware_setup(void)
85268522 */
85278523 vmx_setup_me_spte_mask ();
85288524
8529- kvm_configure_mmu (enable_ept , 0 , vmx_get_max_tdp_level (),
8525+ kvm_configure_mmu (enable_ept , 0 , vmx_get_max_ept_level (),
85308526 ept_caps_to_lpage_level (vmx_capability .ept ));
85318527
85328528 /*
0 commit comments