aboutsummaryrefslogtreecommitdiffstats
path: root/target-i386
AgeCommit message (Collapse)AuthorFilesLines
2012-03-03Merge branch 'upstream' of git://qemu.weilnetz.de/qemuBlue Swirl2-7/+0
* 'upstream' of git://qemu.weilnetz.de/qemu: Move definition of HOST_LONG_BITS to qemu-common.h target-xtensa: Clean includes target-unicore32: Clean includes target-sh4: Clean includes target-s390x: Clean includes target-ppc: Clean includes target-mips: Clean includes target-microblaze: Clean includes target-m68k: Clean includes target-lm32: Clean includes target-i386: Clean includes target-cris: Clean includes target-arm: Clean includes target-alpha: Clean includes Remove macro HOST_LONG_SIZE
2012-03-01Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori3-2/+50
* qemu-kvm/uq/master: pc-bios: update kvmvapic.bin kvmvapic: Use optionrom helpers optionsrom: Reserve space for checksum kvmvapic: Simplify mp/up_set_tpr kvmvapic: Introduce TPR access optimization for Windows guests kvmvapic: Add option ROM target-i386: Add infrastructure for reporting TPR MMIO accesses Allow to use pause_all_vcpus from VCPU context Process pending work while waiting for initial kick-off in TCG mode Remove useless casts from cpu iterators kvm: Set cpu_single_env only once kvm: Synchronize cpu state in kvm_arch_stop_on_emulation_error()
2012-02-28target-i386: Clean includesStefan Weil2-7/+0
Remove some include statements which are not needed. Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-02-24target-i386: Introduce x86_cpuid_set_model_id()Andreas Färber1-14/+19
Move the logic to transform the 48-char model ID into the 12-word model value into a helper. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24target-i386: Introduce x86_cpuid_version_set_stepping()Andreas Färber1-1/+7
Move the logic for setting the stepping field into a helper function. To make the function self-contained and to prepare for future unordered/multiple uses, mask out any previous stepping values first. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24target-i386: Introduce x86_cpuid_version_set_model()Andreas Färber1-1/+7
Move the logic for setting the model and extended model fields into a helper function. To make the function self-contained and to prepare for future unordered/multiple uses, mask out any previous model values first. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24target-i386: Introduce x86_cpuid_version_set_family()Andreas Färber1-4/+11
Move the logic for setting the family and extended family into a helper function. To make the helper self-contained and in preparation of future unordered/multiple uses, mask out any previous family values first. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-22cpu defs: use Intel flag names for Intel models (v2)Eduardo Habkost1-2/+2
Use 'i64' instead of 'lm' and 'xd' instead of 'nx' on Intel models. The flags have different names on Intel docs, so use those names for clarity. This is based on a previous patch from John Cooper where this was introduced with many other changes at the same time. Original John's patch submission is at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>. Changes v1 -> v2: - Rebase patch against latest Qemu git tree Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-22cpu flags: aliases: pclmuldq|pclmulqdq and ffxsr|fxsr_optEduardo Habkost1-2/+2
pclmulqdq: /proc/cpuinfo on Linux and all documentation I have seen uses pclmulqdq as the flag name. As the only document using pclmuldq seems to be the Intel CPUID documentation (Application Note 485), it looks like a typo and not the correct name for the flag. ffxsr: AMD docs refer to fxsr_opt as ffxsr, so allow this named to be used too. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-18target-i386: Add infrastructure for reporting TPR MMIO accessesJan Kiszka3-2/+49
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 forward the event directly. KVM does not allows us to restart, so we postpone the delivery of events recording in the user space APIC until the current instruction is completed. Note that KVM without in-kernel irqchip will report the address after the instruction that triggered the access. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-16kvm: Synchronize cpu state in kvm_arch_stop_on_emulation_error()Gleb Natapov1-0/+1
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 <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-08kvm: Implement kvm_irqchip_in_kernel like kvm_enabledJan Kiszka1-2/+2
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 defining kvm_irqchip_in_kernel as a preprocessor macro. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-02-08kvm: Allow to set shadow MMU sizeJan Kiszka1-0/+13
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 concept for all targets with shadow MMUs. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-01-23hyperv: fix build on non-KVM hostsBlue Swirl1-1/+3
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-19kvm: x86: Add user space part for in-kernel APICJan Kiszka1-0/+38
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 into the VCPU if LINT1 is unmasked and configured to DM_NMI. MSI is not yet supported, so we disable this when the in-kernel model is in use. CC: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-01-19kvm: Introduce core services for in-kernel irqchip supportJan Kiszka1-0/+11
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 we can't route GSI0 to IOAPIC pin 2. In-kernel irqchip support will once be controlled by the machine property 'kernel_irqchip', but this is not yet wired up. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-01-19hyper-v: initialize Hyper-V CPUID leaves.Vadim Rozenfeld1-2/+63
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-01-19hyper-v: introduce Hyper-V support infrastructure.Vadim Rozenfeld3-0/+121
[Jan: fix build with CONFIG_USER_ONLY] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-01-13target-i386: fix compilation with --enable-debug-tcgAurelien Jarno1-1/+2
Commit 2355c16e74ffa4d14e7fc2b4a23b055565ac0221 introduced a new ldmxcsr helper taking an i32 argument, but the helper is actually passed a long. Fix that by truncating the long to i32. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-01-11target-i386: fix SSE rounding and flush to zeroAurelien Jarno3-11/+56
SSE rounding and flush to zero control has never been implemented. However given that softfloat-native was using a single state for FPU and SSE and given that glibc is setting both FPU and SSE state in fesetround(), this was working correctly up to the switch to softfloat. Fix that by adding an update_sse_status() function similar to update_fpu_status(), and callin git on write to mxcsr. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-01-11target-i386: fix dpps and dppd SSE2 instructionsAurelien Jarno1-14/+14
The helpers implemented dpps and dppd SSE instructions are not passing the correct argument types to the softfloat functions. While they do work anyway providing a correct behaviour, this patch fixes that. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-01-11target-i386: fix round{pd,ps,sd,ss} SSE2 instructionsAurelien Jarno1-8/+8
roundps and roundss SSE2 instructions have been broken when switching target-i386 to softfloat. They use float64_round_to_int to convert a float32, and while the implicit conversion from float32 to float64 was correct for softfloat-native, it is not for pure softfloat. Fix that by using the correct registers and correct functions. Also fix roundpd and roundsd implementation at the same time, even if these functions are behaving correctly. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-01-11target-i386: fix {min,max}{pd,ps,sd,ss} SSE2 instructionsAurelien Jarno2-3/+7
minpd, minps, minsd, minss and maxpd, maxps, maxsd, maxss SSE2 instructions have been broken when switching target-i386 to softfloat. It's not possible to use comparison instructions on float types anymore to softfloat, so use the floatXX_lt function instead, as the float_XX_min and float_XX_max functions can't be used due to the Intel specific behaviour. As it implements the correct NaNs behaviour, let's remove the corresponding entry from the TODO. It fixes GDM screen display on Debian Lenny. Thanks to Peter Maydell and Jason Wessel for their analysis of the problem. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-01-03Merge remote-tracking branch 'qemu-kvm/memory/page_desc' into stagingAnthony Liguori1-4/+3
* 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() kvm: avoid cpu_get_physical_page_desc() memory: remove CPUPhysMemoryClient xen: convert to MemoryListener API memory: temporarily add memory_region_get_ram_addr() xen, vga: add API for registering the framebuffer vhost: convert to MemoryListener API kvm: convert to MemoryListener API kvm: switch kvm slots to use host virtual address instead of ram_addr_t memory: add API for observing updates to the physical memory map memory: replace cpu_physical_sync_dirty_bitmap() with a memory API framebuffer: drop use of cpu_physical_sync_dirty_bitmap() loader: remove calls to cpu_get_physical_page_desc() framebuffer: drop use of cpu_get_physical_page_desc() memory: introduce memory_region_find() memory: add memory_region_is_logging() memory: add memory_region_is_rom() ...
2011-12-22enable architectural PMU cpuid leaf for kvmGleb Natapov1-4/+13
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22kvm: x86: Drop redundant apic base and tpr update from kvm_get_sregsJan Kiszka1-3/+2
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 <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22kvm: x86: Avoid runtime allocation of xsave bufferJan Kiszka2-9/+9
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 <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22kvm: x86: Use symbols for all xsave fieldJan Kiszka1-6/+8
Field 0 (FCW+FSW) and 1 (FTW+FOP) were hard-coded so far. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-20kvm: switch kvm slots to use host virtual address instead of ram_addr_tAvi Kivity1-4/+3
This simplifies a later switch to the memory API in slot management. Signed-off-by: Avi Kivity <avi@redhat.com>
2011-12-12target-i386: fix cmpxchg instruction emulationAndreas Gustafsson1-4/+7
When the i386 cmpxchg instruction is executed with a memory operand and the comparison result is "unequal", do the memory write before changing the accumulator instead of the other way around, because otherwise the new accumulator value will incorrectly be used in the comparison when the instruction is restarted after a page fault. This bug was originally reported on 2010-04-25 as https://bugs.launchpad.net/qemu/+bug/569760 Signed-off-by: Andreas Gustafsson <gson@gson.org>
2011-11-28x86/cpuid: Tighten parsing of tsc_freq=FREQMarkus Armbruster1-1/+1
cpu_x86_find_by_name() uses strtosz_suffix_unit(), but screws up the error checking. It detects some failures, but not all. Undetected failures result in a zero tsc_khz value (error value -1 divided by 1000), which means "no tsc_freq set". To reproduce, try "-cpu qemu64,tsc_freq=9999999T". strtosz_suffix_unit() fails, because the value overflows int64_t, Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28Revert "i386: derive '-cpu host' from KVM_GET_SUPPORTED_CPUID"Anthony Liguori1-4/+23
This reverts commit 66e3dd9282141b5ae75637c9676002cf3ceeb988. From Avi, "Anthony, I think we should revert that commit and refactor cpuid for 1.1. The logic is spread over too many places which makes it hard to reason about." Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21Merge remote-tracking branch 'origin/master' into stagingAnthony Liguori1-4/+8
2011-11-19x86: fix pcmpestrm and pcmpistrmBlue Swirl1-4/+8
Fix obvious typos (decrement and off-by-one error) in pcmpestrm and pcmpistrm which resulted in infinite loop. Reported by Frank Mehnert, spotted also by Coverity (bug 84752853). Reported-by: Frank Mehnert <frank.mehnert@oracle.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-11-17Fix typo: runnning -> runningVagrant Cascadian1-1/+1
One n too many for running, need we say more. Signed-Off-By: Vagrant Cascadian <vagrant@freegeek.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-10x86/cpuid: Fix crash on -cpu ""Markus Armbruster1-2/+2
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-10x86/cpuid: Plug memory leak in cpudef_setfield()Markus Armbruster1-0/+1
To reproduce the leak, put two name options into the same [cpudef] section of target-x86_64.conf. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-10x86/cpuid: Convert remaining strdup() to g_strdup()Markus Armbruster1-4/+4
Fixes missing error checking. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-09i386: derive '-cpu host' from KVM_GET_SUPPORTED_CPUIDAvi Kivity1-23/+4
The fact that a host cpu supports a feature doesn't mean that QEMU and KVM will also support it, yet -cpuid host brings host features wholesale. We need to whitelist each feature separately to make sure we support it. This patch adds KVM whitelisting (by simply using KVM_GET_SUPPORTED_CPUID instead of the CPUID instruction). Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-02Fix X86 CPU topology in KVM modeBharata B Rao1-0/+1
apic id returned to guest kernel in ebx for cpuid(function=1) depends on CPUX86State->cpuid_apic_id which gets populated after the cpuid information is cached in the host kernel. This results in broken CPU topology in guest. Fix this by setting cpuid_apic_id before cpuid information is passed to the host kernel. This is done by moving the setting of cpuid_apic_id to cpu_x86_init() where it will work for both KVM as well as TCG modes. Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Bharata B Rao <bharata.rao@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-24i386: wire up MSR_IA32_MISC_ENABLEAvi Kivity5-0/+48
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 <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-10-24kvm: support TSC deadline MSR with subsectionLiu, Jinsong3-0/+37
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 <jinsong.liu@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-10-24Revert "kvm: support TSC deadline MSR"Marcelo Tosatti3-18/+1
This reverts commit bfc2455ddbb41148494a084d15777e6bed7533c3. New patch with subsections will follow. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-10-03kvm: support TSC deadline MSRLiu, Jinsong3-1/+18
KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-10-01softmmu_header: pass CPUState to tlb_fillBlue Swirl1-4/+3
Pass CPUState pointer to tlb_fill() instead of architecture local cpu_single_env hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-01target-i386: Remove redundant word mask in port out instructionsJan Kiszka1-2/+0
T0 was already masked to 16 bits when loading it. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-21target-i386: Remove data type CCTableStefan Weil2-10/+0
Remove also two assert statements which were the last remaining users. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-20Merge remote-tracking branch 'qmp/queue/qmp' into stagingAnthony Liguori1-2/+2
2011-09-17target-i386: Fix several SSE3 instructions.Max Reitz1-18/+18
haddp[sd], hsubp[sd] and addsubp[sd] operate on floats, thus it is necessary to use the appropriate floating point calculation functions. If this is not done, those functions operate merely on integers, which is not correct. Signed-off-by: Max Reitz <max@tyndur.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-15Drop the vm_running global variableLuiz Capitulino1-1/+1
Use runstate_is_running() instead, which is introduced by this commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>