summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* KVM: Reset PIT irq injection logic when the PIT IRQ is unmaskedAvi Kivity2009-03-242-0/+16
| | | | | | | | | | | While the PIT is masked the guest cannot ack the irq, so the reinject logic will never allow the interrupt to be injected. Fix by resetting the reinjection counters on unmask. Unbreaks Xen. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Interrupt mask notifiers for ioapicAvi Kivity2009-03-244-0/+50
| | | | | | | | | | Allow clients to request notifications when the guest masks or unmasks a particular irq line. This complements irq ack notifications, as the guest will not ack an irq line that is masked. Currently implemented for the ioapic only. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Add CONFIG_HAVE_KVM_IRQCHIPAvi Kivity2009-03-244-0/+14
| | | | | | | Two KVM archs support irqchips and two don't. Add a Kconfig item to make selecting between the two models easier. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Optimize page unshadowingAvi Kivity2009-03-241-3/+12
| | | | | | | Using kvm_mmu_lookup_page() will result in multiple scans of the hash chains; use hlist_for_each_entry_safe() to achieve a single scan instead. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Add microcode patch level dummyAlexander Graf2009-03-241-0/+3
| | | | | | | | | VMware ESX checks if the microcode level is correct when using a barcelona CPU, in order to see if it actually can use SVM. Let's tell it we're on the safe side... Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Add support to disable MSI for assigned deviceSheng Yang2009-03-242-2/+17
| | | | | | | | | | | | | | MSI is always enabled by default for msi2intx=1. But if msi2intx=0, we have to disable MSI if guest require to do so. The patch also discard unnecessary msi2intx judgment if guest want to update MSI state. Notice KVM_DEV_IRQ_ASSIGN_MSI_ACTION is a mask which should cover all MSI related operations, though we only got one for now. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Remove duplicated prototype of kvm_arch_destroy_vmSheng Yang2009-03-241-1/+0
| | | | | Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: remove debug support broken by KVM debug rewriteHollis Blanchard2009-03-244-99/+2
| | | | | | | | After the rewrite of KVM's debug support, this code doesn't even build any more. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Properly lock PIT creationAvi Kivity2009-03-242-2/+6
| | | | | | Otherwise, two threads can create a PIT in parallel and cause a memory leak. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: implement 'ret far' instruction (opcode 0xcb)Avi Kivity2009-03-241-1/+25
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: When emulating on invalid vmx state, don't return to userspace ↵Avi Kivity2009-03-241-2/+6
| | | | | | | | | unnecessarily If we aren't doing mmio there's no need to exit to userspace (which will just be confused). Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Make emulate_pop() a little more genericAvi Kivity2009-03-241-9/+6
| | | | | | | Allow emulate_pop() to read into arbitrary memory rather than just the source operand. Needed for complicated instructions like far returns. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Prevent exit handler from running if emulating due to invalid stateAvi Kivity2009-03-241-7/+4
| | | | | | | | | | | If we've just emulated an instruction, we won't have any valid exit reason and associated information. Fix by moving the clearing of the emulation_required flag to the exit handler. This way the exit handler can notice that we've been emulating and abort early. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: don't clobber segment AR if emulating invalid stateAvi Kivity2009-03-241-1/+1
| | | | | | | The ususable bit is important for determining state validity; don't clobber it. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Fix guest state validity checksAvi Kivity2009-03-241-4/+14
| | | | | | | The vmx guest state validity checks are full of bugs. Make them conform to the manual. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: Add extra E500 exceptionsHollis Blanchard2009-03-247-15/+92
| | | | | | | | | e500 has additional interrupt vectors (and corresponding IVORs) for SPE and performance monitoring interrupts. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: distinguish between interrupts and prioritiesHollis Blanchard2009-03-242-1/+2
| | | | | | | | Although BOOKE_MAX_INTERRUPT has the right value, the meaning is not match. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: Add kvmppc_mmu_dtlb/itlb_miss for bookeHollis Blanchard2009-03-243-0/+12
| | | | | | | | | When itlb or dtlb miss happens, E500 needs to update some mmu registers. So that the auto-load mechanism can work on E500 when write a tlb entry. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: E500 core-specific codeHollis Blanchard2009-03-247-0/+1330
| | | | | | Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: ifdef iccci with CONFIG_44xHollis Blanchard2009-03-241-0/+2
| | | | | | | | E500 deosn't support this instruction. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: No need to include core-header for KVM in asm-offsets.c currentlyHollis Blanchard2009-03-241-3/+1
| | | | | | Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: Add dbsr in kvm_vcpu_archHollis Blanchard2009-03-242-0/+5
| | | | | | | | | Kernel for E500 need clear dbsr when startup. So add dbsr register in kvm_vcpu_arch for BOOKE. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: split out common Book E instruction emulationHollis Blanchard2009-03-244-202/+284
| | | | | | | | | | | The Book E code will be shared with e500. I've left PID in kvmppc_core_emulate_op() just so that we don't need to move kvmppc_set_pid() right now. Once we have the e500 implementation, we can probably share that too. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: use macros instead of hardcoded literals for instruction decodingHollis Blanchard2009-03-241-30/+63
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: remove last 44x-specific bits from booke.cHollis Blanchard2009-03-241-4/+0
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: rename 44x MMU functions used in booke.cHollis Blanchard2009-03-244-6/+6
| | | | | | | e500 will provide its own implementation of these. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: turn tlb_xlate() into a per-core hook (and give it a better name)Hollis Blanchard2009-03-245-20/+15
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: change kvmppc_mmu_map() parametersHollis Blanchard2009-03-243-13/+9
| | | | | | | Passing just the TLB index will ease an e500 implementation. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: small cosmetic changes to Book E DTLB miss handlerHollis Blanchard2009-03-241-3/+5
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: cosmetic changes to mmu hook namesHollis Blanchard2009-03-243-4/+5
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ppc: move struct kvmppc_44x_tlbe into 44x-specific headerHollis Blanchard2009-03-242-7/+7
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Move struct kvm_pio_request into x86 kvm_host.hAvi Kivity2009-03-242-12/+12
| | | | | | This is an x86 specific stucture and has no business living in common code. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: PIT: provide an option to disable interrupt reinjectionMarcelo Tosatti2009-03-245-0/+35
| | | | | | | | | | | | | | Certain clocks (such as TSC) in older 2.6 guests overaccount for lost ticks, causing severe time drift. Interrupt reinjection magnifies the problem. Provide an option to disable it. [avi: allow room for expansion in case we want to disable reinjection of other timers] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fallback support for MSR_VM_HSAVE_PAAvi Kivity2009-03-241-0/+2
| | | | | | | | Since we advertise MSR_VM_HSAVE_PA, userspace will attempt to read it even on Intel. Implement fake support for this MSR to avoid the warnings. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: remove the vmap usageIzik Eidus2009-03-242-51/+14
| | | | | | | | vmap() on guest pages hides those pages from the Linux mm for an extended (userspace determined) amount of time. Get rid of it. Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: introduce kvm_read_guest_virt, kvm_write_guest_virtIzik Eidus2009-03-242-18/+42
| | | | | | | | | This commit change the name of emulator_read_std into kvm_read_guest_virt, and add new function name kvm_write_guest_virt that allow writing into a guest virtual address. Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: initialize TSC offset relative to vm creation timeMarcelo Tosatti2009-03-243-8/+14
| | | | | | | | | | | | | | | | | | | | | VMX initializes the TSC offset for each vcpu at different times, and also reinitializes it for vcpus other than 0 on APIC SIPI message. This bug causes the TSC's to appear unsynchronized in the guest, even if the host is good. Older Linux kernels don't handle the situation very well, so gettimeofday is likely to go backwards in time: http://www.mail-archive.com/kvm@vger.kernel.org/msg02955.html http://sourceforge.net/tracker/index.php?func=detail&aid=2025534&group_id=180599&atid=893831 Fix it by initializating the offset of each vcpu relative to vm creation time, and moving it from vmx_vcpu_reset to vmx_vcpu_setup, out of the APIC MP init path. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Drop walk_shadow()Avi Kivity2009-03-241-20/+0
| | | | | | No longer used. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Replace walk_shadow() by for_each_shadow_entry() in invlpg()Avi Kivity2009-03-241-49/+32
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Replace walk_shadow() by for_each_shadow_entry() in fetch()Avi Kivity2009-03-241-70/+58
| | | | | | | Effectively reverting to the pre walk_shadow() version -- but now with the reusable for_each(). Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Use for_each_shadow_entry() in __direct_map()Avi Kivity2009-03-241-54/+29
| | | | | | Eliminating a callback and a useless structure. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Add for_each_shadow_entry(), a simpler alternative to walk_shadow()Avi Kivity2009-03-241-20/+49
| | | | | | | | | Using a for_each loop style removes the need to write callback and nasty casts. Implement the walk_shadow() using the for_each_shadow_entry(). Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Advertise guest debug capability per-archJan Kiszka2009-03-241-0/+2
| | | | | | | | Limit KVM_CAP_SET_GUEST_DEBUG only to those archs (currently x86) that support it. This simplifies user space stub implementations. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix vmload and friends misinterpreted as lidtAvi Kivity2009-03-241-5/+10
| | | | | | | | | | | The AMD SVM instruction family all overload the 0f 01 /3 opcode, further multiplexing on the three r/m bits. But the code decided that anything that isn't a vmmcall must be an lidt (which shares the 0f 01 /3 opcode, for the case that mod = 3). Fix by aborting emulation if this isn't a vmmcall. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Initialize a shadow page's global attribute from cr4.pgeAvi Kivity2009-03-241-3/+1
| | | | | | | If cr4.pge is cleared, we ought to treat any ptes in the page as non-global. This allows us to remove the check from set_spte(). Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Segregate mmu pages created with different cr4.pge settingsAvi Kivity2009-03-242-0/+2
| | | | | | | | | | | | Don't allow a vcpu with cr4.pge cleared to use a shadow page created with cr4.pge set; this might cause a cr3 switch not to sync ptes that have the global bit set (the global bit has no effect if !cr4.pge). This can only occur on smp with different cr4.pge settings for different vcpus (since a cr4 change will resync the shadow ptes), but there's no cost to being correct here. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Inherit a shadow page's guest level count from vcpu setupAvi Kivity2009-03-242-6/+12
| | | | | | | | | | Instead of "calculating" it on every shadow page allocation, set it once when switching modes, and copy it when allocating pages. This doesn't buy us much, but sets up the stage for inheriting more information related to the mmu setup. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ia64: Code cleanupXiantao Zhang2009-03-243-57/+2
| | | | | | | | Remove some unnecessary blank lines to accord with Kernel's coding style. Also remove vcpu_get_itir_on_fault due to no reference to it. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Remove old kvm_guest_debug structsJan Kiszka2009-03-243-11/+0
| | | | | | | | Remove the remaining arch fragments of the old guest debug interface that now break non-x86 builds. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ia64: stack get/restore patchJes Sorensen2009-03-244-4/+104
| | | | | | | | | | | Implement KVM_IA64_VCPU_[GS]ET_STACK ioctl calls. This is required for live migrations. Patch is based on previous implementation that was part of old GET/SET_REGS ioctl calls. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Avi Kivity <avi@redhat.com>
OpenPOWER on IntegriCloud