Statistics
| Branch: | Revision:

root / kvm-all.c @ 18f1c729

History | View | Annotate | Download (35.7 kB)

# Date Author Comment
5300f1a5 05/05/2011 04:39 pm Michael S. Tsirkin

Merge remote branch 'origin/master' into pci

Conflicts:
exec.c

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

kvm: use qemu_free consistently

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

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

kvm: Install specialized interrupt handler

KVM only requires to set the raised IRQ in CPUState and to kick the
receiving vcpu if it is remote. Installing a specialized handler allows
potential future changes to the TCG code path without risking KVM side
effects....

51b0c606 05/02/2011 03:38 pm Michael Tokarev

fix crash in migration, 32-bit userspace on 64-bit host

This change fixes a long-standing immediate crash (memory corruption
and abort in glibc malloc code) in migration on 32bits.

The bug is present since this commit:

commit 692d9aca97b865b0f7903565274a52606910f129...
25254bbc 04/06/2011 11:08 pm Michael S. Tsirkin

kvm: halve number of set memory calls for vga

use the new api to reduce the number of these (expensive)
system calls.

Note: using this API, we should be able to
get rid of vga_dirty_log_xxx APIs. Using them doesn't
affect the performance though because we detects...

0fd542fb 04/06/2011 10:28 pm Michael S. Tsirkin

cpu: add set_memory flag to request dirty logging

Pass the flag to all cpu notifiers, doing
nothing at this point. Will be used by
follow-up patches.

Signed-off-by: Michael S. Tsirkin <>

51e8fa60 03/16/2011 10:11 pm Jan Kiszka

kvm: Consider EXIT_DEBUG unknown without CAP_SET_GUEST_DEBUG

Without KVM_CAP_SET_GUEST_DEBUG, we neither motivate the kernel to
report KVM_EXIT_DEBUG nor do we expect such exits. So fall through to
the arch code which will simply report an unknown exit reason....

7cbb533f 03/16/2011 10:11 pm Jan Kiszka

kvm: Keep KVM_RUN return value in separate variable

Avoid using 'ret' both for the return value of KVM_RUN as well as the
code kvm_cpu_exec is supposed to return. Both have no direct relation.

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

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

kvm: Reorder error handling of KVM_RUN

Test for general errors first as this is the slower path.

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

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

kvm: Rework inner loop of kvm_cpu_exec

Let kvm_cpu_exec return EXCP_* values consistently and generate those
codes already inside its inner loop. This means we will now re-enter the
kernel while ret == 0.

Update kvm_handle_internal_error accordingly, but keep...

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...

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 <>

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

kvm: Mark VCPU state dirty on creation

This avoids that early cpu_synchronize_state calls try to retrieve an
uninitialized state from the kernel. That even causes a deadlock if
io-thread is enabled.

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

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 <>

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

kvm: Fix build warning when KVM_CAP_SET_GUEST_DEBUG is lacking

Original fix by David Gibson.

CC: David Gibson <>
Signed-off-by: Jan Kiszka <>
Signed-off-by: Marcelo Tosatti <>

e5896b12 02/14/2011 04:39 pm Anthony PERARD

Introduce log_start/log_stop in CPUPhysMemoryClient

In order to use log_start/log_stop with Xen as well in the vga code,
this two operations have been put in CPUPhysMemoryClient.

The two new functions cpu_physical_log_start,cpu_physical_log_stop are
used in hw/vga.c and replace the kvm_log_start/stop. With this, vga does...

6a7af8cb 02/14/2011 04:39 pm Jan Kiszka

kvm: Make kvm_state globally available

KVM-assisted devices need access to it but we have no clean channel to
distribute a reference. As a workaround until there is a better
solution, export kvm_state for global use, though use should remain
restricted to the mentioned scenario....

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

Improve vm_stop reason declarations

Define and use dedicated constants for vm_stop reasons, they actually
have nothing to do with the EXCP_* defines used so far. At this chance,
specify more detailed reasons so that VM state change handlers can
evaluate them....

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....

8e045ac4 02/14/2011 04:39 pm Jan Kiszka

kvm: Remove unneeded memory slot reservation

The number of slots and the location of private ones changed several
times in KVM's early days. However, it's stable since 2.6.29 (our
required baseline), and slots 8..11 are no longer reserved since then.
So remove this unneeded restriction....

748a680b 02/14/2011 04:39 pm Jan Kiszka

kvm: Report proper error on GET_VCPU_MMAP_SIZE failures

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...

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

kvm: Remove static return code of kvm_handle_io

Improve the readability of the exit dispatcher by moving the static
return value of kvm_handle_io to its caller.

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

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

kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN

The reset we issue on KVM_EXIT_SHUTDOWN implies that we should also
leave the VCPU loop. As we now check for exit_request which is set by
qemu_system_reset_request, this bug is no longer critical. Still it's an...

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 <>

d0dcac83 01/31/2011 11:03 am Stefan Hajnoczi

virtio-pci: Disable virtio-ioeventfd when !CONFIG_IOTHREAD

It is not possible to use virtio-ioeventfd when building without an I/O
thread. We rely on a signal to kick us out of vcpu execution. Timers
and AIO use SIGALRM and SIGUSR2 respectively. Unfortunately eventfd...

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 <>...

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

kvm: Flush coalesced mmio buffer on IO window exits

We must flush pending mmio writes if we leave kvm_cpu_exec for an IO
window. Otherwise we risk to loose those requests when migrating to a
different host during that window.

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

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 <>

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....

a426e122 01/21/2011 06:12 pm Jan Kiszka

kvm: Fix coding style violations

No functional changes.

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

14a09518 01/21/2011 06:05 pm Lai Jiangshan

kvm: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension()

simple cleanup and use existing helper: kvm_check_extension().

Signed-off-by: Lai Jiangshan <>
Signed-off-by: Marcelo Tosatti <>

d2f2b8a7 01/10/2011 02:44 pm Stefan Hajnoczi

kvm: test for ioeventfd support on old kernels

There used to be a limit of 6 KVM io bus devices in the kernel.
On such a kernel, we can't use many ioeventfds for host notification
since the limit is reached too easily.

Add an API to test for this condition....

b2e0a138 12/02/2010 09:13 pm Michael S. Tsirkin

migration: stable ram block ordering

This makes ram block ordering under migration stable, ordered by offset.
This is especially useful for migration to exec, for debugging.

Signed-off-by: Michael S. Tsirkin <>
Tested-by: Jason Wang <>

983dfc3b 10/21/2010 12:15 am Huang Ying

Add RAM -> physical addr mapping in MCE simulation

In QEMU-KVM, physical address != RAM address. While MCE simulation
needs physical address instead of RAM address. So
kvm_physical_memory_addr_from_ram() is implemented to do the
conversion, and it is invoked before being filled in the IA32_MCi_ADDR...

e78815a5 09/25/2010 02:26 pm Andreas Färber

Introduce qemu_madvise()

vl.c has a Sun-specific hack to supply a prototype for madvise(),
but the call site has apparently moved to arch_init.c.

Haiku doesn't implement madvise() in favor of posix_madvise().
OpenBSD and Solaris 10 don't implement posix_madvise() but madvise()....

e945fb76 08/23/2010 11:10 pm Anthony Liguori

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

44f1a3d8 08/11/2010 12:25 am Cam Macdonell

Add function to assign ioeventfd to MMIO.

Signed-off-by: Cam Macdonell <>
Signed-off-by: Anthony Liguori <>

14542fea 08/05/2010 03:57 pm Gleb Natapov

kvm: remove guest triggerable abort()

This abort() condition is easily triggerable by a guest if it configures
pci bar with unaligned address that overlaps main memory.

Signed-off-by: Gleb Natapov <>
Signed-off-by: Marcelo Tosatti <>

70fedd76 08/05/2010 03:57 pm Alex Williamson

kvm: Don't walk memory_size == 0 slots in kvm_client_migration_log

If we've unregistered a memory area, we should avoid calling
qemu_get_ram_ptr() on the left over phys_offset cruft in the
slot array. Now that we support removing ramblocks, the
phys_offset ram_addr_t can go away and cause a lookup fault...

3c638d06 07/22/2010 06:52 am Jan Kiszka

Rework debug exception processing for gdb use

Guest debugging is currently broken under CONFIG_IOTHREAD. The reason is
inconsistent or even lacking signaling the debug events from the source
VCPU to the main loop and the gdbstub.

This patch addresses the issue by pushing this signaling into a...

be41cbe0 06/28/2010 07:06 pm Jan Kiszka

kvm: Switch kvm_update_guest_debug to run_on_cpu

Guest debugging under KVM is currently broken once io-threads are
enabled. Easily fixable by switching the fake on_vcpu to the real
run_on_cpu implementation.

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

f1665b21 06/28/2010 07:06 pm Sheng Yang

kvm: Enable XSAVE live migration support

Signed-off-by: Sheng Yang <>
Signed-off-by: Marcelo Tosatti <>

4513d923 05/11/2010 08:03 pm Gleb Natapov

Do not stop VM if emulation failed in userspace.

Continue vcpu execution in case emulation failure happened while vcpu
was in userspace. In this case #UD will be injected into the guest
allowing guest OS to kill offending process and continue.

Signed-off-by: Gleb Natapov <>...

2705d56a 05/11/2010 08:02 pm Jan Kiszka

kvm: synchronize state from cpu context

It is not safe to retrieve the KVM internal state of a given cpu
while its potentially modifying it.

Queue the request to run on cpu context, similarly to qemu-kvm.

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

0af691d7 05/11/2010 08:02 pm Marcelo Tosatti

kvm: enable smp > 1

Process INIT/SIPI requests and enable -smp > 1.

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Avi Kivity <>

273faf1b 05/11/2010 08:02 pm Marcelo Tosatti

kvm: set cpu_single_env around KVM_RUN ioctl

Zero cpu_single_env before leaving global lock protection, and
restore on return.

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Avi Kivity <>

8369e01c 04/28/2010 07:41 pm Marcelo Tosatti

kvm: port qemu-kvm's bitmap scanning

Which is significantly faster.

Signed-off-by: Marcelo Tosatti <>

ff44f1a3 04/26/2010 05:28 pm Jan Kiszka

KVM: x86: Add debug register saving and restoring

Make use of the new KVM_GET/SET_DEBUGREGS to save/restore the x86 debug
registers.

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

7c80eef8 04/26/2010 05:28 pm Marcelo Tosatti

kvm: handle internal error

Port qemu-kvm's KVM_EXIT_INTERNAL_ERROR handling to upstream.

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Avi Kivity <>

98c8573e 04/19/2010 09:59 pm Paolo Bonzini

provide a stub version of kvm-all.c if !CONFIG_KVM

This allows limited use of kvm functions (which will return ENOSYS)
even in once-compiled modules. The patch also improves a bit the error
messages for KVM initialization.

Signed-off-by: Paolo Bonzini <>...

8c0d577e 04/18/2010 05:22 pm Blue Swirl

kvm: avoid collision with dprintf macro in stdio.h, spotted by clang

Fixes clang errors:
CC i386-softmmu/kvm.o
/src/qemu/target-i386/kvm.c:40:9: error: 'dprintf' macro redefined
In file included from /src/qemu/target-i386/kvm.c:21:
In file included from /src/qemu/qemu-common.h:27:...

0104dcac 04/01/2010 10:51 pm Alexander Graf

S390: Tell user why VM creation failed

The KVM kernel module on S390 refuses to create a VM when the switch_amode
kernel parameter is not used.

Since that is not exactly obvious, let's give the user a nice warning.

Signed-off-by: Alexander Graf <>...

ca821806 04/01/2010 09:56 pm Michael S. Tsirkin

kvm: add API to set ioeventfd

Comment on kvm usage: rather than require users to do if (kvm_enabled())
and/or ifdefs, this patch adds an API that, internally, is defined to
stub function on non-kvm build, and checks kvm_enabled for non-kvm
run.

While rest of qemu code still uses if (kvm_enabled()), I think this...

d745bef8 03/29/2010 10:23 pm Blue Swirl

Move KVM and Xen global flags to vl.c

Signed-off-by: Blue Swirl <>

ea375f9a 03/04/2010 05:29 am Jan Kiszka

KVM: Rework VCPU state writeback API

This grand cleanup drops all reset and vmsave/load related
synchronization points in favor of four(!) generic hooks:

- cpu_synchronize_all_states in qemu_savevm_state_complete
(initial sync from kernel before vmsave)...

b0b1d690 03/04/2010 05:29 am Jan Kiszka

KVM: Rework of guest debug state writing

So far we synchronized any dirty VCPU state back into the kernel before
updating the guest debug state. This was a tribute to a deficite in x86
kernels before 2.6.33. But as this is an arch-dependent issue, it is
better handle in the x86 part of KVM and remove the writeback point for...

85199474 02/22/2010 07:04 pm Marcelo Tosatti

kvm-all.c: define smp_wmb and use it for coalesced mmio

Acked-by: "Michael S. Tsirkin" <>
Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Avi Kivity <>

cc84de95 02/22/2010 10:58 am Marcelo Tosatti

kvm: consume internal signal with sigtimedwait

Change the way the internal qemu signal, used for communication between
iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which
allows more precise timing control....

6312b928 02/22/2010 10:58 am Marcelo Tosatti

kvm: remove pre-entry exit_request check with iothread enabled

With SIG_IPI blocked vcpu loop exit notification happens via -EAGAIN
from KVM_RUN.

Signed-off-by: Marcelo Tosatti <>
Signed-off-by: Avi Kivity <>

a2eebe88 02/10/2010 08:45 pm Amit Shah

kvm: reduce code duplication in config_iothread

We have some duplicated code in the CONFIG_IOTHREAD #ifdef and #else
cases. Fix that.

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

46dbef6a 02/10/2010 12:56 am Michael S. Tsirkin

kvm: move kvm_set_phys_mem around

move kvm_set_phys_mem so that it will
be later available earlier in the file.
needed for next patch using memory notifiers.

Signed-off-by: Michael S. Tsirkin <>
Acked-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

7b8f3b78 02/10/2010 12:56 am Michael S. Tsirkin

kvm: move kvm to use memory notifiers

remove direct kvm calls from exec.c, make
kvm use memory notifiers framework instead.

Signed-off-by: Michael S. Tsirkin <>
Acked-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

9ded2744 02/03/2010 11:47 pm Jan Kiszka

KVM: Move and rename regs_modified

Touching the user space representation of KVM's VCPU state is -
naturally - a per-VCPU thing. So move the dirty flag into KVM_CPU_COMMON
and rename it at this chance to reflect its true meaning.

Signed-off-by: Jan Kiszka <>

62a2744c 02/03/2010 11:47 pm Sheng Yang

kvm: Flush coalesced MMIO buffer periodly

The default action of coalesced MMIO is, cache the writing in buffer, until:
1. The buffer is full.
2. Or the exit to QEmu due to other reasons.

But this would result in a very late writing in some condition.
1. The each time write to MMIO content is small....

a0fb002c 12/03/2009 11:25 pm Jan Kiszka

kvm: x86: Add support for VCPU event states

This patch extends the qemu-kvm state sync logic with support for
KVM_GET/SET_VCPU_EVENTS, giving access to yet missing exception,
interrupt and NMI states.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

40ff6d7e 12/03/2009 07:45 pm Kevin Wolf

Don't leak file descriptors

We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
descriptors that don't need to be passed to children to stop this misbehaviour.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

caa5af0f 11/17/2009 04:49 pm Jan Kiszka

kvm: Add arch reset handler

Will be required by succeeding changes.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

9bdbe550 11/12/2009 07:23 pm Hollis Blanchard

kvm: Move KVM mp_state accessors to i386-specific code

Unbreaks PowerPC and S390 KVM builds.

Signed-off-by: Hollis Blanchard <>
Signed-off-by: Anthony Liguori <>

d549db5a 10/12/2009 05:42 pm Glauber Costa

unlock iothread mutex before running kvm ioctl

Without this, kvm will hold the mutex while it issues its run ioctl,
and never be able to step out of it, causing a deadlock.

Patchworks-ID: 35359
Signed-off-by: Glauber Costa <>
Signed-off-by: Anthony Liguori <>

b3807725 10/05/2009 05:32 pm Jan Kiszka

kvm: Fix guest single-stepping

Hopefully the last regression of 4c0960c0: KVM_SET_GUEST_DEBUG requires
properly synchronized guest registers (on x86: eflags) on entry.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

828566bc 10/05/2009 05:32 pm Glauber Costa

temporary fix for on_vcpu

Recent changes made on_vcpu hit the abort() path, even with the IO thread
disabled. This is because cpu_single_env is no longer set when we call this
function. Although the correct fix is a little bit more complicated that that,...

c227f099 10/02/2009 12:12 am Anthony Liguori

Revert "Get rid of _t suffix"

In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem. Something
like this must be presented on the list first so people can provide input...

99a0949b 10/01/2009 09:45 pm malc

Get rid of _t suffix

Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <>

afcea8cb 09/20/2009 07:05 pm Blue Swirl

ioports: remove unused env parameter and compile only once

The CPU state parameter is not used, remove it and adjust callers. Now we
can compile ioport.c once for all targets.

Signed-off-by: Blue Swirl <>

72cf2d4f 09/12/2009 10:36 am Blue Swirl

Fix sys-queue.h conflict for good

Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...

4c0960c0 08/28/2009 04:35 am Avi Kivity

kvm: Simplify cpu_synchronize_state()

cpu_synchronize_state() is a little unreadable since the 'modified'
argument isn't self-explanatory. Simplify it by making it always
synchronize the kernel state into qemu, and automatically flush the
registers back to the kernel if they've been synchronized on this...

6e489f3f 07/27/2009 11:26 pm Anthony Liguori

Revert "Fake dirty loggin when it's not there"

This reverts commit bd8367761236cd5c435598aeb2f1b8240c09b059.

PPC should just implement dirty logging so we can avoid all the fall-out from
this changeset.

Signed-off-by: Anthony Liguori <>

fc5d642f 07/27/2009 10:09 pm Luiz Capitulino

Fix broken build

The only caller of on_vcpu() is protected by ifdef
KVM_CAP_SET_GUEST_DEBUG, so protect on_vcpu() too otherwise QEMU
may not to build.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Anthony Liguori <>

1c7936e3 07/27/2009 10:09 pm Alexander Graf

Use 64bit pointer for dirty log

Dirty logs currently get written with native "long" size. On little endian
it doesn't matter if we use uint64_t instead though, because we'd still end
up using the right bytes.

On big endian, this does become a bigger problem, so we need to ensure that...

96c1606b 07/27/2009 10:09 pm Alexander Graf

Use Little Endian for Dirty Log

We currently use host endian long types to store information
in the dirty bitmap.

This works reasonably well on Little Endian targets, because the
u32 after the first contains the next 32 bits. On Big Endian this
breaks completely though, forcing us to be inventive here....

452e4751 07/22/2009 06:58 pm Glauber Costa

introduce on_vcpu

on_vcpu is a qemu-kvm function that will make sure that a specific
piece of code will run on a requested cpu. We don't need that because
we're restricted to -smp 1 right now, but those days are likely to end soon.

So for the benefit of having qemu-kvm share more code with us, I'm...

6f725c13 07/22/2009 06:58 pm Glauber Costa

provide tests for pit in kernel and irqchip in kernel

KVM can have an in-kernel pit or irqchip. While we don't implement it
yet, having a way for test for it (that always returns zero) will allow us
to reuse code in qemu-kvm that tests for it.

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

b80a55e6 07/22/2009 06:58 pm Alexander Graf

Fix warning in kvm-all.c

This fixes a warning I stumbled across while compiling qemu on PPC64.

Signed-off-by: Alexander Graf <>
Signed-off-by: Anthony Liguori <>

bd836776 07/22/2009 06:58 pm Alexander Graf

Fake dirty loggin when it's not there

Some KVM platforms don't support dirty logging yet, like IA64 and PPC,
so in order to still have screen updates on those, we need to fake it.

This patch just tells the getter function for dirty bitmaps, that all
pages within a slot are dirty when the slot has dirty logging enabled....

a08d4367 06/29/2009 10:18 pm Jan Kiszka

Revert "Introduce reset notifier order"

This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and
updates later added users of qemu_register_reset), we solved the
problem it originally addressed less invasively.

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

8d2ba1fb 06/29/2009 10:18 pm Jan Kiszka

kvm: Rework VCPU synchronization

During startup and after reset we have to synchronize user space to the
in-kernel KVM state. Namely, we need to transfer the VCPU registers when
they change due to VCPU as well as APIC reset.

This patch refactors the required hooks so that kvm_init_vcpu registers...

8c14c173 06/16/2009 11:36 pm Jan Kiszka

kvm: Fix IRQ injection into full queue

User space may only inject interrupts during kvm_arch_pre_run if
ready_for_interrupt_injection is set in kvm_run. But that field is
updated on exit from KVM_RUN, so we must ensure that we enter the
kernel after potentially queuing an interrupt, otherwise we risk to...

168ccc11 06/07/2009 04:40 pm Jan Kiszka

kvm: Improve upgrade notes when facing unsupported kernels

Users complained that it is not obvious what to do when kvm refuses to
build or run due to an unsupported host kernel, so let's improve the
hints.

Signed-off-by: Jan Kiszka <>

d33a1810 05/22/2009 06:50 pm Jan Kiszka

kvm: Rework VCPU reset

Use standard callback with highest order to synchronize VCPU on reset
after all device callbacks were execute. This allows to remove the
special kvm hook in qemu_system_reset.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

f8d926e9 05/22/2009 06:50 pm Jan Kiszka

kvm: x86: Save/restore KVM-specific CPU states

Save and restore all so far neglected KVM-specific CPU states. Handling
the TSC stabilizes migration in KVM mode. The interrupt_bitmap and
mp_state are currently unused, but will become relevant for in-kernel...

4495d6a7 05/22/2009 06:50 pm Jan Kiszka

kvm: Introduce kvm_set_migration_log

Introduce a global dirty logging flag that enforces logging for all
slots. This can be used by the live migration code to enable/disable
global logging withouth destroying the per-slot setting.

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

62518b8b 05/22/2009 06:50 pm Jan Kiszka

kvm: Fix dirty log temporary buffer size

The buffer passed to KVM_GET_DIRTY_LOG requires one bit per page. Fix
the size calculation in kvm_physical_sync_dirty_bitmap accordingly,
avoiding allocation of extremly oversized buffers.

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

151f7749 05/22/2009 06:50 pm Jan Kiszka

kvm: Rework dirty bitmap synchronization

Extend kvm_physical_sync_dirty_bitmap() so that is can sync across
multiple slots. Useful for updating the whole dirty log during
migration. Moreover, properly pass down errors the whole call chain.

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

e69917e2 05/22/2009 06:50 pm Jan Kiszka

kvm: Conditionally apply workaround for KVM slot handling bug

Only apply the workaround for broken slot joining in KVM when the
capability was not found that signals the corresponding fix existence.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

9f8fd694 05/20/2009 05:24 pm Mark McLoughlin

kvm: add error message for when SMP is requested

Right now, if you try e.g. '-smp 2' you just get 'failed to
initialize KVM'.

Signed-off-by: Mark McLoughlin <>

ad7b8b33 05/08/2009 11:42 pm Anthony Liguori

Introduce kvm_check_extension to check if KVM extensions are supported

Signed-off-by: Anthony Liguori <>