summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-101-0/+5
| | | | | | | | 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-103-52/+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: 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: 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-103-18/+50
| | | | | | | | | | 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-101-0/+3
| | | | | | | | | | | | | 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-103-0/+86
| | | | | | | | | | | 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: 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-103-1/+22
| | | | | | | | 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-101-23/+34
| | | | | | | | | | 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-101-8/+0
| | | | | | | | 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-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* KVM: APIC: get rid of deliver_bitmaskGleb Natapov2009-06-102-45/+17
| | | | | | | | Deliver interrupt during destination matching loop. Signed-off-by: Gleb Natapov <gleb@redhat.com> Acked-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: change the way how lowest priority vcpu is calculatedGleb Natapov2009-06-101-37/+6
| | | | | | | | | The new way does not require additional loop over vcpus to calculate the one with lowest priority as one is chosen during delivery bitmap construction. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: consolidate ioapic/ipi interrupt delivery logicGleb Natapov2009-06-102-43/+28
| | | | | | | | | | Use kvm_apic_match_dest() in kvm_get_intr_delivery_bitmask() instead of duplicating the same code. Use kvm_get_intr_delivery_bitmask() in apic_send_ipi() to figure out ipi destination instead of reimplementing the logic. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: APIC: kvm_apic_set_irq deliver all kinds of interruptsGleb Natapov2009-06-102-19/+30
| | | | | | | Get rid of ioapic_inj_irq() and ioapic_inj_nmi() functions. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: MMU: remove call to kvm_mmu_pte_write from walk_addrJoerg Roedel2009-06-101-1/+0
| | | | | | | | There is no reason to update the shadow pte here because the guest pte is only changed to dirty state. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: unify part of generic timer handlingMarcelo Tosatti2009-06-107-108/+129
| | | | | | | | | Hide the internals of vcpu awakening / injection from the in-kernel emulated timers. This makes future changes in this logic easier and decreases the distance to more generic timer handling. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>