aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2009-03-24KVM: MMU: remove assertion in kvm_mmu_alloc_pageJoerg Roedel1-1/+0
The assertion no longer makes sense since we don't clear page tables on allocation; instead we clear them during prefetch. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: MMU: remove redundant check in mmu_set_spteJoerg Roedel1-6/+2
The following code flow is unnecessary: if (largepage) was_rmapped = is_large_pte(*shadow_pte); else was_rmapped = 1; The is_large_pte() function will always evaluate to one here because the (largepage && !is_large_pte) case is already handled in the first if-clause. So we can remove this check and set was_rmapped to one always here. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Acked-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: MMU: handle compound pages in kvm_is_mmio_pfnJoerg Roedel1-2/+4
The function kvm_is_mmio_pfn is called before put_page is called on a page by KVM. This is a problem when when this function is called on some struct page which is part of a compund page. It does not test the reserved flag of the compound page but of the struct page within the compount page. This is a problem when KVM works with hugepages allocated at boot time. These pages have the reserved bit set in all tail pages. Only the flag in the compount head is cleared. KVM would not put such a page which results in a memory leak. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Acked-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Fix kvmclock on !constant_tsc boxesGerd Hoffmann2-9/+95
kvmclock currently falls apart on machines without constant tsc. This patch fixes it. Changes: * keep tsc frequency in a per-cpu variable. * handle kvmclock update using a new request flag, thus checking whenever we need an update each time we enter guest context. * use a cpufreq notifier to track frequency changes and force kvmclock updates. * send ipis to kick cpu out of guest context if needed to make sure the guest doesn't see stale values. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: VMX: Use kvm_mmu_page_fault() handle EPT violation mmioSheng Yang1-29/+1
Removed duplicated code. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Use irq routing API for MSISheng Yang4-73/+86
Merge MSI userspace interface with IRQ routing table. Notice the API have been changed, and using IRQ routing table would be the only interface kvm-userspace supported. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Drop unused evaluations from string pio handlersJan Kiszka2-6/+2
Looks like neither the direction nor the rep prefix are used anymore. Drop related evaluations from SVM's and VMX's I/O exit handlers. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Add FFXSR supportAlexander Graf2-0/+15
AMD K10 CPUs implement the FFXSR feature that gets enabled using EFER. Let's check if the virtual CPU description includes that CPUID feature bit and allow enabling it then. This is required for Windows Server 2008 in Hyper-V mode. v2 adds CPUID capability exposure Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24x86: Add EFER descriptions for FFXSRAlexander Graf1-0/+2
AMD k10 includes support for the FFXSR feature, which leaves out XMM registers on FXSAVE/FXSAVE when the EFER_FFXSR bit is set in EFER. The CPUID feature bit exists already, but the EFER bit is missing currently, so this patch adds it to the list of known EFER bits. Signed-off-by: Alexander Graf <agraf@suse.de> CC: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: make irq ack notifications aware of routing tableMarcelo Tosatti5-11/+21
IRQ ack notifications assume an identity mapping between pin->gsi, which might not be the case with, for example, HPET. Translate before acking. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Gleb Natapov <gleb@redhat.com>
2009-03-24KVM: ia64: dynamic nr online cpusJes Sorensen3-9/+18
Account for number of online cpus and use that in loops iterating over the list of vpus instead of scanning the full array unconditionally. This patch is a building block to facilitate allowing to bump up the size of MAX_VCPUS significantly. Signed-off-by: Jes Sorensen <jes@sgi.com> Acked-by : Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: s390: Fix SIGP set prefix ioctlChristian Borntraeger1-1/+6
This patch fixes the SET PREFIX interrupt if triggered by userspace. Until now, it was not necessary, but life migration will need it. In addition, it helped me creating SMP support for my kvm_crashme tool (lets kvm execute random guest memory content). Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: s390: Fix problem state check for b2 interceptsChristian Borntraeger3-5/+17
The kernel handles some priviledged instruction exits. While I was unable to trigger such an exit from guest userspace, the code should check for supervisor state before emulating a priviledged instruction. I also renamed kvm_s390_handle_priv to kvm_s390_handle_b2. After all there are non priviledged b2 instructions like stck (store clock). Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: s390: Fix printk on SIGP set archChristian Borntraeger1-2/+0
KVM on s390 does not support the ESA/390 architecture. We refuse to change the architecture mode and print a warning. This patch removes the printk for several reasons: o A malicious guest can flood host dmesg o The old message had no newline o there is no connection between the message and the failing guest This patch simply removes the printk. We already set the condition code to 3 - the guest knows that something went wrong. Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: ia64: Implement some pal calls needed for windows 2008Xiantao Zhang2-7/+152
For windows 2008, it needs more pal calls to implement for booting. In addition, also changes the name of set_{sal, pal}_call_result to get_{sal,pal}_call_result for readability. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: ia64: Add the support for translating PAL Call's pointer argsXiantao Zhang1-3/+45
Add the support to translate PAL Call's pointer args. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: ia64: vTLB change for enabling windows 2008 bootXiantao Zhang2-24/+19
Simply the logic of hash vTLB, and export kvm_gpa_to_mpa. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Avoid using CONFIG_ in userspace visible headersAvi Kivity2-3/+4
Kconfig symbols are not available in userspace, and are not stripped by headers-install. Avoid their use by adding #defines in <asm/kvm.h> to suit each architecture. Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Userspace controlled irq routingAvi Kivity6-4/+275
Currently KVM has a static routing from GSI numbers to interrupts (namely, 0-15 are mapped 1:1 to both PIC and IOAPIC, and 16:23 are mapped 1:1 to the IOAPIC). This is insufficient for several reasons: - HPET requires non 1:1 mapping for the timer interrupt - MSIs need a new method to assign interrupt numbers and dispatch them - ACPI APIC mode needs to be able to reassign the PCI LINK interrupts to the ioapics This patch implements an interrupt routing table (as a linked list, but this can be easily changed) and a userspace interface to replace the table. The routing table is initialized according to the current hardwired mapping. Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: x86: Fix typos and whitespace errorsAmit Shah1-17/+16
Some typos, comments, whitespace errors corrected in the cpuid code Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: ppc: Move to new TLB invalidate interfaceLiu Yu1-5/+5
Commit 2a4aca1144394653269720ffbb5a325a77abd5fa removed old method _tlbia(). 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>
2009-03-24KVM: ppc: Fix e500 warnings and some spelling problemsLiu Yu3-6/+4
Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24powerpc/fsl-booke: declare tlbcam_index for use in cLiu Yu1-0/+2
So, KVM needs to read tlbcam_index to know exactly which TLB1 entry is unused by host. Signed-off-by: Liu Yu <yu.liu@freescale.com> Acked-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: MMU: Only enable cr4_pge role in shadow modeAvi Kivity1-1/+1
Two dimensional paging is only confused by it. Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: MMU: Rename "metaphysical" attribute to "direct"Avi Kivity3-24/+25
This actually describes what is going on, rather than alerting the reader that something strange is going on. Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: MMU: drop zeroing on mmu_memory_cache_allocMarcelo Tosatti1-1/+0
Zeroing on mmu_memory_cache_alloc is unnecessary since: - Smaller areas are pre-allocated with kmem_cache_zalloc. - Page pointed by ->spt is overwritten with prefetch_page and entries in page pointed by ->gfns are initialized before reading. [avi: zeroing pages is unnecessary] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: SVM: Fix typo in has_svm()Joe Perches1-1/+1
Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: ia64: expose registers in struct kvm_regsJes Sorensen1-1/+34
Provide register layout for struct kvm_regs exposed to userland. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: Reset PIT irq injection logic when the PIT IRQ is unmaskedAvi Kivity2-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>
2009-03-24KVM: Interrupt mask notifiers for ioapicAvi Kivity4-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>
2009-03-24KVM: Add CONFIG_HAVE_KVM_IRQCHIPAvi Kivity4-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>
2009-03-24KVM: MMU: Optimize page unshadowingAvi Kivity1-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>
2009-03-24KVM: SVM: Add microcode patch level dummyAlexander Graf1-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>
2009-03-24KVM: Add support to disable MSI for assigned deviceSheng Yang2-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>
2009-03-24KVM: Remove duplicated prototype of kvm_arch_destroy_vmSheng Yang1-1/+0
Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: ppc: remove debug support broken by KVM debug rewriteHollis Blanchard4-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>
2009-03-24KVM: Properly lock PIT creationAvi Kivity2-2/+6
Otherwise, two threads can create a PIT in parallel and cause a memory leak. Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: x86 emulator: implement 'ret far' instruction (opcode 0xcb)Avi Kivity1-1/+25
Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: VMX: When emulating on invalid vmx state, don't return to userspace unnecessarilyAvi Kivity1-2/+6
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>
2009-03-24KVM: x86 emulator: Make emulate_pop() a little more genericAvi Kivity1-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>
2009-03-24KVM: VMX: Prevent exit handler from running if emulating due to invalid stateAvi Kivity1-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>
2009-03-24KVM: VMX: don't clobber segment AR if emulating invalid stateAvi Kivity1-1/+1
The ususable bit is important for determining state validity; don't clobber it. Signed-off-by: Avi Kivity <avi@redhat.com>
2009-03-24KVM: VMX: Fix guest state validity checksAvi Kivity1-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>
2009-03-24KVM: ppc: Add extra E500 exceptionsHollis Blanchard7-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>
2009-03-24KVM: ppc: distinguish between interrupts and prioritiesHollis Blanchard2-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>
2009-03-24KVM: ppc: Add kvmppc_mmu_dtlb/itlb_miss for bookeHollis Blanchard3-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>
2009-03-24KVM: ppc: E500 core-specific codeHollis Blanchard7-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>
2009-03-24KVM: ppc: ifdef iccci with CONFIG_44xHollis Blanchard1-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>
2009-03-24KVM: ppc: No need to include core-header for KVM in asm-offsets.c currentlyHollis Blanchard1-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>
2009-03-24KVM: ppc: Add dbsr in kvm_vcpu_archHollis Blanchard2-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>