Statistics
| Branch: | Revision:

root / target-i386 / kvm.c @ 1c90ef26

History | View | Annotate | Download (73 kB)

# Date Author Comment
234cc647 02/03/2014 06:33 pm Paolo Bonzini

KVM: fix coexistence of KVM and Hyper-V leaves

kvm_arch_init_vcpu's initialization of the KVM leaves at 0x40000100
is broken, because KVM_CPUID_FEATURES is left at 0x40000001. Move
it to 0x40000101 if Hyper-V is enabled.

Signed-off-by: Paolo Bonzini <>

7bc3d711 02/03/2014 06:33 pm Paolo Bonzini

kvm: make availability of Hyper-V enlightenments dependent on KVM_CAP_HYPERV

The MS docs specify HV_X64_MSR_HYPERCALL as a mandatory interface,
thus we must provide the MSRs even if the user only specified
features that, like relaxed timing, in principle don't require them....

1c90ef26 02/03/2014 06:33 pm Vadim Rozenfeld

kvm: make hyperv hypercall and guest os id MSRs migratable.

Signed-off-by: Vadim Rozenfeld <>
Signed-off-by: Paolo Bonzini <>

0169c511 01/25/2014 01:52 am Anthony Liguori

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

  • qemu-kvm/uq/master:
    kvm: always update the MPX model specific register
    KVM: fix addr type for KVM_IOEVENTFD
    KVM: Retry KVM_CREATE_VM on EINTR
    mempath prefault: fix off-by-one error
    kvm: x86: Separately write feature control MSR on reset...
439d19f2 01/20/2014 03:25 pm Paolo Bonzini

kvm: always update the MPX model specific register

The original patch from Liu Jinsong restricted them to reset or full
state updates, but that's unnecessary (and wrong) since the BNDCFGS
MSR has no side effects.

Cc: Liu Jinsong <>
Signed-off-by: Paolo Bonzini <>

02e51483 12/23/2013 05:30 pm Chen Fan

target-i386: Move apic_state field from CPUX86State to X86CPU

This motion is preparing for refactoring vCPU APIC subsequently.

Signed-off-by: Chen Fan <>
Signed-off-by: Andreas Färber <>

6bdf863d 12/18/2013 11:13 am Jan Kiszka

kvm: x86: Separately write feature control MSR on reset

If the guest is running in nested mode on system reset, clearing the
feature MSR signals the kernel to leave this mode. Recent kernels
processes this properly, but leave the VCPU state undefined behind. It...

0522604b 12/12/2013 02:13 pm Fernando Luis Vázquez Cao

target-i386: clear guest TSC on reset

VCPU TSC is not cleared by a warm reset (*), which leaves some types of Linux
guests (non-pvops guests and those with the kernel parameter no-kvmclock set)
vulnerable to the overflow in cyc2ns_offset fixed by upstream commit...

f86746c2 12/12/2013 02:12 pm Fernando Luis Vázquez Cao

target-i386: do not special case TSC writeback

Newer kernels are capable of synchronizing TSC values of multiple VCPUs
on writeback, but we were excluding the power up case, which is not needed
anymore.

Signed-off-by: Fernando Luis Vazquez Cao <>...

79e9ebeb 12/12/2013 02:10 pm Liu Jinsong

target-i386: Intel MPX

Add some MPX related definiation, and hardcode sizes and offsets
of xsave features 3 and 4. It also add corresponding part to
kvm_get/put_xsave, and vmstate.

Signed-off-by: Liu Jinsong <>
Signed-off-by: Paolo Bonzini <>

ef4cbe14 11/07/2013 01:14 pm Stefan Weil

kvm: Fix uninitialized cpuid_data

This error was reported by valgrind when running qemu-system-x86_64
with kvm:

975 Conditional jump or move depends on uninitialised value(s)
975 at 0x521C38: cpuid_find_entry (kvm.c:176)
975 by 0x5235BA: kvm_arch_init_vcpu (kvm.c:686)...
0fd53fec 11/05/2013 09:34 am Paolo Bonzini

KVM: x86: fix typo in KVM_GET_XCRS

Only the first item of the array was ever looked at. No
practical effect, but still worth fixing.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Gleb Natapov <>

b5d54bd4 08/30/2013 01:21 am Anthony Liguori

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

  • qemu-kvm/uq/master:
    kvm-stub: fix compilation
    kvm: shorten the parameter list for get_real_device()
    kvm: i386: fix LAPIC TSC deadline timer save/restore
    kvm-all.c: max_cpus should not exceed KVM vcpu limit...
7477cd38 08/20/2013 07:38 pm Marcelo Tosatti

kvm: i386: fix LAPIC TSC deadline timer save/restore

The configuration of the timer represented by MSR_IA32_TSCDEADLINE depends on:

- APIC LVT Timer register.
- TSC value.

Change the order to respect the dependency.

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

df67696e 08/20/2013 07:37 pm Liu Jinsong

kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabled

This patch is to fix the bug https://bugs.launchpad.net/qemu-kvm/+bug/1207623

IA32_FEATURE_CONTROL is pointless if not expose VMX or SMX bits to
cpuid.1.ecx of vcpu. Current qemu-kvm will error return when kvm_put_msrs...

92067bf4 08/16/2013 07:44 pm Igor Mammedov

target-i386: Move hyperv_* static globals to X86CPU

- since hyperv_* helper functions are used only in target-i386/kvm.c
move them there as static helpers

Requested-by: Eduardo Habkost <>
Signed-off-by: Igor Mammedov <>...

0d894367 08/09/2013 10:19 pm Paolo Bonzini

kvm: migrate vPMU state

Reviewed-by: Gleb Natapov <>
Signed-off-by: Paolo Bonzini <>

38e478ec 07/27/2013 12:05 am Stefan Weil

kvm: Change prototype of kvm_update_guest_debug()

Passing a CPUState pointer instead of a CPUArchState pointer eliminates
the last target dependent data type in sysemu/kvm.h.

It also simplifies the code.

Signed-off-by: Stefan Weil <>
Acked-by: Paolo Bonzini <>...

0779caeb 07/25/2013 01:09 pm Arthur Chunqi Li

Initialize IA32_FEATURE_CONTROL MSR in reset and migration

The recent KVM patch adds IA32_FEATURE_CONTROL support. QEMU needs
to clear this MSR when reset vCPU and keep the value of it when
migration. This patch add this feature.

Signed-off-by: Arthur Chunqi Li <>...

f17ec444 07/23/2013 03:41 am Andreas Färber

exec: Change cpu_memory_rw_debug() argument to CPUState

Propagate X86CPU in kvmvapic for simplicity.

Signed-off-by: Andreas Färber <>

ed2803da 07/23/2013 03:41 am Andreas Färber

cpu: Move singlestep_enabled field from CPU_COMMON to CPUState

Prepares for changing cpu_single_step() argument to CPUState.

Acked-by: Michael Walle <> (for lm32)
Signed-off-by: Andreas Färber <>

51455c59 07/10/2013 06:54 pm Anthony Liguori

Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings

  • Fix for OpenRISCCPU subclasses
  • Fix for gdbstub CPU selection
  • Move linux-user CPU functions into new header
  • CPUState part 10 refactoring: first_cpu, next_cpu, cpu_single_env et al....
182735ef 07/09/2013 10:32 pm Andreas Färber

cpu: Make first_cpu and next_cpu CPUState

Move next_cpu from CPU_COMMON to CPUState.
Move first_cpu variable to qom/cpu.h.

gdbstub needs to use CPUState::env_ptr for now.
cpu_copy() no longer needs to save and restore cpu_next.

Acked-by: Paolo Bonzini <>...

36ad0e94 07/09/2013 09:38 pm Markus Armbruster

Fix -machine options accel, kernel_irqchip, kvm_shadow_mem

Multiple -machine options with the same ID are merged. All but the
one without an ID are to be silently ignored.

In most places, we query these options with a null ID. This is
correct.

In some places, we instead query whatever options come first in the...

1b5ec234 07/04/2013 06:42 pm Paolo Bonzini

memory: return MemoryRegion from qemu_ram_addr_from_host

It will be needed in the next patch.

Reviewed-by: Jan Kiszka <>
Signed-off-by: Paolo Bonzini <>

dd1750d7 06/28/2013 02:25 pm Andreas Färber

kvm: Change kvm_cpu_synchronize_state() argument to CPUState

It no longer relies on CPUArchState since 20d695a.

Reviewed-by: liguang <>
Acked-by: Paolo Bonzini <>
Reviewed-by: Richard Henderson <>...

cb446eca 06/28/2013 02:25 pm Andreas Färber

kvm: Change cpu_synchronize_state() argument to CPUState

Change Monitor::mon_cpu to CPUState as well.

Reviewed-by: liguang <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Andreas Färber <>

0514ef2f 05/02/2013 01:27 am Eduardo Habkost

target-i386: Replace cpuid_*features fields with a feature word array

This replaces the feature-bit fields on both X86CPU and x86_def_t
structs with an array.

With this, we will be able to simplify code that simply does the same
operation on all feature words (e.g. kvm_check_features_against_host(),...

fc7a504c 05/02/2013 12:21 am Eduardo Habkost

target-i386/kvm.c: Code formatting changes

Add appropriate spaces around operators, and break line where it needs
to be broken to allow feature-words array to be introduced without
having too-long lines.

Signed-off-by: Eduardo Habkost <>...

917367aa 04/18/2013 05:27 am Marcelo Tosatti

target-i386: kvm: save/restore steal time MSR

Read and write steal time MSR, so that reporting is functional across
migration.

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

0d09e41a 04/08/2013 07:13 pm Paolo Bonzini

hw: move headers to include/

Many of these should be cleaned up with proper qdev-/QOM-ification.
Right now there are many catch-all headers in include/hw/ARCH depending
on cpu.h, and this makes it necessary to compile these files per-target.
However, fixing this does not belong in these patches....

259186a7 03/12/2013 11:35 am Andreas Färber

cpu: Move halted and interrupt_request fields to CPUState

Both fields are used in VMState, thus need to be moved together.
Explicitly zero them on reset since they were located before
breakpoints.

Pass PowerPCCPU to kvmppc_handle_halt().

Signed-off-by: Andreas Färber <>

fcd7d003 02/16/2013 03:51 pm Andreas Färber

cpu: Move exit_request field to CPUState

Since it was located before breakpoints field, it needs to be reset.

Signed-off-by: Andreas Färber <>

0893d460 01/30/2013 12:57 am Anthony Liguori

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

  • qemu-kvm/uq/master:
    target-i386: kvm: prevent buffer overflow if -cpu foo, [x]level is too big
    vmxcap: bit 9 of VMX_PROCBASED_CTLS2 is 'virtual interrupt delivery'

Conflicts:
target-i386/kvm.c...

f8bb0565 01/29/2013 08:57 am Igor Mammedov

target-i386: kvm: prevent buffer overflow if -cpu foo, [x]level is too big

Stack corruption may occur if too big 'level' or 'xlevel' values passed
on command line with KVM enabled, due to limited size of cpuid_data
in kvm_arch_init_vcpu().

reproduces with:...

b164e48e 01/27/2013 03:34 pm Eduardo Habkost

kvm: Create kvm_arch_vcpu_id() function

This will allow each architecture to define how the VCPU ID is set on
the KVM_CREATE_VCPU ioctl call.

Signed-off-by: Eduardo Habkost <>
Acked-by: Gleb Natapov <>
Signed-off-by: Andreas Färber <>

83b17af5 01/27/2013 03:34 pm Eduardo Habkost

target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index

The CPU ID in KVM is supposed to be the APIC ID, so change the
KVM_CREATE_VCPU call to match it. The current behavior didn't break
anything yet because today the APIC ID is assumed to be equal to the CPU...

34daffa0 01/02/2013 04:01 pm Anthony Liguori

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

  • qemu-kvm/uq/master:
    qemu-kvm/pci-assign: 64 bits bar emulation
    target-i386: Enabling IA32_TSC_ADJUST for QEMU KVM guest VMs

Signed-off-by: Anthony Liguori <>

501a7ce7 12/23/2012 01:40 am Andreas Färber

Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu

Adapt header include paths.

Signed-off-by: Andreas Färber <>

a60f24b5 12/19/2012 03:09 pm Andreas Färber

cpu: Move kvm_state field into CPUState

Adapt some functions to take CPUState / {PowerPC,S390}CPU argument.

Signed-off-by: Andreas Färber <>

f7575c96 12/19/2012 03:09 pm Andreas Färber

cpu: Move kvm_run into CPUState

Pass CPUState / {X86,S390}CPU to helper functions.

Signed-off-by: Andreas Färber <>

20d695a9 12/19/2012 03:09 pm Andreas Färber

kvm: Pass CPUState to kvm_arch_*

Move kvm_vcpu_dirty field into CPUState to simplify things and change
its type to bool while at it.

Signed-off-by: Andreas Färber <>

1bc22652 12/19/2012 03:09 pm Andreas Färber

kvm: Pass CPUState to kvm_vcpu_ioctl()

Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU.

Signed-off-by: Andreas Färber <>

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

022c62cb 12/19/2012 09:31 am Paolo Bonzini

exec: move include files to include/exec/

Signed-off-by: Paolo Bonzini <>

077805fa 12/19/2012 09:29 am Paolo Bonzini

janitor: do not rely on indirect inclusions of or from qemu-char.h

Various header files rely on qemu-char.h including qemu-config.h or
main-loop.h, but they really do not need qemu-char.h at all (particularly
interesting is the case of the block layer!). Clean this up, and also...

a2cb15b0 12/17/2012 01:02 pm Michael S. Tsirkin

pci: update all users to look in pci/

update all users so we can remove the makefile hack.

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

f28558d3 12/14/2012 10:17 pm Will Auld

target-i386: Enabling IA32_TSC_ADJUST for QEMU KVM guest VMs

CPUID.7.0.EBX1=1 indicates IA32_TSC_ADJUST MSR 0x3b is supported

Basic design is to emulate the MSR by allowing reads and writes to the
hypervisor vcpu specific locations to store the value of the emulated MSRs....

48405526 11/10/2012 03:49 pm Blue Swirl

kvm: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <>
Reviewed-by: Andreas Färber <>

43552994 11/01/2012 06:12 pm Anthony Liguori

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

  • qemu-kvm/uq/master: (28 commits)
    update-linux-headers.sh: Handle new kernel uapi/ directories
    target-i386: kvm_cpu_fill_host: use GET_SUPPORTED_CPUID
    target-i386: cpu: make -cpu host/check/enforce code KVM-specific...
bee615d4 10/31/2012 05:12 am Andreas Färber

target-i386: Pass X86CPU to kvm_mce_inject()

Needed for changing cpu_x86_inject_mce() argument to X86CPU.

Signed-off-by: Andreas Färber <>
[AF: Rebased onto hwaddr]

8c5cf3b6 10/31/2012 05:12 am Andreas Färber

target-i386: Pass X86CPU to cpu_x86_inject_mce()

Needed for changing run_on_cpu() argument to CPUState.

Signed-off-by: Andreas Färber <>

23d02d9b 10/31/2012 05:12 am Andreas Färber

target-i386: Pass X86CPU to kvm_get_mp_state()

Needed for moving halted field to CPUState.

Signed-off-by: Andreas Färber <>

839b5630 10/31/2012 05:12 am Andreas Färber

target-i386: Pass X86CPU to kvm_handle_halt()

Needed for moving interrupt_request and halted fields to CPUState.

Signed-off-by: Andreas Färber <>

c9da8382 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: mask cpuid_ext4_features bits earlier

This way all the filtering by GET_SUPPORTED_CPUID is being done at the
same place in the code.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Marcelo Tosatti <>

bc74b7db 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: filter CPUID feature words earlier, on cpu.c

cpu.c contains the code that will check if all requested CPU features
are available, so the filtering of KVM features must be there, so we can
implement "check" and "enforce" properly.

The only point where kvm_arch_init_vcpu() is called on i386 is:...

ac67ee26 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: set CPUID_EXT_TSC_DEADLINE_TIMER on kvm_arch_get_supported_cpuid()

This moves the CPUID_EXT_TSC_DEADLINE_TIMER CPUID flag hacking from
kvm_arch_init_vcpu() to kvm_arch_get_supported_cpuid().

Full git grep for kvm_arch_get_supported_cpuid:

kvm.h:uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,...
41e5e76d 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: x2apic is not supported without in-kernel irqchip

This is necessary so that x2apic is not improperly enabled when the
in-kernel irqchip is disabled.

This won't generate a warning with "-cpu ...,check" because the current
check/enforce code is broken (it checks the host CPU data directly,...

ea85c9e4 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: mask cpuid_kvm_features earlier

Instead of masking the KVM feature bits very late (while building the
KVM_SET_CPUID2 data), mask it out on env->cpuid_kvm_features, at the
same point where the other feature words are masked out.

Signed-off-by: Eduardo Habkost <>...

c2acb022 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: kvm_arch_get_supported_cpuid: replace if+switch with single 'if'

Additional fixups will be added, and making them a single 'if/else if'
chain makes it clearer than two nested switch statements.

Signed-off-by: Eduardo Habkost <>...

84bd945c 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: set CPUID_EXT_HYPERVISOR on kvm_arch_get_supported_cpuid()

Full grep for kvm_arch_get_supported_cpuid:

kvm.h:uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
target-i386/cpu.c: x86_cpu_def->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX);...
8c723b79 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: kvm_arch_get_supported_cpuid: clean up has_kvm_features check

Instead of a function-specific has_kvm_features variable, simply use a
"found" variable that will be checked in case we have to use the legacy
get_para_features() interface.

No behavior change, just code cleanup....

47111e2c 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: kvm_arch_get_supported_cpuid: use 'entry' variable

The reg switch will be moved to a separate function, so store the entry
pointer in a variable.

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Marcelo Tosatti <>

829ae2f9 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: extract register switch to cpuid_entry_get_reg() function

No behavior change: just code movement.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Marcelo Tosatti <>

4fb73f1d 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: extract CPUID entry lookup to cpuid_find_entry() function

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Marcelo Tosatti <>

dd87f8a6 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: extract try_get_cpuid() loop to get_supported_cpuid() function

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Marcelo Tosatti <>

7b46e5ce 10/31/2012 03:39 am Eduardo Habkost

i386: kvm: kvm_arch_get_supported_cpuid: move R_EDX hack outside of for loop

The for loop will become a separate function, so clean it up so it can
become independent from the bit hacking for R_EDX.

No behavior change1, just code movement.

[1] Well, only if the kernel returned CPUID leafs 1 or 0x80000001 as...

2fa45344 10/31/2012 02:02 am Andreas Färber

cpus: Pass CPUState to cpu_is_stopped()

CPUArchState is no longer needed there.

Also change the return type to bool.

Signed-off-by: Andreas Färber <>

60e82579 10/31/2012 02:02 am Andreas Färber

cpus: Pass CPUState to qemu_cpu_is_self()

Change return type to bool, move to include/qemu/cpu.h and
add documentation.

Signed-off-by: Andreas Färber <>
Reviewed-by: Igor Mammedov <>
[AF: Updated new caller qemu_in_vcpu_thread()]

a8170e5e 10/23/2012 04:58 pm Avi Kivity

Rename target_phys_addr_t to hwaddr

target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific). Replace it with a finger-friendly,...

8fad4b44 09/30/2012 02:11 pm Eduardo Habkost

i386: kvm: use a #define for the set of alias feature bits

Instea of using a hardcoded hex constant, define CPUID_EXT2_AMD_ALIASES
as the set of CPUID[8000_0001].EDX bits that on AMD are the same as the
bits of CPUID1.EDX.

Signed-off-by: Eduardo Habkost <>...

b1f46793 09/30/2012 02:10 pm Eduardo Habkost

i386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved

Bit 10 of CPUID[8000_0001].EDX is not defined as an alias of
CPUID1.EDX10, so do not duplicate it on
kvm_arch_get_supported_cpuid().

Signed-off-by: Eduardo Habkost <>
Reviewed-By: Igor Mammedov <>...

b139bd30 09/10/2012 03:29 pm Jan Kiszka

kvm: i386: Add services required for PCI device assignment

These helpers abstract the interaction of upcoming pci-assign with the
KVM kernel services. Put them under i386 only as other archs will
implement device pass-through via VFIO and not this classic interface....

bc9a839d 08/29/2012 06:51 pm Michael S. Tsirkin

kvm: get/set PV EOI MSR

Support get/set of new PV EOI MSR, for migration.
Add an optional section for MSR value - send it
out in case MSR was changed from the default value (0).

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

f3e1bed8 08/09/2012 04:16 pm Peter Maydell

kvm: Decouple 'GSI routing' from 'kernel irqchip'

Don't assume having an in-kernel irqchip means that GSI
routing is enabled.

Signed-off-by: Peter Maydell <>
Signed-off-by: Avi Kivity <>

cc7e0ddf 08/09/2012 04:16 pm Peter Maydell

kvm: Decouple 'irqfds usable' from 'kernel irqchip'

Instead of assuming that we can use irqfds if and only if
kvm_irqchip_in_kernel(), add a bool to the KVMState which
indicates this, and is set only on x86 and only if the
irqchip is in the kernel.

The kernel documentation implies that the only thing...

614e41bc 08/09/2012 04:16 pm Peter Maydell

kvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'

Decouple another x86-specific assumption about what irqchips imply.

Signed-off-by: Peter Maydell <>
Signed-off-by: Avi Kivity <>

1d31f66b 08/09/2012 04:16 pm Peter Maydell

kvm: Move kvm_allows_irq0_override() to target-i386, fix return type

kvm_allows_irq0_override() is a totally x86 specific concept:
move it to the target-specific source file where it belongs.
This means we need a new header file for the prototype:
kvm_i386.h, in line with the existing kvm_ppc.h....

dd673288 08/01/2012 04:45 pm Igor Mammedov

target-i386: move cpu halted decision into x86_cpu_reset

MP initialization protocol differs between cpu families, and for P6 and
onward models it is up to CPU to decide if it will be BSP using this
protocol, so try to model this. However there is no point in implementing...

5d62c43a 07/10/2012 11:31 am Jan Kiszka

apic: Defer interrupt updates to VCPU thread

KVM performs TPR raising asynchronously to QEMU, specifically outside
QEMU's global lock. When an interrupt is injected into the APIC and TPR
is checked to decide if this can be delivered, a stale TPR value may be...

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