/kvm-unit-tests/lib/x86/ |
H A D | atomic.h | 4 #include "asm-generic/atomic.h" 15 * atomic_read - read atomic variable 16 * @v: pointer of type atomic_t 18 * Atomically reads the value of @v. 20 static inline int atomic_read(const atomic_t *v) in atomic_read() argument 22 return v->counter; in atomic_read() 26 * atomic_set - set atomic variable 27 * @v: pointer of type atomic_t 30 * Atomically sets the value of @v to @i. 32 static inline void atomic_set(atomic_t *v, int i) in atomic_set() argument [all …]
|
H A D | atomic.c | 6 u64 atomic64_cmpxchg(atomic64_t *v, u64 old, u64 new) in atomic64_cmpxchg() argument 13 "+m" (*(volatile long long *)&v->counter) in atomic64_cmpxchg() 23 u64 atomic64_cmpxchg(atomic64_t *v, u64 old, u64 new) in atomic64_cmpxchg() argument 30 : "=a" (ret), "+m" (*(volatile long *)&v->counter) in atomic64_cmpxchg()
|
H A D | desc.c | 6 #include "apic-defs.h" 8 /* Boot-related data structures */ 14 .limit = sizeof(boot_idt) - 1, 22 {0xffff, 0, 0, .type_limit_flags = 0xcf9b}, /* flat 32-bit code segment */ 23 {0xffff, 0, 0, .type_limit_flags = 0xcf93}, /* flat 32-bit data segment */ 24 {0xffff, 0, 0, .type_limit_flags = 0xcf1b}, /* flat 32-bit code segment, not present */ 26 {0xffff, 0, 0, .type_limit_flags = 0x8f9b}, /* 16-bit code segment */ 27 {0xffff, 0, 0, .type_limit_flags = 0x8f93}, /* 16-bit data segment */ 28 {0xffff, 0, 0, .type_limit_flags = 0xcffb}, /* 32-bit code segment (user) */ 29 {0xffff, 0, 0, .type_limit_flags = 0xcff3}, /* 32-bit data segment (user) */ [all …]
|
/kvm-unit-tests/lib/arm64/ |
H A D | processor.c | 71 regs->pc, regs->regs[30], regs->pstate); in show_regs() 72 printf("sp : %016lx\n", regs->sp); in show_regs() 74 for (i = 29; i >= 0; --i) { in show_regs() 75 printf("x%-2d: %016lx ", i, regs->regs[i]); in show_regs() 105 static void bad_exception(enum vector v, struct pt_regs *regs, in bad_exception() argument 115 (uintptr_t)regs->pc, (uintptr_t)regs->pc - text); in bad_exception() 118 if (v < VECTOR_MAX) in bad_exception() 119 printf("Unhandled vector %d (%s)\n", v, in bad_exception() 120 vector_names[v]); in bad_exception() 122 printf("Got bad vector=%d\n", v); in bad_exception() [all …]
|
H A D | spinlock.c | 18 lock->v = 1; in spin_lock() 30 : "r" (&lock->v) in spin_lock() 40 asm volatile("stlrh wzr, [%0]" :: "r" (&lock->v)); in spin_unlock() 42 lock->v = 0; in spin_unlock()
|
/kvm-unit-tests/lib/arm/ |
H A D | processor.c | 35 regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr, in show_regs() 36 regs->ARM_sp, regs->ARM_ip, regs->ARM_fp); in show_regs() 38 regs->ARM_r10, regs->ARM_r9, regs->ARM_r8); in show_regs() 40 regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4); in show_regs() 42 regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0); in show_regs() 44 flags = regs->ARM_cpsr; in show_regs() 48 buf[3] = flags & PSR_V_BIT ? 'V' : 'v'; in show_regs() 68 void install_exception_handler(enum vector v, exception_fn fn) in install_exception_handler() argument 72 if (v < EXCPTN_MAX) in install_exception_handler() 73 ti->exception_handlers[v] = fn; in install_exception_handler() [all …]
|
H A D | spinlock.c | 17 lock->v = 1; in spin_lock() 30 : "r" (&lock->v) in spin_lock() 40 lock->v = 0; in spin_unlock()
|
/kvm-unit-tests/lib/s390x/ |
H A D | sclp-console.c | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 23 * ASCII (IBM PC 437) -> EBCDIC 037 29 /* ->NL */ 34 /* ->IGS ->IRS ->IUS */ 38 /*28 ( ) * + , - . / */ 48 /*50 P Q R S T U V W */ 56 /*70 p q r s t u v w */ 136 static int read_index = sizeof(read_buf) - 1; 143 char *str_dest = (char *)&sccb->msg; in sclp_print_ascii() 162 sccb->h.length = offsetof(WriteEventData, msg) + len; in sclp_print_ascii() [all …]
|
/kvm-unit-tests/lib/asm-generic/ |
H A D | spinlock.h | 5 unsigned int v; member 10 while (__sync_lock_test_and_set(&lock->v, 1)); in spin_lock() 15 __sync_lock_release(&lock->v); in spin_unlock()
|
/kvm-unit-tests/x86/ |
H A D | hyperv_stimer.c | 65 timer->index = index; in stimer_init() 74 svcpu->vcpu = vcpu; in synic_enable() 75 svcpu->msg_page = synic_alloc_page(); in synic_enable() 76 for (i = 0; i < ARRAY_SIZE(svcpu->timer); i++) { in synic_enable() 77 stimer_init(&svcpu->timer[i], i); in synic_enable() 79 wrmsr(HV_X64_MSR_SIMP, (u64)virt_to_phys(svcpu->msg_page) | in synic_enable() 86 wrmsr(HV_X64_MSR_STIMER0_CONFIG + 2*timer->index, 0); in stimer_shutdown() 91 atomic_inc(&timer->fire_count); in process_stimer_expired() 98 (struct hv_timer_message_payload *)msg->u.payload; in process_stimer_msg() 101 if (msg->header.message_type != HVMSG_TIMER_EXPIRED && in process_stimer_msg() [all …]
|
H A D | emulator.c | 29 "S"(st1), "c"(sizeof(st1) - 1)); in test_stringio() 31 report(r == st1[sizeof(st1) - 2], "outsb up"); /* last char */ in test_stringio() 37 "S"(st1 + sizeof(st1) - 2), "c"(sizeof(st1) - 1)); in test_stringio() 178 unsigned long *m = mem, v = 1234; in test_incdecnotneg() local 201 *m = v; in test_incdecnotneg() 204 asm ("lock negq %0" : "+m"(*m)); v = -v; in test_incdecnotneg() 205 report(*m == v, "lock negl"); in test_incdecnotneg() 206 asm ("lock notq %0" : "+m"(*m)); v = ~v; in test_incdecnotneg() 207 report(*m == v, "lock notl"); in test_incdecnotneg() 212 asm ("lock negb %0" : "+m"(*mb)); vb = -vb; in test_incdecnotneg() [all …]
|
H A D | smap.c | 30 // no task on x86_64, save/restore caller-save regs 49 #define USER_VAR(v) (*((__typeof__(&(v))) (((unsigned long)&v) + USER_BASE))) argument 50 #define USER_ADDR(v) ((void *)((unsigned long)(&v) + USER_BASE)) argument 113 // Present the same 8MB as user pages in the 8MB-16MB range in main() 161 test = -1; in main() 178 test = -1; in main() 185 report(pf_count == 1 && test == 45 && save == -1, in main() 192 "1: jmp 2f - "xstr(USER_BASE)" \n" in main()
|
H A D | hyperv_synic.c | 93 report_fail("Hyper-V SynIC test, EOM read %#" PRIx64, r); in synic_test_prepare() 148 report_skip("Hyper-V SynIC is not supported"); in main() 166 printf("test %d -> %d\n", i, ncpus - 1 - i); in main() 167 on_cpu_async(i, synic_test, (void *)(ulong)(ncpus - 1 - i)); in main() 182 report(ok, "Hyper-V SynIC test"); in main()
|
H A D | pks.c | 10 #define SUPER_VAR(v) (*((__typeof__(&(v))) (((unsigned long)&v) + SUPER_BASE))) argument 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()
|
H A D | pku.c | 10 #define USER_VAR(v) (*((__typeof__(&(v))) (((unsigned long)&v) + USER_BASE))) argument 38 // no task on x86_64, save/restore caller-save regs
|
H A D | emulator64.c | 22 memset(mem, 0x55, (void *)stack_top - mem); in test_push() 26 "pushq $-7 \n\t" in test_push() 29 "pushq $-7070707 \n\t" in test_push() 34 [reg]"r"(-17l), [mem]"r"(&memw) in test_push() 37 report(stack_top[-1] == -7ul, "push $imm8"); in test_push() 38 report(stack_top[-2] == -17ul, "push %%reg"); in test_push() 39 report(stack_top[-3] == 0x123456789abcdeful, "push mem"); in test_push() 40 report(stack_top[-4] == -7070707, "push $imm"); in test_push() 50 memset(mem, 0x55, (void *)stack_top - mem); in test_pop() 57 memw = 7 - memw; in test_pop() [all …]
|
/kvm-unit-tests/s390x/ |
H A D | gs.c | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 12 #include <asm/asm-offsets.h> 16 #include <asm-generic/barrier.h> 28 unsigned long v; in load_guarded() local 31 : "=d" (v) in load_guarded() 34 return v; in load_guarded() 37 /* guarded-storage event handler and finally it calls gs_handler */ 46 " aghi %r15,-(.Lgs_handler_frame)\n" /* Allocate stack frame */ 58 ".size gs_handler_asm,.-gs_handler_asm\n" 64 struct gs_epl *gs_epl = (struct gs_epl *) this_cb->gs_epl_a; in gs_handler() [all …]
|
/kvm-unit-tests/scripts/ |
H A D | arch-run.bash | 6 echo -n "$@" 7 [ "$ENVIRON_DEFAULT" = "yes" ] && echo -n " #" 14 exec {stdout}>&- 28 exec {stdout}>&- 30 if [ $ret -eq 1 ]; then 31 testret=$(grep '^EXIT: ' <<<"$lines" | head -n1 | sed 's/.*STATUS=\([0-9][0-9]*\).*/\1/') 33 if [ $testret -eq 1 ]; then 50 s=${TIMEOUT: -1} 52 TIMEOUT=${TIMEOUT:0:-1} 57 echo "timeout -k 1s --foreground $TIMEOUT" [all …]
|
/kvm-unit-tests/lib/powerpc/ |
H A D | processor.c | 26 * of 0x20 bytes in some cases. Indexing spans 0-0x1000 with 0x20 increments 47 unsigned char v; in do_handle_exception() local 51 current_cpu()->in_user = false; in do_handle_exception() 61 v = regs->trap >> 5; in do_handle_exception() 63 if (v < 128 && handlers[v].func) { in do_handle_exception() 64 handlers[v].func(regs, handlers[v].data); in do_handle_exception() 65 if (regs->msr & MSR_PR) in do_handle_exception() 66 current_cpu()->in_user = true; in do_handle_exception() 71 smp_processor_id(), regs->trap, regs->nip, regs->msr); in do_handle_exception() 72 dump_frame_stack((void *)regs->nip, (void *)regs->gpr[1]); in do_handle_exception() [all …]
|
/kvm-unit-tests/arm/ |
H A D | selftest.c | 15 #include <asm/asm-offsets.h> 40 if (len == -1) in check_setup() 48 phys_addr_t memsize = PHYS_END - PHYS_OFFSET; in check_setup() 87 for (r = mem_regions; r->end; ++r) { in check_pabt_init() 88 if (r->flags & MR_F_IO) in check_pabt_init() 90 if (r->end > highest_end) in check_pabt_init() 91 highest_end = PAGE_ALIGN(r->end); in check_pabt_init() 98 mmu_clear_user(current_thread_info()->pgtable, vaddr); in check_pabt_init() 119 "stmia r0, { r0-lr }\n" \ 122 "mov r1, #-1\n" \ [all …]
|
H A D | spinlock-test.c | 20 void (*lock)(int *v); 21 void (*unlock)(int *v); 70 report(errors == 0, "CPU%d: Done - Errors: %d", cpu, errors); in test_spinlock()
|
H A D | pmu.c | 4 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 75 #define PRE_OVERFLOW2_32 (ALL_SET_32 - COUNT - MARGIN) 76 #define PRE_OVERFLOW2_64 (ALL_SET_64 - COUNT - MARGIN) 126 static inline void set_pmcr(uint32_t v) { write_sysreg(v, PMCR); } in set_pmcr() argument 127 static inline void set_pmcntenset(uint32_t v) { write_sysreg(v, PMCNTENSET); } in set_pmcntenset() argument 211 static inline void set_pmcr(uint32_t v) { write_sysreg(v, pmcr_el0); } in set_pmcr() argument 213 static inline void set_pmccntr(uint64_t v) { write_sysreg(v, pmccntr_el0); } in set_pmccntr() argument 214 static inline void set_pmcntenset(uint32_t v) { write_sysreg(v, pmcntenset_el0); } in set_pmcntenset() argument 215 static inline void set_pmccfiltr(uint32_t v) { write_sysreg(v, pmccfiltr_el0); } in set_pmccfiltr() argument 260 * The low 32-bits of PMCEID0/1 respectively describe in is_event_supported() [all …]
|
/kvm-unit-tests/lib/arm/asm/ |
H A D | sysreg.h | 16 #define CR_P (1 << 4) /* 32-bit exception handler */ 17 #define CR_D (1 << 5) /* 32-bit data address range */ 61 #define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v))) argument 62 #define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__) argument
|
/kvm-unit-tests/ |
H A D | run_tests.sh | 7 if [ ! -f config.mak ]; then 8 echo "run ./configure && make first. See ./configure -h" 19 Usage: $0 [-h] [-v] [-a] [-g group] [-j NUM-TASKS] [-t] [-l] 21 -h, --help Output this help text 22 -v, --verbose Enables verbose mode 23 -a, --all Run all tests, including those flagged as 'nodefault' 25 -g, --group Only execute tests in the given group 26 -j, --parallel Execute tests in parallel 27 -t, --tap13 Output test results in TAP format 28 -l, --list Only output all tests list [all …]
|
H A D | .travis.yml | 11 - arch: ppc64le 13 apt_packages: clang qemu-system-ppc 15 - CONFIG="--arch=ppc64 --endian=little --cc=clang --cflags=-no-integrated-as" 16 - TESTS="emulator rtas-get-time-of-day rtas-get-time-of-day-base 17 rtas-set-time-of-day selftest-setup spapr_hcall" 19 - arch: s390x 22 apt_packages: clang-11 qemu-system-s390x 24 - CONFIG="--arch=s390x --cc=clang-11 --cflags=-no-integrated-as" 25 - TESTS="" 28 - mkdir -p build && cd build [all …]
|