summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* KVM: ia64: Flush all TLBs once guest's memory mapping changes.Xiantao Zhang2009-06-101-0/+1
| | | | | | | Flush all vcpu's TLB entries once changes guest's memory mapping. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86: check for cr3 validity in ioctl_set_sregsMarcelo Tosatti2009-06-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Matt T. Yourst notes that kvm_arch_vcpu_ioctl_set_sregs lacks validity checking for the new cr3 value: "Userspace callers of KVM_SET_SREGS can pass a bogus value of cr3 to the kernel. This will trigger a NULL pointer access in gfn_to_rmap() when userspace next tries to call KVM_RUN on the affected VCPU and kvm attempts to activate the new non-existent page table root. This happens since kvm only validates that cr3 points to a valid guest physical memory page when code *inside* the guest sets cr3. However, kvm currently trusts the userspace caller (e.g. QEMU) on the host machine to always supply a valid page table root, rather than properly validating it along with the rest of the reloaded guest state." http://sourceforge.net/tracker/?func=detail&atid=893831&aid=2687641&group_id=180599 Check for a valid cr3 address in kvm_arch_vcpu_ioctl_set_sregs, triple fault in case of failure. Cc: stable@kernel.org Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ia64: Don't hold slots_lock in guest modeJes Sorensen2009-06-101-31/+33
| | | | | | | | | Reorder locking to avoid holding the slots_lock when entering the guest. Signed-off-by: Jes Sorensen <jes@sgi.com> Acked-by : Xiantao Zhang<xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Replace kvmclock open-coded get_cpu_var() with the real thingAvi Kivity2009-06-101-5/+6
| | | | | | Suggested by Ingo Molnar. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Skip instruction on a task switch only when appropriateGleb Natapov2009-06-101-2/+9
| | | | | | | | | If a task switch was initiated because off a task gate in IDT and IDT was accessed because of an external even the instruction should not be skipped. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Add new mode of instruction emulation: skipGleb Natapov2009-06-102-0/+6
| | | | | | | | In the new mode instruction is decoded, but not executed. The EIP is moved to point after the instruction. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Decode soft interrupt instructionsGleb Natapov2009-06-101-1/+2
| | | | | | | Do not emulate them yet. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Completely decode in/out at decoding stageGleb Natapov2009-06-101-4/+4
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Add unsigned byte immediate decodeGleb Natapov2009-06-101-6/+11
| | | | | | | | Extend "Source operand type" opcode description field to 4 bites to accommodate new option. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Complete decoding of call near in decode stageGleb Natapov2009-06-101-13/+2
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Complete short/near jcc decoding in decode stageGleb Natapov2009-06-101-32/+10
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Complete ljmp decoding at decode stageGleb Natapov2009-06-101-20/+5
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Add lcall decodingGleb Natapov2009-06-101-1/+2
| | | | | | | No emulation yet. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: Add decoding of 16bit second immediate argumentGleb Natapov2009-06-101-0/+7
| | | | | | | Such as segment number in lcall/ljmp Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: remove global page optimization logicMarcelo Tosatti2009-06-104-56/+8
| | | | | | | | Complexity to fix it not worthwhile the gains, as discussed in http://article.gmane.org/gmane.comp.emulators.kvm.devel/28649. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Make kvm header C++ friendlynathan binkert2009-06-101-3/+3
| | | | | | | | | | Two things needed fixing: 1) g++ does not allow a named structure type within an anonymous union and 2) Avoid name clash between two padding fields within the same struct by giving them different names as is done elsewhere in the header. Signed-off-by: Nathan Binkert <nate@binkert.org> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: PIT: fix count read and mode 0 handlingMarcelo Tosatti2009-06-101-11/+15
| | | | | | | | | | | | | | Commit 46ee278652f4cbd51013471b64c7897ba9bcd1b1 causes Solaris 10 to hang on boot. Assuming that PIT counter reads should return 0 for an expired timer is wrong: when it is active, the counter never stops (see comment on __kpit_elapsed). Also arm a one shot timer for mode 0. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ia64: make kvm depend on CONFIG_MODULES.Zhang, Xiantao2009-06-101-1/+1
| | | | | | | | Since kvm-intel modue can't be built-in, make kvm depend on CONFIG_MODULES. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: fix call near emulationGleb Natapov2009-06-101-1/+0
| | | | | | | | The length of pushed on to the stack return address depends on operand size not address size. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Discard reserved bits checking on PDE bit 7-8Sheng Yang2009-06-101-3/+4
| | | | | | | | | | | | | | | | 1. It's related to a Linux kernel bug which fixed by Ingo on 07a66d7c53a538e1a9759954a82bb6c07365eff9. The original code exists for quite a long time, and it would convert a PDE for large page into a normal PDE. But it fail to fit normal PDE well. With the code before Ingo's fix, the kernel would fall reserved bit checking with bit 8 - the remaining global bit of PTE. So the kernel would receive a double-fault. 2. After discussion, we decide to discard PDE bit 7-8 reserved checking for now. For this marked as reserved in SDM, but didn't checked by the processor in fact... Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix unneeded instruction skipping during task switching.Gleb Natapov2009-06-104-18/+51
| | | | | | | | | | There is no need to skip instruction if the reason for a task switch is a task gate in IDT and access to it is caused by an external even. The problem is currently solved only for VMX since there is no reliable way to skip an instruction in SVM. We should emulate it instead. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix task switch back link handling.Gleb Natapov2009-06-101-8/+32
| | | | | | | Back link is written to a wrong TSS now. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Do not zero idt_vectoring_info in vmx_complete_interrupts().Gleb Natapov2009-06-101-7/+0
| | | | | | | | | | We will need it later in task_switch(). Code in handle_exception() is dead. is_external_interrupt(vect_info) will always be false since idt_vectoring_info is zeroed in vmx_complete_interrupts(). Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Rewrite vmx_complete_interrupt()'s twisted maze of if() statementsGleb Natapov2009-06-101-18/+25
| | | | | | | | | | | ...with a more straightforward switch(). Also fix a bug when NMI could be dropped on exit. Although this should never happen in practice, since NMIs can only be injected, never triggered internally by the guest like exceptions. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Fix handling of a fault during NMI unblocked due to IRETGleb Natapov2009-06-101-6/+11
| | | | | | | | | Bit 12 is undefined in any of the following cases: If the VM exit sets the valid bit in the IDT-vectoring information field. If the VM exit is due to a double fault. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Use rsvd_bits_mask in load_pdptrs()Dong, Eddie2009-06-103-6/+10
| | | | | | | Also remove bit 5-6 from rsvd_bits_mask per latest SDM. Signed-off-by: Eddie Dong <Eddie.Dong@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Fix feature testingSheng Yang2009-06-101-9/+9
| | | | | | | The testing of feature is too early now, before vmcs_config complete initialization. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Clean up Flex Priority relatedSheng Yang2009-06-101-17/+30
| | | | | | | And clean paranthes on returns. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: remove pointless conditional before kfree() in lapic initializationWei Yongjun2009-06-101-2/+1
| | | | | | | Remove pointless conditional before kfree(). Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Use different shadows when EFER.NXE changesAvi Kivity2009-06-102-0/+4
| | | | | | | | | | | | | A pte that is shadowed when the guest EFER.NXE=1 is not valid when EFER.NXE=0; if bit 63 is set, the pte should cause a fault, and since the shadow EFER always has NX enabled, this won't happen. Fix by using a different shadow page table for different EFER.NXE bits. This allows vcpus to run correctly with different values of EFER.NXE, and for transitions on this bit to be handled correctly without requiring a full flush. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Emulate #PF error code of reserved bits violationDong, Eddie2009-06-104-0/+88
| | | | | | | | | | | Detect, indicate, and propagate page faults where reserved bits are set. Take care to handle the different paging modes, each of which has different sets of reserved bits. [avi: fix pte reserved bits for efer.nxe=0] Signed-off-by: Eddie Dong <eddie.dong@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ia64: enable external interrupt in vmmYang Zhang2009-06-103-10/+16
| | | | | | | | | Currently, the interrupt enable bit is cleared when in the vmm. This patch sets the bit and the external interrupts can be dealt with when in the vmm. This improves the I/O performance. Signed-off-by: Yang Zhang <yang.zhang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Fix comment in page_fault()Eddie Dong2009-06-101-1/+1
| | | | | | | | The original one is for the code before refactoring. Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com> Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Correct wrong vmcs field sizesSheng Yang2009-06-101-6/+6
| | | | | | | EXIT_QUALIFICATION and GUEST_LINEAR_ADDRESS are natural width, not 64-bit. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Make flexpriority module parameter reflect hardware capabilityAvi Kivity2009-06-101-3/+4
| | | | | | If the hardware does not support flexpriority, zero the module parameter. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix interrupt unhalting a vcpu when it shouldn'tGleb Natapov2009-06-109-3/+44
| | | | | | | | kvm_vcpu_block() unhalts vpu on an interrupt/timer without checking if interrupt window is actually opened. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Timer event should not unconditionally unhalt vcpu.Gleb Natapov2009-06-103-28/+40
| | | | | | | | | | Currently timer events are processed before entering guest mode. Move it to main vcpu event loop since timer events should be processed even while vcpu is halted. Timer may cause interrupt/nmi to be injected and only then vcpu will be unhalted. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Fold vm_need_ept() into callersAvi Kivity2009-06-101-19/+14
| | | | | | Trivial. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Zero ept module parameter if ept is not presentAvi Kivity2009-06-101-1/+4
| | | | | | Allows reading back hardware capability. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Zero the vpid module parameter if vpid is not supportedAvi Kivity2009-06-101-1/+4
| | | | | | This allows reading back how the hardware is configured. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Annotate module parameters as __read_mostlyAvi Kivity2009-06-101-5/+5
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Simplify module parameter namesAvi Kivity2009-06-101-3/+3
| | | | | | Instead of 'enable_vpid=1', use a simple 'vpid=1'. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Rename kvm_handle_exit() to vmx_handle_exit()Avi Kivity2009-06-101-2/+2
| | | | | | It is a static vmx-specific function. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Make module parameters readableAvi Kivity2009-06-101-5/+5
| | | | | | Useful to see how the module was loaded. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: reuse (pop|push)_irq from svm.c in vmx.cGleb Natapov2009-06-103-36/+24
| | | | | | | | The prioritized bit vector manipulation functions are useful in both vmx and svm. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Remove duplicate code in svm_do_inject_vector()Gleb Natapov2009-06-101-9/+1
| | | | | | | svm_do_inject_vector() reimplements pop_irq(). Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86: Ignore reads to EVNTSEL MSRsAmit Shah2009-06-101-0/+2
| | | | | | | | | | | | We ignore writes to the performance counters and performance event selector registers already. Kaspersky antivirus reads the eventsel MSR causing it to crash with the current behaviour. Return 0 as data when the eventsel registers are read to stop the crash. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: do not free active mmu pages in free_mmu_pages()Gleb Natapov2009-06-102-8/+2
| | | | | | | | free_mmu_pages() should only undo what alloc_mmu_pages() does. Free mmu pages from the generic VM destruction function, kvm_destroy_vm(). Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Device assignment framework reworkSheng Yang2009-06-104-242/+276
| | | | | | | | | | | | | | | | | | | | | | | After discussion with Marcelo, we decided to rework device assignment framework together. The old problems are kernel logic is unnecessary complex. So Marcelo suggest to split it into a more elegant way: 1. Split host IRQ assign and guest IRQ assign. And userspace determine the combination. Also discard msi2intx parameter, userspace can specific KVM_DEV_IRQ_HOST_MSI | KVM_DEV_IRQ_GUEST_INTX in assigned_irq->flags to enable MSI to INTx convertion. 2. Split assign IRQ and deassign IRQ. Import two new ioctls: KVM_ASSIGN_DEV_IRQ and KVM_DEASSIGN_DEV_IRQ. This patch also fixed the reversed _IOR vs _IOW in definition(by deprecated the old interface). [avi: replace homemade bitcount() by hweight_long()] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: make 'lapic_timer_ops' and 'kpit_ops' staticHannes Eder2009-06-102-2/+2
| | | | | | | | | Fix this sparse warnings: arch/x86/kvm/lapic.c:916:22: warning: symbol 'lapic_timer_ops' was not declared. Should it be static? arch/x86/kvm/i8254.c:268:22: warning: symbol 'kpit_ops' was not declared. Should it be static? Signed-off-by: Hannes Eder <hannes@hanneseder.net> Signed-off-by: Avi Kivity <avi@redhat.com>
OpenPOWER on IntegriCloud