Lines Matching refs:nested
61 if (vmcb_is_intercept(&svm->nested.ctl, INTERCEPT_EXCEPTION_OFFSET + PF_VECTOR) && in svm_inject_page_fault_nested()
62 !svm->nested.nested_run_pending) { in svm_inject_page_fault_nested()
76 u64 cr3 = svm->nested.ctl.nested_cr3; in nested_svm_get_tdp_pdptr()
91 return svm->nested.ctl.nested_cr3; in nested_svm_get_tdp_cr3()
109 svm->nested.ctl.nested_cr3); in nested_svm_init_mmu_context()
134 g = &svm->nested.ctl; in recalc_intercepts()
206 if (!(vmcb_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT))) in nested_svm_vmrun_msrpm()
217 offset = svm->nested.ctl.msrpm_base_pa + (p * 4); in nested_svm_vmrun_msrpm()
222 svm->nested.msrpm[p] = svm->msrpm[p] | value; in nested_svm_vmrun_msrpm()
225 svm->vmcb->control.msrpm_base_pa = __sme_set(__pa(svm->nested.msrpm)); in nested_svm_vmrun_msrpm()
318 copy_vmcb_control_area(&svm->nested.ctl, control); in nested_load_control_from_vmcb12()
321 svm->nested.ctl.asid = control->asid; in nested_load_control_from_vmcb12()
322 svm->nested.ctl.msrpm_base_pa &= ~0x0fffULL; in nested_load_control_from_vmcb12()
323 svm->nested.ctl.iopm_base_pa &= ~0x0fffULL; in nested_load_control_from_vmcb12()
333 svm->nested.ctl.event_inj = svm->vmcb->control.event_inj; in nested_sync_control_from_vmcb02()
334 svm->nested.ctl.event_inj_err = svm->vmcb->control.event_inj_err; in nested_sync_control_from_vmcb02()
338 if (!(svm->nested.ctl.int_ctl & V_INTR_MASKING_MASK) && in nested_sync_control_from_vmcb02()
350 svm->nested.ctl.int_ctl &= ~mask; in nested_sync_control_from_vmcb02()
351 svm->nested.ctl.int_ctl |= svm->vmcb->control.int_ctl & mask; in nested_sync_control_from_vmcb02()
393 return svm->nested.ctl.nested_ctl & SVM_NESTED_CTL_NP_ENABLE; in nested_npt_enabled()
443 if (!svm->nested.vmcb02.ptr) in nested_vmcb02_compute_g_pat()
447 svm->nested.vmcb02.ptr->save.g_pat = svm->vmcb01.ptr->save.g_pat; in nested_vmcb02_compute_g_pat()
457 if (svm->nested.vmcb12_gpa != svm->nested.last_vmcb12_gpa) { in nested_vmcb02_prepare_save()
459 svm->nested.last_vmcb12_gpa = svm->nested.vmcb12_gpa; in nested_vmcb02_prepare_save()
543 vcpu->arch.l1_tsc_offset + svm->nested.ctl.tsc_offset; in nested_vmcb02_prepare_control()
546 (svm->nested.ctl.int_ctl & int_ctl_vmcb12_bits) | in nested_vmcb02_prepare_control()
549 svm->vmcb->control.int_vector = svm->nested.ctl.int_vector; in nested_vmcb02_prepare_control()
550 svm->vmcb->control.int_state = svm->nested.ctl.int_state; in nested_vmcb02_prepare_control()
551 svm->vmcb->control.event_inj = svm->nested.ctl.event_inj; in nested_vmcb02_prepare_control()
552 svm->vmcb->control.event_inj_err = svm->nested.ctl.event_inj_err; in nested_vmcb02_prepare_control()
554 svm->vmcb->control.pause_filter_count = svm->nested.ctl.pause_filter_count; in nested_vmcb02_prepare_control()
555 svm->vmcb->control.pause_filter_thresh = svm->nested.ctl.pause_filter_thresh; in nested_vmcb02_prepare_control()
601 svm->nested.vmcb12_gpa = vmcb12_gpa; in enter_svm_guest_mode()
603 WARN_ON(svm->vmcb == svm->nested.vmcb02.ptr); in enter_svm_guest_mode()
605 nested_svm_copy_common_state(svm->vmcb01.ptr, svm->nested.vmcb02.ptr); in enter_svm_guest_mode()
607 svm_switch_vmcb(svm, &svm->nested.vmcb02); in enter_svm_guest_mode()
635 if (!svm->nested.hsave_msr) { in nested_svm_vmrun()
658 if (WARN_ON_ONCE(!svm->nested.initialized)) in nested_svm_vmrun()
664 !nested_vmcb_check_controls(vcpu, &svm->nested.ctl)) { in nested_svm_vmrun()
685 svm->nested.nested_run_pending = 1; in nested_svm_vmrun()
694 svm->nested.nested_run_pending = 0; in nested_svm_vmrun()
754 rc = kvm_vcpu_map(vcpu, gpa_to_gfn(svm->nested.vmcb12_gpa), &map); in nested_svm_vmexit()
765 svm->nested.vmcb12_gpa = 0; in nested_svm_vmexit()
766 WARN_ON_ONCE(svm->nested.nested_run_pending); in nested_svm_vmexit()
806 vmcb12->control.int_ctl = svm->nested.ctl.int_ctl; in nested_svm_vmexit()
807 vmcb12->control.tlb_ctl = svm->nested.ctl.tlb_ctl; in nested_svm_vmexit()
808 vmcb12->control.event_inj = svm->nested.ctl.event_inj; in nested_svm_vmexit()
809 vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err; in nested_svm_vmexit()
816 nested_svm_copy_common_state(svm->nested.vmcb02.ptr, svm->vmcb01.ptr); in nested_svm_vmexit()
833 svm->nested.ctl.nested_cr3 = 0; in nested_svm_vmexit()
895 if (svm->nested.initialized) in svm_allocate_nested()
901 svm->nested.vmcb02.ptr = page_address(vmcb02_page); in svm_allocate_nested()
902 svm->nested.vmcb02.pa = __sme_set(page_to_pfn(vmcb02_page) << PAGE_SHIFT); in svm_allocate_nested()
904 svm->nested.msrpm = svm_vcpu_alloc_msrpm(); in svm_allocate_nested()
905 if (!svm->nested.msrpm) in svm_allocate_nested()
907 svm_vcpu_init_msrpm(&svm->vcpu, svm->nested.msrpm); in svm_allocate_nested()
909 svm->nested.initialized = true; in svm_allocate_nested()
919 if (!svm->nested.initialized) in svm_free_nested()
925 svm_vcpu_free_msrpm(svm->nested.msrpm); in svm_free_nested()
926 svm->nested.msrpm = NULL; in svm_free_nested()
928 __free_page(virt_to_page(svm->nested.vmcb02.ptr)); in svm_free_nested()
929 svm->nested.vmcb02.ptr = NULL; in svm_free_nested()
938 svm->nested.last_vmcb12_gpa = INVALID_GPA; in svm_free_nested()
940 svm->nested.initialized = false; in svm_free_nested()
948 svm->nested.nested_run_pending = 0; in svm_leave_nested()
949 svm->nested.vmcb12_gpa = INVALID_GPA; in svm_leave_nested()
967 if (!(vmcb_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT))) in nested_svm_exit_handled_msr()
981 if (kvm_vcpu_read_guest(&svm->vcpu, svm->nested.ctl.msrpm_base_pa + offset, &value, 4)) in nested_svm_exit_handled_msr()
994 if (!(vmcb_is_intercept(&svm->nested.ctl, INTERCEPT_IOIO_PROT))) in nested_svm_intercept_ioio()
1000 gpa = svm->nested.ctl.iopm_base_pa + (port / 8); in nested_svm_intercept_ioio()
1025 if (vmcb_is_intercept(&svm->nested.ctl, exit_code)) in nested_svm_intercept()
1030 if (vmcb_is_intercept(&svm->nested.ctl, exit_code)) in nested_svm_intercept()
1048 if (vmcb_is_intercept(&svm->nested.ctl, exit_code)) in nested_svm_intercept()
1087 return (svm->nested.ctl.intercepts[INTERCEPT_EXCEPTION] & BIT(nr)); in nested_exit_on_exception()
1126 return vmcb_is_intercept(&svm->nested.ctl, INTERCEPT_INIT); in nested_exit_on_init()
1133 kvm_event_needs_reinjection(vcpu) || svm->nested.nested_run_pending; in svm_check_nested_events()
1153 if (svm->nested.nested_run_pending) in svm_check_nested_events()
1243 kvm_state.hdr.svm.vmcb_pa = svm->nested.vmcb12_gpa; in svm_get_nested_state()
1247 if (svm->nested.nested_run_pending) in svm_get_nested_state()
1266 if (copy_to_user(&user_vmcb->control, &svm->nested.ctl, in svm_get_nested_state()
1369 svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save; in svm_set_nested_state()
1373 svm->nested.nested_run_pending = in svm_set_nested_state()
1376 svm->nested.vmcb12_gpa = kvm_state->hdr.svm.vmcb_pa; in svm_set_nested_state()
1381 svm_switch_vmcb(svm, &svm->nested.vmcb02); in svm_set_nested_state()