Statistics
| Branch: | Revision:

root / target-i386 / cpu.c @ 3523e4bd

History | View | Annotate | Download (92.6 kB)

# Date Author Comment
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;
@@
(...
cb41bad3 01/27/2013 03:34 pm Eduardo Habkost

target-i386: Introduce x86_cpu_apic_id_from_index() function

This function will be used by both the CPU initialization code and the
fw_cfg table initialization code.

Later this function will be updated to generate APIC IDs according to
the CPU topology....

8932cfdf 01/27/2013 03:34 pm Eduardo Habkost

pc: Generate APIC IDs according to CPU topology

This keeps compatibility on machine-types pc-1.2 and older, and prints a
warning in case the requested configuration won't get the correct
topology.

I couldn't think of a better way to warn about broken topology when in...

4bfe910d 01/27/2013 03:34 pm Andreas Färber

target-i386: Simplify cpu_x86_find_by_name()

Catch NULL name argument early to avoid repeated checks.
Similarly, check for -cpu host early and untangle from iterating through
model definitions. This prepares for introducing X86CPU subclasses.

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

7fc9b714 01/27/2013 03:34 pm Andreas Färber

target-i386: Drop redundant list of CPU definitions

It is no longer needed since dropping cpudef config file support.
Cleaning this up removes knowledge about other models from x86_def_t,
in preparation for reusing x86_def_t as intermediate step towards pure...

8ba8a698 01/27/2013 03:34 pm Igor Mammedov

target-i386: Print deprecation warning if xlevel < 0x80000000

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

99b88a17 01/27/2013 03:34 pm Igor Mammedov

target-i386: Replace uint32_t vendor fields by vendor string in x86_def_t

Vendor property setter takes string as vendor value but cpudefs
use uint32_t vendor123 fields to define vendor value. It makes it
difficult to unify and use property setter for values from cpudefs....

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

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

target-i386: Don't set any KVM flag by default if KVM is disabled

This is a cleanup that tries to solve two small issues:

- We don't need a separate kvm_pv_eoi_features variable just to keep a
constant calculated at compile-time, and this style would require...
29694758 01/27/2013 03:34 pm Eduardo Habkost

pc: Reverse pc_init_pci() compatibility logic

Currently, the pc-1.4 machine init function enables PV EOI and then
calls the pc-1.2 machine init function. The problem with this approach
is that now we can't enable any additional compatibility code inside the...

1356b98d 01/21/2013 09:52 pm Andreas Färber

sysbus: Drop sysbus_from_qdev() cast macro

Replace by SYS_BUS_DEVICE() QOM cast macro using a scripted conversion.
Avoids the old macro creeping into new code.

Resolve a Coding Style warning in openpic code.

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

5ec01c2e 01/15/2013 05:09 am Igor Mammedov

target-i386: Move kvm_check_features_against_host() check to realize time

kvm_check_features_against_host() should be called when features can't
be changed, and when features are converted to properties it would be
possible to change them until realize time, so correct way is to call...

6a4784ce 01/15/2013 05:09 am Eduardo Habkost

target-i386: Disable kvm_mmu by default

KVM_CAP_PV_MMU capability reporting was removed from the kernel since
v2.6.33 (see commit a68a6a7282373), and was completely removed from the
kernel since v3.3 (see commit fb92045843). It doesn't make sense to keep...

5ef57876 01/15/2013 05:09 am Eduardo Habkost

target-i386/cpu: Introduce FeatureWord typedefs

This introduces a FeatureWord enum, FeatureWordInfo struct (with
generation information about a feature word), and a FeatureWordArray
typedef, and changes add_flagname_to_bitmaps() code and
cpu_x86_parse_featurestr() to use the new typedefs instead of separate...

bffd67b0 01/15/2013 05:09 am Eduardo Habkost

target-i386: kvm_check_features_against_host(): Use feature_word_info

Instead of carrying the CPUID leaf/register and feature name array on
the model_features_t struct, move that information into
feature_word_info so it can be reused by other functions.
...

89e49c8b 01/15/2013 05:09 am Eduardo Habkost

target-i386/cpu.c: Add feature name array for ext4_features

Feature names were taken from the X86_FEATURE_* constants in the Linux
kernel code.

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

07ca5945 01/15/2013 05:09 am Eduardo Habkost

target-i386: check/enforce: Check all feature words

This adds the following feature words to the list of flags to be checked
by kvm_check_features_against_host():

- cpuid_7_0_ebx_features
- ext4_features
- kvm_features
- svm_features

This will ensure the "enforce" flag works as it should: it won't allow...

077c68c3 01/15/2013 05:09 am Igor Mammedov

target-i386: Move setting defaults out of cpu_x86_parse_featurestr()

No functional change, needed for simplifying conversion to properties.

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

fa2db3c4 01/15/2013 05:09 am Igor Mammedov

target-i386: cpu_x86_register() consolidate freeing resources

Freeing resources in one place would require setting 'error'
to not NULL, so add some more error reporting before jumping to
exit branch.

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

ce3960eb 01/15/2013 05:09 am Andreas Färber

cpu: Move nr_{cores,threads} fields to CPUState

To facilitate the field movements, pass MIPSCPU to malta_mips_config();
avoid that for mips_cpu_map_tc() since callers only access MIPS Thread
Contexts, inside TCG helpers.

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

55e5c285 01/15/2013 05:09 am Andreas Färber

cpu: Move cpu_index field to CPUState

Note that target-alpha accesses this field from TCG, now using a
negative offset. Therefore the field is placed last in CPUState.

Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.

Move common parts of mips cpu_state_reset() to mips_cpu_reset()....

e8beac00 01/08/2013 10:03 pm Eduardo Habkost

target-i386: check/enforce: Eliminate check_feat field

Now that all entries have check_feat=~0 in
kvm_check_features_against_host(), we can eliminate check_feat entirely
and make the code check all bits.

This patch shouldn't introduce any behavior change, as check_feat is set...

4586f157 01/08/2013 10:03 pm Igor Mammedov

target-i386: Filter out unsupported features at realize time

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

9b15cd9e 01/08/2013 10:03 pm Igor Mammedov

target-i386: Sanitize AMD's ext2_features at realize time

When CPU properties are implemented, ext2_features may change
between object_new(CPU) and cpu_realize_fn(). Sanitizing
ext2_features for AMD based CPU at realize() time will keep
current behavior after CPU features are converted to properties....

ebe8b9c6 01/08/2013 10:03 pm Igor Mammedov

target-i386: Explicitly set vendor for each built-in cpudef

Since cpudef config is not supported anymore and all remaining sources
now always set x86_def_t.vendor123 fields, remove setting default
vendor to simplify future re-factoring.

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