/kvm-unit-tests/x86/ |
H A D | tsc_adjust.c | 20 "MSR_IA32_TSC_ADJUST msr read / write"); in main() 21 report((t2 - t1) >= t3, in main() 26 "MSR_IA32_TSC_ADJUST msr read / write"); in main() 32 report(t1 <= t4 - t5, "Internal TSC advances across write to IA32_TSC"); in main() 33 report(t2 >= t4, "IA32_TSC advances after write to IA32_TSC"); in main()
|
H A D | README | 4 The infrastructure initialize the system/cpus, switches to long-mode, and 10 These invocations run the msr test case and outputs to stdio. 12 Using qemu-kvm: 14 qemu-kvm -device testdev,chardev=testlog \ 15 -chardev file,id=testlog,path=msr.out \ 16 -serial stdio -kernel ./x86/msr.flat 20 qemu-system-x86_64 -enable-kvm -device pc-testdev -serial stdio \ 21 -device isa-debug-exit,iobase=0xf4,iosize=0x4 \ 22 -kernel ./x86/msr.flat 25 access: lots of page table related access (pte/pde) (read/write) [all …]
|
H A D | pks.c | 39 // no task on x86_64, save/restore caller-save regs 88 // Present the same 16MB as supervisor pages in the 16MB-32MB range in main() 104 "write to supervisor page when pkrs is ad and wp == 1"); in main() 111 "write to supervisor page when pkrs is ad and wp == 0"); in main() 118 "write to supervisor page when pkrs is wd and wp == 1"); in main() 125 "write to supervisor page when pkrs is wd and wp == 0"); in main() 132 "write to user page when pkrs is wd and wp == 0"); in main() 139 "write to user page when pkrs is wd and wp == 1"); in main()
|
H A D | pku.c | 38 // no task on x86_64, save/restore caller-save regs 101 "write to supervisor page when pkru is ad and wp == 1"); in main() 108 "write to supervisor page when pkru is ad and wp == 0"); in main() 115 "write to supervisor page when pkru is wd and wp == 1"); in main() 122 "write to supervisor page when pkru is wd and wp == 0"); in main() 129 "write to user page when pkru is wd and wp == 0"); in main() 136 "write to user page when pkru is wd and wp == 1"); in main()
|
H A D | smap.c | 14 // separate stack (the ring 0 stack). Seems easier to use the alt_stack 30 // no task on x86_64, save/restore caller-save regs 75 "write from user page with SMAP=0, AC=0, WP=0, PTE.U=1 && PTE.W=0"); in check_smap_nowp() 113 // Present the same 8MB as user pages in the 8MB-16MB range in main() 133 "write to supervisor page"); in main() 151 "write to user page with AC=1"); in main() 161 test = -1; in main() 174 "write to user stack with AC=1"); in main() 178 test = -1; in main() 185 report(pf_count == 1 && test == 45 && save == -1, in main() [all …]
|
H A D | la57.c | 141 * TODO: A successful write to the MSR_GS_BASE corrupts it, and that in test_register_write() 142 * breaks the wrmsr_safe macro (it uses GS for per-CPU data). in test_register_write() 147 /* Write the test value*/ in test_register_write() 150 "Write to %s with value %lx did %s%s as expected", in test_register_write() 157 * because it's not possible to read them directly. in test_register_write() 165 "%s set to %lx as expected (actual value %lx)", in test_register_write() 171 * Restore the old value directly without safety wrapper, to avoid test in test_register_write() 172 * crashes related to temporary clobbered GDT/IDT/etc bases. in test_register_write() 184 /* 57-canonical value will work on CPUs that *support* LA57 */ in test_register() 217 "Tested invpcid type 0 with 0x%lx value - %s", in __test_invpcid() [all …]
|
H A D | access.c | 17 #define PT_BASE_ADDR_MASK ((pt_element_t)((((pt_element_t)1 << 36) - 1) & PAGE_MASK)) 31 (((address) >> (12 + ((level)-1) * 9)) & 511) 35 * test case. The main test will bump a counter by 1 to run all permutations 39 * toggled on every test, e.g. to keep entries in the TLB. 63 * special test case to DISABLE writable bit on page directory 148 [AC_ACCESS_WRITE_BIT] = "write", 183 /* 5-level paging, 1-based to avoid math. */ 209 for (i = at->pt_levels; i >= min_level; --i) { in walk_va() 254 /* Flush to avoid spurious #PF */ in clear_user_mask() 262 /* Flush to avoid spurious #PF */ in set_user_mask() [all …]
|
H A D | taskswitch2.c | 3 #include "apic-defs.h" 68 if (*error_code == 0x2) /* write access, not present */ in do_pf_tss() 88 printf("JMP to task succeeded\n"); in jmp_tss() 151 printf("Try to divide by 0\n"); in test_kernel_mode_int() 201 /* hlt opcode is 0xf4 I use destination IP 0xf4f4f4f4 to catch in test_gdt_task_gate() 215 printf("Jumping to a task by ljmp\n"); in test_gdt_task_gate() 228 /* Write a 'ud2' instruction somewhere below 1 MB */ in test_vm86_switch() 234 set_gdt_entry(MAIN_TSS_SEL, (u32)&main_tss, sizeof(tss32_t) - 1, 0x89, 0); in test_vm86_switch() 241 /* VM86 TSS (marked as busy, so we can iret to it) */ in test_vm86_switch() 242 set_gdt_entry(VM86_TSS_SEL, (u32)&vm86_tss, sizeof(tss32_t) - 1, 0x8b, 0); in test_vm86_switch() [all …]
|
/kvm-unit-tests/s390x/ |
H A D | edat.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 16 #include <asm-generic/barrier.h> 18 #define PGD_PAGE_SHIFT (REGION1_SHIFT - PAGE_SHIFT) 66 /* Write protect the page and try to write, expect a fault */ in test_dat() 75 * off. We set a value and then we try to read it back again after in test_dat() 86 * Segment protection should work even with EDAT off, try to write in test_dat() 104 * Protect the various region1/2/3 entries and write, expect the in test_dat() 105 * write to be successful. in test_dat() 136 * Segment protection should work normally, try to write and expect in test_edat1() 147 * to write anyway and expect a fault. in test_edat1() [all …]
|
H A D | sie-dat.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 20 #include <snippet-exit.h> 21 #include "snippets/c/sie-dat.h" 40 /* guest will now write to the test buffer and we verify the contents */ in test_sie_dat() 55 …/* the guest will now write to an unmapped address and we check that this causes a segment transla… in test_sie_dat() 56 report_prefix_push("guest write to unmapped"); in test_sie_dat() 76 /* allocate a region-1 table */ in setup_guest() 84 /* set up storage limit supression - leave mso and msl intact they are ignored anyways */ in setup_guest() 85 vm.sblk->cpuflags |= CPUSTAT_SM; in setup_guest() 96 report_prefix_push("sie-dat"); in main()
|
H A D | adtl-status.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 11 #include <asm/asm-offsets.h> 14 #include <asm-generic/barrier.h> 23 #define INVALID_CPU_ADDRESS -4711 27 uint8_t reserved200[0x400 - 0x200]; /* 0x200 */ 29 uint8_t reserved420[0x800 - 0x420]; /* 0x420 */ 30 uint8_t reserved800[0x1000 - 0x800]; /* 0x800 */ 78 uint32_t status = -1; in test_store_adtl_status() 84 report_skip("no guarded-storage or vector facility installed"); in test_store_adtl_status() 137 report_skip("guarded-storage or vector facility installed"); in test_store_adtl_status_unavail() [all …]
|
/kvm-unit-tests/riscv/ |
H A D | sbi-sse.c | 1 // SPDX-License-Identifier: GPL-2.0-only 12 #include <on-cpus.h> 24 #include "sbi-tests.h" 118 return sse_event_get_info(event_id)->name; in sse_event_name() 123 return sse_event_get_info(event_id)->can_inject; in sse_event_can_inject() 158 unsigned long current_hart = current_thread_info()->hartid; in sse_global_event_set_current_hart() 195 * always be decremented before storing anything on it in sse-entry.S. in sse_alloc_stack() 204 free_page(stack - SSE_STACK_SIZE); in sse_free_stack() 216 sbiret_report_error(&ret, expected_error, "Write %s error", str); in sse_read_write_test() 256 * but other bits are zero-initialized. in sse_test_attrs() [all …]
|
H A D | sbi-fwft.c | 1 // SPDX-License-Identifier: GPL-2.0-only 18 #include "sbi-tests.h" 49 if (!sbiret_report_error(&ret, SBI_SUCCESS, "set to %ld%s", value, str)) in fwft_set_and_check_raw() 74 sbiret_report(&ret, SBI_SUCCESS, reset, "resets to %lu", reset); in fwft_check_reset() 92 "Set to %lu without lock flag", test_values[i]); in fwft_feature_lock_test_values() 96 "Set to %lu with lock flag", test_values[i]); in fwft_feature_lock_test_values() 129 regs->epc += 4; in misaligned_handler() 184 /* Set to 0 and check after with get */ in fwft_check_misaligned_exc_deleg() 187 /* Set to 1 and check after with get */ in fwft_check_misaligned_exc_deleg() 198 ".option arch,-c\n" in fwft_check_misaligned_exc_deleg() [all …]
|
/kvm-unit-tests/powerpc/ |
H A D | timebase.c | 1 // SPDX-License-Identifier: GPL-2.0-only 27 prop = fdt_get_property(dt_fdt(), fdtnode, "ibm,dec-bits", &plen); in cpu_dec_bits() 36 /* Check all CPU nodes have the same value of dec-bits */ in cpu_dec_bits() 38 assert(dec_bits == fdt32_to_cpu(*(uint32_t *)prop->data)); in cpu_dec_bits() 40 dec_bits = fdt32_to_cpu(*(uint32_t *)prop->data); in cpu_dec_bits() 93 regs->msr &= ~MSR_EE; in dec_handler() 108 if (tb2 - tb1 < dec_max - dec) in test_dec() 112 report_kfail(!host_is_tcg, tb2 - tb1 >= dec_max - dec, in test_dec() 120 report(tb2 - tb1 >= dec_max - dec, in test_dec() 133 mdelay(100); /* Give the timer a chance to run */ in test_dec() [all …]
|
/kvm-unit-tests/scripts/ |
H A D | pretty_print_stacks.py | 13 sys.stdout.write(string) 20 # from the address to get the call code. 26 addrs[i] = '%lx' % max((int(addrs[i], 16) - 1), 0) 29 # 0x004002be: start64 at path/to/kvm-unit-tests-repo-worktree/x86/cstart64.S:208 30 …# (inlined by) test_ept_violation at path/to/kvm-unit-tests-repo-worktree/x86/vmx_tests.c:… 31 cmd = [config.get('ADDR2LINE', 'addr2line'), '-e', binary, '-i', '-f', '--pretty', '--address'] 41 m = re.match(rb'(.*) at (.*):(([0-9]+)|\?)([^:]*)', line) 56 puts(' %s\n' % lines[line - 2].rstrip()) 57 puts(' > %s\n' % lines[line - 1].rstrip()) 63 sys.stderr.write('usage: %s <kernel>\n' % sys.argv[0])
|
/kvm-unit-tests/lib/ |
H A D | acpi.h | 7 * All tables and structures must be byte-packed to match the ACPI 32 u8 checksum; /* To make sum of struct == 0 */ 35 u32 rsdt_physical_address; /* 32-bit physical address of RSDT */ 37 u64 xsdt_physical_address; /* 64-bit physical address of XSDT */ 46 u8 checksum; /* To make sum of entire table == 0 */ \ 73 u64 address; /* 64-bit address of struct or register */ 84 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 85 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 86 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ 87 u8 reserved2; /* Reserved - must be zero */ [all …]
|
/kvm-unit-tests/s390x/snippets/c/ |
H A D | sie-dat.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 3 * Snippet used by the sie-dat.c test to verify paging without MSO/MSL 11 #include <asm-generic/page.h> 13 #include <snippet-exit.h> 14 #include "sie-dat.h" 26 /* write some value to the page so the host can verify it */ in main() 37 /* indicate we've written the non-allowed page (should never get here) */ in main()
|
/kvm-unit-tests/arm/ |
H A D | mte.c | 1 /* SPDX-License-Identifier: GPL-2.0 */ 12 #include <asm/pgtable-hwdef.h> 29 #define MTE_GRANULE_MASK (~(MTE_GRANULE_SIZE - 1)) 51 * to access a tagged address, the compiler will reasonably assume 55 * But a test might want the tagged access to fail on purpose, and if 56 * we advance the PC to the next instruction, the one added by the 71 /* The NOP allows the same exception handler as mem_read() to be used. */ in mem_write() 88 report_info("Unexpected non-zero FnV"); in mte_fault_handler() 95 * function that called mem_read() will want to check that the in mte_fault_handler() 100 regs->pc += 8; in mte_fault_handler() [all …]
|
H A D | fpu.c | 1 /* SPDX-License-Identifier: GPL-2.0 */ 15 #define FPU_RESULT_PASS (-1U) 18 * Write 8 bytes of random data in random. Returns true on success, false on 27 " cset %[ret], ne\n" /* RNDR sets NZCV to 0b0100 on failure */ in arch_collect_entropy() 223 /* 128b aligned array to read data into */ in __fpuregs_testall() 226 [0 ... ((FPU_QREG_MAX * 2) - 1)] = 0 }; in __fpuregs_testall() 262 * Write randomly sampled data into the FPU/SIMD registers. 279 /* Write data into FPU registers */ in __fpuregs_writeall_random() 321 * This test uses two CPUs to test FPU/SIMD save/restore 332 /* write data from CPU1 */ in fpuregs_context_switch_cpu1() [all …]
|
H A D | cstart.S | 11 #include <asm/asm-offsets.h> 12 #include <asm/pgtable-hwdef.h> 16 #define THREAD_START_SP ((THREAD_SIZE - S_FRAME_SIZE * 8) & ~7) 61 * bootloader params are in r0-r2 68 * put the dtb in r0. This allows setup to be consistent 72 push {r0-r1} 81 pop {r0-r1} 101 * r0 -- function_id 102 * r1 -- arg0 103 * r2 -- arg1 [all …]
|
/kvm-unit-tests/lib/linux/ |
H A D | efi.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 17 #define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1))) 18 #define EFI_INVALID_PARAMETER ( 2 | (1UL << (BITS_PER_LONG-1))) 19 #define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1))) 20 #define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1))) 21 #define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1))) 22 #define EFI_NOT_READY ( 6 | (1UL << (BITS_PER_LONG-1))) 23 #define EFI_DEVICE_ERROR ( 7 | (1UL << (BITS_PER_LONG-1))) 24 #define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1))) 25 #define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1))) [all …]
|
/kvm-unit-tests/ |
H A D | LICENSE | 5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 Everyone is permitted to copy and distribute verbatim copies 11 The licenses for most software are designed to take away your 12 freedom to share and change it. By contrast, the GNU General Public 13 License is intended to guarantee your freedom to share and change free 14 software--to make sure the software is free for all its users. This 15 General Public License applies to most of the Free Software 16 Foundation's software and to any other program whose authors commit to 18 the GNU Lesser General Public License instead.) You can apply it to 21 When we speak of free software, we are referring to freedom, not [all …]
|
H A D | MAINTAINERS | 4 The intention of this file is not to establish who owns what portions of the 5 code base, but to provide a set of names that developers can consult when they 6 have a question about a particular subset and also to provide a set of names 7 to be CC'd when submitting a patch to obtain appropriate review. 15 M: Mail patches to: FullName <address@domain> 18 L: Mailing list that is relevant to this area 19 W: Web-page with status/info 23 Supported: Someone is actually paid to look after this. 25 Odd Fixes: It has a maintainer but they don't have time to do 28 role as you write your new code]. [all …]
|
H A D | run_tests.sh | 7 if [ ! -f config.mak ]; then 8 echo "run ./configure && make first. See ./configure -h" 18 Usage: $0 [-h] [-v] [-a] [-g group] [-j NUM-TASKS] [-t] [-l] 20 -h, --help Output this help text 21 -v, --verbose Enables verbose mode 22 -a, --all Run all tests, including those flagged as 'nodefault' 24 -g, --group Only execute tests in the given group 25 -j, --parallel Execute tests in parallel 26 -t, --tap13 Output test results in TAP format 27 -l, --list Only output all tests list [all …]
|
/kvm-unit-tests/lib/arm/asm/ |
H A D | sysreg.h | 15 #define CR_W (1 << 3) /* Write buffer enable */ 16 #define CR_P (1 << 4) /* 32-bit exception handler */ 17 #define CR_D (1 << 5) /* 32-bit data address range */ 25 #define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
|