summaryrefslogtreecommitdiff
path: root/target-i386
AgeCommit message (Collapse)AuthorFilesLines
2011-01-23kvm: Stop on all fatal exit reasonsJan Kiszka1-0/+4
Ensure that we stop the guest whenever we face a fatal or unknown exit reason. If we stop, we also have to enforce a cpu loop exit. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-23kvm: x86: Swallow KVM_EXIT_SET_TPRJan Kiszka1-0/+3
This exit only triggers activity in the common exit path, but we should accept it in order to be able to detect unknown exit types. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21kvm: x86: Fix a few coding style violationsJan Kiszka1-153/+182
No functional changes. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-01-21kvm: x86: Prevent sign extension of DR7 in guest debugging modeJan Kiszka1-1/+1
This unbreaks guest debugging when the 4th hardware breakpoint used for guest debugging is a watchpoint of 4 or 8 byte lenght. The 31st bit of DR7 is set in that case and used to cause a sign extension to the high word which was breaking the guest state (vm entry failure). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-01-21kvm: x86: Remove obsolete SS.RPL/DPL aligmentJan Kiszka1-7/+0
This seems to date back to the days KVM didn't support real mode. The check is no longer needed and, even worse, is corrupting the guest state in case SS.RPL != DPL. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-01-21kvm: x86: Fix DPL write back of segment registersJan Kiszka1-1/+1
The DPL is stored in the flags and not in the selector. In fact, the RPL may differ from the DPL at some point in time, and so we were corrupting the guest state so far. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-01-21kvm: introduce kvm_inject_x86_mce_onJin Dongming1-21/+36
Pass a table instead of multiple args. Note: kvm_inject_x86_mce(env, bank, status, mcg_status, addr, misc, abort_on_error); is equal to: struct kvm_x86_mce mce = { .bank = bank, .status = status, .mcg_status = mcg_status, .addr = addr, .misc = misc, }; kvm_inject_x86_mce_on(env, &mce, abort_on_error); Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21kvm: kvm_mce_inj_* subroutines for templated error injectionsJin Dongming1-40/+71
Refactor codes for maintainability. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21kvm: introduce kvm_mce_in_progressJin Dongming1-10/+5
Share same error handing, and rename this function after MCIP (Machine Check In Progress) flag. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21Add function for checking mca broadcast of CPUJin Dongming3-5/+35
Add function for checking whether current CPU support mca broadcast. Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21Add "broadcast" option for mce commandJin Dongming3-7/+34
When the following test case is injected with mce command, maybe user could not get the expected result. DATA command cpu bank status mcg_status addr misc (qemu) mce 1 1 0xbd00000000000000 0x05 0x1234 0x8c Expected Result panic type: "Fatal Machine check" That is because each mce command can only inject the given cpu and could not inject mce interrupt to other cpus. So user will get the following result: panic type: "Fatal machine check on current CPU" "broadcast" option is used for injecting dummy data into other cpus. Injecting mce with this option the expected result could be gotten. Usage: Broadcast[on] command broadcast cpu bank status mcg_status addr misc (qemu) mce -b 1 1 0xbd00000000000000 0x05 0x1234 0x8c Broadcast[off] command cpu bank status mcg_status addr misc (qemu) mce 1 1 0xbd00000000000000 0x05 0x1234 0x8c Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21Clean up cpu_inject_x86_mce()Jin Dongming1-10/+17
Clean up cpu_inject_x86_mce() for later patch. Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21kvm: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension()Lai Jiangshan1-2/+2
simple cleanup and use existing helper: kvm_check_extension(). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-21kvm: Enable user space NMI injection for kvm guestLai Jiangshan1-0/+7
Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space raised them. (example: qemu monitor's "nmi" command) Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-20target-i386: Use deposit operation.Richard Henderson1-28/+6
Use this for assignment to the low byte or low word of a register. Acked-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-12-27x86: Filter out garbage from segment flags dumpJan Kiszka1-2/+2
Only bits 8..23 of the segment flags contain valid data, so only dump those when printing the CPU state. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-12-20target-i386: Fix accidental use of SoftFloat uint64 typeAndreas Färber1-4/+4
softfloat.h's uint64 type has least-width semantics. Use uint64_t instead since that is used in helpers. v4: * Summary change. v3: * Split off. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Acked-by: Huang Ying <ying.huang@intel.com> Acked-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-11-16Add support for async page fault to qemuGleb Natapov4-1/+42
Add save/restore of MSR for migration and cpuid bit. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-30target-xxx: Use fprintf_function (format checking)Stefan Weil3-11/+10
fprintf_function uses format checking with GCC_FMT_ATTR. Format errors were fixed in * target-i386/helper.c * target-mips/translate.c * target-ppc/translate.c Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-21kvm: save/restore x86-64 MSRs on x86-64 kernelsMarcelo Tosatti1-10/+20
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21kvm: writeback SMP TSCs on migration onlyMarcelo Tosatti1-1/+9
commit 6389c45441269baa2873e6feafebd17105ddeaf6 Author: Jan Kiszka <jan.kiszka@siemens.com> Date: Mon Mar 1 18:17:26 2010 +0100 qemu-kvm: Cleanup/fix TSC and PV clock writeback Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21kvm: factor out kvm_has_msr_starMarcelo Tosatti1-11/+30
And add kvm_has_msr_hsave_pa(), to avoid warnings on older kernels without support. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21kvm: add save/restore of MSR_VM_HSAVE_PAMarcelo Tosatti1-0/+5
commit 2bba4446746add456ceeb0e8359a43032a2ea333 Author: Alexander Graf <agraf@suse.de> Date: Thu Dec 18 15:38:32 2008 +0100 Enable nested SVM support in userspace Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21Fix build on !KVM_CAP_MCEHidetoshi Seto1-2/+3
This patch removes following warnings: target-i386/kvm.c: In function 'kvm_put_msrs': target-i386/kvm.c:782: error: unused variable 'i' target-i386/kvm.c: In function 'kvm_get_msrs': target-i386/kvm.c:1083: error: label at end of compound statement Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21x86, mce: broadcast mce depending on the cpu versionHidetoshi Seto1-5/+24
There is no reason why SRAO event received by the main thread is the only one that being broadcasted. According to the x86 ASDM vol.3A 15.10.4.1, MCE signal is broadcast on processor version 06H_EH or later. This change is required to handle SRAR in smp guests. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-21x86, mce: ignore SRAO only when MCG_SER_P is availableHidetoshi Seto1-6/+10
And restruct this block to call kvm_mce_in_exception() only when it is required. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-20Fix memory leak in register save load due to xsave supportMarcelo Tosatti1-3/+8
From: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-10-20Add savevm/loadvm support for MCEMarcelo Tosatti1-1/+38
Port qemu-kvm's commit 1bab5d11545d8de5facf46c28630085a2f9651ae Author: Huang Ying <ying.huang@intel.com> Date: Wed Mar 3 16:52:46 2010 +0800 Add savevm/loadvm support for MCE MCE registers are saved/load into/from CPUState in kvm_arch_save/load_regs. To simulate the MCG_STATUS clearing upon reset, MSR_MCG_STATUS is set to 0 for KVM_PUT_RESET_STATE. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20MCE: Relay UCR MCE to guestMarcelo Tosatti4-6/+197
Port qemu-kvm's commit 4b62fff1101a7ad77553147717a8bd3bf79df7ef Author: Huang Ying <ying.huang@intel.com> Date: Mon Sep 21 10:43:25 2009 +0800 MCE: Relay UCR MCE to guest UCR (uncorrected recovery) MCE is supported in recent Intel CPUs, where some hardware error such as some memory error can be reported without PCC (processor context corrupted). To recover from such MCE, the corresponding memory will be unmapped, and all processes accessing the memory will be killed via SIGBUS. For KVM, if QEMU/KVM is killed, all guest processes will be killed too. So we relay SIGBUS from host OS to guest system via a UCR MCE injection. Then guest OS can isolate corresponding memory and kill necessary guest processes only. SIGBUS sent to main thread (not VCPU threads) will be broadcast to all VCPU threads as UCR MCE. aliguori: fix build Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20kvm: x86: add mce supportMarcelo Tosatti3-0/+111
Port qemu-kvm's MCE support commit c68b2374c9048812f488e00ffb95db66c0bc07a7 Author: Huang Ying <ying.huang@intel.com> Date: Mon Jul 20 10:00:53 2009 +0800 Add MCE simulation support to qemu/kvm KVM ioctls are used to initialize MCE simulation and inject MCE. The real MCE simulation is implemented in Linux kernel. The Kernel part has been merged. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20Add svm cpuid featuresJoerg Roedel3-17/+75
This patch adds the svm cpuid feature flags to the qemu intialization path. It also adds the svm features available on phenom to its cpu-definition and extends the host cpu type to support all svm features KVM can provide. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-20Set cpuid definition to 0 before initializing itJoerg Roedel1-0/+2
This patch cleans the (stack-allocated) cpuid definition to 0 before actually initializing it. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-10-13i386: avoid a write only variableBlue Swirl1-0/+4
Compiling with GCC 4.6.0 20100925 produced warnings: /src/qemu/target-i386/op_helper.c: In function 'switch_tss': /src/qemu/target-i386/op_helper.c:283:53: error: variable 'new_trap' set but not used [-Werror=unused-but-set-variable] Fix by adding a dummy cast so that the variable is not unused. Add also pointer to docs. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-08-22QemuOpts: make most qemu_*_opts staticGerd Hoffmann1-1/+1
Switch tree to lookup-by-name using qemu_find_opts(). Also hook up virtfs options so qemu_find_opts works for them too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-08-22target-i386: svm: Fix MSRPM checkAdam Lackorzynski1-1/+1
Correct the calculation of the offset in the msrpm for the MSR range 0 - 0x1fff. Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-08-20Use ARRAY_SIZE macroBlue Swirl1-1/+1
Replace array size calculations with ARRAY_SIZE macro. Implemented with this Coccinelle semantic patch, adapted from Linux kernel: @@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) Some files (*-dis.c, tests/*) had to be filtered out. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-25target-i386: use gen_update_cc_op()Jun Koi1-32/+8
This patch simplifies target-i386/translate.c a bit by replacing some code with gen_update_cc_op() Signed-off-by: Jun Koi <junkoi2004@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-24use symbol for DisasContext->is_jmpJun Koi1-10/+10
This patch replaces constant value assigned for (DisasContext *)->is_jmp with DISAS_TB_JUMP. Signed-off-by: Jun Koi <junkoi2004@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-03remove exec-all.h inclusion from cpu.hPaolo Bonzini1-2/+0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03move cpu_pc_from_tb to target-*/exec.hPaolo Bonzini2-5/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03remove unused stuff from */exec.hPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-02Don't declare XSAVE as supportedAndi Kleen1-2/+2
i386 cpuid.c currently claims XSAVE is supported in the CPUID filter, but that's not true: Only FXSAVE is supported. Remove that bit from the filter. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-02Add more boundary checking to sse3/4 parsingAndi Kleen1-0/+9
ssse3 uses tables with only two entries per op, but it is indexed with b1 which can contain variables upto 3. This happens when ssse3 or sse4 are used with REP* prefixes. Add boundary checking for this case. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-07-01target-i386: fix xchg rax,r8Richard Henderson1-2/+7
We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30x86: svm: Always clear event_inj on vmexitJan Kiszka1-0/+1
We currently only clear SVM_EVTINJ_VALID after successful interrupt delivery. This apparently does not match real hardware which clears the whole event_inj field on every vmexit, including unsuccessful interrupt delivery. Reported-by: Erik van der Kouwe <vdkouwe@cs.vu.nl> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-28kvm: Fix cpu_is_bsp() compilation warningSheng Yang1-0/+1
Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-06-28kvm: init mp_stateMarcelo Tosatti1-0/+6
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-06-28kvm: Enable XSAVE live migration supportSheng Yang3-3/+163
Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-06-28Enable XSAVE related CPUIDSheng Yang1-0/+21
We can support it in KVM now. The 0xd leaf is queried from KVM. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-06-28kvm: Extend kvm_arch_get_supported_cpuid() to support indexSheng Yang1-8/+11
Would use it later for XSAVE related CPUID. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>