Statistics
| Branch: | Revision:

root / target-i386 @ c6bfc164

# Date Author Comment
c6bfc164 09/02/2011 01:08 pm Boris Figovsky

x86: fix daa opcode for al register values higher than 0xf9

The second if statement should consider the original al register value,
and not the new one.

Signed-off-by: Boris Figovsky <>
Reviewed-by: Peter Maydell <>...

fdc9c41a 08/25/2011 11:21 am Jan Kiszka

Fix up some style nits of last uq/master merge

Signed-off-by: Jan Kiszka <>
Signed-off-by: Stefan Hajnoczi <>

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

986563b1 08/08/2011 10:38 pm Anthony Liguori

Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

97b348e7 08/07/2011 12:32 pm Blue Swirl

Remove unused is_softmmu parameter from cpu_handle_mmu_fault

Parameter is_softmmu (and its evil mutant twin brother is_softmuu)
is not used in cpu_*_handle_mmu_fault() functions, remove them
and adjust callers.

Acked-by: Richard Henderson <>...

d5ab9713 08/05/2011 06:57 pm Jan Kiszka

Avoid allocating TCG resources in non-TCG mode

Do not allocate TCG-only resources like the translation buffer when
running over KVM or XEN. Saves a "few" bytes in the qemu address space
and is also conceptually cleaner.

Signed-off-by: Jan Kiszka <>...

ac363c90 08/05/2011 06:10 pm Marcelo Tosatti

Remove #ifdef KVM_CAP_TSC_CONTROL

Signed-off-by: Marcelo Tosatti <>

b862d1fe 08/05/2011 06:04 pm Joerg Roedel

qemu-x86: Add tsc_freq option to -cpu

To let the user configure the desired tsc frequency for the
guest if running in KVM.

Signed-off-by: Joerg Roedel <>
Signed-off-by: Marcelo Tosatti <>

e7429073 08/05/2011 06:04 pm Joerg Roedel

qemu-x86: Set tsc_khz in kvm when supported

Make use of the KVM_TSC_CONTROL feature if available.

Signed-off-by: Joerg Roedel <>
Signed-off-by: Marcelo Tosatti <>

3e457172 07/30/2011 12:41 pm Blue Swirl

exec.h cleanup

Move softmmu_exec.h include directives from target-*/exec.h to
target-*/op_helper.c. Move also various other stuff only used in
op_helper.c there.

Define global env in dyngen-exec.h.

For i386, move wrappers for segment and FPU helpers from user-exec.c...

2b41f10e 06/26/2011 09:25 pm Blue Swirl

Remove exec-all.h include directives

Most exec-all.h include directives are now useless, remove them.

Signed-off-by: Blue Swirl <>

f081c76c 06/26/2011 09:25 pm Blue Swirl

Move cpu_has_work and cpu_pc_from_tb to cpu.h

Move functions cpu_has_work() and cpu_pc_from_tb() from exec.h to cpu.h. This is
needed by later patches.

Signed-off-by: Blue Swirl <>

f3e27037 06/26/2011 09:25 pm Blue Swirl

exec.h: fix coding style and change cpu_has_work to return bool

Before the next patch, fix coding style of the areas affected.

Change the type of the return value from cpu_has_work() and
qemu_cpu_has_work() to bool.

Signed-off-by: Blue Swirl <>

e694d4e2 06/26/2011 09:25 pm Blue Swirl

x86: use caller supplied CPUState for interrupt related stuff

Several x86 specific functions are called from cpu-exec.c with the
assumption that global env register is valid. This will be changed
later, so make the functions use caller supplied CPUState parameter....

1162c041 06/26/2011 09:25 pm Blue Swirl

cpu_loop_exit: avoid using AREG0

Make cpu_loop_exit() take a parameter for CPUState instead of relying
on global env.

Signed-off-by: Blue Swirl <>

ca98557a 06/21/2011 07:53 pm Marcelo Tosatti

kvm: fix FPU state subsection

There is no need to specify version on the subsection fields.

Signed-off-by: Marcelo Tosatti <>

31e8c696 06/20/2011 09:26 pm Andre Przywara

KVM: Fix XSAVE feature bit enumeration

When iterating through the XSAVE feature enumeration CPUID leaf (0xD)
we should not stop at the first zero EAX, but instead keep scanning
since there are gaps in the enumeration (ECX=1 for instance).
This fixes the proper usage of AVX in KVM guests....

ba9bc59e 06/20/2011 09:24 pm Jan Kiszka

kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid

kvm_arch_get_supported_cpuid checks for global cpuid restrictions, it
does not require any CPUState reference. Changing its interface allows
to call it before any VCPU is initialized.

CC: Eduardo Habkost <>...

e56ff191 06/20/2011 09:19 pm Jan Kiszka

kvm: x86: Drop KVM_CAP build dependencies

No longer needed with accompanied kernel headers.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

5802e066 06/20/2011 09:16 pm Jan Kiszka

kvm: Drop CONFIG_KVM_PARA

The kvm_para.h header is now always available.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

42cc8fa6 06/19/2011 03:57 pm Jan Kiszka

kvm: x86: Save/restore FPU OP, IP and DP

These FPU states are properly maintained by KVM but not yet by TCG. So
far we unconditionally set them to 0 in the guest which may cause
state corruptions, though not with modern guests.

To avoid breaking backward migration, use a conditional subsection that...

b3baa152 06/14/2011 05:34 pm brillywu@viatech.com.cn

kvm: Add CPUID support for VIA CPU

When KVM is running on VIA CPU with host cpu's model, the
feautures of VIA CPU will be passed into kvm guest by calling
the CPUID instruction for Centaur.

Signed-off-by: BrillyWu<>
Signed-off-by: KaryJin<>...

f7911686 06/14/2011 05:34 pm Yang, Wei Y

kvm: Enable CPU SMEP feature

This patchset enables a new CPU feature SMEP (Supervisor Mode Execution
Protection) in QEMU-KVM. SMEP prevents kernel from executing code in application.
Updated Intel SDM describes this CPU feature. The document will be published soon....

9bf0960a 06/08/2011 11:04 am Alexandre Raymond

Fix compilation warning due to missing header for sigaction (followup)

This patch removes all references to signal.h when qemu-common.h is included
as they become redundant.

Signed-off-by: Alexandre Raymond <>
Signed-off-by: Stefan Hajnoczi <>

8001c294 06/08/2011 11:04 am Martin Simmons

target-i386: Make x86 mfence and lfence illegal without SSE2

While trying to use qemu -cpu pentium3 to test for incorrect uses of certain
SSE2 instructions, I found that QEMU allowed the mfence and lfence
instructions to be executed even though Pentium 3 doesn't support them....

66fcf8ff 06/03/2011 05:07 pm Aurelien Jarno

target-i386: use floatx80 constants in helper_fld*_ST0()

Instead of using a table which doesn't correspond to anything from
physical in the CPU, use directly the constants in helper_fld*_ST0().

Cc: Andreas Färber <>
Reviewed-by: Peter Maydell <>...

c31da136 06/03/2011 05:07 pm Aurelien Jarno

target-i386: remove old code handling float64

Now that target-i386 uses softfloat, floatx80 is always available and
there is no need anymore to have code handling both float64 and floax80.

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

85097db6 05/08/2011 07:55 pm Richard Henderson

irq: Privatize CPU_INTERRUPT_NMI.

This interrupt name is used by i386, CRIS, and MicroBlaze.
Copy the name into each target.

Signed-off-by: Richard Henderson <>
Signed-off-by: Blue Swirl <>

00a152b4 05/08/2011 07:55 pm Richard Henderson

target-i386: Privatize some i386-specific interrupt names.

SMI, VIRQ, INIT, SIPI, and MCE are all only used by the i386 port.

Signed-off-by: Richard Henderson <>
Signed-off-by: Blue Swirl <>

4a043713 05/02/2011 03:51 pm Paolo Bonzini

kvm: use qemu_free consistently

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Marcelo Tosatti <>

e41e0fc6 05/02/2011 03:38 pm Jan Kiszka

x86: Allow multiple cpu feature matches of lookup_feature

kvmclock is represented by two feature bits. Therefore, lookup_feature
needs to continue its search even after the first match. Enhance it
accordingly and switch to a bool return type at this chance....

642258c6 05/02/2011 03:38 pm Glauber Costa

kvm: add kvmclock to its second bit

We have two bits that can represent kvmclock in cpuid.
They signal the guest which msr set to use. When we tweak flags
involving this value - specially when we use "-", we have to act on both.

Signed-off-by: Glauber Costa <>...

0c31b744 05/02/2011 02:24 pm Glauber Costa

kvm: use kernel-provided para_features instead of statically coming up with new capabilities

Use the features provided by KVM_GET_SUPPORTED_CPUID directly to
mask out features from guest-visible cpuid.

The old get_para_features() mechanism is kept for older kernels that do not implement it....

be1c17c7 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix helper_fscale() wrt softfloat

Use the scalbn softfloat function to implement helper_fscale(). This
fixes corner cases (e.g. NaN) and makes a few more GNU libc math tests
to pass.

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

788e7336 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix helper_fbld_ST0() wrt softfloat

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

c9ad19c5 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix helper_fxtract() wrt softfloat

With softfloat it's not possible to play with the overflow of an
unsigned value to get the 0 case partially correct. Use a special case
for that. Using a division to generate an infinity is the easiest way
that works for both softfloat and softfloat-native....

13822781 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix helper_fdiv() wrt softfloat

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

fec05e42 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix helper_fsqrt() wrt softfloat

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

c2ef9a83 04/25/2011 12:18 pm Aurelien Jarno

target-i386: replace approx_rsqrt and approx_rcp by softfloat ops

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

47c0143c 04/25/2011 12:18 pm Aurelien Jarno

target-i386: add CPU86_LDouble <-> double conversion functions

Add functions to convert CPU86_LDouble to double and vice versa. They
are going to be used to implement logarithmic and trigonometric function
until softfloat implement them.

Reviewed-by: Peter Maydell <>...

a2c9ed3c 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix logarithmic and trigonometric helpers wrt softfloat

Use the new CPU86_LDouble <-> double conversion functions to make logarithmic
and trigonometric helpers working with softfloat.

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

bcb5fec5 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix helper_fprem() and helper_fprem1() wrt softfloat

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

a1d8db07 04/25/2011 12:18 pm Aurelien Jarno

target-i386: fix constants wrt softfloat

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

618ba8e6 04/20/2011 11:37 am Stefan Weil

Remove unused function parameter from cpu_restore_state

The previous patch removed the need for parameter puc.
Is is now unused, so remove it.

Cc: Aurelien Jarno <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Stefan Weil <>

e87b7cb0 04/20/2011 11:33 am Stefan Weil

Remove unused function parameters from gen_pc_load and rename the function

Function gen_pc_load was introduced in commit
d2856f1ad4c259e5766847c49acbb4e390731bd4.
The only reason for parameter searched_pc was
a debug statement in target-i386/translate.c....

1ffd41ee 04/17/2011 09:32 pm Aurelien Jarno

target-i386: use CPU_LDoubleU instead of a private union

Use CPU_LDoubleU in cpu_dump_state() instead of redefining a union for
doing the conversion.

Based on a patch from Laurent Vivier <>.

Cc: Laurent Vivier <>
Reviewed-by: Peter Maydell <>...

c4137223 04/17/2011 09:32 pm Aurelien Jarno

target-i386: use float unions from cpu-all.h

Use float unions from cpu-all.h instead of redefining new (wrong for arm)
ones in target-i386. This also allows building cpu-exec.o with softfloat.

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

67dd64bf 04/17/2011 09:32 pm Aurelien Jarno

target-i386: add floatx_{add,mul,sub} and use them

Add floatx_{add,mul,sub} defines, and use them instead of using direct
C operations.

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

e0b29ce1 04/17/2011 09:32 pm Aurelien Jarno

target-i386: fix CMPUNORDPS/D and CMPORDPS/D instructions

SSE instructions CMPUNORDPS/D and CMPORDPS/D do not trigger an invalid
exception if operands are qNANs.

Reviewed-by: Peter Maydell <>
Signed-off-by: Aurelien Jarno <>

211315fb 04/17/2011 09:32 pm Aurelien Jarno

softfloat: rename float*_eq() into float*_eq_quiet()

float*_eq functions have a different semantics than other comparison
functions. Fix that by first renaming float*_quiet() into float*_eq_quiet().

Note that it is purely mechanical, and the behaviour should be unchanged....

4b4a72e5 04/10/2011 01:45 am Stefan Weil

Fix conversions from pointer to tcg_target_long

tcg_gen_exit_tb takes a parameter of type tcg_target_long,
so the type casts of pointer to long should be replaced by
type casts of pointer to tcg_target_long (suggested by Blue Swirl).

These changes are needed for build environments where...

4ac8e585 03/23/2011 02:05 am Anthony Liguori

Revert "x86: Save/restore PAT MSR"

This reverts commit c995b495b9d6e60ab1e390bd398a22425d0b3c8c.

From Jan Kiszka:

Ouch, indeed. Moreover, CPU_SAVE_VERSION was not updated (likely the
reason for the breakage). Thanks for debugging this!
Anthony (or whoever), please revert this unneeded commit in qemu.git....
bb4ea393 03/16/2011 10:11 pm Jan Kiszka

kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes

Make the return code of kvm_arch_handle_exit directly usable for
kvm_cpu_exec. This is straightforward for x86 and ppc, just s390
would require more work. Avoid this for now by pushing the return code...

2a4dac83 03/16/2011 10:11 pm Jan Kiszka

kvm: x86: Reorder functions in kvm.c

Required for next patch which will access guest debug services from
kvm_arch_handle_exit. No functional changes.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

f2574737 03/16/2011 10:11 pm Jan Kiszka

kvm: x86: Push kvm_arch_debug to kvm_arch_handle_exit

There are no generic bits remaining in the handling of KVM_EXIT_DEBUG.
So push its logic completely into arch hands, i.e. only x86 so far.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

4601f7b0 03/16/2011 10:11 pm Jan Kiszka

kvm: x86: Do not leave halt if interrupts are disabled

When an external interrupt is pending but IF is cleared, we must not
leave the halt state prematurely.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

ebda377f 03/16/2011 10:11 pm Jan Kiszka

x86: Properly reset PAT MSR

Conforming to the Intel spec, set the power-on value of PAT also on
reset, but save it across INIT.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

c995b495 03/16/2011 10:11 pm Jan Kiszka

x86: Save/restore PAT MSR

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

0c03266a 03/16/2011 10:11 pm Jan Kiszka

kvm: x86: Synchronize PAT MSR with the kernel

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

c34d440a 03/15/2011 06:19 am Jan Kiszka

kvm: x86: Consolidate TCG and KVM MCE injection code

This switches KVM's MCE injection path to cpu_x86_inject_mce, both for
SIGBUS and monitor initiated events. This means we prepare the MCA MSRs
in the VCPUState also for KVM.

We have to drop the MSRs writeback restrictions for this purpose which...

32a42024 03/15/2011 06:19 am Jan Kiszka

kvm: x86: Clean up kvm_setup_mce

There is nothing to abstract here. Fold kvm_setup_mce into its caller
and fix up the error reporting (return code of kvm_vcpu_ioctl holds the
error value).

Signed-off-by: Jan Kiszka <>
CC: Huang Ying <>...

75d49497 03/15/2011 06:19 am Jan Kiszka

kvm: x86: Fail kvm_arch_init_vcpu if MCE initialization fails

There is no reason to continue if the kernel claims to support MCE but
then fails to process our request.

Signed-off-by: Jan Kiszka <>
CC: Huang Ying <>...

3c85e74f 03/15/2011 06:19 am Huang Ying

KVM, MCE, unpoison memory address across reboot

In Linux kernel HWPoison processing implementation, the virtual
address in processes mapping the error physical memory page is marked
as HWPoison. So that, the further accessing to the virtual
address will kill corresponding processes with SIGBUS....

ac098781 03/15/2011 06:19 am Jan Kiszka

x86: Account for MCE in cpu_has_work

MCEs can be injected asynchronously, so they can also terminate the halt
state.

Signed-off-by: Jan Kiszka <>
CC: Huang Ying <>
CC: Hidetoshi Seto <>...

18559232 03/15/2011 06:19 am Jan Kiszka

x86: Perform implicit mcg_status reset

Reorder mcg_status in CPUState to achieve automatic clearing on reset.

Signed-off-by: Jan Kiszka <>
CC: Huang Ying <>
CC: Hidetoshi Seto <>
CC: Jin Dongming <>...

2fa11da0 03/15/2011 06:19 am Jan Kiszka

x86: Small cleanups of MCE helpers

Fix some code style issues, use proper headers, and align to cpu_x86
naming scheme. No functional changes.

Signed-off-by: Jan Kiszka <>
CC: Huang Ying <>
CC: Hidetoshi Seto <>...

316378e4 03/15/2011 06:19 am Jan Kiszka

x86: Refine error reporting of MCE injection services

As this service is used by the human monitor, make sure that errors get
reported to the right channel, and also raise the verbosity.

This requires to move Monitor typedef in qemu-common.h to resolve the...

747461c7 03/15/2011 06:19 am Jan Kiszka

x86: Optionally avoid injecting AO MCEs while others are pending

Allow to tell cpu_x86_inject_mce that it should ignore Action Optional
MCE events when the target VCPU is still processing another one. This
will be used by KVM soon.

Signed-off-by: Jan Kiszka <>...

419fb20a 03/15/2011 06:19 am Jan Kiszka

kvm: x86: Move MCE functions together

Pure function suffling to avoid multiple #ifdef KVM_CAP_MCE sections,
no functional changes. While at it, annotate some #ifdef sections.

Signed-off-by: Jan Kiszka <>
CC: Huang Ying <>...

99036865 03/15/2011 06:19 am Jan Kiszka

kvm: Rename kvm_arch_process_irqchip_events to async_events

We will broaden the scope of this function on x86 beyond irqchip events.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

ab443475 03/15/2011 06:19 am Jan Kiszka

kvm: x86: Inject pending MCE events on state writeback

The current way of injecting MCE events without updating of and
synchronizing with the CPUState is broken and causes spurious
corruptions of the MCE-related parts of the CPUState.

As a first step towards a fix, enhance the state writeback code with...

d5bfda33 03/15/2011 06:19 am Jan Kiszka

x86: Run qemu_inject_x86_mce on target VCPU

We will use the current TCG-only MCE injection path for KVM as well, and
then this read-modify-write of the target VCPU state has to be performed
synchronously in the corresponding thread.

Signed-off-by: Jan Kiszka <>...

b7680cb6 03/13/2011 04:44 pm Jan Kiszka

Refactor thread retrieval and check

We have qemu_cpu_self and qemu_thread_self. The latter is retrieving the
current thread, the former is checking for equality (using CPUState). We
also have qemu_thread_equal which is only used like qemu_cpu_self.

This refactors the interfaces, creating qemu_cpu_is_self and...

eda48c34 03/13/2011 04:44 pm Paolo Bonzini

inline cpu_halted into sole caller

All implementations are now the same, and there is only one caller,
so inline the function there.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

b8cc45d6 02/14/2011 04:39 pm Glauber Costa

kvm: make tsc stable over migration and machine start

If the machine is stopped, we should not record two different tsc values
upon a save operation. The same problem happens with kvmclock.

But kvmclock is taking a different diretion, being now seen as a separate...

6792a57b 02/14/2011 04:39 pm Jan Kiszka

kvm: Separate TCG from KVM cpu execution

Mixing up TCG bits with KVM already led to problems around eflags
emulation on x86. Moreover, quite some code that TCG requires on cpu
enty/exit is useless for KVM. So dispatch between tcg_cpu_exec and
kvm_cpu_exec as early as possible....

db1669bc 02/14/2011 04:39 pm Jan Kiszka

kvm: x86: Prepare VCPU loop for in-kernel irqchip

Effectively no functional change yet as kvm_irqchip_in_kernel still only
returns 0, but this patch will allow qemu-kvm to adopt the VCPU loop of
upsteam KVM.

Signed-off-by: Jan Kiszka <>...

7a39fe58 02/14/2011 04:39 pm Jan Kiszka

kvm: Drop return values from kvm_arch_pre/post_run

We do not check them, and the only arch with non-empty implementations
always returns 0 (this is also true for qemu-kvm).

Signed-off-by: Jan Kiszka <>
CC: Alexander Graf <>...

ce377af3 02/14/2011 04:39 pm Jan Kiszka

kvm: x86: Catch and report failing IRQ and NMI injections

We do not need to abort, but the user should be notified that weird
things go on.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

a1b87fe0 02/14/2011 04:39 pm Jan Kiszka

kvm: Provide sigbus services arch-independently

Provide arch-independent kvm_on_sigbus* stubs to remove the #ifdef'ery
from cpus.c. This patch also fixes --disable-kvm build by providing the
missing kvm_on_sigbus_vcpu kvm-stub.

Signed-off-by: Jan Kiszka <>...

9ccfac9e 02/14/2011 04:39 pm Jan Kiszka

kvm: Unconditionally reenter kernel after IO exits

KVM requires to reenter the kernel after IO exits in order to complete
instruction emulation. Failing to do so will leave the kernel state
inconsistently behind. To ensure that we will get back ASAP, we issue a...

29057492 02/08/2011 01:36 pm Jan Kiszka

x86: Fix MCA broadcast parameters for TCG case

When broadcasting MCEs, we need to set MCIP and RIPV in mcg_status like
it is done for KVM. Use the symbolic constants at this chance.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>...

b3a98367 02/01/2011 11:32 pm Anthony Liguori

Merge remote branch 'qemu-kvm/uq/master' into staging

aliguori: fix build with !defined(KVM_CAP_ASYNC_PF)

Signed-off-by: Anthony Liguori <>

94a8d39a 01/23/2011 06:27 am Jan Kiszka

kvm: Consolidate must-have capability checks

Instead of splattering the code with #ifdefs and runtime checks for
capabilities we cannot work without anyway, provide central test
infrastructure for verifying their availability both at build and
runtime.

Signed-off-by: Jan Kiszka <>...

11076198 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Rework identity map and TSS setup for larger BIOS sizes

In order to support loading BIOSes > 256K, reorder the code, adjusting
the base if the kernel supports moving the identity map.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

d8f771d9 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Implicitly clear nmi_injected/pending on reset

All CPUX86State variables before CPU_COMMON are automatically cleared on
reset. Reorder nmi_injected and nmi_pending to avoid having to touch
them explicitly.

Signed-off-by: Jan Kiszka <>...

c5999bfc 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Only read/write MSR_KVM_ASYNC_PF_EN if supported

If the kernel does not support KVM_CAP_ASYNC_PF, it also does not know
about the related MSR. So skip it during state synchronization in that
case. Fixes annoying kernel warnings.

Signed-off-by: Jan Kiszka <>...

0d75a9ec 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Align kvm_arch_put_registers code with comment

The ordering doesn't matter in this case, but better keep it consistent.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

c14750e8 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Prepare kvm_get_mp_state for in-kernel irqchip

This code path will not yet be taken as we still lack in-kernel irqchip
support. But qemu-kvm can already make use of it and drop its own
mp_state access services.

Signed-off-by: Jan Kiszka <>...

3390e7f7 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Remove redundant mp_state initialization

kvm_arch_reset_vcpu initializes mp_state, and that function is invoked
right after kvm_arch_init_vcpu.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

1a5e9d2f 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Fix xcr0 reset mismerge

For unknown reasons, xcr0 reset ended up in kvm_arch_update_guest_debug
on upstream merge. Fix this and also remove the misleading comment (1 is
THE reset value).

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

c3a3a7d3 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Refactor msr_star/hsave_pa setup and checks

Simplify kvm_has_msr_star/hsave_pa to booleans and push their one-time
initialization into kvm_arch_init. Also handle potential errors of that
setup procedure.

Signed-off-by: Jan Kiszka <>...

ff5c186b 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Reset paravirtual MSRs

Make sure to write the cleared MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
and MSR_KVM_ASYNC_PF_EN to the kernel state so that a freshly booted
guest cannot be disturbed by old values.

Signed-off-by: Jan Kiszka <>...

521f0798 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Fix !CONFIG_KVM_PARA build

If we lack kvm_para.h, MSR_KVM_ASYNC_PF_EN is not defined. The change in
kvm_arch_init_vcpu is just for consistency reasons.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

cad1e282 01/23/2011 06:27 am Jan Kiszka

kvm: Drop smp_cpus argument from init functions

No longer used.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

646042e1 01/23/2011 06:27 am Jan Kiszka

kvm: x86: Swallow KVM_EXIT_SET_TPR

This exit only triggers activity in the common exit path, but we should
accept it in order to be able to detect unknown exit types.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

73aaec4a 01/23/2011 06:27 am Jan Kiszka

kvm: Stop on all fatal exit reasons

Ensure that we stop the guest whenever we face a fatal or unknown exit
reason. If we stop, we also have to enforce a cpu loop exit.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

bb44e0d1 01/23/2011 06:27 am Jan Kiszka

kvm: Improve reporting of fatal errors

Report KVM_EXIT_UNKNOWN, KVM_EXIT_FAIL_ENTRY, and KVM_EXIT_EXCEPTION
with more details to stderr. The latter two are so far x86-only, so move
them into the arch-specific handler. Integrate the Intel real mode
warning on KVM_EXIT_FAIL_ENTRY that qemu-kvm carries, but actually...

f5c848ee 01/23/2011 06:27 am Jan Kiszka

x86: Optionally dump code bytes on cpu_dump_state

Introduce the cpu_dump_state flag CPU_DUMP_CODE and implement it for
x86. This writes out the code bytes around the current instruction
pointer. Make use of this feature in KVM to help debugging fatal vm
exits....

b9bec74b 01/21/2011 06:05 pm Jan Kiszka

kvm: x86: Fix a few coding style violations

No functional changes.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>