aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-03-07iommu-api: Remove iommu_{un}map_range functionsJoerg Roedel3-92/+2
These functions are not longer used and can be removed savely. There functionality is now provided by the iommu_{un}map functions which are also capable of multiple page sizes. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07x86/amd-iommu: Implement ->{un}map callbacks for iommu-apiJoerg Roedel1-0/+29
This patch implements the new callbacks for the IOMMU-API with functions that can handle different page sizes in the IOMMU page table. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07x86/amd-iommu: Make amd_iommu_iova_to_phys aware of multiple page sizesJoerg Roedel1-4/+9
This patch extends the amd_iommu_iova_to_phys() function to handle different page sizes correctly. It doesn't use fetch_pte() anymore because we don't know (or care about) the page_size used for mapping the given iova. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07x86/amd-iommu: Make iommu_unmap_page and fetch_pte aware of page sizesJoerg Roedel2-18/+78
This patch extends the functionality of iommu_unmap_page and fetch_pte to support arbitrary page sizes. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07x86/amd-iommu: Make iommu_map_page and alloc_pte aware of page sizesJoerg Roedel2-20/+61
This patch changes the old map_size parameter of alloc_pte to a page_size parameter which can be used more easily to alloc a pte for intermediate page sizes. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07kvm: Change kvm_iommu_map_pages to map large pagesJoerg Roedel1-22/+91
This patch changes the implementation of of kvm_iommu_map_pages to map the pages with the host page size into the io virtual address space. Signed-off-by: Joerg Roedel <[email protected]> Acked-By: Avi Kivity <[email protected]>
2010-03-07VT-d: Change {un}map_range functions to implement {un}map interfaceJoerg Roedel1-10/+12
This patch changes the iommu-api functions for mapping and unmapping page ranges to use the new page-size based interface. This allows to remove the range based functions later. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07iommu-api: Add ->{un}map callbacks to iommu_opsJoerg Roedel2-0/+10
This patch adds new callbacks for mapping and unmapping pages to the iommu_ops structure. These callbacks are aware of page sizes which makes them different to the ->{un}map_range callbacks. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07iommu-api: Add iommu_map and iommu_unmap functionsJoerg Roedel2-0/+47
These two functions provide support for mapping and unmapping physical addresses to io virtual addresses. The difference to the iommu_(un)map_range() is that the new functions take a gfp_order parameter instead of a size. This allows the IOMMU backend implementations to detect easier if a given range can be mapped by larger page sizes. These new functions should replace the old ones in the long term. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-07iommu-api: Rename ->{un}map function pointers to ->{un}map_rangeJoerg Roedel4-10/+10
The new function pointer names match better with the top-level functions of the iommu-api which are using them. Main intention of this change is to make the ->{un}map pointer names free for two new mapping functions. Signed-off-by: Joerg Roedel <[email protected]>
2010-03-01KVM: x86: Add KVM_CAP_X86_ROBUST_SINGLESTEPJan Kiszka2-0/+2
This marks the guest single-step API improvement of 94fe45da and 91586a3b with a capability flag to allow reliable detection by user space. Signed-off-by: Jan Kiszka <[email protected]> Cc: [email protected] (2.6.33) Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: VMX: Update instruction length on intercepted BPJan Kiszka1-0/+13
We intercept #BP while in guest debugging mode. As VM exits due to intercepted exceptions do not necessarily come with valid idt_vectoring, we have to update event_exit_inst_len explicitly in such cases. At least in the absence of migration, this ensures that re-injections of #BP will find and use the correct instruction length. Signed-off-by: Jan Kiszka <[email protected]> Cc: [email protected] (2.6.32, 2.6.33) Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Fix emulate_sys[call, enter, exit]()'s fault handlingTakuya Yoshikawa1-17/+20
This patch fixes emulate_syscall(), emulate_sysenter() and emulate_sysexit() to handle injected faults properly. Even though original code injects faults in these functions, we cannot handle these unless we use the different return value from the UNHANDLEABLE case. So this patch use X86EMUL_* codes instead of -1 and 0 and makes x86_emulate_insn() to handle these propagated faults. Be sure that, in x86_emulate_insn(), goto cannot_emulate and goto done with rc equals X86EMUL_UNHANDLEABLE have same effect. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Fix segment descriptor loadingGleb Natapov3-59/+151
Add proper error and permission checking. This patch also change task switching code to load segment selectors before segment descriptors, like SDM requires, otherwise permission checking during segment descriptor loading will be incorrect. Cc: [email protected] (2.6.33, 2.6.32) Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Fix load_guest_segment_descriptor() to inject page faultTakuya Yoshikawa1-3/+10
This patch injects page fault when reading descriptor in load_guest_segment_descriptor() fails with FAULT. Effects of this injection: This function is used by kvm_load_segment_descriptor() which is necessary for the following instructions: - mov seg,r/m16 - jmp far - pop ?s This patch makes it possible to emulate the page faults generated by these instructions. But be sure that unless we change the kvm_load_segment_descriptor()'s ret value propagation this patch has no effect. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Forbid modifying CS segment register by mov instructionGleb Natapov1-0/+6
Inject #UD if guest attempts to do so. This is in accordance to Intel SDM. Cc: [email protected] (2.6.33, 2.6.32) Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Convert kvm->requests_lock to raw_spinlock_tAvi Kivity2-4/+4
The code relies on kvm->requests_lock inhibiting preemption. Noted by Jan Kiszka. Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Convert i8254/i8259 locks to raw_spinlocksThomas Gleixner5-26/+27
The i8254/i8259 locks need to be real spinlocks on preempt-rt. Convert them to raw_spinlock. No change for !RT kernels. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: disallow opcode 82 in 64-bit modeGleb Natapov1-8/+8
Instructions with opcode 82 are not valid in 64 bit mode. Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: code style cleanupWei Yongjun1-1/+1
Just remove redundant semicolon. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Plan obsolescence of kernel allocated slots, paravirt mmuAvi Kivity1-0/+30
These features are unused by modern userspace and can go away. Paravirt mmu needs to stay a little longer for live migration. Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Add LOCK prefix validity checkingGleb Natapov1-41/+56
Instructions which are not allowed to have LOCK prefix should generate #UD if one is used. [avi: fold opcode 82 fix from another patch] Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Check CPL level during privilege instruction emulationGleb Natapov1-15/+20
Add CPL checking in case emulator is tricked into emulating privilege instruction from userspace. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Fix popf emulationGleb Natapov1-1/+54
POPF behaves differently depending on current CPU mode. Emulate correct logic to prevent guest from changing flags that it can't change otherwise. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Check IOPL level during io instruction emulationGleb Natapov3-13/+87
Make emulator check that vcpu is allowed to execute IN, INS, OUT, OUTS, CLI, STI. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: fix memory access during x86 emulationGleb Natapov7-50/+142
Currently when x86 emulator needs to access memory, page walk is done with broadest permission possible, so if emulated instruction was executed by userspace process it can still access kernel memory. Fix that by providing correct memory access to page walker during emulation. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Add Virtual-8086 mode of emulationGleb Natapov3-6/+10
For some instructions CPU behaves differently for real-mode and virtual 8086. Let emulator know which mode cpu is in, so it will not poke into vcpu state directly. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Add group9 instruction decodingGleb Natapov1-2/+7
Use groups mechanism to decode 0F C7 instructions. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: x86 emulator: Add group8 instruction decodingGleb Natapov1-1/+6
Use groups mechanism to decode 0F BA instructions. Signed-off-by: Gleb Natapov <[email protected]> Cc: [email protected] Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: do not store wqh in irqfdMichael S. Tsirkin1-3/+0
wqh is unused, so we do not need to store it in irqfd anymore Signed-off-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: ppc/booke: Set ESR and DEAR when inject interrupt to guestLiu Yu3-17/+48
Old method prematurely sets ESR and DEAR. Move this part after we decide to inject interrupt, which is more like hardware behave. Signed-off-by: Liu Yu <[email protected]> Acked-by: Hollis Blanchard <[email protected]> Acked-by: Alexander Graf <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: ia64: destroy ioapic device if fail to setup default irq routingWei Yongjun1-1/+1
If KVM_CREATE_IRQCHIP fail due to kvm_setup_default_irq_routing(), ioapic device is not destroyed and kvm->arch.vioapic is not set to NULL, this may cause KVM_GET_IRQCHIP and KVM_SET_IRQCHIP access to unexcepted memory. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: cleanup the failure path of KVM_CREATE_IRQCHIP ioctrlWei Yongjun5-4/+28
If we fail to init ioapic device or the fail to setup the default irq routing, the device register by kvm_create_pic() and kvm_ioapic_init() remain unregister. This patch fixed to do this. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: kvm->arch.vioapic should be NULL if kvm_ioapic_init() failureWei Yongjun1-1/+3
kvm->arch.vioapic should be NULL in case of kvm_ioapic_init() failure due to cannot register io dev. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: PIT: unregister kvm irq notifier if fail to create pitWei Yongjun1-2/+3
If fail to create pit, we should unregister kvm irq notifier which register in kvm_create_pit(). Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Marcelo Tosatti <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: VMX: Rename VMX_EPT_IGMT_BIT to VMX_EPT_IPAT_BITSheng Yang2-3/+3
Following the new SDM. Now the bit is named "Ignore PAT memory type". Signed-off-by: Sheng Yang <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: MMU: Add tracepoint for guest page agingAvi Kivity2-3/+30
Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Fix Codestyle in virt/kvm/coalesced_mmio.cJochen Maes1-2/+2
Fixed 2 codestyle issues in virt/kvm/coalesced_mmio.c Signed-off-by: Jochen Maes <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Remove redundant reading of rax on OUT instructionsTakuya Yoshikawa1-2/+4
kvm_emulate_pio() and complete_pio() both read out the RAX register value and copy it to a place into which the value read out from the port will be copied later. This patch removes this redundancy. /*** snippet from arch/x86/kvm/x86.c ***/ int complete_pio(struct kvm_vcpu *vcpu) { ... if (!io->string) { if (io->in) { val = kvm_register_read(vcpu, VCPU_REGS_RAX); memcpy(&val, vcpu->arch.pio_data, io->size); kvm_register_write(vcpu, VCPU_REGS_RAX, val); } ... Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: VMX: emulate accessed bit for EPTRik van Riel1-2/+8
Currently KVM pretends that pages with EPT mappings never got accessed. This has some side effects in the VM, like swapping out actively used guest pages and needlessly breaking up actively used hugepages. We can avoid those very costly side effects by emulating the accessed bit for EPT PTEs, which should only be slightly costly because pages pass through page_referenced infrequently. TLB flushing is taken care of by kvm_mmu_notifier_clear_flush_young(). This seems to help prevent KVM guests from being swapped out when they should not on my system. Signed-off-by: Rik van Riel <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: Introduce kvm_host_page_sizeJoerg Roedel3-16/+28
This patch introduces a generic function to find out the host page size for a given gfn. This function is needed by the kvm iommu code. This patch also simplifies the x86 host_mapping_level function. Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: VMX: Remove redundant test in vmx_set_efer()Julia Lawall1-2/+0
msr was tested above, so the second test is not needed. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ expression *x; expression e; identifier l; @@ if (x == NULL || ...) { ... when forall return ...; } ... when != goto l; when != x = e when != &x *x == NULL // </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: ia64: Fix string literal continuation linesJoe Perches2-4/+4
String constants that are continued on subsequent lines with \ are not good. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: VMX: Wire up .fpu_activate() callbackAvi Kivity1-0/+1
Signed-off-by: Avi Kivity <[email protected]>
2010-03-01KVM: fix kvm_fix_hypercall() to return X86EMUL_*Takuya Yoshikawa1-6/+1
This patch fixes kvm_fix_hypercall() to propagate X86EMUL_* info generated by emulator_write_emulated() to its callers: suggested by Marcelo. The effect of this is x86_emulate_insn() will begin to handle the page faults which occur in emulator_write_emulated(): this should be OK because emulator_write_emulated_onepage() always injects page fault when emulator_write_emulated() returns X86EMUL_PROPAGATE_FAULT. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2010-03-01KVM: fix load_guest_segment_descriptor() to return X86EMUL_*Takuya Yoshikawa1-1/+1
This patch fixes load_guest_segment_descriptor() to return X86EMUL_PROPAGATE_FAULT when it tries to access the descriptor table beyond the limit of it: suggested by Marcelo. I have checked current callers of this helper function, - kvm_load_segment_descriptor() - kvm_task_switch() and confirmed that this patch will change nothing in the upper layers if we do not change the handling of this return value from load_guest_segment_descriptor(). Next step: Although fixing the kvm_task_switch() to handle the propagated faults properly seems difficult, and maybe not worth it because TSS is not used commonly these days, we can fix kvm_load_segment_descriptor(). By doing so, the injected #GP becomes possible to be handled by the guest. The only problem for this is how to differentiate this fault from the page faults generated by kvm_read_guest_virt(). We may have to split this function to achive this goal. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2010-03-01KVM: enable PCI multiple-segments for pass-through deviceZhai, Edwin5-5/+14
Enable optional parameter (default 0) - PCI segment (or domain) besides BDF, when assigning PCI device to guest. Signed-off-by: Zhai Edwin <[email protected]> Acked-by: Chris Wright <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2010-03-01KVM: VMX: Remove redundant check in vm_need_virtualize_apic_accesses()Gui Jianfeng1-3/+1
flexpriority_enabled implies cpu_has_vmx_virtualize_apic_accesses() returning true, so we don't need this check here. Signed-off-by: Gui Jianfeng <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2010-03-01KVM: Trace failed msr reads and writesAvi Kivity3-13/+22
Record failed msrs reads and writes, and the fact that they failed as well. Signed-off-by: Avi Kivity <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
2010-03-01KVM: Fix msr traceAvi Kivity1-8/+8
- data is 64 bits wide, not unsigned long - rw is confusingly named Signed-off-by: Avi Kivity <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>