xref: /kvm-unit-tests/x86/README (revision 2805ff600e44936ce4d2c024f3ae81078c59658d)
1
2Tests for the x86 architecture are run as kernel images for qemu that support
3multiboot format. The tests use an infrastructure called from the bios code.
4The infrastructure initialize the system/cpus, switches to long-mode, and
5calls the 'main' function of the individual test. Tests use a qemu virtual
6test device, named testdev, for services like printing, exiting, querying
7memory size, etc. See file docs/testdev.txt for more details.
8
9Examples of a test invocation:
10 These invocations run the msr test case and outputs to stdio.
11
12 Using qemu-kvm:
13
14	qemu-kvm -device testdev,chardev=testlog \
15		 -chardev file,id=testlog,path=msr.out \
16		 -serial stdio -kernel ./x86/msr.flat
17
18 Using qemu (supported since qemu 1.3):
19
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
23
24Tests in this directory and what they do:
25 access:	lots of page table related access (pte/pde) (read/write)
26 apic:		enable x2apic, self ipi, ioapic intr, ioapic simultaneous
27 emulator:	move to/from regs, cmps, push, pop, to/from cr8, smsw and lmsw
28 hypercall:	intel and amd hypercall insn
29 msr:		write to msr (only KERNEL_GS_BASE for now)
30 realmode:	goes back to realmode, shld, push/pop, mov immediate, cmp
31		immediate, add immediate, io, eflags instructions
32		(clc, cli, etc.), jcc short, jcc near, call, long jmp, xchg
33 sieve:		heavy memory access with no paging and with paging static and
34		with paging vmalloc'ed
35 smptest:	run smp_id() on every cpu and compares return value to number
36 tsc:		write to tsc(0) and write to tsc(100000000000) and read it back
37 vmexit:	long loops for each: cpuid, vmcall, mov_from_cr8, mov_to_cr8,
38		inl_pmtimer, ipi, ipi+halt
39 kvmclock_test:	test of wallclock, monotonic cycle and performance of kvmclock
40 pcid:		basic functionality test of PCID/INVPCID feature
41
42Legacy notes:
43 The exit status of the binary is inconsistent; with qemu-system, after
44 the unit-test is done, the exit status of qemu is 1, different from the
45 'old style' qemu-kvm, whose exit status in successful completion is 0.
46 The run script converts the qemu-system exit status to 0 (SUCCESS), and
47 treats the legacy exit status of 0 as an error, converting it to an exit
48 status of 1.
49