Lines Matching refs:nested

44 		 * TODO: track the cause of the nested page fault, and
61 u64 cr3 = svm->nested.ctl.nested_cr3;
80 return svm->nested.ctl.nested_cr3;
98 svm->nested.ctl.nested_cr3);
119 if (!(svm->nested.ctl.virt_ext & VIRTUAL_VMLOAD_VMSAVE_ENABLE_MASK))
138 g = &svm->nested.ctl;
160 * We want to see VMMCALLs from a nested guest only when Hyper-V L2 TLB
282 nsvm_msrpm_merge_t *msrpm02 = svm->nested.msrpm;
295 if (!svm->nested.force_msr_bitmap_recalc) {
296 struct hv_vmcb_enlightenments *hve = &svm->nested.ctl.hv_enlightenments;
300 (svm->nested.ctl.clean & BIT(HV_VMCB_NESTED_ENLIGHTENMENTS)))
305 if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT)))
313 gpa = svm->nested.ctl.msrpm_base_pa + (p * sizeof(l1_val));
321 svm->nested.force_msr_bitmap_recalc = false;
326 svm->vmcb->control.msrpm_base_pa = __sme_set(__pa(svm->nested.msrpm));
408 struct vmcb_save_area_cached *save = &svm->nested.save;
416 struct vmcb_ctrl_area_cached *ctl = &svm->nested.ctl;
490 __nested_copy_vmcb_control_to_cache(&svm->vcpu, &svm->nested.ctl, control);
512 __nested_copy_vmcb_save_to_cache(&svm->nested.save, save);
522 svm->nested.ctl.event_inj = svm->vmcb->control.event_inj;
523 svm->nested.ctl.event_inj_err = svm->vmcb->control.event_inj_err;
536 !test_bit(INTERCEPT_VINTR, (unsigned long *)svm->nested.ctl.intercepts))
545 svm->nested.ctl.int_ctl &= ~mask;
546 svm->nested.ctl.int_ctl |= svm->vmcb->control.int_ctl & mask;
596 * - Honor L1's request to flush an ASID on nested VMRUN
597 * - Sync nested NPT MMU on VMRUN that flushes L2's ASID[*]
598 * - Don't crush a pending TLB flush in vmcb02 on nested VMRUN
601 * [*] Unlike nested EPT, SVM's ASID management can invalidate nested
609 * Load guest's/host's cr3 on nested vmentry or vmexit. @nested_npt is true
635 if (!svm->nested.vmcb02.ptr)
639 svm->nested.vmcb02.ptr->save.g_pat = svm->vmcb01.ptr->save.g_pat;
646 struct vmcb *vmcb02 = svm->nested.vmcb02.ptr;
652 /* Load the nested guest state */
653 if (svm->nested.vmcb12_gpa != svm->nested.last_vmcb12_gpa) {
655 svm->nested.last_vmcb12_gpa = svm->nested.vmcb12_gpa;
656 svm->nested.force_msr_bitmap_recalc = true;
684 svm_set_efer(vcpu, svm->nested.save.efer);
686 svm_set_cr0(vcpu, svm->nested.save.cr0);
687 svm_set_cr4(vcpu, svm->nested.save.cr4);
701 vmcb02->save.dr7 = svm->nested.save.dr7 | DR7_FIXED_1;
702 svm->vcpu.arch.dr6 = svm->nested.save.dr6 | DR6_ACTIVE_LOW;
707 (svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK))) {
753 struct vmcb *vmcb02 = svm->nested.vmcb02.ptr;
768 (svm->nested.ctl.int_ctl & V_GIF_ENABLE_MASK))
804 * If the RIP hasn't changed, stash the bus lock counter at nested VMRUN
812 if (vmcb02->save.rip && (svm->nested.ctl.bus_lock_rip == vmcb02->save.rip))
828 svm->nested.ctl.tsc_offset,
838 (svm->nested.ctl.int_ctl & int_ctl_vmcb12_bits) |
841 vmcb02->control.int_vector = svm->nested.ctl.int_vector;
842 vmcb02->control.int_state = svm->nested.ctl.int_state;
843 vmcb02->control.event_inj = svm->nested.ctl.event_inj;
844 vmcb02->control.event_inj_err = svm->nested.ctl.event_inj_err;
855 vmcb02->control.next_rip = svm->nested.ctl.next_rip;
865 svm->soft_int_next_rip = svm->nested.ctl.next_rip;
876 pause_count12 = svm->nested.ctl.pause_filter_count;
880 pause_thresh12 = svm->nested.ctl.pause_filter_thresh;
894 if (vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_PAUSE)) {
906 * RAP size. Unconditionally clear the RAP on nested VMRUN, as KVM is
911 vmcb02->control.erap_ctl = (svm->nested.ctl.erap_ctl &
926 * moved at the time of nested vmrun and vmexit.
958 svm->nested.vmcb12_gpa = vmcb12_gpa;
960 WARN_ON(svm->vmcb == svm->nested.vmcb02.ptr);
962 nested_svm_copy_common_state(svm->vmcb01.ptr, svm->nested.vmcb02.ptr);
964 svm_switch_vmcb(svm, &svm->nested.vmcb02);
968 ret = nested_svm_load_cr3(&svm->vcpu, svm->nested.save.cr3,
995 if (!svm->nested.hsave_msr) {
1025 if (WARN_ON_ONCE(!svm->nested.initialized))
1052 svm->nested.nested_run_pending = 1;
1061 svm->nested.nested_run_pending = 0;
1124 struct vmcb *vmcb02 = svm->nested.vmcb02.ptr;
1129 rc = kvm_vcpu_map(vcpu, gpa_to_gfn(svm->nested.vmcb12_gpa), &map);
1140 svm->nested.vmcb12_gpa = 0;
1141 WARN_ON_ONCE(svm->nested.nested_run_pending);
1186 vmcb12->control.int_ctl = svm->nested.ctl.int_ctl;
1187 vmcb12->control.event_inj = svm->nested.ctl.event_inj;
1188 vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err;
1201 svm->nested.ctl.bus_lock_rip = INVALID_GPA;
1203 nested_svm_copy_common_state(svm->nested.vmcb02.ptr, svm->vmcb01.ptr);
1227 * V_GIF: If nested vGIF is not used, KVM uses vmcb02's V_GIF for L1's
1235 (svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK)))
1275 svm->nested.ctl.nested_cr3 = 0;
1339 if (!vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_SHUTDOWN))
1350 if (svm->nested.initialized)
1356 svm->nested.vmcb02.ptr = page_address(vmcb02_page);
1357 svm->nested.vmcb02.pa = __sme_set(page_to_pfn(vmcb02_page) << PAGE_SHIFT);
1359 svm->nested.msrpm = svm_vcpu_alloc_msrpm();
1360 if (!svm->nested.msrpm)
1363 svm->nested.initialized = true;
1373 if (!svm->nested.initialized)
1379 svm_vcpu_free_msrpm(svm->nested.msrpm);
1380 svm->nested.msrpm = NULL;
1382 __free_page(virt_to_page(svm->nested.vmcb02.ptr));
1383 svm->nested.vmcb02.ptr = NULL;
1392 svm->nested.last_vmcb12_gpa = INVALID_GPA;
1394 svm->nested.initialized = false;
1402 svm->nested.nested_run_pending = 0;
1403 svm->nested.vmcb12_gpa = INVALID_GPA;
1423 gpa_t base = svm->nested.ctl.msrpm_base_pa;
1428 if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT)))
1453 if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_IOIO_PROT)))
1459 gpa = svm->nested.ctl.iopm_base_pa + (port / 8);
1495 if (vmcb12_is_intercept(&svm->nested.ctl, exit_code))
1535 return (svm->nested.ctl.intercepts[INTERCEPT_EXCEPTION] & BIT(vector));
1575 return vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_INIT);
1583 * Only a pending nested run blocks a pending exception. If there is a
1587 bool block_nested_exceptions = svm->nested.nested_run_pending;
1760 kvm_state.hdr.svm.vmcb_pa = svm->nested.vmcb12_gpa;
1764 if (svm->nested.nested_run_pending)
1788 nested_copy_vmcb_cache_to_control(ctl, &svm->nested.ctl);
1897 svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save;
1901 svm->nested.nested_run_pending =
1904 svm->nested.vmcb12_gpa = kvm_state->hdr.svm.vmcb_pa;
1909 svm_switch_vmcb(svm, &svm->nested.vmcb02);
1913 * While the nested guest CR3 is already checked and set by
1914 * KVM_SET_SREGS, it was set when nested state was yet loaded,
1923 svm->nested.force_msr_bitmap_recalc = true;
1943 * the guest CR3 might be restored prior to setting the nested