History | View | Annotate | Download (91.3 kB)
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 <vrozenfe@redhat.com>...
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 caneliminate the CONFIG_KVM #ifdefs there.
Also, kvm_cpu_fill_host() and host_cpuid() don't need to check...
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 CPUclass, it's better to not touch it, and handle the special cases on theX86CPU object itself.
Current behavior of the code should stay exactly the same....
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 dependson KVM being initialized....
target-i386: kvm_cpu_fill_host(): Kill unused code
Those host_cpuid() calls are useless. They are leftovers from when theold code using host_cpuid() was removed.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: kvm_cpu_fill_host(): No need to check level
There's no need to check level (CPUID0.EAX) before callingkvm_arch_get_supported_cpuid(s, 0x7, 0, R_EBX), because:
target-i386: kvm_cpu_fill_host(): No need to check CPU vendor
There's no need to check CPU vendor before callingkvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX), because:
target-i386: kvm_cpu_fill_host(): No need to check xlevel2
There's no need to check CPU xlevel2 before callingkvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX), because:
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 atthe end of the function.
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 setthe feature word array using a simple loop.
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 haseverything we need.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>...
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
Merge remote branch 'luiz/queue/qmp' into qmpq
target-i386: Remove assert_no_error usage
Replace an assert_no_error() usage with the error_abort system.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
target-i386: Cleanup 'foo' feature handling
Features check, enforce, hv_relaxed and hv_vapic are treated as booleanset to 'on' when passed from command line, so it's not necessary tohandle each of them separately. Collapse them to one catch-all branchwhich will treat any feature in format 'foo' as boolean set to 'on'....
target-i386: Cleanup 'foo=val' feature handling
Features family, model, stepping, level, hv_spinlocks are treated similarlywhen passed from command line, so it's not necessary to handle each of themindividually. Collapse them to one catch-all branch which will treat...
target-i386: Convert 'check' and 'enforce' to static properties
Signed-off-by: Igor Mammedov <imammedo@redhat.com>...
target-i386: Convert 'hv_relaxed' to static property
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Convert 'hv_vapic' to static property
target-i386: Convert 'hv_spinlocks' to static property
target-i386: Move apic_state field from CPUX86State to X86CPU
This motion is preparing for refactoring vCPU APIC subsequently.
Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
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...
target-i386: Intel MPX
Add some MPX related definiation, and hardcode sizes and offsetsof xsave features 3 and 4. It also add corresponding part tokvm_get/put_xsave, and vmstate.
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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 .offsetfield contained the size and was stored in the register thatis supposed to hold the size (eax), and likewise the .size field...
target-i386: do not override nr_cores for -cpu host
Commit 787aaf5 (target-i386: forward CPUID cache leaves when -cpu host isused, 2013-09-02) brings bits 31..26 of CPUID leaf 04h out of sync withthe APIC IDs that QEMU reserves for each package. This number must come...
cpu: Drop cpu_model_str from CPU_COMMON
Since this is only read in cpu_copy() and linux-user has a globalcpu_model, drop the field from generic code.
Signed-off-by: Andreas Färber <afaerber@suse.de>
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 onwhether these feature bits are enabled.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
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 resettime. In fact, that value is the same that KVM_GET_XSAVE returns on...
target-i386: Set model=6 on qemu64 & qemu32 CPU models
There's no Intel CPU with family=6,model=2, and Linux and Windows guestsdisable SEP when seeing that combination due to Pentium Pro erratum #82.
In addition to just having SEP ignored by guests, Skype (and maybe other...
target-i386: add feature kvm_pv_unhalt
I don't know yet if want this feature on by default, so for now I'mjust adding support for "-cpu ...,+kvm_pv_unhalt".
Signed-off-by: Andrew Jones <drjones@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>...
target-i386: forward CPUID cache leaves when -cpu host is used
Some users running cpu intensive tasks checking the cache CPUID leaves atstartup and making decisions based on the result reported that the guest wasnot reflecting the host CPUID leaves when -cpu host is used....
target-i386: Use #defines instead of magic numbers for CPUID cache info
This is an attempt to make the CPUID cache topology code clearer, byreplacing the magic numbers in the code with #defines, and moving allthe cache information to the same place in the file....
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...
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 <ehabkost@redhat.com>Signed-off-by: Igor Mammedov <imammedo@redhat.com>...
target-i386: Fix X86CPU error handling
Error **errp argument is not for emitting warnings, it means an errorhas occurred and the caller should not make any assumptions about thestate of other return values (unless otherwise documented).
Therefore cpu_x86_create() must unref the new X86CPU itself, and...
target-i386: Pass X86CPU object to cpu_x86_find_by_name()
This will help us change the initialization code to not require carryingsome intermediate values in a x86_def_t struct (and eventually kill thex86_def_t struct entirely).
target-i386: Disable PMU CPUID leaf by default
Bug description: QEMU currently gets all bits from GET_SUPPORTED_CPUIDfor CPUID leaf 0xA and passes them directly to the guest. This makesthe guest ABI depend on host kernel and host CPU capabilities, andbreaks live migration if we migrate between hosts with different...
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...
cpu: Introduce CPUClass::gdb_{read,write}_register()
Completes migration of target-specific code to new target-*/gdbstub.c.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)Signed-off-by: Andreas Färber <afaerber@suse.de>
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....
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 helperscpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd()....
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 <michael@walle.cc> (for lm32)Signed-off-by: Andreas Färber <afaerber@suse.de>
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.
log: Change log_cpu_state[_mask]() argument to CPUState
Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turncpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is nolonger needed.
Add documentation and make the functions available through qemu/log.h...
cpu: Move reset logging to CPUState
x86 was using additional CPU_DUMP_* flags, so make that configurable inCPUClass::reset_dump_flags.
This adds reset logging for alpha, unicore32 and xtensa.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Reviewed-by: Richard Henderson <rth@twiddle.net>...
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 <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
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.
cpu: Turn cpu_get_memory_mapping() into a CPUState hook
Change error reporting from return value to Error argument.
Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com>Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>[AF: Fixed cpu_get_memory_mapping() documentation]...
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 <jfrei@linux.vnet.ibm.com>Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
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 accessingx86_reg_info_32[CPU_NB_REGS32] will be one element off array.
target-i386: Update model values on Conroe/Penryn/Nehalem CPU models
The CPUID model values on Conroe, Penryn, and Nehalem are tooconservative 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...
target-i386: Set level=4 on Conroe/Penryn/Nehalem
The CPUID level value on Conroe, Penryn, and Nehalem are too low. Thiscauses at least one known problem: the -smp "threads" option doesn'twork as expect if level is < 4, because thread count information is...
target-i386: n270 can MOVBE
The Atom core (cpu name "n270" in QEMU speak) supports MOVBE. This isneeded when booting 3.8 and later linux kernels built with the MATOMtarget because we require MOVBE in order to boot properly now.
Signed-off-by: Borislav Petkov <bp@suse.de>...
target-i386: Introduce generic CPUID feature compat function
Introduce x86_cpu_compat_set_features(), that can be used to set/unsetfeature bits on specific CPU models for machine-type compatibility.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Change CPUID model of 486 to 8
This changes the model number of 486 to 8 (DX4) which matches thefeature 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 <hpa@zytor.com>...
target-i386: Emulate X86CPU subclasses for global properties
After initializing the object from its x86_def_t and before setting anyadditional cpu arguments, set any global properties for the designatedsubclass <name>{i386,x86_64}-cpu.
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>...
target-i386: Introduce X86CPU::filtered_features field
This field will contain the feature bits that were filtered out becauseof missing host support.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Add "filtered-features" property to X86CPU
This property will contain all the features that were removed from theCPU because they are not supported by the host.
This way, libvirt or other management tools can emulate thecheck/enforce behavior by checking if filtered-properties is all zeroes,...
target-i386: Add "feature-words" property to X86CPU
This property will be useful for libvirt, as libvirt already has logicbased on low-level feature bits (not feature names), so it will bereally easy to convert the current libvirt logic to something using the...
target-i386: Use FeatureWord loop on filter_features_for_kvm()
Instead of open-coding the filtering code for each feature word, changethe existing code to use the feature_word_info array, that has exactlythe same CPUID eax/ecx/register values for each feature word....
target-i386: Add ECX information to FeatureWordInfo
FEAT_7_0_EBX uses ECX as input, so we have to take that into accountwhen reporting feature word values.
target-i386: Replace cpuid_*features fields with a feature word array
This replaces the feature-bit fields on both X86CPU and x86_def_tstructs with an array.
With this, we will be able to simplify code that simply does the sameoperation on all feature words (e.g. kvm_check_features_against_host(),...
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 *_featuresfields are replaced by an array.
target-i386: Group together level, xlevel, xlevel2 fields
Consolidate level, xlevel, xlevel2 fields in x86_def_t and CPUX86State.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Move APIC to ICC bus
It allows APIC to be hotplugged.
target-i386: Attach ICC bus to CPU on its creation
X86CPU should have parent bus so it could provide bus for child APIC.
cpu: Move cpu_write_elfXX_note() functions to CPUState
Convert cpu_write_elfXX_note() functions to CPUClass methods and passCPUState as argument. Update target-i386 accordingly.
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>[AF: Retain stubs as CPUClass' default method implementation; style changes]...
cpu: Introduce get_arch_id() method and override it for X86CPU
get_arch_id() adds possibility for generic code to get a guest-visibleCPU 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....
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 <imammedo@redhat.com>[AF: Split off; operate on NUL-terminated string rather than '=' delimiter]...
target-i386: Introduce apic-id CPU property
The property is used from board level to set APIC ID for CPUs itcreates. Do so in a new pc_new_cpu() helper, to be reused for hot-plug.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>...
target-i386: Do not allow to set apic-id once CPU is realized
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Fix including "host" in -cpu ? output
kvm_enabled() cannot be true at this point because accelerators areinitialized much later during init. Also, hiding this makes it very hardto discover for users. Simply dump unconditionally if CONFIG_KVM is set....
target-i386: Improve -cpu ? features output
We were missing a bunch of feature lists. Fix this by simply dumpingthe meta list feature_word_info.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Reviewed-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Consolidate error propagation in x86_cpu_realizefn()
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
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, followingcall chain will fail: apic_reset_common()...
target-i386/cpu.c: Coding style fixes
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>[AF: Changed whitespace]Reviewed-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
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 CPUproperties before CPU is realized.
Keep cpu_x86_init() for compatibility with the code that uses cpu_init()...
target-i386: add AES-NI instructions
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-i386: add pclmulqdq instruction
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-i386: enable PCLMULQDQ on Westmere CPU
The PCLMULQDQ instruction has been introduced on the Westmere CPU.
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 dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
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.cis "target-i386/cpu.h".
Signed-off-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>...
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 thefilter_features_for_kvm() call. filter_features_for_kvm() removes all...
target-i386: enable SSE4.1 and SSE4.2 in TCG mode
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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 beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
cpu: Replace do_interrupt() by CPUClass::do_interrupt method
This removes a global per-target function and thus takes us one stepcloser to compiling multiple targets into one executable.
It will also allow to override the interrupt handling for certain CPU...
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 <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
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 duringenumeration process. Since lower and higher parts of a 64bit BAR...
target-i386: Implement ADX extension
Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Implement MOVBE
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.
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 movecpu_x86_parse_featurestr() into cpu_x86_init() as well....
cpu: Add CPUArchState pointer to CPUState
The target-specific ENV_GET_CPU() macros have allowed us to navigatefrom CPUArchState to CPUState. The reverse direction was not supported.Avoid introducing CPU_GET_ENV() macros by initializing an untypedpointer that is initialized in derived instance_init functions....
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 <ehabkost@redhat.com>Reviewed-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Update X86CPU to QOM realizefn
Adapt the signature of x86_cpu_realize(), hook up toDeviceClass::realize and set realized = true in cpu_x86_init().
The QOM realizefn cannot depend on errp being non-NULL as incpu_x86_init(), so use a local Error to preserve error handling behavior...
error: Strip trailing '\n' from error string arguments (again)
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep comingback. Tracked down with this Coccinelle semantic patch:
r expression err, eno, cls, fmt; position p; @@ (...
r
target-i386: Remove vendor_override field from CPUX86State
Commit 8935499831312 makes cpuid return to guest host's vendor valueinstead of built-in one by default if kvm_enabled() == true and allowsto override this behavior if 'vendor' is specified on -cpu command line....
target-i386: Set custom features/properties without intermediate x86_def_t
Move custom features parsing after built-in cpu_model defaults are setand set custom features directly on CPU instance. That allows to make aclear distinction between built-in cpu model defaults that eventually...
target-i386: Remove setting tsc-frequency from x86_def_t
Setting tsc-frequency from x86_def_t is NOP because default tsc_khzin x86_def_t is 0 and CPUX86State.tsc_khz is also initialized to 0by default. So there is no need to overwrite tsc_khz with default 0...