/kvm-unit-tests/lib/x86/ |
H A D | atomic.h | 4 #include "asm-generic/atomic.h" 15 * atomic_read - read atomic variable 22 return v->counter; in atomic_read() 26 * atomic_set - set atomic variable 30 * Atomically sets the value of @v to @i. 34 v->counter = i; in atomic_set() 38 * atomic_inc - increment atomic variable 46 : "+m" (v->counter)); in atomic_inc() 50 * atomic_dec - decrement atomic variable 58 : "+m" (v->counter)); in atomic_dec() [all …]
|
H A D | amd_sev.c | 2 * AMD SEV support in kvm-unit-tests 9 * SPDX-License-Identifier: LGPL-2.0-or-later 59 * Extract C-Bit position from ebx[5:0] in setup_amd_sev() 61 * - Section " Function 8000_001Fh - Encrypted Memory Capabilities" in setup_amd_sev() 82 /* Test if SEV-ES is enabled */ in amd_sev_es_enabled() 102 * Copy UEFI's #VC IDT entry, so KVM-Unit-Tests can reuse it and does in setup_amd_sev_es() 103 * not have to re-implement a #VC handler. Also update the #VC IDT code in setup_amd_sev_es() 104 * segment to use KVM-Unit-Tests segments, KERNEL_CS, so that we do not in setup_amd_sev_es() 105 * have to copy the UEFI GDT entries into KVM-Unit-Tests GDT. in setup_amd_sev_es() 107 * TODO: Reusing UEFI #VC handler is a temporary workaround to simplify in setup_amd_sev_es() [all …]
|
/kvm-unit-tests/s390x/snippets/lib/ |
H A D | snippet-exit.h | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 16 mb(); /* host may read any memory written by the guest before */ in force_exit() 18 mb(); /* allow host to modify guest memory */ in force_exit() 23 mb(); /* host may read any memory written by the guest before */ in force_exit_value() 25 mb(); /* allow host to modify guest memory */ in force_exit_value()
|
/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 | 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 83 "read from user page with SMAP=1, 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() 138 report(pf_count == 0, "read from user page with AC=1"); in main() 144 "read from user page with AC=0"); in main() 151 "write to user page with AC=1"); in main() 157 "read from user page with AC=0"); in main() 161 test = -1; in main() [all …]
|
H A D | kvmclock.c | 18 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, 19 * yielding a 64-bit result. 29 delta >>= -shift; in scale_delta() 77 rem -= (u64) (high*base) << 32; in __div64_32() 87 rem -= b; in __div64_32() 112 * set_normalized_timespec - set timespec sec and nsec parts and normalize 114 * @ts: pointer to timespec variable to be set 115 * @sec: seconds to set 116 * @nsec: nanoseconds to set 119 * normalize to the timespec storage format [all …]
|
H A D | la57.c | 25 * directly read. in get_test_register_value() 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() 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 …]
|
/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() 213 sbiret_report_error(&ret, expected_error, "Read %s error", str); in sse_read_write_test() 240 sbiret_report_error(&ret, SBI_SUCCESS, "Read multiple attributes"); in sse_test_attrs() [all …]
|
/kvm-unit-tests/s390x/ |
H A D | mvpg.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 11 #include <asm/asm-offsets.h> 23 /* Used to build the appropriate test values for register 0 */ 27 /* How much memory to allocate for the test */ 29 /* How many iterations to perform in the loops */ 32 /* Used to generate the simple pattern */ 84 * to the beginning of the instruction after the one that caused the fault 86 * nullifying instructions). Therefore it is enough to compare the byte 92 return *(uint8_t *)(lowcore.pgm_old_psw.addr - 1) == lowcore.op_acc_id; in check_oai() 103 * state, and even then, only if the move-page-and-set-key facility in test_exceptions() [all …]
|
H A D | sclp.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 13 #include <asm/asm-offsets.h> 27 /* SCCB template to be used */ 33 static uint32_t valid_code; /* valid command code for READ SCP INFO */ 59 * should be copied to the test address, and should be 0 when the test 62 * The template is used to simplify tests where the same buffer content is 72 /* Copy the template to the test address if needed */ in test_one_sccb() 91 if (exp_rc && exp_rc != h->response_code) { in test_one_sccb() 93 addr, buf_len, cmd, h->response_code); in test_one_sccb() 100 * Wrapper for test_one_sccb to be used when the template should not be [all …]
|
/kvm-unit-tests/scripts/ |
H A D | common.bash | 21 while read -r -u $fd line; do 24 if [ -n "${testname}" ]; then 43 while read -r -u $fd; do 73 if [ -n "${testname}" ]; then 76 exec {fd}<&- 84 # The current file has to be the only file sourcing the arch helper 85 # file. Shellcheck can't follow this so help it out. There doesn't appear to be a 86 # way to specify multiple alternatives, so we will have to rethink this if things 89 if [ -f "${ARCH_FUNC}" ]; then
|
H A D | arch-run.bash | 2 # run_qemu translates the ambiguous exit status in Table1 to that in Table2. 6 # -------------------- 7 # 0 - Unexpected exit from QEMU (possible signal), or the unittest did 8 # not use debug-exit 9 # 1 - most likely unittest succeeded, or QEMU failed 12 # ------------------- 13 # 0 - Everything succeeded 14 # 1 - most likely QEMU failed 17 # ---------------------- 18 # 0 - SUCCESS [all …]
|
/kvm-unit-tests/ |
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 | assembler.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 3 * Based on several files from Linux version v5.10: arch/arm/mm/proc-macros.S, 4 * arch/arm/mm/proc-v7.S. 15 * dcache_line_size - get the minimum D-cache line size from the CTR register 19 mrc p15, 0, \tmp, c0, c0, 1 // read ctr 27 * Macro to perform a data cache maintenance for the interval 30 * op: operation to execute
|
/kvm-unit-tests/lib/ |
H A D | efi.c | 2 * EFI-related functions to set up and run test cases in EFI 7 * SPDX-License-Identifier: LGPL-2.0-or-later 74 * Pad map_size with additional descriptors so we don't need to in efi_get_memory_map() 78 *map->buff_size = map_size; in efi_get_memory_map() 92 *map->desc_ver = desc_ver; in efi_get_memory_map() 93 *map->desc_size = desc_size; in efi_get_memory_map() 94 *map->map_size = map_size; in efi_get_memory_map() 95 *map->key_ptr = key; in efi_get_memory_map() 97 *map->map = m; in efi_get_memory_map() 103 return efi_bs_call(exit_boot_services, handle, *map->key_ptr); in efi_exit_boot_services() [all …]
|
/kvm-unit-tests/lib/arm64/asm/ |
H A D | assembler.h | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 5 * arch/arm/mm/proc-macros.S 7 * Copyright (C) 1996-2000 Russell King 19 * raw_dcache_line_size - get the minimum D-cache line size on this CPU 23 mrs \tmp, ctr_el0 // read CTR 30 * Macro to perform a data cache maintenance for the interval 32 * kvm-unit-tests has no concept of scheduling. 34 * op: operation passed to dc instruction
|
/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 | gic.c | 21 #include <asm/gic-v3-its.h> 60 irq_sender[i] = -1; in stats_reset() 61 irq_number[i] = -1; in stats_reset() 69 /* Wait up to 5s for all interrupts to be delivered */ in wait_for_interrupts() 77 * wait it cannot un-receive it. Consider at least one in wait_for_interrupts() 87 /* Wait for unexpected interrupts to fire */ in wait_for_interrupts() 93 report_info("interrupts timed-out (5s)"); in wait_for_interrupts() 152 /* GICC_IAR.CPUID is RAZ for non-SGIs */ in gic_get_sender() 154 return -1; in gic_get_sender() 173 /* Wait for writes to acked/spurious to complete */ in irq_handler() [all …]
|
H A D | pmu.c | 4 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 72 * produce 32b overflow and 2nd @COUNT iterations do. To accommodate 75 #define PRE_OVERFLOW2_32 (ALL_SET_32 - COUNT - MARGIN) 76 #define PRE_OVERFLOW2_64 (ALL_SET_64 - COUNT - MARGIN) 153 * Extra instructions inserted by the compiler would be difficult to compensate 155 * to start and stop counting. isb instructions were inserted to make sure 156 * pmccntr read after this function returns the exact instructions executed in 224 * Extra instructions inserted by the compiler would be difficult to compensate 226 * to start and stop counting. isb instructions are inserted to make sure 227 * pmccntr read after this function returns the exact instructions executed [all …]
|
H A D | timer.c | 22 regs->pc += 4; in ptimer_unsupported_handler() 139 u32 irq = info->irq; in set_timer_irq_enabled() 164 info->write_ctl(ARCH_TIMER_CTL_IMASK | ARCH_TIMER_CTL_ENABLE); in irq_handler() 167 info->irq_received = true; in irq_handler() 173 return (info->read_ctl() & ARCH_TIMER_CTL_ENABLE) && in timer_pending() 174 (info->read_ctl() & ARCH_TIMER_CTL_ISTATUS); in timer_pending() 182 /* Wait for up to 1s for the GIC to sample the interrupt. */ in gic_timer_check_state() 185 if (gic_irq_state(info->irq) == expected_state) { in gic_timer_check_state() 187 if (gic_irq_state(info->irq) == expected_state) in gic_timer_check_state() 202 /* Program timer to fire in 10 ms */ in test_cval_10msec() [all …]
|
/kvm-unit-tests/lib/s390x/ |
H A D | css_lib.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 29 "Request-block error", 32 "Absolute address of channel-subsystem communication block exceeds 2G - 1.", 34 "Invalid channel-subsystem identification (CSSID)", 35 "The command-request block specified an invalid format for the command response block.", 36 "Invalid subchannel-set identification (SSID)", 44 if (h->code == CHSC_RSP_OK) in check_response() 47 if (h->code > CHSC_RSP_MAX) in check_response() 48 h->code = 0; in check_response() 50 report_abort("Response code %04x: %s", h->code, in check_response() [all …]
|
/kvm-unit-tests/lib/linux/ |
H A D | pci_regs.h | 6 * Copyright 1997--1999 Martin Mares <mj@ucw.cz> 9 * http://www.pcisig.com/ for how to get them): 13 * PCI to PCI Bridge Specification 36 #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ 42 #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ 50 #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ 76 #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ 82 * 0xffffffff to the register, and reading it back. Only 113 /* 0x35-0x3b are reserved */ 119 /* Header type 1 (PCI-to-PCI bridges) */ [all …]
|
/kvm-unit-tests/lib/arm/ |
H A D | io.c | 3 * devices exposed from QEMU, e.g. pl011 and chr-testdev. That's 13 #include <chr-testdev.h> 23 * Use this guess for the uart base in order to make an attempt at 25 * base address that we read from the device tree later. This is 26 * the address we expect the virtual machine manager to put in 36 * kvm-unit-tests uses the uart only for output. Both uart models have in uart0_init_fdt() 38 * need to treat them separately. in uart0_init_fdt() 45 assert(ret >= 0 || ret == -FDT_ERR_NOTFOUND); in uart0_init_fdt() 47 if (ret == -FDT_ERR_NOTFOUND) { in uart0_init_fdt() 51 assert(ret == 0 || ret == -FDT_ERR_NOTFOUND); in uart0_init_fdt() [all …]
|
/kvm-unit-tests/lib/riscv/ |
H A D | io.c | 1 // SPDX-License-Identifier: GPL-2.0-only 21 * Use this guess for the uart base in order to make an attempt at 23 * base address that we read from the device tree later. This is 24 * the address we expect the virtual machine manager to put in 66 assert(ret >= 0 || ret == -FDT_ERR_NOTFOUND); in uart0_init_fdt() 68 if (ret == -FDT_ERR_NOTFOUND) { in uart0_init_fdt() 71 assert(ret == 0 || ret == -FDT_ERR_NOTFOUND); in uart0_init_fdt() 85 val = fdt_getprop(dt_fdt(), ret, "reg-shift", &len); in uart0_init_fdt() 89 val = fdt_getprop(dt_fdt(), ret, "reg-io-width", &len); in uart0_init_fdt() 144 * Defining halt to take 'code' as an argument guarantees that it will [all …]
|