aboutsummaryrefslogtreecommitdiffstats
path: root/target-i386
AgeCommit message (Collapse)AuthorFilesLines
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>
2011-09-15Replace the VMSTOP macros with a proper state typeLuiz Capitulino1-1/+1
Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-10kvm: remove unnecessary assignmentsBlue Swirl1-1/+1
Avoid these warnings from clang analyzer: /src/qemu/target-i386/kvm.c:772:5: warning: Value stored to 'cwd' is never read cwd = swd = twd = 0; /src/qemu/target-i386/kvm.c:772:11: warning: Although the value stored to 'swd' is used in the enclosing expression, the value is never actually read from 'swd' cwd = swd = twd = 0; Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-08Merge remote-tracking branch 'origin/master' into stagingAnthony Liguori1-29/+43
2011-09-08target-i386: Compute all flag data inside %cl != 0 test.Richard Henderson1-29/+43
The (x << (cl - 1)) quantity is only used if CL != 0. Move the computation of that quantity nearer its use. This avoids the creation of undefined TCG operations when the constant propagation optimization proves that CL == 0, and thus CL-1 is outside the range [0-wordsize). Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: malc <av1474@comtv.ru>
2011-09-08Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori1-3/+3
2011-09-03Use new macro QEMU_PACKED for packed structuresStefan Weil2-5/+5
Most changes were made using these commands: git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/' git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/' git grep -la '__attribute__((__packed__))'|xargs perl -pi -e 's/__attribute__\(\(__packed__\)\)/QEMU_PACKED/' git grep -la '__attribute__ ((__packed__))'|xargs perl -pi -e 's/__attribute__ \(\(__packed__\)\)/QEMU_PACKED/' git grep -la '__attribute((packed))'|xargs perl -pi -e 's/__attribute\(\(packed\)\)/QEMU_PACKED/' Whitespace in linux-user/syscall_defs.h was fixed manually to avoid warnings from scripts/checkpatch.pl. Manual changes were also applied to hw/pc.c. I did not fix indentation with tabs in block/vvfat.c. The patch will show 4 errors with scripts/checkpatch.pl. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-02x86: fix daa opcode for al register values higher than 0xf9Boris Figovsky1-3/+3
The second if statement should consider the original al register value, and not the new one. Signed-off-by: Boris Figovsky <boris.figovksy@ravellosystems.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-08-25Fix up some style nits of last uq/master mergeJan Kiszka1-2/+3
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori3-13/+13
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori3-1/+29
2011-08-07Remove unused is_softmmu parameter from cpu_handle_mmu_faultBlue Swirl3-4/+4
Parameter is_softmmu (and its evil mutant twin brother is_softmuu) is not used in cpu_*_handle_mmu_fault() functions, remove them and adjust callers. Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-05Avoid allocating TCG resources in non-TCG modeJan Kiszka1-2/+2
Do not allocate TCG-only resources like the translation buffer when running over KVM or XEN. Saves a "few" bytes in the qemu address space and is also conceptually cleaner. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-05Remove #ifdef KVM_CAP_TSC_CONTROLMarcelo Tosatti1-2/+0
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>