xref: /kvm-unit-tests/x86/README (revision a322d4c597bb7a4de7985e7b51b80504f7e4fdda)
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 port80:	lots of out to port 80
31 realmode:	goes back to realmode, shld, push/pop, mov immediate, cmp
32		immediate, add immediate, io, eflags instructions
33		(clc, cli, etc.), jcc short, jcc near, call, long jmp, xchg
34 sieve:		heavy memory access with no paging and with paging static and
35		with paging vmalloc'ed
36 smptest:	run smp_id() on every cpu and compares return value to number
37 tsc:		write to tsc(0) and write to tsc(100000000000) and read it back
38 vmexit:	long loops for each: cpuid, vmcall, mov_from_cr8, mov_to_cr8,
39		inl_pmtimer, ipi, ipi+halt
40 kvmclock_test:	test of wallclock, monotonic cycle and performance of kvmclock
41 pcid:		basic functionality test of PCID/INVPCID feature
42
43Legacy notes:
44 The exit status of the binary (and the script) is inconsistent: with
45 qemu-system, after the unit-test is done, the exit status of qemu is 1,
46 different from the 'old style' qemu-kvm, whose exit status in successful
47 completion is 0.
48