summaryrefslogtreecommitdiffstats
path: root/drivers/kvm
Commit message (Collapse)AuthorAgeFilesLines
...
* KVM: Portability: Move some macro definitions from kvm.h to x86.hZhang Xiantao2008-01-302-33/+33
| | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: MMU initialization and teardown splitZhang Xiantao2008-01-302-13/+19
| | | | | | | Move out kvm_mmu init and exit functionality from kvm_main.c Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_vcpu_ioctl_get_dirty_log to arch-specific fileZhang Xiantao2008-01-303-15/+40
| | | | | | | | Meanwhile keep the interface in common, and leave as more logic in common as possible. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Make unloading of FPU state when putting vcpu arch-independentAmit Shah2008-01-303-2/+1
| | | | | | | | | | | Instead of having each architecture do it individually, we do this in the arch-independent code (just x86 as of now). [avi: add svm to the mix, which was added to mainline during the 2.6.24-rc process] Signed-off-by: Amit Shah <amit.shah@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Add some mmu statisticsAvi Kivity2008-01-303-1/+20
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Extend stats support for VM statsAvi Kivity2008-01-303-24/+55
| | | | | | This is in addition to the current virtual cpu statistics. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Add instruction emulation statisticsAvi Kivity2008-01-302-0/+6
|
* KVM: Add fpu_reload counterAvi Kivity2008-01-302-0/+3
| | | | | | Measure the number of times we switch the fpu state. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Replace 'light_exits' stat with 'host_state_reload'Avi Kivity2008-01-304-5/+5
| | | | | | | | This is a little more accurate (since it counts actual reloads, not potential reloads), and reverses the sense of the statistic to measure a bad event like most of the other stats (e.g. we want to minimize all counters). Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Add two hooks to handle kvm_create and destroy vmZhang Xiantao2008-01-303-36/+57
| | | | | | | | Add two arch hooks to handle kvm_create_vm and kvm destroy_vm. Now, just put io_bus init and destory in common. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Remove __init attributes for kvm_init_debug and kvm_init_msr_listZhang Xiantao2008-01-302-2/+2
| | | | | | | Since their callers are not declared with __init. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Remove ptr comparisons to 0Joe Perches2008-01-303-3/+4
| | | | | | | Fix sparse warnings "Using plain integer as NULL pointer" Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Make kvm_vcpu_ioctl_translate arch dependentZhang Xiantao2008-01-303-23/+26
| | | | | | | Move kvm_vcpu_ioctl_translate to arch, since mmu would be put under arch. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Consolidate register usage in vmx_vcpu_run()Avi Kivity2008-01-301-73/+73
| | | | | | | | We pass vcpu, vmx->fail, and vmx->launched to assembly code, but all three are fields within vmx. Consolidate by only passing in vmx and offsets for the rest. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: move KVM_CHECK_EXTENSIONZhang Xiantao2008-01-303-16/+25
| | | | | | | | | Make KVM_CHECK_EXTENSION code into a function, all archs can define its capability independently. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: modify 'lods', and 'stos' not to depend on CR2Sheng Yang2008-01-301-4/+10
| | | | | | | | The current 'lods' and 'stos' is depending on incoming CR2 rather than decode memory address from registers. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move x86 specific code from kvm_init() to kvm_arch()Zhang Xiantao2008-01-303-23/+35
| | | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Combine kvm_init and kvm_init_x86Zhang Xiantao2008-01-304-45/+28
| | | | | | | | Will be called once arch module registers itself. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Add vcpu and hardware management arch hooksZhang Xiantao2008-01-304-95/+197
| | | | | | | | | | | | | | | | | | | | | | Add the following hooks: void decache_vcpus_on_cpu(int cpu); int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu); void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id); void kvm_arch_vcpu_destory(struct kvm_vcpu *vcpu); int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu); void kvm_arch_hardware_enable(void *garbage); void kvm_arch_hardware_disable(void *garbage); int kvm_arch_hardware_setup(void); void kvm_arch_hardware_unsetup(void); void kvm_arch_check_processor_compat(void *rtn); Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_x86_ops to x86.cZhang Xiantao2008-01-303-1/+4
| | | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move some includes to x86.cZhang Xiantao2008-01-302-2/+2
| | | | | | | | | Move some includes to x86.c from kvm_main.c, since the related functions have been moved to x86.c Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Change kvm_{read,write}_guest() to use copy_{from,to}_user()Izik Eidus2008-01-301-24/+14
| | | | | | | | | This changes kvm_write_guest_page/kvm_read_guest_page to use copy_to_user/read_from_user, as a result we get better speed and better dirty bit tracking. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: introduce gfn_to_hva()Izik Eidus2008-01-301-8/+17
| | | | | | | Convert a guest frame number to the corresponding host virtual address. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: add kvm_is_error_hva()Izik Eidus2008-01-302-0/+12
| | | | | | | | Check for the "error hva", an address outside the user address space that signals a bad gfn. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Simplify CPU_TASKS_FROZEN cpu notifier handlingAvi Kivity2008-01-301-3/+1
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: remove 8 bytes operands emulator for call near instructionIzik Eidus2008-01-301-3/+0
| | | | | | | it is removed beacuse it isnt supported on a real host Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: wbinvd exitingEddie Dong2008-01-302-1/+12
| | | | | | | | | Add wbinvd VM Exit support to prepare for pass-through device cache emulation and also enhance real time responsiveness. Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Comment VMX primary/secondary exec ctl definitionsEddie Dong2008-01-301-2/+8
| | | | | | | Add comments for secondary/primary Processor-Based VM-execution controls. Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Fix faults during injection of real-mode interruptsAvi Kivity2008-01-301-2/+49
| | | | | | | | If vmx fails to inject a real-mode interrupt while fetching the interrupt redirection table, it fails to record this in the vectoring information field. So we detect this condition and do it ourselves. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Read & store IDT_VECTORING_INFO_FIELDAvi Kivity2008-01-301-5/+12
| | | | | | | We'll want to write to it in order to fix real-mode irq injection problems, but it is a read-only field. Storing it in a variable solves that issue. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Use vmx to inject real-mode interruptsAvi Kivity2008-01-302-49/+5
| | | | | | | | | | | | Instead of injecting real-mode interrupts by writing the interrupt frame into guest memory, abuse vmx by injecting a software interrupt. We need to pretend the software interrupt instruction had a length > 0, so we have to adjust rip backward. This lets us not to mess with writing guest memory, which is complex and also sleeps. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Add make_page_dirty() to kvm_clear_guest_page()Dor Laor2008-01-301-0/+1
| | | | | | | | Every write access to guest pages should be tracked. Signed-off-by: Dor Laor <dor.laor@qumranet.com> Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move x86 vcpu ioctl handlers to x86.cHollis Blanchard2008-01-303-436/+443
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move x86 FPU handling to x86.cHollis Blanchard2008-01-303-105/+108
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move x86 instruction emulation code to x86.cHollis Blanchard2008-01-303-176/+177
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Make exported debugfs data architecture-specificHollis Blanchard2008-01-303-25/+29
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Hoist modrm and abs decoding into separate functionsAvi Kivity2008-01-301-160/+177
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Make mark_page_dirty() work for aliased pages too.Uri Lublin2008-01-301-1/+1
| | | | | | | Recommended by Izik Eidus. Signed-off-by: Uri Lublin <uril@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Simplify decode_register_operand() calling conventionAvi Kivity2008-01-301-3/+3
| | | | | | | Now that rex_prefix is part of the decode cache, there is no need to pass it along. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: centralize decoding of one-byte register access insnsAvi Kivity2008-01-302-57/+47
| | | | | | | | | Instructions like 'inc reg' that have the register operand encoded in the opcode are currently specially decoded. Extend decode_register_operand() to handle that case, indicated by having DstReg or SrcReg without ModRM. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: Extract the common code of SrcReg and DstRegAvi Kivity2008-01-301-49/+31
| | | | | | Share the common parts of SrcReg and DstReg decoding. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move pio emulation functions to x86.cCarsten Otte2008-01-303-248/+244
| | | | | | | | | | | | | | This patch moves implementation of the following functions from kvm_main.c to x86.c: free_pio_guest_pages, vcpu_find_pio_dev, pio_copy_data, complete_pio, kernel_pio, pio_string_write, kvm_emulate_pio, kvm_emulate_pio_string The function inject_gp, which was duplicated by yesterday's patch series, is removed from kvm_main.c now because it is not needed anymore. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move x86 emulation and mmio device hook to x86.cCarsten Otte2008-01-302-357/+358
| | | | | | | | | | | | | | | | This patch moves the following functions to from kvm_main.c to x86.c: emulator_read/write_std, vcpu_find_pervcpu_dev, vcpu_find_mmio_dev, emulator_read/write_emulated, emulator_write_phys, emulator_write_emulated_onepage, emulator_cmpxchg_emulated, get_setment_base, emulate_invlpg, emulate_clts, emulator_get/set_dr, kvm_report_emulation_failure, emulate_instruction The following data type is moved to x86.c: struct x86_emulate_ops emulate_ops Signed-off-by: Carsten Otte <cotte@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_get/set_msr[_common] to x86.cCarsten Otte2008-01-302-133/+134
| | | | | | | | | | This patch moves the implementation of the functions of kvm_get/set_msr, kvm_get/set_msr_common, and set_efer from kvm_main.c to x86.c. The definition of EFER_RESERVED_BITS is moved too. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Fix gfn_to_page() acquiring mmap_sem twiceAnthony Liguori2008-01-301-4/+18
| | | | | | | | | | | | KVM's nopage handler calls gfn_to_page() which acquires the mmap_sem when calling out to get_user_pages(). nopage handlers are already invoked with the mmap_sem held though. Introduce a __gfn_to_page() for use by the nopage handler which requires the lock to already be held. This was noticed by tglx. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Enable memory mapped TPR shadow (FlexPriority)Sheng Yang2008-01-304-30/+152
| | | | | | | | | | This patch based on CR8/TPR patch, and enable the TPR shadow (FlexPriority) for 32bit Windows. Since TPR is accessed very frequently by 32bit Windows, especially SMP guest, with FlexPriority enabled, we saw significant performance gain. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move control register helper functions to x86.cCarsten Otte2008-01-303-220/+225
| | | | | | | | | | | | | | | | | | This patch moves the definitions of CR0_RESERVED_BITS, CR4_RESERVED_BITS, and CR8_RESERVED_BITS along with the following functions from kvm_main.c to x86.c: set_cr0(), set_cr3(), set_cr4(), set_cr8(), get_cr8(), lmsw(), load_pdptrs() The static function wrapper inject_gp is duplicated in kvm_main.c and x86.c for now, the version in kvm_main.c should disappear once the last user of it is gone too. The function load_pdptrs is no longer static, and now defined in x86.h for the time being, until the last user of it is gone from kvm_main.c. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: move get/set_apic_base to x86.cCarsten Otte2008-01-302-19/+19
| | | | | | | | | | This patch moves the implementation of get_apic_base and set_apic_base from kvm_main.c to x86.c Signed-off-by: Carsten Otte <cotte@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move memory segmentation to x86.cCarsten Otte2008-01-303-42/+45
| | | | | | | | | | | | This patch moves the definition of segment_descriptor_64 for AMD64 and EM64T from kvm_main.c to segment_descriptor.h. It also adds a proper #ifndef...#define...#endif around that header file. The implementation of segment_base is moved from kvm_main.c to x86.c. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Split kvm_vm_ioctl v3Carsten Otte2008-01-303-249/+271
| | | | | | | | | | | | | | | | | | | | This patch splits kvm_vm_ioctl into archtecture independent parts, and x86 specific parts which go to kvm_arch_vcpu_ioctl in x86.c. The patch is unchanged since last submission. Common ioctls for all architectures are: KVM_CREATE_VCPU, KVM_GET_DIRTY_LOG, KVM_SET_USER_MEMORY_REGION x86 specific ioctls are: KVM_SET_MEMORY_REGION, KVM_GET/SET_NR_MMU_PAGES, KVM_SET_MEMORY_ALIAS, KVM_CREATE_IRQCHIP, KVM_CREATE_IRQ_LINE, KVM_GET/SET_IRQCHIP KVM_SET_TSS_ADDR Signed-off-by: Carsten Otte <cotte@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
OpenPOWER on IntegriCloud