Statistics
| Branch: | Revision:

root / target-i386 / cpu.c @ feature-archipelago

History | View | Annotate | Download (91.3 kB)

# Date Author Comment
48a5f3bc 02/03/2014 06:33 pm Vadim Rozenfeld

kvm: add support for hyper-v timers

http://msdn.microsoft.com/en-us/library/windows/hardware/ff541625%28v=vs.85%29.aspx

This code is generic for activating reference time counter or virtual reference time stamp counter

Signed-off-by: Vadim Rozenfeld <>...

c1f41226 02/03/2014 06:33 pm Eduardo Habkost

target-i386: Eliminate CONFIG_KVM #ifdefs

The compiler is already able to eliminate the kvm_arch_get_supported_cpuid()
calls in kvm_cpu_fill_host() and filter_features_for_kvm(), so we can
eliminate the CONFIG_KVM #ifdefs there.

Also, kvm_cpu_fill_host() and host_cpuid() don't need to check...

82beb536 02/03/2014 06:33 pm Eduardo Habkost

target-i386: Don't change x86_def_t struct on cpu_x86_register()

As eventually the x86_def_t data is going to be provided by the CPU
class, it's better to not touch it, and handle the special cases on the
X86CPU object itself.

Current behavior of the code should stay exactly the same....

7c08db30 02/03/2014 06:33 pm Eduardo Habkost

target-i386: Move KVM default-vendor hack to instance_init

As we will not have a cpu_x86_find_by_name() function anymore,
move the KVM default-vendor hack to instance_init.

Unfortunately we can't move that code to class_init because it depends
on KVM being initialized....

81e20770 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_cpu_fill_host(): Kill unused code

Those host_cpuid() calls are useless. They are leftovers from when the
old code using host_cpuid() was removed.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Paolo Bonzini <>

7171a393 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_cpu_fill_host(): No need to check level

There's no need to check level (CPUID0.EAX) before calling
kvm_arch_get_supported_cpuid(s, 0x7, 0, R_EBX), because:

  • The kernel won't return any entry for CPUID 7 if CPUID0.EAX is < 7
    on the host (See kvm_dev_ioctl_get_cpuid() on the kernel code);...
b73dcfb1 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_cpu_fill_host(): No need to check CPU vendor

There's no need to check CPU vendor before calling
kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX), because:

  • The kernel won't return any entry for 0xC0000000 if host CPU vendor
    is not Centaur (See kvm_dev_ioctl_get_cpuid() on the kernel code);...
803a9327 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_cpu_fill_host(): No need to check xlevel2

There's no need to check CPU xlevel2 before calling
kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX), because:

  • The kernel won't return any entry for 0xC0000000 if host CPU vendor
    is not Centaur (See kvm_dev_ioctl_get_supported_cpuid() on the kernel...
2a573259 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_cpu_fill_host(): Set all feature words at end of function

Reorder the code so all the code that sets x86_cpu_def->features is at
the end of the function.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Paolo Bonzini <>

2bc65d2b 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_cpu_fill_host(): Fill feature words in a loop

Now that the kvm_cpu_fill_host() code is simplified, we can simply set
the feature word array using a simple loop.

Signed-off-by: Eduardo Habkost <>
Signed-off-by: Paolo Bonzini <>

f0b9b111 02/03/2014 06:33 pm Eduardo Habkost

target-i386: kvm_check_features_against_host(): Kill feature word array

We don't need the ft[] array on kvm_check_features_against_host()
anymore, as we can simply use the feature_word_info[] array, that has
everything we need.

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

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...
133fe774 01/14/2014 04:10 am Edgar E. Iglesias

Merge remote branch 'luiz/queue/qmp' into qmpq

  • luiz/queue/qmp:
    migration: qmp_migrate(): keep working after syntax error
    qerror: Remove assert_no_error()
    qemu-option: Remove qemu_opts_create_nofail
    target-i386: Remove assert_no_error usage
    hw: Remove assert_no_error usages...
00b81053 01/06/2014 10:02 pm Peter Crosthwaite

target-i386: Remove assert_no_error usage

Replace an assert_no_error() usage with the error_abort system.

Signed-off-by: Peter Crosthwaite <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

258f5abe 12/24/2013 02:47 pm Igor Mammedov

target-i386: Cleanup 'foo' feature handling

Features check, enforce, hv_relaxed and hv_vapic are treated as boolean
set to 'on' when passed from command line, so it's not necessary to
handle each of them separately. Collapse them to one catch-all branch
which will treat any feature in format 'foo' as boolean set to 'on'....

d024d209 12/24/2013 02:47 pm Igor Mammedov

target-i386: Cleanup 'foo=val' feature handling

Features family, model, stepping, level, hv_spinlocks are treated similarly
when passed from command line, so it's not necessary to handle each of them
individually. Collapse them to one catch-all branch which will treat...

912ffc47 12/24/2013 02:47 pm Igor Mammedov

target-i386: Convert 'check' and 'enforce' to static properties

  • Additionally convert check_cpuid & enforce_cpuid to bool and make them
    members of X86CPU
  • Make 'enforce' feature independent from 'check'

Signed-off-by: Igor Mammedov <>...

89314504 12/24/2013 01:30 pm Igor Mammedov

target-i386: Convert 'hv_relaxed' to static property

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

0f46685d 12/24/2013 01:30 pm Igor Mammedov

target-i386: Convert 'hv_vapic' to static property

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

c8f0f88e 12/24/2013 01:30 pm Igor Mammedov

target-i386: Convert 'hv_spinlocks' to static property

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

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

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

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

33f373d7 12/05/2013 07:51 pm Liu Jinsong

target-i386: fix cpuid leaf 0x0d

Fix cpuid leaf 0x0d which incorrectly parsed eax and ebx.

However, before this patch the CPUID worked fine -- the .offset
field contained the size and was stored in the register that
is supposed to hold the size (eax), and likewise the .size field...

76c2975a 11/21/2013 05:56 pm Paolo Bonzini

target-i386: do not override nr_cores for -cpu host

Commit 787aaf5 (target-i386: forward CPUID cache leaves when -cpu host is
used, 2013-09-02) brings bits 31..26 of CPUID leaf 04h out of sync with
the APIC IDs that QEMU reserves for each package. This number must come...

fc8ead74 10/18/2013 08:03 pm Anthony Liguori

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

  1. By Paolo Bonzini (2) and Jan Kiszka (1)
  2. Via Gleb Natapov
    • qemu-kvm/uq/master:
      kvmvapic: Prevent reading beyond the end of guest RAM
      x86: cpuid: reconstruct leaf 0Dh data
      x86: fix migration from pre-version 12...
51fb256a 10/07/2013 12:48 pm Andreas Färber

cpu: Drop cpu_model_str from CPU_COMMON

Since this is only read in cpu_copy() and linux-user has a global
cpu_model, drop the field from generic code.

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

2560f19f 10/02/2013 06:58 pm Paolo Bonzini

x86: cpuid: reconstruct leaf 0Dh data

The data in leaf 0Dh depends on information from other feature bits.
Instead of passing it blindly from the host, compute it based on
whether these feature bits are enabled.

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

c74f41bb 10/02/2013 06:58 pm Paolo Bonzini

x86: fix migration from pre-version 12

On KVM, the KVM_SET_XSAVE would be executed with a 0 xstate_bv,
and not restore anything.

Since FP and SSE data are always valid, set them in xstate_bv at reset
time. In fact, that value is the same that KVM_GET_XSAVE returns on...

f8e6a11a 10/02/2013 05:51 pm Eduardo Habkost

target-i386: Set model=6 on qemu64 & qemu32 CPU models

There's no Intel CPU with family=6,model=2, and Linux and Windows guests
disable SEP when seeing that combination due to Pentium Pro erratum #82.

In addition to just having SEP ignored by guests, Skype (and maybe other...

f010bc64 09/20/2013 01:38 pm Andrew Jones

target-i386: add feature kvm_pv_unhalt

I don't know yet if want this feature on by default, so for now I'm
just adding support for "-cpu ...,+kvm_pv_unhalt".

Signed-off-by: Andrew Jones <>
Reviewed-by: Eduardo Habkost <>...

787aaf57 09/20/2013 01:38 pm Benoît Canet

target-i386: forward CPUID cache leaves when -cpu host is used

Some users running cpu intensive tasks checking the cache CPUID leaves at
startup and making decisions based on the result reported that the guest was
not reflecting the host CPUID leaves when -cpu host is used....

5e891bf8 09/03/2013 01:25 pm Eduardo Habkost

target-i386: Use #defines instead of magic numbers for CPUID cache info

This is an attempt to make the CPUID cache topology code clearer, by
replacing the magic numbers in the code with #defines, and moving all
the cache information to the same place in the file....

4a44d85e 08/20/2013 06:51 pm Seiji Aguchi

Convert stderr message calling error_get_pretty() to error_report()

Convert stderr messages calling error_get_pretty()
to error_report().

Timestamp is prepended by -msg timstamp option with it.

Per Markus's comment below, A conversion from fprintf() to...

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

cd7b87ff 08/06/2013 08:27 pm Andreas Färber

target-i386: Fix X86CPU error handling

Error **errp argument is not for emitting warnings, it means an error
has occurred and the caller should not make any assumptions about the
state of other return values (unless otherwise documented).

Therefore cpu_x86_create() must unref the new X86CPU itself, and...

c1399112 07/29/2013 04:29 pm Eduardo Habkost

target-i386: Pass X86CPU object to cpu_x86_find_by_name()

This will help us change the initialization code to not require carrying
some intermediate values in a x86_def_t struct (and eventually kill the
x86_def_t struct entirely).

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

9337e3b6 07/29/2013 04:29 pm Eduardo Habkost

target-i386: Disable PMU CPUID leaf by default

Bug description: QEMU currently gets all bits from GET_SUPPORTED_CPUID
for CPUID leaf 0xA and passes them directly to the guest. This makes
the guest ABI depend on host kernel and host CPU capabilities, and
breaks live migration if we migrate between hosts with different...

14a10fc3 07/29/2013 04:29 pm Andreas Färber

cpu: Partially revert "cpu: Change qemu_init_vcpu() argument to CPUState"

Commit c643bed99 moved qemu_init_vcpu() calls to common CPUState code.
This causes x86 cpu-add to fail with "KVM: setting VAPIC address failed".

The reason for the failure is that CPUClass::kvm_fd is not yet...

5b50e790 07/27/2013 01:04 am Andreas Färber

cpu: Introduce CPUClass::gdb_{read,write}_register()

Completes migration of target-specific code to new target-*/gdbstub.c.

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

a0e372f0 07/27/2013 12:23 am Andreas Färber

cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regs

CPUState::gdb_num_regs replaces num_g_regs.
CPUClass::gdb_num_core_regs replaces NUM_CORE_REGS.

Allows building gdb_register_coprocessor() for xtensa, too.

As a side effect this should fix coprocessor register numbering for SMP....

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

cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook

Change breakpoint_invalidate() argument to CPUState alongside.

Since all targets now assign a softmmu-only field, we can drop helpers
cpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd()....

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

cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()

Where no extra implementation is needed, fall back to CPUClass::set_pc().

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

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

cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()

This moves setting the Program Counter from gdbstub into target code.
Use vaddr type as upper-bound replacement for target_ulong.

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

a0762859 07/09/2013 10:33 pm Andreas Färber

log: Change log_cpu_state[_mask]() argument to CPUState

Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turn
cpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is no
longer needed.

Add documentation and make the functions available through qemu/log.h...

91b1df8c 07/09/2013 10:33 pm Andreas Färber

cpu: Move reset logging to CPUState

x86 was using additional CPU_DUMP_* flags, so make that configurable in
CPUClass::reset_dump_flags.

This adds reset logging for alpha, unicore32 and xtensa.

Acked-by: Michael Walle <> (for lm32)
Reviewed-by: Richard Henderson <>...

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

cpu: Change qemu_init_vcpu() argument to CPUState

This allows to move the call into CPUState's realizefn.
Therefore move the stub into libqemustub.a.

Reviewed-by: Richard Henderson <>
Signed-off-by: Andreas Färber <>

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

cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks

Make cpustats monitor command available unconditionally.

Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()
arguments to CPUState.

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

a23bbfda 06/11/2013 07:03 pm Andreas Färber

cpu: Turn cpu_get_memory_mapping() into a CPUState hook

Change error reporting from return value to Error argument.

Reviewed-by: Jens Freimann <>
Reviewed-by: Luiz Capitulino <>
[AF: Fixed cpu_get_memory_mapping() documentation]...

444d5590 06/11/2013 06:50 pm Andreas Färber

cpu: Turn cpu_paging_enabled() into a CPUState hook

Relocate assignment of x86 get_arch_id to have all hooks in one place.

Reviewed-by: Jens Freimann <>
Reviewed-by: Luiz Capitulino <>
Signed-off-by: Andreas Färber <>

31ccdde2 06/11/2013 12:33 am Igor Mammedov

target-i386: cpu: Fix potential buffer overrun in get_register_name_32()

Spotted by Coverity,
x86_reg_info_32[] is CPU_NB_REGS32 elements long, so accessing
x86_reg_info_32[CPU_NB_REGS32] will be one element off array.

Signed-off-by: Igor Mammedov <>...

ffce9ebb 06/11/2013 12:33 am Eduardo Habkost

target-i386: Update model values on Conroe/Penryn/Nehalem CPU models

The CPUID model values on Conroe, Penryn, and Nehalem are too
conservative and don't reflect the values found on real Conroe, Penryn,
and Nehalem CPUs.

This causes at least one known problems: Windows XP disables sysenter...

6b11322e 06/11/2013 12:33 am Eduardo Habkost

target-i386: Set level=4 on Conroe/Penryn/Nehalem

The CPUID level value on Conroe, Penryn, and Nehalem are too low. This
causes at least one known problem: the -smp "threads" option doesn't
work as expect if level is < 4, because thread count information is...

4458c236 05/06/2013 11:27 pm Borislav Petkov

target-i386: n270 can MOVBE

The Atom core (cpu name "n270" in QEMU speak) supports MOVBE. This is
needed when booting 3.8 and later linux kernels built with the MATOM
target because we require MOVBE in order to boot properly now.

Signed-off-by: Borislav Petkov <>...

0668af54 05/06/2013 11:14 pm Eduardo Habkost

target-i386: Introduce generic CPUID feature compat function

Introduce x86_cpu_compat_set_features(), that can be used to set/unset
feature bits on specific CPU models for machine-type compatibility.

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

b2a856d9 05/06/2013 08:55 pm Andreas Färber

target-i386: Change CPUID model of 486 to 8

This changes the model number of 486 to 8 (DX4) which matches the
feature set presented, and actually has the CPUID instruction.

This adds a compatibility property, to keep model=0 on pc-*-1.4 and older.

Signed-off-by: H. Peter Anvin <>...

ba2bc7a4 05/06/2013 08:55 pm Andreas Färber

target-i386: Emulate X86CPU subclasses for global properties

After initializing the object from its x86_def_t and before setting any
additional cpu arguments, set any global properties for the designated
subclass <name>
{i386,x86_64}-cpu.

Reviewed-by: Eduardo Habkost <>...

034acf4a 05/06/2013 08:16 pm Eduardo Habkost

target-i386: Introduce X86CPU::filtered_features field

This field will contain the feature bits that were filtered out because
of missing host support.

Signed-off-by: Eduardo Habkost <>
Reviewed-by: Eric Blake <>
Signed-off-by: Andreas Färber <>

7e5292b5 05/06/2013 08:16 pm Eduardo Habkost

target-i386: Add "filtered-features" property to X86CPU

This property will contain all the features that were removed from the
CPU because they are not supported by the host.

This way, libvirt or other management tools can emulate the
check/enforce behavior by checking if filtered-properties is all zeroes,...

8e8aba50 05/06/2013 08:16 pm Eduardo Habkost

target-i386: Add "feature-words" property to X86CPU

This property will be useful for libvirt, as libvirt already has logic
based on low-level feature bits (not feature names), so it will be
really easy to convert the current libvirt logic to something using the...

bd87d2a2 05/06/2013 06:53 pm Eduardo Habkost

target-i386: Use FeatureWord loop on filter_features_for_kvm()

Instead of open-coding the filtering code for each feature word, change
the existing code to use the feature_word_info array, that has exactly
the same CPUID eax/ecx/register values for each feature word....

04d104b6 05/06/2013 06:53 pm Eduardo Habkost

target-i386: Add ECX information to FeatureWordInfo

FEAT_7_0_EBX uses ECX as input, so we have to take that into account
when reporting feature word values.

Signed-off-by: Eduardo Habkost <>
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(),...

27861ecc 05/02/2013 01:21 am Eduardo Habkost

target-i386: Break CPUID feature definition lines

Break lines on kvm_check_features_against_host(), kvm_cpu_fill_host(),
and builtin_x86_defs, so they don't get too long once the *_features
fields are replaced by an array.

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

90e4b0c3 05/02/2013 12:21 am Eduardo Habkost

target-i386: Group together level, xlevel, xlevel2 fields

Consolidate level, xlevel, xlevel2 fields in x86_def_t and CPUX86State.

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

53a89e26 05/01/2013 02:06 pm Igor Mammedov

target-i386: Move APIC to ICC bus

It allows APIC to be hotplugged.

  • map APIC's mmio at board level if it is present
  • do not register mmio region for each APIC, since
    only one is used/mapped

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

62fc403f 05/01/2013 02:06 pm Igor Mammedov

target-i386: Attach ICC bus to CPU on its creation

X86CPU should have parent bus so it could provide bus for child APIC.

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

c72bf468 05/01/2013 02:04 pm Jens Freimann

cpu: Move cpu_write_elfXX_note() functions to CPUState

Convert cpu_write_elfXX_note() functions to CPUClass methods and pass
CPUState as argument. Update target-i386 accordingly.

Signed-off-by: Jens Freimann <>
[AF: Retain stubs as CPUClass' default method implementation; style changes]...

997395d3 05/01/2013 02:04 pm Igor Mammedov

cpu: Introduce get_arch_id() method and override it for X86CPU

get_arch_id() adds possibility for generic code to get a guest-visible
CPU ID without accessing CPUArchState.
If derived classes don't override it, it will return cpu_index.

Override it on target-i386 in X86CPU to return the APIC ID....

72ac2e87 05/01/2013 02:04 pm Igor Mammedov

target-i386: Introduce feat2prop() for CPU properties

This helper replaces '_' with '-' in a uniform way.
As a side effect, even custom mappings must use '-' now.

Signed-off-by: Igor Mammedov <>
[AF: Split off; operate on NUL-terminated string rather than '=' delimiter]...

31050930 05/01/2013 02:04 pm Igor Mammedov

target-i386: Introduce apic-id CPU property

The property is used from board level to set APIC ID for CPUs it
creates. Do so in a new pc_new_cpu() helper, to be reused for hot-plug.

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

8d6d4980 05/01/2013 02:04 pm Igor Mammedov

target-i386: Do not allow to set apic-id once CPU is realized

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

21ad7789 04/16/2013 02:19 am Jan Kiszka

target-i386: Fix including "host" in -cpu ? output

kvm_enabled() cannot be true at this point because accelerators are
initialized much later during init. Also, hiding this makes it very hard
to discover for users. Simply dump unconditionally if CONFIG_KVM is set....

3af60be2 04/16/2013 02:19 am Jan Kiszka

target-i386: Improve -cpu ? features output

We were missing a bunch of feature lists. Fix this by simply dumping
the meta list feature_word_info.

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

4dc1f449 04/16/2013 02:19 am Igor Mammedov

target-i386: Consolidate error propagation in x86_cpu_realizefn()

Signed-off-by: Igor Mammedov <>
Reviewed-by: Paolo Bonzini <>
Reviewed-by: Eduardo Habkost <>
Signed-off-by: Andreas Färber <>

d3c64d6a 04/16/2013 02:19 am Igor Mammedov

target-i386: Split APIC creation from initialization in x86_cpu_realizefn()

When APIC is hotplugged during CPU hotplug, device_set_realized()
calls device_reset() on it. And if QEMU runs in KVM mode, following
call chain will fail:
apic_reset_common()...

dd13e088 04/16/2013 02:19 am Eduardo Habkost

target-i386/cpu.c: Coding style fixes

  • Add braces to 'if' statements;
  • Remove last TAB character from the source.

Signed-off-by: Eduardo Habkost <>
[AF: Changed whitespace]
Reviewed-by: Igor Mammedov <>
Signed-off-by: Andreas Färber <>

7f833247 04/16/2013 02:19 am Igor Mammedov

target-i386: Split out CPU creation and features parsing

Move CPU creation and features parsing into a separate cpu_x86_create()
function, so that board would be able to set board-specific CPU
properties before CPU is realized.

Keep cpu_x86_init() for compatibility with the code that uses cpu_init()...

d640045a 04/13/2013 02:51 pm Aurelien Jarno

target-i386: add AES-NI instructions

Reviewed-by: Edgar E. Iglesias <>
Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

e71827bc 04/13/2013 02:51 pm Aurelien Jarno

target-i386: add pclmulqdq instruction

Reviewed-by: Richard Henderson <>
Reviewed-by: Edgar E. Iglesias <>
Signed-off-by: Aurelien Jarno <>

41cb383f 04/13/2013 02:51 pm Aurelien Jarno

target-i386: enable PCLMULQDQ on Westmere CPU

The PCLMULQDQ instruction has been introduced on the Westmere CPU.

Reviewed-by: Richard Henderson <>
Reviewed-by: Edgar E. Iglesias <>
Signed-off-by: Aurelien Jarno <>

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

dab86234 04/05/2013 03:23 am Laszlo Ersek

extract/unify the constant 0xfee00000 as APIC_DEFAULT_ADDRESS

A common dependency of the constant's current users:
- hw/apic_common.c
- hw/i386/kvmvapic.c
- target-i386/cpu.c
is "target-i386/cpu.h".

Signed-off-by: Laszlo Ersek <>
Reviewed-by: Anthony Liguori <>...

a509d632 04/03/2013 11:06 pm Eduardo Habkost

target-i386: Check for host features before filter_features_for_kvm()

commit 5ec01c2e96910e1588d1a0de8609b9dda7618c7f broke "-cpu ..,enforce",
as it has moved kvm_check_features_against_host() after the
filter_features_for_kvm() call. filter_features_for_kvm() removes all...

83f7dc28 04/01/2013 07:49 pm Aurelien Jarno

target-i386: enable SSE4.1 and SSE4.2 in TCG mode

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

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

97a8ea5a 03/12/2013 11:35 am Andreas Färber

cpu: Replace do_interrupt() by CPUClass::do_interrupt method

This removes a global per-target function and thus takes us one step
closer to compiling multiple targets into one executable.

It will also allow to override the interrupt handling for certain CPU...

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

target-i386: Update VMStateDescription to X86CPU

Expose vmstate_cpu as vmstate_x86_cpu and hook it up to CPUClass::vmsd.
Adapt opaques and VMState fields to X86CPU. Drop cpu_{save,load}().

Reviewed-by: Eduardo Habkost <>
Signed-off-by: Andreas Färber <>

7feb640c 02/27/2013 05:23 pm Alexey Korolev

Fix guest OS hang when 64bit PCI bar present

This patch addresses the issue fully described here:
http://lists.nongnu.org/archive/html/qemu-devel/2013-02/msg01804.html

Linux kernels prior to 2.6.36 do not disable the PCI device during
enumeration process. Since lower and higher parts of a 64bit BAR...

cd7f97ca 02/20/2013 09:05 am Richard Henderson

target-i386: Implement ADX extension

Signed-off-by: Richard Henderson <>

111994ee 02/19/2013 01:39 am Richard Henderson

target-i386: Implement MOVBE

Signed-off-by: Richard Henderson <>

7073fbad 02/19/2013 01:39 am Richard Henderson

target-i386: Implement ANDN

As this is the first of the BMI insns to be implemented,
this carries quite a bit more baggage than normal.

Signed-off-by: Richard Henderson <>

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

target-i386: Split command line parsing out of cpu_x86_register()

In order to instantiate a CPU subtype we will need to know which type,
so move the cpu_model splitting into cpu_x86_init().

Parameters need to be set on the X86CPU instance, so move
cpu_x86_parse_featurestr() into cpu_x86_init() as well....

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

cpu: Add CPUArchState pointer to CPUState

The target-specific ENV_GET_CPU() macros have allowed us to navigate
from CPUArchState to CPUState. The reverse direction was not supported.
Avoid introducing CPU_GET_ENV() macros by initializing an untyped
pointer that is initialized in derived instance_init functions....

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

target-i386: Move cpu_x86_init()

Consolidate CPU functions in cpu.c.
Allows to make cpu_x86_register() static.

No functional changes.

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

2b6f294c 02/16/2013 03:50 pm Andreas Färber

target-i386: Update X86CPU to QOM realizefn

Adapt the signature of x86_cpu_realize(), hook up to
DeviceClass::realize and set realized = true in cpu_x86_init().

The QOM realizefn cannot depend on errp being non-NULL as in
cpu_x86_init(), so use a local Error to preserve error handling behavior...

312fd5f2 02/11/2013 04:13 pm Markus Armbruster

error: Strip trailing '\n' from error string arguments (again)

Commit 6daf194d and be62a2eb got rid of a bunch, but they keep coming
back. Tracked down with this Coccinelle semantic patch:

r
expression err, eno, cls, fmt;
position p;
@@
(...
11acfdd5 01/27/2013 03:34 pm Igor Mammedov

target-i386: Remove vendor_override field from CPUX86State

Commit 8935499831312 makes cpuid return to guest host's vendor value
instead of built-in one by default if kvm_enabled() == true and allows
to override this behavior if 'vendor' is specified on -cpu command line....

a91987c2 01/27/2013 03:34 pm Igor Mammedov

target-i386: Set custom features/properties without intermediate x86_def_t

Move custom features parsing after built-in cpu_model defaults are set
and set custom features directly on CPU instance. That allows to make a
clear distinction between built-in cpu model defaults that eventually...

2c728dfe 01/27/2013 03:34 pm Igor Mammedov

target-i386: Remove setting tsc-frequency from x86_def_t

Setting tsc-frequency from x86_def_t is NOP because default tsc_khz
in x86_def_t is 0 and CPUX86State.tsc_khz is also initialized to 0
by default. So there is no need to overwrite tsc_khz with default 0...