aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAge
* KVM: Device Assignment with VT-dBen-Ami Yassour2008-10-15
| | | | | | | | | | | | | | | | | | | Based on a patch by: Kay, Allen M <allen.m.kay@intel.com> This patch enables PCI device assignment based on VT-d support. When a device is assigned to the guest, the guest memory is pinned and the mapping is updated in the VT-d IOMMU. [Amit: Expose KVM_CAP_IOMMU so we can check if an IOMMU is present and also control enable/disable from userspace] Signed-off-by: Kay, Allen M <allen.m.kay@intel.com> Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com> Signed-off-by: Amit Shah <amit.shah@qumranet.com> Acked-by: Mark Gross <mgross@linux.intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* VT-d: Changes to support KVMKay, Allen M2008-10-15
| | | | | | | | | | | | | | This patch extends the VT-d driver to support KVM [Ben: fixed memory pinning] [avi: move dma_remapping.h as well] Signed-off-by: Kay, Allen M <allen.m.kay@intel.com> Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com> Signed-off-by: Amit Shah <amit.shah@qumranet.com> Acked-by: Mark Gross <mgross@linux.intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Use DstAcc for 'and'Guillaume Thouvenin2008-10-15
| | | | | | | | For instruction 'and al,imm' we use DstAcc instead of doing the emulation directly into the instruction's opcode. Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Add cmp al, imm and cmp ax, imm instructions (ocodes 3c, 3d)Guillaume Thouvenin2008-10-15
| | | | | | | Add decode entries for these opcodes; execution is already implemented. Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Add DstAcc operand typeGuillaume Thouvenin2008-10-15
| | | | | | | | | | | | | | | | | | Add DstAcc operand type. That means that there are 4 bits now for DstMask. "In the good old days cpus would have only one register that was able to fully participate in arithmetic operations, typically called A for Accumulator. The x86 retains this tradition by having special, shorter encodings for the A register (like the cmp opcode), and even some instructions that only operate on A (like mul). SrcAcc and DstAcc would accommodate these instructions by decoding A into the corresponding 'struct operand'." -- Avi Kivity Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
* x86: Move FEATURE_CONTROL bits to msr-index.hSheng Yang2008-10-15
| | | | | | | For MSR_IA32_FEATURE_CONTROL is already there. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Rename IA32_FEATURE_CONTROL bitsSheng Yang2008-10-15
| | | | | Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* MAINTAINERS: add entry for the KVM AMD moduleJoerg Roedel2008-10-15
| | | | | Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: fix jmp r/m64 instructionAvi Kivity2008-10-15
| | | | | | | | jmp r/m64 doesn't require the rex.w prefix to indicate the operand size is 64 bits. Set the Stack attribute (even though it doesn't involve the stack, really) to indicate this. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Cleanup stalled INTR_INFO readJan Kiszka2008-10-15
| | | | | | | | Commit 1c0f4f5011829dac96347b5f84ba37c2252e1e08 left a useless access of VM_ENTRY_INTR_INFO_FIELD in vmx_intr_assist behind. Clean this up. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: ppc: kvmppc_44x_shadow_release() does not require mmap_sem to be lockedHollis Blanchard2008-10-15
| | | | | | | And it gets in the way of get_user_pages_fast(). Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86: unhalt vcpu0 on resetMarcelo Tosatti2008-10-15
| | | | | | | | | | Since "KVM: x86: do not execute halted vcpus", HLT by vcpu0 before system reset by the IO thread will hang the guest. Mark vcpu as runnable in such case. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Add call near absolute instruction (opcode 0xff/2)Mohammed Gamal2008-10-15
| | | | | | | Add call near absolute instruction. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86: do not execute halted vcpusMarcelo Tosatti2008-10-15
| | | | | | | | | | | | | | Offline or uninitialized vcpu's can be executed if requested to perform userspace work. Follow Avi's suggestion to handle halted vcpu's in the main loop, simplifying kvm_emulate_halt(). Introduce a new vcpu->requests bit to indicate events that promote state from halted to running. Also standardize vcpu wake sites. Signed-off-by: Marcelo Tosatti <mtosatti <at> redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Add in/out instructions (opcodes 0xe4-0xe7, 0xec-0xef)Mohammed Gamal2008-10-15
| | | | | | | | | | The patch adds in/out instructions to the x86 emulator. The instruction was encountered while running the BIOS while using the invalid guest state emulation patch. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Add statistics for guest irq injectionsAvi Kivity2008-10-15
| | | | | | These can help show whether a guest is making progress or not. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Modify kvm_shadow_walk.entry to accept u64 addrSheng Yang2008-10-15
| | | | | | | | | | | | | EPT is 4 level by default in 32pae(48 bits), but the addr parameter of kvm_shadow_walk->entry() only accept unsigned long as virtual address, which is 32bit in 32pae. This result in SHADOW_PT_INDEX() overflow when try to fetch level 4 index. Fix it by extend kvm_shadow_walk->entry() to accept 64bit addr in parameter. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: ia64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstateXiantao Zhang2008-10-15
| | | | | | | Two ioctl arch functions are added to set vcpu's smp state. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Add std and cld instructions (opcodes 0xfc-0xfd)Mohammed Gamal2008-10-15
| | | | | | | | | | This adds the std and cld instructions to the emulator. Encountered while running the BIOS with invalid guest state emulation enabled. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: s390: change help text of guest KconfigChristian Borntraeger2008-10-15
| | | | | | | | The current help text for CONFIG_S390_GUEST is not very helpful. Lets add more text. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: s390: Make facility bits future-proofChristian Borntraeger2008-10-15
| | | | | | | | | Heiko Carstens pointed out, that its safer to activate working facilities instead of disabling problematic facilities. The new code uses the host facility bits and masks it with known good ones. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: add MC5_MISC msr read supportJoerg Roedel2008-10-15
| | | | | | | | | Currently KVM implements MC0-MC4_MISC read support. When booting Linux this results in KVM warnings in the kernel log when the guest tries to read MC5_MISC. Fix this warnings with this patch. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: SVM: No need to unprotect memory during event injection when using nptAvi Kivity2008-10-15
| | | | | | No memory is protected anyway. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Fix setting the accessed bit on non-speculative sptesAvi Kivity2008-10-15
| | | | | | | | | | | The accessed bit was accidentally turned on in a random flag word, rather than, the spte itself, which was lucky, since it used the non-EPT compatible PT_ACCESSED_MASK. Fix by turning the bit on in the spte and changing it to use the portable accessed mask. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Flush tlbs after clearing write permission when accessing dirty logAvi Kivity2008-10-15
| | | | | | | Otherwise, the cpu may allow writes to the tracked pages, and we lose some display bits or fail to migrate correctly. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Add locking around kvm_mmu_slot_remove_write_access()Avi Kivity2008-10-15
| | | | | | | It was generally safe due to slots_lock being held for write, but it wasn't very nice. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Account for npt/ept/realmode page faultsAvi Kivity2008-10-15
| | | | | | | Now that two-dimensional paging is becoming common, account for tdp page faults. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Add mov r, imm instructions (opcodes 0xb0-0xbf)Mohammed Gamal2008-10-15
| | | | | | | | The emulator only supported one instance of mov r, imm instruction (opcode 0xb8), this adds the rest of these instructions. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Don't call get_user_pages(.force = 1)Avi Kivity2008-10-15
| | | | | | | | This is esoteric and only needed to break COW on MAP_SHARED mappings. Since KVM no longer does these sorts of mappings, breaking COW on them is no longer necessary. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Allocate guest memory as MAP_PRIVATE, not MAP_SHAREDAvi Kivity2008-10-15
| | | | | | There is no reason to share internal memory slots with fork()ed instances. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Convert the paging mode shadow walk to use the generic walkerAvi Kivity2008-10-15
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Convert direct maps to use the generic shadow walkerAvi Kivity2008-10-15
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Add generic shadow walkerAvi Kivity2008-10-15
| | | | | | | | | | | | | | We currently walk the shadow page tables in two places: direct map (for real mode and two dimensional paging) and paging mode shadow. Since we anticipate requiring a third walk (for invlpg), it makes sense to have a generic facility for shadow walk. This patch adds such a shadow walker, walks the page tables and calls a method for every spte encountered. The method can examine the spte, modify it, or even instantiate it. The walk can be aborted by returning nonzero from the method. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Infer shadow root level in direct_map()Avi Kivity2008-10-15
| | | | | | | In all cases the shadow root level is available in mmu.shadow_root_level, so there is no need to pass it as a parameter. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: ia64: Enable virtio driver for ia64 in KconfigXiantao Zhang2008-10-15
| | | | | | | kvm/ia64 uses the virtio drivers to optimize its I/O subsytem. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Unify direct map 4K and large page pathsAvi Kivity2008-10-15
| | | | | | | The two paths are equivalent except for one argument, which is already available. Merge the two codepaths. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Move SHADOW_PT_INDEX to mmu.cAvi Kivity2008-10-15
| | | | | | It is not specific to the paging mode, so can be made global (and reusable). Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: remove bad ByteOp specifier from NEG descriptorAvi Kivity2008-10-15
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: remove duplicate SrcImmroel kluin2008-10-15
| | | | | Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Load real mode segments correctlyAvi Kivity2008-10-15
| | | | | | | Real mode segments to not reference the GDT or LDT; they simply compute base = selector * 16. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Change segment dpl at reset to 3Avi Kivity2008-10-15
| | | | | | This is more emulation friendly, if not 100% correct. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Change cs reset state to be a data segmentAvi Kivity2008-10-15
| | | | | | Real mode cs is a data segment, not a code segment. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: ia64: add a dummy irq ack notificationXiantao Zhang2008-10-15
| | | | | | | | Before enabling notify_acked_irq for ia64, leave the related APIs as nop-op first. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: make irq ack notifier functions staticHarvey Harrison2008-10-15
| | | | | | | | | | | sparse says: arch/x86/kvm/x86.c:107:32: warning: symbol 'kvm_find_assigned_dev' was not declared. Should it be static? arch/x86/kvm/i8254.c:225:6: warning: symbol 'kvm_pit_ack_irq' was not declared. Should it be static? Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Use kvm_set_irq to inject interruptsAmit Shah2008-10-15
| | | | | | | ... instead of using the pic and ioapic variants Signed-off-by: Amit Shah <amit.shah@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: SVM: Fix typoAmit Shah2008-10-15
| | | | | | | Fix typo in as-yet unused macro definition. Signed-off-by: Amit Shah <amit.shah@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Modify mode switching and vmentry functionsMohammed Gamal2008-10-15
| | | | | | | | This patch modifies mode switching and vmentry function in order to drive invalid guest state emulation. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Add invalid guest state handlerMohammed Gamal2008-10-15
| | | | | | | | | | | | | This adds the invalid guest state handler function which invokes the x86 emulator until getting the guest to a VMX-friendly state. [avi: leave atomic context if scheduling] [guillaume: return to atomic context correctly] Signed-off-by: Laurent Vivier <laurent.vivier@bull.net> Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Add module parameter and emulation flag.Mohammed Gamal2008-10-15
| | | | | | | | | The patch adds the module parameter required to enable emulating invalid guest state, as well as the emulation_required flag used to drive emulation whenever needed. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Add Guest State Validity ChecksMohammed Gamal2008-10-15
| | | | | | | This patch adds functions to check whether guest state is VMX compliant. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>