Lines Matching +full:io +full:- +full:width

91 #define MASK(_bits) GENMASK_ULL((_bits) - 1, 0)
255 return (f->encoding >> VMCS_FIELD_TYPE_SHIFT) & 0x3; in vmcs_field_type()
273 value |= (f->encoding << 8); in vmcs_field_value()
276 return value & f->mask; in vmcs_field_value()
281 vmcs_write(f->encoding, vmcs_field_value(f, cookie)); in set_vmcs_field()
290 if (f->encoding == VMX_INST_ERROR) { in check_vmcs_field()
291 printf("Skipping volatile field %lx\n", f->encoding); in check_vmcs_field()
295 ret = vmcs_read_safe(f->encoding, &actual); in check_vmcs_field()
302 printf("Skipping read-only field %lx\n", f->encoding); in check_vmcs_field()
307 actual &= f->mask; in check_vmcs_field()
313 f->encoding, (unsigned long) expected, (unsigned long) actual); in check_vmcs_field()
341 u32 idx, width, type, enc; in find_vmcs_max_index() local
346 for (idx = (1 << 9) - 1; idx >= 0; idx--) { in find_vmcs_max_index()
348 /* try all combinations of width and type */ in find_vmcs_max_index()
350 for (width = 0; width < (1 << 2) ; width++) { in find_vmcs_max_index()
353 (width << VMCS_FIELD_WIDTH_SHIFT); in find_vmcs_max_index()
372 vmcs->hdr.revision_id = basic_msr.revision; in test_vmwrite_vmread()
396 * Execute VMREAD/VMWRITE with a not-PRESENT memory operand, and verify in __test_vmread_vmwrite_pf()
433 vmcs->hdr.revision_id = basic_msr.revision; in test_vmread_vmwrite_pf()
438 * Test with two values to candy-stripe the 5 flags stored/loaded by in test_vmread_vmwrite_pf()
459 vmcs->hdr.revision_id = basic_msr.revision; in test_vmcs_high()
485 vmcs[i]->hdr.revision_id = basic_msr.revision; in test_vmcs_lifecycle()
579 if (current->syscall_handler) in syscall_handler()
580 current->syscall_handler(syscall_no); in syscall_handler()
676 if (result->entered) in print_vmentry_failure_info()
679 if (result->vm_fail) { in print_vmentry_failure_info()
680 printf("VM-Fail on %s: ", result->instr); in print_vmentry_failure_info()
681 switch (result->flags & VMX_ENTRY_FLAGS) { in print_vmentry_failure_info()
683 printf("current-VMCS pointer is not valid.\n"); in print_vmentry_failure_info()
690 printf("unexpected flags %lx!\n", result->flags); in print_vmentry_failure_info()
695 printf("VM-Exit failure on %s (reason=%#x, qual=%#lx): ", in print_vmentry_failure_info()
696 result->instr, result->exit_reason.full, qual); in print_vmentry_failure_info()
698 switch (result->exit_reason.basic) { in print_vmentry_failure_info()
706 printf("machine-check event\n"); in print_vmentry_failure_info()
710 result->exit_reason.basic); in print_vmentry_failure_info()
713 if (!result->exit_reason.failed_vmentry) in print_vmentry_failure_info()
716 if (result->exit_reason.full & 0x7fff0000) in print_vmentry_failure_info()
734 vmcs[0]->hdr.revision_id = basic_msr.revision; in test_vmclear_flushing()
762 int width = cpuid_maxphyaddr(); in test_vmclear() local
765 * Note- The tests below do not necessarily have a in test_vmclear()
775 /* gpa bits beyond physical address width are set*/ in test_vmclear()
777 ((u64)1 << (width+1))); in test_vmclear()
779 "test vmclear with vmcs address bits set beyond physical address width"); in test_vmclear()
794 if (current->v2) in guest_main()
797 current->guest_main(); in guest_main()
838 gpa += 1ul << EPT_LEVEL_SHIFT(level - 1); in split_large_ept_entry()
868 for (level = EPT_PAGE_LEVEL; level > pte_level; --level) { in install_ept_entry()
897 /* Map a 1G-size page */
907 /* Map a 2M-size page */
959 for (l = EPT_PAGE_LEVEL; ; --l) { in get_ept_pte()
983 for (l = EPT_PAGE_LEVEL; ; --l) { in clear_ept_ad_pte()
1003 for (l = EPT_PAGE_LEVEL; ; --l) { in clear_ept_ad()
1016 offset_in_page = guest_addr & ((1 << EPT_LEVEL_SHIFT(l)) - 1); in clear_ept_ad()
1033 for (l = EPT_PAGE_LEVEL; ; --l) { in check_ept_ad()
1037 printf("EPT - guest level %d page table is not mapped.\n", l); in check_ept_ad()
1044 report_fail("EPT - guest level %d page table A=%d/D=%d", in check_ept_ad()
1059 report_pass("EPT - guest page table structures A=%d/D=%d", in check_ept_ad()
1064 offset_in_page = guest_addr & ((1 << EPT_LEVEL_SHIFT(l)) - 1); in check_ept_ad()
1068 report_fail("EPT - guest physical address is not mapped"); in check_ept_ad()
1072 "EPT - guest physical address A=%d/D=%d", in check_ept_ad()
1086 for (l = EPT_PAGE_LEVEL; ; --l) { in set_ept_pte()
1099 /* 26.2 CHECKS ON VMX CONTROLS AND HOST-STATE AREA */ in init_vmcs_ctrl()
1102 /* Disable VMEXIT of IO instruction */ in init_vmcs_ctrl()
1115 /* 26.2 CHECKS ON VMX CONTROLS AND HOST-STATE AREA */ in init_vmcs_host()
1237 (*vmcs)->hdr.revision_id = basic_msr.revision; in init_vmcs()
1254 /* DIsable IO instruction VMEXIT now */ in init_vmcs()
1427 * gets to VMXON. nVMX tests are 64-bit only, so CR4.PAE is in test_vmxon_bad_cr()
1484 int width = cpuid_maxphyaddr(); in test_vmxon() local
1503 /* gpa bits beyond physical address width are set*/ in test_vmxon()
1504 vmxon_region = (u64 *)((intptr_t)bsp_vmxon_region | ((u64)1 << (width+1))); in test_vmxon()
1506 report(ret < 0, "test vmxon with bits set beyond physical address width"); in test_vmxon()
1517 /* and finally a valid region, with valid-but-tweaked cr0/cr4 */ in test_vmxon()
1531 int width = cpuid_maxphyaddr(); in test_vmptrld() local
1534 vmcs->hdr.revision_id = basic_msr.revision; in test_vmptrld()
1541 /* gpa bits beyond physical address width are set*/ in test_vmptrld()
1543 ((u64)1 << (width+1))); in test_vmptrld()
1545 "test vmptrld with vmcs address bits set beyond physical address width"); in test_vmptrld()
1554 "test vmptrld with vmxon region vm-instruction error"); in test_vmptrld()
1637 fixed0 = -1ull; in test_vmx_caps()
1734 current->exits++; in exit_handler()
1739 ret = current->exit_handler(exit_reason); in exit_handler()
1746 * Tries to enter the guest, populates @result with VM-Fail, VM-Exit, entered,
1774 : [vm_fail]"+m"(result->vm_fail), in vmx_enter_guest()
1775 [vm_fail_flags]"=m"(result->flags) in vmx_enter_guest()
1781 result->vmlaunch = !launched; in vmx_enter_guest()
1782 result->instr = launched ? "vmresume" : "vmlaunch"; in vmx_enter_guest()
1783 result->exit_reason.full = result->vm_fail ? 0xdead : in vmx_enter_guest()
1785 result->entered = !result->vm_fail && in vmx_enter_guest()
1786 !result->exit_reason.failed_vmentry; in vmx_enter_guest()
1803 } else if (current->entry_failure_handler) { in vmx_run()
1804 ret = current->entry_failure_handler(&result); in vmx_run()
1834 step->func(step->data); in run_teardown_step()
1842 if (test->v2) { in test_run()
1844 if (test->init || test->guest_main || test->exit_handler || in test_run()
1845 test->syscall_handler) { in test_run()
1853 if (test->name == NULL) in test_run()
1854 test->name = "(no name)"; in test_run()
1860 init_vmcs(&(test->vmcs)); in test_run()
1861 /* Directly call test->init is ok here, init_vmcs has done in test_run()
1863 if (test->init && test->init(test->vmcs) != VMX_TEST_START) in test_run()
1867 test->exits = 0; in test_run()
1869 regs = test->guest_regs; in test_run()
1873 printf("\nTest suite: %s\n", test->name); in test_run()
1882 if (test->v2) in test_run()
1883 test->v2(); in test_run()
1888 run_teardown_step(&teardown_steps[--teardown_count]); in test_run()
1913 step->func = func; in test_add_teardown()
1914 step->data = data; in test_add_teardown()
1919 assert(current->v2); in __test_set_guest()
1986 if (result->vm_fail) { in __enter_guest()
1991 if (result->exit_reason.failed_vmentry) { in __enter_guest()
1993 result->exit_reason.basic != VMX_FAIL_STATE) in __enter_guest()
1999 check_for_guest_termination(result->exit_reason); in __enter_guest()
2018 report(result.vm_fail, "VM-Fail occurred as expected"); in enter_guest_with_bad_controls()
2020 "FLAGS set correctly on VM-Fail"); in enter_guest_with_bad_controls()
2022 "VM-Inst Error # is %d (VM entry with invalid control field(s))", in enter_guest_with_bad_controls()
2057 if (filter[0] == '-') { in test_wanted()
2085 argc--; in main()
2088 printf("WARNING: vmx not supported, add '-cpu host'\n"); in main()