apic: Remove redundant enable_apic

Already called by the bootstrap code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
VMX: Fix return label in fault-triggering handlers

Some compiler versions (seen with gcc 4.8.1) move the resume label after
the return statement which, of course, causes sever problems.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
lib/x86: Move exception test code into library

Will also be used by the APIC test. Moving exception_return assignment
out of line, we can drop the explicit compiler barrier.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
x2apic: Test for invalid state transitions

This checks if KVM properly acknowledges invalid state transitions on
MSR_APIC_BASE writes with a #GP.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
lib/x86/apic: Consolidate over MSR_IA32_APICBASE

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
apic: Add test case for relocation and writing reserved bits

Check that the xAPIC is relocatable and that writing a reserved bit to
MSR_IA32_APICBASE triggers a #GP.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
VMX: Check unconditional I/O exiting

Test if we ignore "unconditional I/O exiting" as long as "use I/O
bitmap" is enabled. Also test if unconditional exiting itself works.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Provide common report and report_summary services

This both reduces code duplication and standardizes the output format a
bit more.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Ignore *.elf build outputs

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
svm: Add missing build dependency

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
x86: Add debug facility test case

This adds a basic test for INT3/#BP, hardware breakpoints, hardware
watchpoints and single-stepping.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
README: add information about memory usage

I got a report of someone trying to run tests with a large amount of
RAM (4GB), which broke the guest as free_memory() function (called
by setup_vm()) will override the PCI hole.

Let's document memory constraints so that people don't do that.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
vmexit: add mov-to-dr test

Currently each MOV to a debug register causes a debug exit.  Add a
testcase to track upcoming improvements.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
emulator: movaps

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
emulator: movapd

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
VMX: Add test cases around interrupt injection and halting

This checks for interrupt delivery to L2, unintercepted hlt in L2 and
explicit L2 suspension via the activity state HLT. All tests are
performed both with direct interrupt injection and external interrupt
interception.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
VMX: Extend preemption timer tests

This checks that we properly expire the preemption timer while the guest
is in HLT state and that we do not progress guest execution of the
preemption timer is activated with a timer value of 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
realmode: add performance test

There's room for speeding up emulation of invalid guest state.  Let's
track our progress by adding a few small performance tests.

Current results on a Xeon E5 (Sandy Bridge) with unrestricted_guest=0:

    739 cycles/emulated jump instruction
    925 cycles/emulated move instruction
    887 cycles/emulated arithmetic instruction
    916 cycles/emulated memory load instruction
    1109 cycles/emulated memory RMW instruction

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
realmode: fix typo in test_cpuid

ECX is initialized to 0 in case the highest CPUID leaf has
sub-functions (as is the case for 0xD on processors with XSAVE).
However, this was only happening in the big real mode case due
to a typo in the asm constraint.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
realmode: add memory store performance test

Missed this in the previous commit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>