summaryrefslogtreecommitdiffstats
path: root/arch
Commit message (Collapse)AuthorAgeFilesLines
* KVM: Replace ->drop_interrupt_shadow() by ->set_interrupt_shadow()Glauber Costa2009-06-105-26/+63
| | | | | | | | | | | | This patch replaces drop_interrupt_shadow with the more general set_interrupt_shadow, that can either drop or raise it, depending on its parameter. It also adds ->get_interrupt_shadow() for future use. Signed-off-by: Glauber Costa <glommer@redhat.com> CC: H. Peter Anvin <hpa@zytor.com> CC: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: use smp_send_reschedule in kvm_vcpu_kickMarcelo Tosatti2009-06-104-39/+25Star
| | | | | | | | | | | | | | | | | | | KVM uses a function call IPI to cause the exit of a guest running on a physical cpu. For virtual interrupt notification there is no need to wait on IPI receival, or to execute any function. This is exactly what the reschedule IPI does, without the overhead of function IPI. So use it instead of smp_call_function_single in kvm_vcpu_kick. Also change the "guest_mode" variable to a bit in vcpu->requests, and use that to collapse multiple IPI's that would be issued between the first one and zeroing of guest mode. This allows kvm_vcpu_kick to called with interrupts disabled. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Update cpuid 1.ecx reportingAvi Kivity2009-06-101-1/+7
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* x86: Add cpu features MOVBE and POPCNTAvi Kivity2009-06-101-0/+2
| | | | | | Add cpu feature bit support for the MOVBE and POPCNT instructions. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Add AMD cpuid bit: cr8_legacy, abm, misaligned sse, sse4, 3dnow prefetchAvi Kivity2009-06-101-33/+38
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix cpuid feature misreportingAvi Kivity2009-06-101-2/+5
| | | | | | | | MTRR, PAT, MCE, and MCA are all supported (to some extent) but not reported. Vista requires these features, so if userspace relies on kernel cpuid reporting, it loses support for Vista. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Drop request_nmi from statsJan Kiszka2009-06-102-2/+0Star
| | | | | | | | The stats entry request_nmi is no longer used as the related user space interface was dropped. So clean it up. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Don't reinject event that caused a task switchGleb Natapov2009-06-101-2/+21
| | | | | | | | If a task switch caused by an event remove it from the event queue. VMX already does that. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Fix cross vendor migration issue in segment segment descriptorAndre Przywara2009-06-101-0/+9
| | | | | | | | | | On AMD CPUs sometimes the DB bit in the stack segment descriptor is left as 1, although the whole segment has been made unusable. Clear it here to pass an Intel VMX entry check when cross vendor migrating. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: fix apic_debug instancesGlauber Costa2009-06-101-2/+2
| | | | | | | | | Apparently nobody turned this on in a while... setting apic_debug to something compilable, generates some errors. This patch fixes it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Enable snooping control for supported hardwareSheng Yang2009-06-103-2/+19
| | | | | | | | | | | | | | | | Memory aliases with different memory type is a problem for guest. For the guest without assigned device, the memory type of guest memory would always been the same as host(WB); but for the assigned device, some part of memory may be used as DMA and then set to uncacheable memory type(UC/WC), which would be a conflict of host memory type then be a potential issue. Snooping control can guarantee the cache correctness of memory go through the DMA engine of VT-d. [avi: fix build on ia64] Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Replace get_mt_mask_shift with get_mt_maskSheng Yang2009-06-105-25/+24Star
| | | | | | | | | | Shadow_mt_mask is out of date, now it have only been used as a flag to indicate if TDP enabled. Get rid of it and use tdp_enabled instead. Also put memory type logical in kvm_x86_ops->get_mt_mask(). Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Wake up waitqueue before calling get_cpu()Jan Blunck2009-06-101-1/+2
| | | | | | | | | | This moves the get_cpu() call down to be called after we wake up the waiters. Therefore the waitqueue locks can safely be rt mutex. Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Sven-Thorsten Dietrich <sven@thebigcorporation.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Get rid of get_irq() callbackGleb Natapov2009-06-104-24/+5Star
| | | | | | | | | It just returns pending IRQ vector from the queue for VMX/SVM. Get IRQ directly from the queue before migration and put it back after. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix userspace IRQ chip migrationGleb Natapov2009-06-101-6/+6
| | | | | | | | Re-put pending IRQ vector into interrupt_bitmap before migration. Otherwise it will be lost if migration happens in the wrong time. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Add NMI injection supportGleb Natapov2009-06-104-109/+145
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Get rid of arch.interrupt_window_open & arch.nmi_window_openGleb Natapov2009-06-103-31/+12Star
| | | | | | | They are recalculated before each use anyway. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Do not report TPR write to userspace if new value bigger or equal to a ↵Gleb Natapov2009-06-102-7/+16
| | | | | | | | | previous one. Saves many exits to userspace in a case of IRQ chip in userspace. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: sync_lapic_to_cr8() should always sync cr8 to V_TPRGleb Natapov2009-06-101-4/+1Star
| | | | | | | Even if IRQ chip is in userspace. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Remove kvm_push_irq()Gleb Natapov2009-06-101-7/+0Star
| | | | | | | No longer used. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Remove inject_pending_vectors() callbackGleb Natapov2009-06-104-7/+1Star
| | | | | | | It is the same as inject_pending_irq() for VMX/SVM now. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Remove exception_injected() callback.Gleb Natapov2009-06-104-15/+0Star
| | | | | | | It always return false for VMX/SVM now. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: Coalesce userspace/kernel irqchip interrupt injection logicGleb Natapov2009-06-101-102/+85Star
| | | | | | | | | | | | | | Start to use interrupt/exception queues like VMX does. This also fix the bug that if exit was caused by a guest internal exception access to IDT the exception was not reinjected. Use EVENTINJ to inject interrupts. Use VINT only for detecting when IRQ windows is open again. EVENTINJ ensures the interrupt is injected immediately and not delayed. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Use kvm_arch_interrupt_allowed() instead of checking ↵Gleb Natapov2009-06-101-3/+2Star
| | | | | | | | | interrupt_window_open directly kvm_arch_interrupt_allowed() also checks IF so drop the check. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Cleanup vmx_intr_assist()Gleb Natapov2009-06-101-25/+30
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: VMX: Consolidate userspace and kernel interrupt injection for VMXGleb Natapov2009-06-104-58/+19Star
| | | | | | | | Use the same callback to inject irq/nmi events no matter what irqchip is in use. Only from VMX for now. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Make kvm_cpu_(has|get)_interrupt() work for userspace irqchip tooGleb Natapov2009-06-104-15/+25
| | | | | | | At the vector level, kernel and userspace irqchip are fairly similar. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: Fix auditing codeJan Kiszka2009-06-101-3/+5
| | | | | | | | Fix build breakage of hpa lookup in audit_mappings_page. Moreover, make this function robust against shadow_notrap_nonpresent_pte entries. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: ia64: ia64 vcpu_reset() do not call kmalloc() with irqs disabledJes Sorensen2009-06-101-1/+1
| | | | | | | | | Restore local irq enabled state before calling kvm_arch_vcpu_init(), which calls kmalloc(GFP_KERNEL). 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: ia64: preserve int status through call to kvm_insert_vmm_mappingJes Sorensen2009-06-101-1/+6
| | | | | | | | | Preserve interrupt status around call to kvm_insert_vmm_mappin() in kvm_vcpu_pre_transition(). 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: ia64: restore irq state before calling kvm_vcpu_initJes Sorensen2009-06-101-2/+1Star
| | | | | | | | | | | | Make sure to restore the psr after calling kvm_insert_vmm_mapping() which calls ia64_itr_entry() as it disables local interrupts and kvm_vcpu_init() may sleep. Avoids a warning from the lock debugging code. 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: ia64: remove empty function vti_vcpu_load()Jes Sorensen2009-06-101-5/+0Star
| | | | | | | | vti_vcpu_load() doesn't do anything, so lets get rid of it. 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: 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/+2Star
| | | | | 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/+10Star
| | | | | 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/+5Star
| | | | | 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/+8Star
| | | | | | | | 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: 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/+0Star
| | | | | | | | 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>