summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* qemu-kvm: enable get/set vcpu events on reset and migrationMarcelo Tosatti2010-01-311-1/+2
| | | | | | | | qemu-kvm should reset and save/restore vcpu events. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Gleb Natapov <gleb@redhat.com>
* Don't leak kvm_save_mpstate() to main qemu codeAvi Kivity2009-12-221-0/+1
| | | | | | | It doesn't exist outside x86, and breaks the build. Move it to cpu_synchronize_state() instead (only reading, not writing). Signed-off-by: Avi Kivity <avi@redhat.com>
* tpr patching: defer post-migration load to vcpu contextAvi Kivity2009-12-101-0/+3
| | | | | | This makes sure the cpu state is properly loaded. Signed-off-by: Avi Kivity <avi@redhat.com>
* Fix mismerge of irq bitmap refactoringAvi Kivity2009-11-241-0/+2
| | | | | | init/reset was left out. Signed-off-by: Avi Kivity <avi@redhat.com>
* Merge commit '0e607a80d323ba9f46dee71cd07380c4eb5c2b0a' into upstream-mergeAvi Kivity2009-11-221-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '0e607a80d323ba9f46dee71cd07380c4eb5c2b0a': (22 commits) kvm: x86: Refactor use of interrupt_bitmap kvm: Add arch reset handler Enable migration without shared storage from the monitor Block live migration Expose a mechanism to trace block writes char: rename qemu_chr_reset to qemu_chr_generic_open char: Remove special init_reset handling char: don't limit data sent to backends to 1k per buffer ARM PB-A8 support LAN9118 emulation mips_r4k: fix reset PPC64: map Uni-North AGP bus aka fix Linux boot PPC64: Partial fix to Linux crash: revert to old devfn PCI: make duplicate devfn allocation fatal Do not execute shell scripts directly mips malta: fix indentation target-mips: fix indentation mips-malta: fix reset mips: fix cpu_reset memory leak fix make clean targets ... Carry changes to qemu-kvm-x86.c. Signed-off-by: Avi Kivity <avi@redhat.com>
* use upstream kvm_vcpu_ioctlGlauber Costa2009-10-221-54/+32
| | | | | Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* move tpr stuff to qemu-kvm-x86.cGlauber Costa2009-10-201-0/+7
| | | | | | | | this whole tpr thing does not belong in common code. Move it to i386 specific files. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* use upstream version of kvm_arch_post_runGlauber Costa2009-10-201-22/+0
| | | | | | | | Replace ours with qemu.git version. A couple of functions go unused, and are deleted. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* change pre and post kvm_run signatures.Glauber Costa2009-10-201-2/+4
| | | | | | | | Intention is to merge with upstream version in the following patch. Doing as a separate step to help identify any further issues. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* get and set clock upon migrationGlauber Costa2009-10-191-0/+35
| | | | | | | | | Register a vmstate handler for kvmclock. The goal here is to pass information about current time to migration, so we avoid going backwards or jumping too much. We use our plain new ioctls for that. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* properly save kvm system time msr registersGlauber Costa2009-10-191-0/+11
| | | | | | | | | | | | Currently, the msrs involved in setting up pvclock are not saved over migration and/or save/restore. This patch puts their value in special fields in our CPUState, and deal with them using vmstate. kvm also has to account for it, by including them in the msr list for the ioctls. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* get rid of MSR_COUNTGlauber Costa2009-10-191-10/+4
| | | | | | | | | | | | qemu.git uses an array of 100 entries for the msr list, which is arguably large enough (tm). I propose we follow the same path, for two reasons: 1) ease future merge. 2) avoid stack overflow problems that had already began to appear Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* change function signatures so that they don't take a vcpu argumentGlauber Costa2009-10-191-46/+45
| | | | | | | | At this point, vcpu arguments are passed only for the fd field. We already provide that in env, as kvm_fd. Replace it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* fix MSR_COUNT for kvm_arch_save_regs()Eduardo Habkost2009-10-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | A new register was added to the load/save list on commit d283d5a65a2bdcc570065267be21848bd6fe3d78, but MSR_COUNT was not updated, leading to potential stack corruption on kvm_arch_save_regs(). The following registers are saved by kvm_arch_save_regs(): 1) MSR_IA32_SYSENTER_CS 2) MSR_IA32_SYSENTER_ESP 3) MSR_IA32_SYSENTER_EIP 4) MSR_STAR 5) MSR_IA32_TSC 6) MSR_VM_HSAVE_PA 7) MSR_CSTAR (x86_64 only) 8) MSR_KERNELGSBASE (x86_64 only) 9) MSR_FMASK (x86_64 only) 10) MSR_LSTAR (x86_64 only) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* use env in kvm_arch_runGlauber Costa2009-10-131-6/+6
| | | | | | | | kvm_arch_run() takes a vcpu context parameter, but CPUState should do. Convert it, as well as the functions that it end up calling Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* use env as parameter for functions that access kvm_runGlauber Costa2009-10-131-2/+2
| | | | | | | | Convert header of public functions that access kvm_run, so they can use CPUState version instead. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* make some functions staticGlauber Costa2009-10-131-9/+9
| | | | | | | | Some functions that uses kvm_run are not static, but should be. Make them static, and make them get a CPUState parameter in the process. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* remove unneded opaque.Glauber Costa2009-10-131-1/+1
| | | | | | | | | kvm_debug() and kvm_arch_halt() both take an opaque field for no reason, since it is totally unused. kvm_halt() itself is just a wrapper around kvm_arch_halt(), and is removed. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* drop kvm_mmio_read and writeGlauber Costa2009-10-131-6/+1
| | | | | | | they are just a tiny wrapper around qemu memory functions. Drop' em Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* use a more upstream friendly version of irqchip-in-kernel testGlauber Costa2009-10-131-4/+4
| | | | | | | | | | Upstream now has tests for irqchip_in_kernel. It differs from our signature, as it does not take any parameter. For consistency, convert our usage. Also, use a field in KVMState to store it, so we can have the exact same function as qemu upstream does. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Don't call kvm_cpu_synchronize_state() if there is no irqchip events to processGleb Natapov2009-09-231-3/+6
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Fix compilation without device assignmentJuan Quintela2009-09-181-0/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs()Gleb Natapov2009-09-181-2/+1
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Remove unused function.Gleb Natapov2009-09-181-10/+0
| | | | | | | kvm_arch_update_regs_for_sipi() is not used anymore. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Fix mpstate reloadsAvi Kivity2009-08-311-0/+2
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* kvm: fix set_ept_identity_addr() in paeSheng Yang2009-08-041-1/+1
| | | | | | | The argument to kernel space should be u64 rather than unsigned long. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Remove useless wrappers around functionsGlauber Costa2009-08-041-1/+1
| | | | | | | | | Some more cleanup from the libkvm era. Functions that starts with kvm_qemu_yyy just to wrap a kvm_yyy. I'm removing it, and changing the name of one of them to match upstream. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Move EPT identity mapping pages to allow a larger BIOS imageJordan Justen2009-08-031-1/+1
| | | | | | | | | | | | | | | | Move from: 0xfffbc000-0xfffbcfff to: 0xfeffc000-0xfeffcfff This step is required to free up the 0xff000000-0xffffffff (16MB) range for use with bios.bin. The KVM kernel change depends upon a change to kvm/bios/rombios.c so the bios INT15-E820 function will properly reserve the new location. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Move TSS pages to allow a larger BIOS imageJordan Justen2009-08-031-1/+1
| | | | | | | | | | | | | | | | Move from: 0xfffbd000-0xfffbffff to: 0xfeffd000-0xfeffffff This step is required to free up the 0xff000000-0xffffffff (16MB) range for use with bios.bin. This change depends upon a change to kvm/bios/rombios.c so the bios INT15-E820 function will properly reserve the new location. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* fix mce check extensionGlauber Costa2009-07-231-1/+1
| | | | | | | | Because a patch got into marcelo's tree before mine did, I forgot to convert one user of kvm_check_extension. Here's the fix for it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* check extensionGlauber Costa2009-07-211-3/+3
| | | | | | | use upstream check_extension code Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* reuse kvm_ioctlGlauber Costa2009-07-211-22/+19
| | | | | | | | | | | | | | | Start using kvm_ioctl's code. For type safety, delete fd from kvm_context entirely, so the compiler can play along with us helping to detect errors I might have made. Signed-off-by: Glauber Costa <glommer@redhat.com> Also, we were slightly different from qemu upstream in handling error code from ioctl, since we were always testing for -1, while kvm_vm_ioctl returns -errno. We already did this in most of the call sites, so this patch has the big advantage of simplifying call sites. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* reuse kvm_vm_ioctlGlauber Costa2009-07-211-39/+14
| | | | | | | | | | | | | | | | | | Start using kvm_vm_ioctl's code. For type safety, delete vm_fd from kvm_context entirely, so the compiler can play along with us helping to detect errors I might have made. Also, we were slightly different from qemu upstream in handling error code from ioctl, since we were always testing for -1, while kvm_vm_ioctl returns -errno. We already did this in most of the call sites, so this patch has the big advantage of simplifying call sites. Diffstat says: 4 files changed, 58 insertions(+), 134 deletions(-) Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* kvm: allow qemu to set EPT identity mapping addressSheng Yang2009-07-211-0/+45
| | | | | | | | | | | If we use larger BIOS image than current 256KB, we would need move reserved TSS and EPT identity mapping pages. Currently TSS support this, but not EPT. (change from v1, use parameter address instead of value for ioctl) Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Add MCE simulation support to qemu/kvmHuang Ying2009-07-201-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. ChangeLog: v7: - Re-based on qemu-kvm.git/next branch v6: - Re-based on latest qemu-kvm.git v5: - Re-based on latest qemu-kvm.git v3: - Re-based on qemu/tcg MCE support patch v2: - Use new kernel MCE capability exportion interface. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* qemu-kvm: x86: fix memleak if ioctl failsAmit Shah2009-07-141-1/+1
| | | | | | | | | Fix a memleak when the KVM_SET_CPUID2 ioctl fails. Free the memory that we allocate to store cpuids. Reported-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* use kvm_upstream sw_breakpoints structureGlauber Costa2009-07-141-2/+2
| | | | | Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* fold libkvm-all into standard qemu headerGlauber Costa2009-07-141-1/+0
| | | | | | | | | Sharing of structures containing each other between libkvm-all.h and qemu-kmv.h gets a bit messy in this series. So fold them together. libkvm-all.h has no place in the final schema of things anyway. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* replace malloc with qemu_mallocGlauber Costa2009-07-141-23/+8
| | | | | | | | This patch replaces both malloc and malloc+memset sequences with qemu_malloc and qemu_mallocz. Target is upstream integration Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* HPET support with kvmBeth Kon2009-07-121-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | The big change here is handling of enabling/disabling of hpet legacy mode. When hpet enters legacy mode, the spec says that the pit stops generating interrupts. In practice, we want to stop the pit periodic timer from running because it is wasteful in a virtual environment. We also have to worry about the hpet leaving legacy mode (which, at least in linux, happens only during a shutdown or crash). At this point, according to the hpet spec, PIT interrupts need to be reenabled. For us, it means the PIT timer needs to be restarted. This patch handles this situation better than the earlier versions by coming closer to just disabling PIT interrupts. It allows the PIT state to change if the OS modifies it, even while PIT is disabled, but does not allow a pit timer to start. Then if HPET legacy mode is disabled, whatever the PIT state is at that point, the PIT timer is restarted accordingly. [avi: adjust to kernel header changes] Signed-off-by: Beth Kon <eak@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Select irq0->irq2 override based on kernel gsi routing availabilityBeth Kon2009-07-121-1/+5
| | | | | | | | If the kernel does not support gsi routing, we cannot do the irq0->irq2 override, so disable it in that case. Signed-off-by: Beth Kon <eak@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Preserve the hypervisor bit while KVM trims the CPUID bitsAndre Przywara2009-07-071-0/+5
| | | | | | | | | | | The KVM kernel will disable all bits in CPUID which are not present in the host. As this is mostly true for the hypervisor bit (1.ecx), preserve its value before the trim and restore it afterwards. This is similar to commit 6c0d7ee8, but since qemu-kvm uses another code path it has to be inserted in qemu-kvm-x86.c, too. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Remove qemu-kvm callbacks structureGlauber Costa2009-07-071-11/+5
| | | | | | | | | The purpose of that was only to allow the user of libkvm to register functions pointers that corresponded to possible actions. We don't need that anymore. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Work around borken MSR_GET_INDEX_LISTJan Kiszka2009-07-061-1/+4
| | | | | | | | Allocate enough memory for KVM_GET_MSR_INDEX_LIST as older kernels shot far beyond their limits, corrupting user space memory. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Update registers after INIT/SIPIGleb Natapov2009-07-011-0/+2
| | | | | | | | Load updated register into kernel after INIT/SIPI. Otherwise vcpu starts at the wrong address after SIPI. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Fix KVMs GET_SUPPORTED_CPUID feature usageAndre Przywara2009-07-011-10/+11
| | | | | | | | | | | | | | If we want to trim the user provided CPUID bits for KVM to be not greater than that of the host, we should a) not remove the bits _after_ we sent them to the kernel and b) not do the bitmangling on the original values while sending a copy This fixes the masking of features that are not present on the host and helps to use -cpu host. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Use upstream QEMU apic init/sipi handlingGleb Natapov2009-06-291-39/+4
| | | | | | | | Remove KVM specific init/sipi handling from hw/apic.c. Now when upstream QEMU handles init/sipi in a cpu loop KVM can do the same. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Use cpu_is_bsp() to check for bsp cpuGleb Natapov2009-06-281-2/+3
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Move x86 specific code from qemu-kvm.c to qemu-kvm-x86.cGleb Natapov2009-06-281-0/+43
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Fold target-i386/libkvm.c into qemu-kvm-x86.cGlauber Costa2009-06-211-0/+652
| | | | | | | | | Same spirit of what has already been done for the generic code. Fold libkvm.c into qemu-kvm-x86.c. handle_tpr_access becomes kvm_handle_tpr_access, to avoid name clash. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>