Lines Matching refs:nested
182 if (to_vmx(vcpu)->nested.hv_evmcs_vmptr != EVMPTR_INVALID) in nested_vmx_failValid()
183 to_vmx(vcpu)->nested.need_vmcs12_to_shadow_sync = true; in nested_vmx_failValid()
196 if (vmx->nested.current_vmptr == INVALID_GPA && in nested_vmx_fail()
197 !evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in nested_vmx_fail()
224 vmx->nested.need_vmcs12_to_shadow_sync = false; in vmx_disable_shadow_vmcs()
232 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) { in nested_release_evmcs()
233 kvm_vcpu_unmap(vcpu, &vmx->nested.hv_evmcs_map, true); in nested_release_evmcs()
234 vmx->nested.hv_evmcs = NULL; in nested_release_evmcs()
237 vmx->nested.hv_evmcs_vmptr = EVMPTR_INVALID; in nested_release_evmcs()
240 hv_vcpu->nested.pa_page_gpa = INVALID_GPA; in nested_release_evmcs()
241 hv_vcpu->nested.vm_id = 0; in nested_release_evmcs()
242 hv_vcpu->nested.vp_id = 0; in nested_release_evmcs()
301 if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) in free_nested()
306 vmx->nested.vmxon = false; in free_nested()
307 vmx->nested.smm.vmxon = false; in free_nested()
308 vmx->nested.vmxon_ptr = INVALID_GPA; in free_nested()
309 free_vpid(vmx->nested.vpid02); in free_nested()
310 vmx->nested.posted_intr_nv = -1; in free_nested()
311 vmx->nested.current_vmptr = INVALID_GPA; in free_nested()
318 kfree(vmx->nested.cached_vmcs12); in free_nested()
319 vmx->nested.cached_vmcs12 = NULL; in free_nested()
320 kfree(vmx->nested.cached_shadow_vmcs12); in free_nested()
321 vmx->nested.cached_shadow_vmcs12 = NULL; in free_nested()
327 kvm_vcpu_unmap(vcpu, &vmx->nested.apic_access_page_map, false); in free_nested()
328 kvm_vcpu_unmap(vcpu, &vmx->nested.virtual_apic_map, true); in free_nested()
329 kvm_vcpu_unmap(vcpu, &vmx->nested.pi_desc_map, true); in free_nested()
330 vmx->nested.pi_desc = NULL; in free_nested()
336 free_loaded_vmcs(&vmx->nested.vmcs02); in free_nested()
386 if (vmx->nested.pml_full) { in nested_ept_inject_page_fault()
388 vmx->nested.pml_full = false; in nested_ept_inject_page_fault()
414 bool execonly = vmx->nested.msrs.ept_caps & VMX_EPT_EXECUTE_ONLY_BIT; in nested_ept_new_eptp()
415 int ept_lpage_level = ept_caps_to_lpage_level(vmx->nested.msrs.ept_caps); in nested_ept_new_eptp()
574 unsigned long *msr_bitmap_l0 = vmx->nested.vmcs02.msr_bitmap; in nested_vmx_prepare_msr_bitmap()
575 struct hv_enlightened_vmcs *evmcs = vmx->nested.hv_evmcs; in nested_vmx_prepare_msr_bitmap()
576 struct kvm_host_map *map = &vmx->nested.msr_bitmap_map; in nested_vmx_prepare_msr_bitmap()
591 if (!vmx->nested.force_msr_bitmap_recalc && evmcs && in nested_vmx_prepare_msr_bitmap()
663 kvm_vcpu_unmap(vcpu, &vmx->nested.msr_bitmap_map, false); in nested_vmx_prepare_msr_bitmap()
665 vmx->nested.force_msr_bitmap_recalc = false; in nested_vmx_prepare_msr_bitmap()
674 struct gfn_to_hva_cache *ghc = &vmx->nested.shadow_vmcs12_cache; in nested_cache_shadow_vmcs12()
693 struct gfn_to_hva_cache *ghc = &vmx->nested.shadow_vmcs12_cache; in nested_flush_cached_shadow_vmcs12()
892 u64 vmx_misc = vmx_control_msr(vmx->nested.msrs.misc_low, in nested_vmx_max_atomic_switch_msrs()
893 vmx->nested.msrs.misc_high); in nested_vmx_max_atomic_switch_msrs()
1133 (nested_cpu_has_vpid(vmcs12) && to_vmx(vcpu)->nested.vpid02); in nested_has_guest_tlb_tag()
1180 if (is_vmenter && vmcs12->virtual_processor_id != vmx->nested.last_vpid) { in nested_vmx_transition_tlb_flush()
1181 vmx->nested.last_vpid = vmcs12->virtual_processor_id; in nested_vmx_transition_tlb_flush()
1211 u64 vmx_basic = vmcs_config.nested.basic; in vmx_restore_vmx_basic()
1230 vmx->nested.msrs.basic = data; in vmx_restore_vmx_basic()
1269 vmx_get_control_msr(&vmcs_config.nested, msr_index, &lowp, &highp); in vmx_restore_control_msr()
1281 vmx_get_control_msr(&vmx->nested.msrs, msr_index, &lowp, &highp); in vmx_restore_control_msr()
1295 u64 vmx_misc = vmx_control_msr(vmcs_config.nested.misc_low, in vmx_restore_vmx_misc()
1296 vmcs_config.nested.misc_high); in vmx_restore_vmx_misc()
1301 if ((vmx->nested.msrs.pinbased_ctls_high & in vmx_restore_vmx_misc()
1316 vmx->nested.msrs.misc_low = data; in vmx_restore_vmx_misc()
1317 vmx->nested.msrs.misc_high = data >> 32; in vmx_restore_vmx_misc()
1324 u64 vmx_ept_vpid_cap = vmx_control_msr(vmcs_config.nested.ept_caps, in vmx_restore_vmx_ept_vpid_cap()
1325 vmcs_config.nested.vpid_caps); in vmx_restore_vmx_ept_vpid_cap()
1331 vmx->nested.msrs.ept_caps = data; in vmx_restore_vmx_ept_vpid_cap()
1332 vmx->nested.msrs.vpid_caps = data >> 32; in vmx_restore_vmx_ept_vpid_cap()
1350 const u64 *msr = vmx_get_fixed0_msr(&vmcs_config.nested, msr_index); in vmx_restore_fixed0_msr()
1359 *vmx_get_fixed0_msr(&vmx->nested.msrs, msr_index) = data; in vmx_restore_fixed0_msr()
1376 if (vmx->nested.vmxon) in vmx_set_vmx_msr()
1417 vmx->nested.msrs.vmcs_enum = data; in vmx_set_vmx_msr()
1420 if (data & ~vmcs_config.nested.vmfunc_controls) in vmx_set_vmx_msr()
1422 vmx->nested.msrs.vmfunc_controls = data; in vmx_set_vmx_msr()
1581 struct vmcs12 *vmcs12 = vmx->nested.cached_vmcs12; in copy_enlightened_to_vmcs12()
1582 struct hv_enlightened_vmcs *evmcs = vmx->nested.hv_evmcs; in copy_enlightened_to_vmcs12()
1591 hv_vcpu->nested.pa_page_gpa = evmcs->partition_assist_page; in copy_enlightened_to_vmcs12()
1592 hv_vcpu->nested.vm_id = evmcs->hv_vm_id; in copy_enlightened_to_vmcs12()
1593 hv_vcpu->nested.vp_id = evmcs->hv_vp_id; in copy_enlightened_to_vmcs12()
1825 struct vmcs12 *vmcs12 = vmx->nested.cached_vmcs12; in copy_vmcs12_to_enlightened()
1826 struct hv_enlightened_vmcs *evmcs = vmx->nested.hv_evmcs; in copy_vmcs12_to_enlightened()
2017 if (unlikely(evmcs_gpa != vmx->nested.hv_evmcs_vmptr)) { in nested_vmx_handle_enlightened_vmptrld()
2018 vmx->nested.current_vmptr = INVALID_GPA; in nested_vmx_handle_enlightened_vmptrld()
2023 &vmx->nested.hv_evmcs_map)) in nested_vmx_handle_enlightened_vmptrld()
2026 vmx->nested.hv_evmcs = vmx->nested.hv_evmcs_map.hva; in nested_vmx_handle_enlightened_vmptrld()
2050 if ((vmx->nested.hv_evmcs->revision_id != KVM_EVMCS_VERSION) && in nested_vmx_handle_enlightened_vmptrld()
2051 (vmx->nested.hv_evmcs->revision_id != VMCS12_REVISION)) { in nested_vmx_handle_enlightened_vmptrld()
2056 vmx->nested.hv_evmcs_vmptr = evmcs_gpa; in nested_vmx_handle_enlightened_vmptrld()
2078 vmx->nested.hv_evmcs->hv_clean_fields &= in nested_vmx_handle_enlightened_vmptrld()
2081 vmx->nested.force_msr_bitmap_recalc = true; in nested_vmx_handle_enlightened_vmptrld()
2091 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in nested_sync_vmcs12_to_shadow()
2096 vmx->nested.need_vmcs12_to_shadow_sync = false; in nested_sync_vmcs12_to_shadow()
2102 container_of(timer, struct vcpu_vmx, nested.preemption_timer); in vmx_preemption_timer_fn()
2104 vmx->nested.preemption_timer_expired = true; in vmx_preemption_timer_fn()
2119 if (!vmx->nested.has_preemption_timer_deadline) { in vmx_calc_preemption_timer_value()
2120 vmx->nested.preemption_timer_deadline = in vmx_calc_preemption_timer_value()
2122 vmx->nested.has_preemption_timer_deadline = true; in vmx_calc_preemption_timer_value()
2124 return vmx->nested.preemption_timer_deadline - l1_scaled_tsc; in vmx_calc_preemption_timer_value()
2137 vmx_preemption_timer_fn(&vmx->nested.preemption_timer); in vmx_start_preemption_timer()
2147 hrtimer_start(&vmx->nested.preemption_timer, in vmx_start_preemption_timer()
2154 if (vmx->nested.nested_run_pending && in nested_vmx_calc_efer()
2173 if (vmx->nested.vmcs02_initialized) in prepare_vmcs02_constant_state()
2175 vmx->nested.vmcs02_initialized = true; in prepare_vmcs02_constant_state()
2194 vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap)); in prepare_vmcs02_constant_state()
2232 if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02) in prepare_vmcs02_early_rare()
2233 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02); in prepare_vmcs02_early_rare()
2245 if (vmx->nested.dirty_vmcs12 || evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in prepare_vmcs02_early()
2256 vmx->nested.pi_pending = false; in prepare_vmcs02_early()
2258 vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv; in prepare_vmcs02_early()
2272 vmx->nested.l1_tpr_threshold = -1; in prepare_vmcs02_early()
2388 if (vmx->nested.nested_run_pending) { in prepare_vmcs02_early()
2406 struct hv_enlightened_vmcs *hv_evmcs = vmx->nested.hv_evmcs; in prepare_vmcs02_rare()
2469 if (kvm_mpx_supported() && vmx->nested.nested_run_pending && in prepare_vmcs02_rare()
2540 if (vmx->nested.dirty_vmcs12 || evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) { in prepare_vmcs02()
2542 vmx->nested.dirty_vmcs12 = false; in prepare_vmcs02()
2544 load_guest_pdptrs_vmcs12 = !evmptr_is_valid(vmx->nested.hv_evmcs_vmptr) || in prepare_vmcs02()
2545 !(vmx->nested.hv_evmcs->hv_clean_fields & in prepare_vmcs02()
2549 if (vmx->nested.nested_run_pending && in prepare_vmcs02()
2555 vmcs_write64(GUEST_IA32_DEBUGCTL, vmx->nested.pre_vmenter_debugctl); in prepare_vmcs02()
2557 if (kvm_mpx_supported() && (!vmx->nested.nested_run_pending || in prepare_vmcs02()
2559 vmcs_write64(GUEST_BNDCFGS, vmx->nested.pre_vmenter_bndcfgs); in prepare_vmcs02()
2570 if (vmx->nested.nested_run_pending && in prepare_vmcs02()
2667 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in prepare_vmcs02()
2668 vmx->nested.hv_evmcs->hv_clean_fields |= in prepare_vmcs02()
2694 if (CC(!(vmx->nested.msrs.ept_caps & VMX_EPTP_UC_BIT))) in nested_vmx_check_eptp()
2698 if (CC(!(vmx->nested.msrs.ept_caps & VMX_EPTP_WB_BIT))) in nested_vmx_check_eptp()
2708 if (CC(!(vmx->nested.msrs.ept_caps & VMX_EPT_PAGE_WALK_5_BIT))) in nested_vmx_check_eptp()
2712 if (CC(!(vmx->nested.msrs.ept_caps & VMX_EPT_PAGE_WALK_4_BIT))) in nested_vmx_check_eptp()
2725 if (CC(!(vmx->nested.msrs.ept_caps & VMX_EPT_AD_BIT))) in nested_vmx_check_eptp()
2741 vmx->nested.msrs.pinbased_ctls_low, in nested_check_vm_execution_controls()
2742 vmx->nested.msrs.pinbased_ctls_high)) || in nested_check_vm_execution_controls()
2744 vmx->nested.msrs.procbased_ctls_low, in nested_check_vm_execution_controls()
2745 vmx->nested.msrs.procbased_ctls_high))) in nested_check_vm_execution_controls()
2750 vmx->nested.msrs.secondary_ctls_low, in nested_check_vm_execution_controls()
2751 vmx->nested.msrs.secondary_ctls_high))) in nested_check_vm_execution_controls()
2778 ~vmx->nested.msrs.vmfunc_controls)) in nested_check_vm_execution_controls()
2800 vmx->nested.msrs.exit_ctls_low, in nested_check_vm_exit_controls()
2801 vmx->nested.msrs.exit_ctls_high)) || in nested_check_vm_exit_controls()
2817 vmx->nested.msrs.entry_ctls_low, in nested_check_vm_entry_controls()
2818 vmx->nested.msrs.entry_ctls_high))) in nested_check_vm_entry_controls()
2981 struct gfn_to_hva_cache *ghc = &vmx->nested.shadow_vmcs12_cache; in nested_vmx_check_vmcs_link_ptr()
3066 if (to_vmx(vcpu)->nested.nested_run_pending && in nested_vmx_check_guest_state()
3174 vmx->nested.hv_evmcs_vmptr == EVMPTR_MAP_PENDING) { in nested_get_evmcs_page()
3186 vmx->nested.need_vmcs12_to_shadow_sync = true; in nested_get_evmcs_page()
3211 map = &vmx->nested.apic_access_page_map; in nested_get_vmcs12_pages()
3227 map = &vmx->nested.virtual_apic_map; in nested_get_vmcs12_pages()
3253 map = &vmx->nested.pi_desc_map; in nested_get_vmcs12_pages()
3256 vmx->nested.pi_desc = in nested_get_vmcs12_pages()
3268 vmx->nested.pi_desc = NULL; in nested_get_vmcs12_pages()
3314 if (WARN_ON_ONCE(vmx->nested.pml_full)) in nested_vmx_write_pml_buffer()
3326 vmx->nested.pml_full = true; in nested_vmx_write_pml_buffer()
3351 if (!to_vmx(vcpu)->nested.vmxon) { in nested_vmx_check_permission()
3399 vmx->nested.current_vmptr, in nested_vmx_enter_non_root_mode()
3417 if (!vmx->nested.nested_run_pending || in nested_vmx_enter_non_root_mode()
3419 vmx->nested.pre_vmenter_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); in nested_vmx_enter_non_root_mode()
3421 (!vmx->nested.nested_run_pending || in nested_vmx_enter_non_root_mode()
3423 vmx->nested.pre_vmenter_bndcfgs = vmcs_read64(GUEST_BNDCFGS); in nested_vmx_enter_non_root_mode()
3444 vmx_switch_vmcs(vcpu, &vmx->nested.vmcs02); in nested_vmx_enter_non_root_mode()
3509 vmx->nested.preemption_timer_expired = false; in nested_vmx_enter_non_root_mode()
3541 if (enable_shadow_vmcs || evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in nested_vmx_enter_non_root_mode()
3542 vmx->nested.need_vmcs12_to_shadow_sync = true; in nested_vmx_enter_non_root_mode()
3572 if (CC(!evmptr_is_valid(vmx->nested.hv_evmcs_vmptr) && in nested_vmx_run()
3573 vmx->nested.current_vmptr == INVALID_GPA)) in nested_vmx_run()
3587 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) { in nested_vmx_run()
3588 copy_enlightened_to_vmcs12(vmx, vmx->nested.hv_evmcs->hv_clean_fields); in nested_vmx_run()
3626 vmx->nested.nested_run_pending = 1; in nested_vmx_run()
3627 vmx->nested.has_preemption_timer_deadline = false; in nested_vmx_run()
3634 kvm_apic_has_interrupt(vcpu) == vmx->nested.posted_intr_nv) { in nested_vmx_run()
3635 vmx->nested.pi_pending = true; in nested_vmx_run()
3637 kvm_apic_clear_irr(vcpu, vmx->nested.posted_intr_nv); in nested_vmx_run()
3666 vmx->nested.nested_run_pending = 0; in nested_vmx_run()
3671 vmx->nested.nested_run_pending = 0; in nested_vmx_run()
3681 vmx->nested.nested_run_pending = 0; in nested_vmx_run()
3822 if (!vmx->nested.pi_pending) in vmx_complete_nested_posted_interrupt()
3825 if (!vmx->nested.pi_desc) in vmx_complete_nested_posted_interrupt()
3828 vmx->nested.pi_pending = false; in vmx_complete_nested_posted_interrupt()
3830 if (!pi_test_and_clear_on(vmx->nested.pi_desc)) in vmx_complete_nested_posted_interrupt()
3833 max_irr = find_last_bit((unsigned long *)vmx->nested.pi_desc->pir, 256); in vmx_complete_nested_posted_interrupt()
3835 vapic_page = vmx->nested.virtual_apic_map.hva; in vmx_complete_nested_posted_interrupt()
3839 __kvm_apic_update_irr(vmx->nested.pi_desc->pir, in vmx_complete_nested_posted_interrupt()
3962 to_vmx(vcpu)->nested.preemption_timer_expired; in nested_vmx_preemption_timer_pending()
3968 to_vmx(vcpu)->nested.mtf_pending; in vmx_has_nested_events()
4063 bool block_nested_exceptions = vmx->nested.nested_run_pending; in vmx_check_nested_events()
4083 vmx->nested.mtf_pending = false; in vmx_check_nested_events()
4127 if (vmx->nested.mtf_pending) { in vmx_check_nested_events()
4196 hrtimer_get_remaining(&to_vmx(vcpu)->nested.preemption_timer); in vmx_get_preemption_timer_value()
4296 vmx->nested.need_sync_vmcs02_to_vmcs12_rare = false; in sync_vmcs02_to_vmcs12_rare()
4305 if (!vmx->nested.need_sync_vmcs02_to_vmcs12_rare) in copy_vmcs02_to_vmcs12_rare()
4312 vmx->loaded_vmcs = &vmx->nested.vmcs02; in copy_vmcs02_to_vmcs12_rare()
4318 vmx_vcpu_load_vmcs(vcpu, cpu, &vmx->nested.vmcs02); in copy_vmcs02_to_vmcs12_rare()
4332 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in sync_vmcs02_to_vmcs12()
4335 vmx->nested.need_sync_vmcs02_to_vmcs12_rare = in sync_vmcs02_to_vmcs12()
4336 !evmptr_is_valid(vmx->nested.hv_evmcs_vmptr); in sync_vmcs02_to_vmcs12()
4360 !vmx->nested.nested_run_pending) in sync_vmcs02_to_vmcs12()
4730 vmx->nested.mtf_pending = false; in nested_vmx_vmexit()
4733 WARN_ON_ONCE(vmx->nested.nested_run_pending); in nested_vmx_vmexit()
4759 hrtimer_cancel(&to_vmx(vcpu)->nested.preemption_timer); in nested_vmx_vmexit()
4827 if (vmx->nested.l1_tpr_threshold != -1) in nested_vmx_vmexit()
4828 vmcs_write32(TPR_THRESHOLD, vmx->nested.l1_tpr_threshold); in nested_vmx_vmexit()
4830 if (vmx->nested.change_vmcs01_virtual_apic_mode) { in nested_vmx_vmexit()
4831 vmx->nested.change_vmcs01_virtual_apic_mode = false; in nested_vmx_vmexit()
4835 if (vmx->nested.update_vmcs01_cpu_dirty_logging) { in nested_vmx_vmexit()
4836 vmx->nested.update_vmcs01_cpu_dirty_logging = false; in nested_vmx_vmexit()
4841 kvm_vcpu_unmap(vcpu, &vmx->nested.apic_access_page_map, false); in nested_vmx_vmexit()
4842 kvm_vcpu_unmap(vcpu, &vmx->nested.virtual_apic_map, true); in nested_vmx_vmexit()
4843 kvm_vcpu_unmap(vcpu, &vmx->nested.pi_desc_map, true); in nested_vmx_vmexit()
4844 vmx->nested.pi_desc = NULL; in nested_vmx_vmexit()
4846 if (vmx->nested.reload_vmcs01_apic_access_page) { in nested_vmx_vmexit()
4847 vmx->nested.reload_vmcs01_apic_access_page = false; in nested_vmx_vmexit()
4851 if (vmx->nested.update_vmcs01_apicv_status) { in nested_vmx_vmexit()
4852 vmx->nested.update_vmcs01_apicv_status = false; in nested_vmx_vmexit()
4857 (enable_shadow_vmcs || evmptr_is_valid(vmx->nested.hv_evmcs_vmptr))) in nested_vmx_vmexit()
4858 vmx->nested.need_vmcs12_to_shadow_sync = true; in nested_vmx_vmexit()
5097 r = alloc_loaded_vmcs(&vmx->nested.vmcs02); in enter_vmx_operation()
5101 vmx->nested.cached_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL_ACCOUNT); in enter_vmx_operation()
5102 if (!vmx->nested.cached_vmcs12) in enter_vmx_operation()
5105 vmx->nested.shadow_vmcs12_cache.gpa = INVALID_GPA; in enter_vmx_operation()
5106 vmx->nested.cached_shadow_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL_ACCOUNT); in enter_vmx_operation()
5107 if (!vmx->nested.cached_shadow_vmcs12) in enter_vmx_operation()
5113 hrtimer_init(&vmx->nested.preemption_timer, CLOCK_MONOTONIC, in enter_vmx_operation()
5115 vmx->nested.preemption_timer.function = vmx_preemption_timer_fn; in enter_vmx_operation()
5117 vmx->nested.vpid02 = allocate_vpid(); in enter_vmx_operation()
5119 vmx->nested.vmcs02_initialized = false; in enter_vmx_operation()
5120 vmx->nested.vmxon = true; in enter_vmx_operation()
5130 kfree(vmx->nested.cached_shadow_vmcs12); in enter_vmx_operation()
5133 kfree(vmx->nested.cached_vmcs12); in enter_vmx_operation()
5136 free_loaded_vmcs(&vmx->nested.vmcs02); in enter_vmx_operation()
5188 if (vmx->nested.vmxon) in handle_vmxon()
5226 vmx->nested.vmxon_ptr = vmptr; in handle_vmxon()
5238 if (vmx->nested.current_vmptr == INVALID_GPA) in nested_release_vmcs12()
5249 vmx->nested.posted_intr_nv = -1; in nested_release_vmcs12()
5253 vmx->nested.current_vmptr >> PAGE_SHIFT, in nested_release_vmcs12()
5254 vmx->nested.cached_vmcs12, 0, VMCS12_SIZE); in nested_release_vmcs12()
5258 vmx->nested.current_vmptr = INVALID_GPA; in nested_release_vmcs12()
5292 if (vmptr == vmx->nested.vmxon_ptr) in handle_vmclear()
5307 if (vmptr == vmx->nested.current_vmptr) in handle_vmclear()
5323 } else if (vmx->nested.hv_evmcs && vmptr == vmx->nested.hv_evmcs_vmptr) { in handle_vmclear()
5363 if (!evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) { in handle_vmread()
5368 if (vmx->nested.current_vmptr == INVALID_GPA || in handle_vmread()
5401 value = evmcs_read_any(vmx->nested.hv_evmcs, field, offset); in handle_vmread()
5478 if (vmx->nested.current_vmptr == INVALID_GPA || in handle_vmwrite()
5550 vmx->nested.dirty_vmcs12 = true; in handle_vmwrite()
5558 vmx->nested.current_vmptr = vmptr; in set_current_vmptr()
5563 vmx->nested.need_vmcs12_to_shadow_sync = true; in set_current_vmptr()
5565 vmx->nested.dirty_vmcs12 = true; in set_current_vmptr()
5566 vmx->nested.force_msr_bitmap_recalc = true; in set_current_vmptr()
5585 if (vmptr == vmx->nested.vmxon_ptr) in handle_vmptrld()
5589 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in handle_vmptrld()
5592 if (vmx->nested.current_vmptr != vmptr) { in handle_vmptrld()
5593 struct gfn_to_hva_cache *ghc = &vmx->nested.vmcs12_cache; in handle_vmptrld()
5627 if (kvm_read_guest_cached(vcpu->kvm, ghc, vmx->nested.cached_vmcs12, in handle_vmptrld()
5644 gpa_t current_vmptr = to_vmx(vcpu)->nested.current_vmptr; in handle_vmptrst()
5652 if (unlikely(evmptr_is_valid(to_vmx(vcpu)->nested.hv_evmcs_vmptr))) in handle_vmptrst()
5681 if (!(vmx->nested.msrs.secondary_ctls_high & in handle_invept()
5683 !(vmx->nested.msrs.ept_caps & VMX_EPT_INVEPT_BIT)) { in handle_invept()
5695 types = (vmx->nested.msrs.ept_caps >> VMX_EPT_EXTENT_SHIFT) & 6; in handle_invept()
5762 if (!(vmx->nested.msrs.secondary_ctls_high & in handle_invvpid()
5764 !(vmx->nested.msrs.vpid_caps & VMX_VPID_INVVPID_BIT)) { in handle_invvpid()
5776 types = (vmx->nested.msrs.vpid_caps & in handle_invvpid()
6360 WARN_ON_ONCE(vmx->nested.nested_run_pending); in nested_vmx_reflect_vmexit()
6430 (vmx->nested.vmxon || vmx->nested.smm.vmxon)) { in vmx_get_nested_state()
6431 kvm_state.hdr.vmx.vmxon_pa = vmx->nested.vmxon_ptr; in vmx_get_nested_state()
6432 kvm_state.hdr.vmx.vmcs12_pa = vmx->nested.current_vmptr; in vmx_get_nested_state()
6438 if (vmx->nested.hv_evmcs_vmptr != EVMPTR_INVALID) in vmx_get_nested_state()
6447 if (vmx->nested.smm.vmxon) in vmx_get_nested_state()
6450 if (vmx->nested.smm.guest_mode) in vmx_get_nested_state()
6456 if (vmx->nested.nested_run_pending) in vmx_get_nested_state()
6459 if (vmx->nested.mtf_pending) in vmx_get_nested_state()
6463 vmx->nested.has_preemption_timer_deadline) { in vmx_get_nested_state()
6467 vmx->nested.preemption_timer_deadline; in vmx_get_nested_state()
6493 if (!vmx->nested.need_vmcs12_to_shadow_sync) { in vmx_get_nested_state()
6494 if (evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) in vmx_get_nested_state()
6531 to_vmx(vcpu)->nested.nested_run_pending = 0; in vmx_leave_nested()
6605 !vmx->nested.enlightened_vmcs_enabled)) in vmx_set_nested_state()
6613 vmx->nested.vmxon_ptr = kvm_state->hdr.vmx.vmxon_pa; in vmx_set_nested_state()
6642 vmx->nested.hv_evmcs_vmptr = EVMPTR_MAP_PENDING; in vmx_set_nested_state()
6649 vmx->nested.smm.vmxon = true; in vmx_set_nested_state()
6650 vmx->nested.vmxon = false; in vmx_set_nested_state()
6653 vmx->nested.smm.guest_mode = true; in vmx_set_nested_state()
6666 vmx->nested.nested_run_pending = in vmx_set_nested_state()
6669 vmx->nested.mtf_pending = in vmx_set_nested_state()
6694 vmx->nested.has_preemption_timer_deadline = false; in vmx_set_nested_state()
6696 vmx->nested.has_preemption_timer_deadline = true; in vmx_set_nested_state()
6697 vmx->nested.preemption_timer_deadline = in vmx_set_nested_state()
6706 vmx->nested.dirty_vmcs12 = true; in vmx_set_nested_state()
6707 vmx->nested.force_msr_bitmap_recalc = true; in vmx_set_nested_state()
6712 if (vmx->nested.mtf_pending) in vmx_set_nested_state()
6718 vmx->nested.nested_run_pending = 0; in vmx_set_nested_state()
7005 struct nested_vmx_msrs *msrs = &vmcs_conf->nested; in nested_vmx_setup_ctls_msrs()