summaryrefslogtreecommitdiffstats
path: root/arch
Commit message (Collapse)AuthorAgeFilesLines
...
| * | KVM: ia64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstateXiantao Zhang2008-10-151-2/+35
| | | | | | | | | | | | | | | | | | | | | 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-151-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-1/+1
| | | | | | | | | | | | | | | | | | 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-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-0/+1
| | | | | | | | | | | | | | | | | | | | | 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-151-0/+2
| | | | | | | | | | | | | | | | | | | | | 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-151-0/+1
| | | | | | | | | | | | | | | | | | | | | 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-151-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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: Allocate guest memory as MAP_PRIVATE, not MAP_SHAREDAvi Kivity2008-10-151-1/+1
| | | | | | | | | | | | | | | | | | 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-151-72/+86
| | | | | | | | | | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: MMU: Convert direct maps to use the generic shadow walkerAvi Kivity2008-10-151-38/+55
| | | | | | | | | | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: MMU: Add generic shadow walkerAvi Kivity2008-10-151-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-5/+4
| | | | | | | | | | | | | | | | | | | | | 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-151-0/+2
| | | | | | | | | | | | | | | | | | | | | 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-151-8/+3
| | | | | | | | | | | | | | | | | | | | | 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-152-3/+2
| | | | | | | | | | | | | | | | | | 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-151-1/+1
| | | | | | | | | | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: x86 emulator: remove duplicate SrcImmroel kluin2008-10-151-1/+1
| | | | | | | | | | | | | | | 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-151-0/+22
| | | | | | | | | | | | | | | | | | | | | 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-151-1/+1
| | | | | | | | | | | | | | | | | | 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-151-2/+1
| | | | | | | | | | | | | | | | | | 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-151-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | 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-152-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-152-11/+3
| | | | | | | | | | | | | | | | | | | | | ... 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-151-1/+1
| | | | | | | | | | | | | | | | | | | | | 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-151-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | 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-151-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-0/+180
| | | | | | | | | | | | | | | | | | | | | 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>
| * | KVM: Device assignment: Check for privileges before assigning irqAmit Shah2008-10-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though we don't share irqs at the moment, we should ensure regular user processes don't try to allocate system resources. We check for capability to access IO devices (CAP_SYS_RAWIO) before we request_irq on behalf of the guest. Noticed by Avi. Signed-off-by: Amit Shah <amit.shah@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: Handle spurious acks for PIT interruptsAvi Kivity2008-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | Spurious acks can be generated, for example if the PIC is being reset. Handle those acks gracefully rather than flooding the log with warnings. Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: fix i8259 reset irq ackingMarcelo Tosatti2008-10-151-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The irq ack during pic reset has three problems: - Ignores slave/master PIC, using gsi 0-8 for both. - Generates an ACK even if the APIC is in control. - Depends upon IMR being clear, which is broken if the irq was masked at the time it was generated. The last one causes the BIOS to hang after the first reboot of Windows installation, since PIT interrupts stop. [avi: fix check whether pic interrupts are seen by cpu] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: VMX: Use interrupt queue for !irqchip_in_kernelAvi Kivity2008-10-151-6/+5
| | | | | | | | | | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: set debug registers after "schedulable" sectionMarcelo Tosatti2008-10-151-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vcpu thread can be preempted after the guest_debug_pre() callback, resulting in invalid debug registers on the new vcpu. Move it inside the non-preemptable section. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: VMX: Clean up magic number 0x66 in init_rmode_tssSheng Yang2008-10-151-1/+2
| | | | | | | | | | | | | | | Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: Reduce stack usage in kvm_pv_mmu_op()Dave Hansen2008-10-151-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're in a hot path. We can't use kmalloc() because it might impact performance. So, we just stick the buffer that we need into the kvm_vcpu_arch structure. This is used very often, so it is not really a waste. We also have to move the buffer structure's definition to the arch-specific x86 kvm header. Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: Reduce stack usage in kvm_arch_vcpu_ioctl()Dave Hansen2008-10-151-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | [sheng: fix KVM_GET_LAPIC using wrong size] Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: Reduce kvm stack usage in kvm_arch_vm_ioctl()Dave Hansen2008-10-151-27/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On my machine with gcc 3.4, kvm uses ~2k of stack in a few select functions. This is mostly because gcc fails to notice that the different case: statements could have their stack usage combined. It overflows very nicely if interrupts happen during one of these large uses. This patch uses two methods for reducing stack usage. 1. dynamically allocate large objects instead of putting on the stack. 2. Use a union{} member for all of the case variables. This tricks gcc into combining them all into a single stack allocation. (There's also a comment on this) Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: pci device assignmentBen-Ami Yassour2008-10-151-0/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on a patch from: Amit Shah <amit.shah@qumranet.com> This patch adds support for handling PCI devices that are assigned to the guest. The device to be assigned to the guest is registered in the host kernel and interrupt delivery is handled. If a device is already assigned, or the device driver for it is still loaded on the host, the device assignment is failed by conveying a -EBUSY reply to the userspace. Devices that share their interrupt line are not supported at the moment. By itself, this patch will not make devices work within the guest. The VT-d extension is required to enable the device to perform DMA. Another alternative is PVDMA. Signed-off-by: Amit Shah <amit.shah@qumranet.com> Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com> Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | x86: KVM guest: use paravirt function to calculate cpu khzGlauber Costa2008-10-151-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently facing timing problems in guests that do calibration under heavy load, and then the load vanishes. This means we'll have a much lower lpj than we actually should, and delays end up taking less time than they should, which is a nasty bug. Solution is to pass on the lpj value from host to guest, and have it preset. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | x86: paravirt: factor out cpu_khz to common codeGlauber Costa2008-10-152-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | KVM intends to use paravirt code to calibrate khz. Xen current code will do just fine. So as a first step, factor out code to pvclock.c. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: PIT: fix injection logic and countMarcelo Tosatti2008-10-153-40/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PIT injection logic is problematic under the following cases: 1) If there is a higher priority vector to be delivered by the time kvm_pit_timer_intr_post is invoked ps->inject_pending won't be set. This opens the possibility for missing many PIT event injections (say if guest executes hlt at this point). 2) ps->inject_pending is racy with more than two vcpus. Since there's no locking around read/dec of pt->pending, two vcpu's can inject two interrupts for a single pt->pending count. Fix 1 by using an irq ack notifier: only reinject when the previous irq has been acked. Fix 2 with appropriate locking around manipulation of pending count and irq_ack by the injection / ack paths. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: irq ack notificationMarcelo Tosatti2008-10-154-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on a patch from: Ben-Ami Yassour <benami@il.ibm.com> which was based on a patch from: Amit Shah <amit.shah@qumranet.com> Notify IRQ acking on PIC/APIC emulation. The previous patch missed two things: - Edge triggered interrupts on IOAPIC - PIC reset with IRR/ISR set should be equivalent to ack (LAPIC probably needs something similar). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> CC: Amit Shah <amit.shah@qumranet.com> CC: Ben-Ami Yassour <benami@il.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: Add irq ack notifier listAvi Kivity2008-10-152-0/+27
| | | | | | | | | | | | | | | | | | | | | This can be used by kvm subsystems that are interested in when interrupts are acked, for example time drift compensation. Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: powerpc: Map guest userspace with TID=0 mappingsHollis Blanchard2008-10-157-19/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we use TID=N userspace mappings, we must ensure that kernel mappings have been destroyed when entering userspace. Using TID=1/TID=0 for kernel/user mappings and running userspace with PID=0 means that userspace can't access the kernel mappings, but the kernel can directly access userspace. The net is that we don't need to flush the TLB on privilege switches, but we do on guest context switches (which are far more infrequent). Guest boot time performance improvement: about 30%. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: ppc: Write only modified shadow entries into the TLB on exitHollis Blanchard2008-10-156-18/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Track which TLB entries need to be written, instead of overwriting everything below the high water mark. Typically only a single guest TLB entry will be modified in a single exit. Guest boot time performance improvement: about 15%. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
| * | KVM: ppc: Stop saving host TLB stateHollis Blanchard2008-10-153-17/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're saving the host TLB state to memory on every exit, but never using it. Originally I had thought that we'd want to restore host TLB for heavyweight exits, but that could actually hurt when context switching to an unrelated host process (i.e. not qemu). Since this decreases the performance penalty of all exits, this patch improves guest boot time by about 15%. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>