Statistics
| Branch: | Revision:

root / target-i386 / kvm.c @ a75b3e0f

History | View | Annotate | Download (57.6 kB)

# Date Author Comment
a75b3e0f 07/03/2012 11:36 pm Liu, Jinsong

kvm: expose tsc deadline timer feature to guest

This patch exposes tsc deadline timer feature to guest if
1). in-kernel irqchip is used, and
2). kvm has emulated tsc deadline timer, and
3). user authorize the feature exposing via cpu or +/ tsc-deadline...

232fc23b 06/05/2012 12:00 am Andreas Färber

target-i386: Pass X86CPU to do_cpu_{init,sipi}()

Allows to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <>
Reviewed-by: Igor Mammedov <>

317ac620 03/14/2012 11:20 pm Andreas Färber

target-i386: Don't overuse CPUState

Scripted conversion:
sed -i "s/CPUState/CPUX86State/g" target-i386/*.[hc]
sed -i "s/#define CPUX86State/#define CPUState/" target-i386/cpu.h

Signed-off-by: Andreas Färber <>
Acked-by: Anthony Liguori <>

7e680753 03/07/2012 12:31 pm Michael S. Tsirkin

kvm: fill in padding to help valgrind

valgrind warns about padding fields which are passed
to vcpu ioctls uninitialized.
This is not an error in practice because kvm ignored padding.
Since the ioctls in question are off data path and
the cost is zero anyway, initialize padding to 0...

d362e757 02/18/2012 12:15 pm Jan Kiszka

target-i386: Add infrastructure for reporting TPR MMIO accesses

This will allow the APIC core to file a TPR access report. Depending on
the accelerator and kernel irqchip mode, it will either be delivered
right away or queued for later reporting.

In TCG mode, we can restart the triggering instruction and can therefore...

d1f86636 02/16/2012 06:21 pm Gleb Natapov

kvm: Synchronize cpu state in kvm_arch_stop_on_emulation_error()

Call to kvm_cpu_synchronize_state() is missing.
kvm_arch_stop_on_emulation_error may look at outdated registers here.

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

39d6960a 02/08/2012 07:57 pm Jan Kiszka

kvm: Allow to set shadow MMU size

Introduce the KVM-specific machine option kvm_shadow_mem. It allows to
set a custom shadow MMU size for the virtual machine. This is useful for
stress testing e.g.

Only x86 supports this for now, but it is in principle a generic...

3d4b2649 02/08/2012 07:57 pm Jan Kiszka

kvm: Implement kvm_irqchip_in_kernel like kvm_enabled

To both avoid that kvm_irqchip_in_kernel always has to be paired with
kvm_enabled and that the former ends up in a function call, implement it
like the latter. This means keeping the state in a global variable and...

84b058d7 01/19/2012 01:14 pm Jan Kiszka

kvm: Introduce core services for in-kernel irqchip support

Add the basic infrastructure to active in-kernel irqchip support, inject
interrupts into these models, and maintain IRQ routes.

Routing is optional and depends on the host arch supporting
KVM_CAP_IRQ_ROUTING. When it's not available on x86, we looe the HPET as...

680c1c6f 01/19/2012 01:14 pm Jan Kiszka

kvm: x86: Add user space part for in-kernel APIC

This introduces the alternative APIC device which makes use of KVM's
in-kernel device model. External NMI injection via LINT1 is emulated by
checking the current state of the in-kernel APIC, only injecting a NMI...

eab70139 01/19/2012 12:33 pm Vadim Rozenfeld

hyper-v: initialize Hyper-V CPUID leaves.

Signed-off-by: Marcelo Tosatti <>

f3c6a169 01/03/2012 10:39 pm Anthony Liguori

Merge remote-tracking branch 'qemu-kvm/memory/page_desc' into staging

  • qemu-kvm/memory/page_desc: (22 commits)
    Remove cpu_get_physical_page_desc()
    sparc: avoid cpu_get_physical_page_desc()
    virtio-balloon: avoid cpu_get_physical_page_desc()
    vhost: avoid cpu_get_physical_page_desc()...
fabacc0f 12/22/2011 06:53 pm Jan Kiszka

kvm: x86: Avoid runtime allocation of xsave buffer

Keep a per-VCPU xsave buffer for kvm_put/get_xsave instead of
continuously allocating and freeing it on state sync.

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

cce47516 12/22/2011 06:53 pm Jan Kiszka

kvm: x86: Drop redundant apic base and tpr update from kvm_get_sregs

The latter was already commented out, the former is redundant as well.
We always get the latest changes after return from the guest via
kvm_arch_post_run.

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

6b42494b 12/22/2011 06:53 pm Jan Kiszka

kvm: x86: Use symbols for all xsave field

Field 0 (FCW+FSW) and 1 (FTW+FOP) were hard-coded so far.

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

9f213ed9 12/20/2011 02:14 pm Avi Kivity

kvm: switch kvm slots to use host virtual address instead of ram_addr_t

This simplifies a later switch to the memory API in slot management.

Signed-off-by: Avi Kivity <>

12619721 11/17/2011 02:57 pm Vagrant Cascadian

Fix typo: runnning -> running

One n too many for running, need we say more.

Signed-Off-By: Vagrant Cascadian <>

Signed-off-by: Stefan Hajnoczi <>

21e87c46 10/25/2011 02:33 am Avi Kivity

i386: wire up MSR_IA32_MISC_ENABLE

It's needed for its default value - bit 0 specifies that "rep movs" is
good enough for memcpy, and Linux may use a slower memcpu if it is not set,
depending on cpu family/model.

Signed-off-by: Avi Kivity <>...

aa82ba54 10/25/2011 02:29 am Liu, Jinsong

kvm: support TSC deadline MSR with subsection

KVM add emulation of lapic tsc deadline timer for guest.
This patch is co-operation work at qemu side.

Use subsections to save/restore the field (mtosatti).

Signed-off-by: Liu, Jinsong <>...

38d2c27e 10/25/2011 02:27 am Marcelo Tosatti

Revert "kvm: support TSC deadline MSR"

This reverts commit bfc2455ddbb41148494a084d15777e6bed7533c3.
New patch with subsections will follow.

Signed-off-by: Marcelo Tosatti <>

bfc2455d 10/03/2011 07:53 pm Liu, Jinsong

kvm: support TSC deadline MSR

KVM add emulation of lapic tsc deadline timer for guest.
This patch is co-operation work at qemu side.

Signed-off-by: Liu, Jinsong <>
Signed-off-by: Marcelo Tosatti <>

1dfb4dd9 09/15/2011 10:39 pm Luiz Capitulino

Replace the VMSTOP macros with a proper state type

Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is....

1354869c 09/15/2011 10:39 pm Luiz Capitulino

Drop the vm_running global variable

Use runstate_is_running() instead, which is introduced by this commit.

Signed-off-by: Luiz Capitulino <>

6115c0a8 09/10/2011 05:50 pm Blue Swirl

kvm: remove unnecessary assignments

Avoid these warnings from clang analyzer:
/src/qemu/target-i386/kvm.c:772:5: warning: Value stored to 'cwd' is never read
cwd = swd = twd = 0;
/src/qemu/target-i386/kvm.c:772:11: warning: Although the value stored to 'swd' is used in the enclosing expression, the value is never actually read from 'swd'...

541dc0d4 09/03/2011 01:45 pm Stefan Weil

Use new macro QEMU_PACKED for packed structures

Most changes were made using these commands:

git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'...

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

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

Remove #ifdef KVM_CAP_TSC_CONTROL

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

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

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

kvm: use qemu_free consistently

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

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

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

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

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

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

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

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

31ce5e0c 01/21/2011 06:05 pm Jin Dongming

Add "broadcast" option for mce command

When the following test case is injected with mce command, maybe user could not
get the expected result.
DATA
command cpu bank status mcg_status addr misc
(qemu) mce 1 1 0xbd00000000000000 0x05 0x1234 0x8c...

2bd3e04c 01/21/2011 06:05 pm Jin Dongming

Add function for checking mca broadcast of CPU

Add function for checking whether current CPU support mca broadcast.

Signed-off-by: Jin Dongming <>
Signed-off-by: Marcelo Tosatti <>

6643e2f0 01/21/2011 06:05 pm Jin Dongming

kvm: introduce kvm_mce_in_progress

Share same error handing, and rename this function after
MCIP (Machine Check In Progress) flag.

Signed-off-by: Hidetoshi Seto <>
Signed-off-by: Jin Dongming <>...

e387c338 01/21/2011 06:05 pm Jin Dongming

kvm: kvm_mce_inj_* subroutines for templated error injections

Refactor codes for maintainability.

Signed-off-by: Hidetoshi Seto <>
Signed-off-by: Jin Dongming <>
Signed-off-by: Marcelo Tosatti <>

7cc2cc3e 01/21/2011 06:05 pm Jin Dongming

kvm: introduce kvm_inject_x86_mce_on

Pass a table instead of multiple args.

Note:

kvm_inject_x86_mce(env, bank, status, mcg_status, addr, misc,
abort_on_error);

is equal to:

struct kvm_x86_mce mce = {
.bank = bank,...
acaa7550 01/21/2011 06:05 pm Jan Kiszka

kvm: x86: Fix DPL write back of segment registers

The DPL is stored in the flags and not in the selector. In fact, the RPL
may differ from the DPL at some point in time, and so we were corrupting
the guest state so far.

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

3980e302 01/21/2011 06:05 pm Jan Kiszka

kvm: x86: Remove obsolete SS.RPL/DPL aligment

This seems to date back to the days KVM didn't support real mode. The
check is no longer needed and, even worse, is corrupting the guest state
in case SS.RPL != DPL.

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

95c077c9 01/21/2011 06:05 pm Jan Kiszka

kvm: x86: Prevent sign extension of DR7 in guest debugging mode

This unbreaks guest debugging when the 4th hardware breakpoint used for
guest debugging is a watchpoint of 4 or 8 byte lenght. The 31st bit of
DR7 is set in that case and used to cause a sign extension to the high...

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

276ce815 01/21/2011 06:05 pm Lai Jiangshan

kvm: Enable user space NMI injection for kvm guest

Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
user space raised them. (example: qemu monitor's "nmi" command)

Signed-off-by: Lai Jiangshan <>
Acked-by: Jan Kiszka <>...

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

f6584ee2 11/16/2010 04:40 pm Gleb Natapov

Add support for async page fault to qemu

Add save/restore of MSR for migration and cpuid bit.

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

25d2e361 10/21/2010 06:37 pm Marcelo Tosatti

kvm: save/restore x86-64 MSRs on x86-64 kernels

Signed-off-by: Marcelo Tosatti <>

384331a6 10/21/2010 06:37 pm Marcelo Tosatti

kvm: writeback SMP TSCs on migration only

commit 6389c45441269baa2873e6feafebd17105ddeaf6
Author: Jan Kiszka <>
Date: Mon Mar 1 18:17:26 2010 +0100

qemu-kvm: Cleanup/fix TSC and PV clock writeback

Signed-off-by: Marcelo Tosatti <>

75b10c43 10/21/2010 06:37 pm Marcelo Tosatti

kvm: factor out kvm_has_msr_star

And add kvm_has_msr_hsave_pa(), to avoid warnings on older
kernels without support.

Signed-off-by: Marcelo Tosatti <>

aa851e36 10/21/2010 06:37 pm Marcelo Tosatti

kvm: add save/restore of MSR_VM_HSAVE_PA

commit 2bba4446746add456ceeb0e8359a43032a2ea333
Author: Alexander Graf <>
Date: Thu Dec 18 15:38:32 2008 +0100

Enable nested SVM support in userspace

Signed-off-by: Marcelo Tosatti <>

d8da8574 10/21/2010 06:12 pm Hidetoshi Seto

Fix build on !KVM_CAP_MCE

This patch removes following warnings:

target-i386/kvm.c: In function 'kvm_put_msrs':
target-i386/kvm.c:782: error: unused variable 'i'
target-i386/kvm.c: In function 'kvm_get_msrs':
target-i386/kvm.c:1083: error: label at end of compound statement...

f71ac88f 10/21/2010 06:11 pm Hidetoshi Seto

x86, mce: broadcast mce depending on the cpu version

There is no reason why SRAO event received by the main thread
is the only one that being broadcasted.

According to the x86 ASDM vol.3A 15.10.4.1,
MCE signal is broadcast on processor version 06H_EH or later....

f8502cfb 10/21/2010 06:09 pm Hidetoshi Seto

x86, mce: ignore SRAO only when MCG_SER_P is available

And restruct this block to call kvm_mce_in_exception() only when it is
required.

Signed-off-by: Hidetoshi Seto <>
Signed-off-by: Marcelo Tosatti <>

296acb64 10/21/2010 12:15 am Joerg Roedel

Add svm cpuid features

This patch adds the svm cpuid feature flags to the qemu
intialization path. It also adds the svm features available
on phenom to its cpu-definition and extends the host cpu
type to support all svm features KVM can provide.

Signed-off-by: Joerg Roedel <>...

e7701825 10/21/2010 12:15 am Marcelo Tosatti

kvm: x86: add mce support

Port qemu-kvm's MCE support

commit c68b2374c9048812f488e00ffb95db66c0bc07a7
Author: Huang Ying <>
Date: Mon Jul 20 10:00:53 2009 +0800

Add MCE simulation support to qemu/kvm
KVM ioctls are used to initialize MCE simulation and inject MCE. The...
c0532a76 10/21/2010 12:15 am Marcelo Tosatti

MCE: Relay UCR MCE to guest

Port qemu-kvm's

commit 4b62fff1101a7ad77553147717a8bd3bf79df7ef
Author: Huang Ying <>
Date: Mon Sep 21 10:43:25 2009 +0800

MCE: Relay UCR MCE to guest
UCR (uncorrected recovery) MCE is supported in recent Intel CPUs,...
57780495 10/21/2010 12:15 am Marcelo Tosatti

Add savevm/loadvm support for MCE

Port qemu-kvm's

commit 1bab5d11545d8de5facf46c28630085a2f9651ae
Author: Huang Ying <>
Date: Wed Mar 3 16:52:46 2010 +0800

Add savevm/loadvm support for MCE
MCE registers are saved/load into/from CPUState in...
0f53994f 10/21/2010 12:15 am Marcelo Tosatti

Fix memory leak in register save load due to xsave support

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

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

ddced198 06/28/2010 07:06 pm Marcelo Tosatti

kvm: init mp_state

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

408392b3 06/28/2010 07:06 pm Sheng Yang

kvm: Fix cpu_is_bsp() compilation warning

Signed-off-by: Sheng Yang <>
Signed-off-by: Avi Kivity <>