aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAge
* KVM: x86 emulator: Make a distinction between repeat prefixes F3 and F2Guillaume Thouvenin2008-01-30
| | | | | | | | | | cmps and scas instructions accept repeat prefixes F3 and F2. So in order to emulate those prefixed instructions we need to be able to know if prefixes are REP/REPE/REPZ or REPNE/REPNZ. Currently kvm doesn't make this distinction. This patch introduces this distinction. Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move unalias_gfn to arch dependent fileZhang Xiantao2008-01-30
| | | | | | | | | Non-x86 archs don't need this mechanism. Move it to arch, and keep its interface in common. 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: VMX: Remove the secondary execute control dependency on irqchipSheng Yang2008-01-30
| | | | | | | | The state of SECONDARY_VM_EXEC_CONTROL shouldn't depend on in-kernel IRQ chip, this patch fix this. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Enhance guest cpuid managementDan Kenigsberg2008-01-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current cpuid management suffers from several problems, which inhibit passing through the host feature set to the guest: - No way to tell which features the host supports While some features can be supported with no changes to kvm, others need explicit support. That means kvm needs to vet the feature set before it is passed to the guest. - No support for indexed or stateful cpuid entries Some cpuid entries depend on ecx as well as on eax, or on internal state in the processor (running cpuid multiple times with the same input returns different output). The current cpuid machinery only supports keying on eax. - No support for save/restore/migrate The internal state above needs to be exposed to userspace so it can be saved or migrated. This patch adds extended cpuid support by means of three new ioctls: - KVM_GET_SUPPORTED_CPUID: get all cpuid entries the host (and kvm) supports - KVM_SET_CPUID2: sets the vcpu's cpuid table - KVM_GET_CPUID2: gets the vcpu's cpuid table, including hidden state [avi: fix original KVM_SET_CPUID not removing nx on non-nx hosts as it did before] Signed-off-by: Dan Kenigsberg <danken@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Disallow fork() and similar games when using a VMAvi Kivity2008-01-30
| | | | | | We don't want the meaning of guest userspace changing under our feet. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Rename 'release_page'Avi Kivity2008-01-30
| | | | | | Rename the awkwardly named variable. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Rename variables of type 'struct kvm_mmu_page *'Avi Kivity2008-01-30
| | | | | | | | These are traditionally named 'page', but even more traditionally, that name is reserved for variables that point to a 'struct page'. Rename them to 'sp' (for "shadow page"). Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Remove gpa_to_hpa()Avi Kivity2008-01-30
| | | | | | Converting last uses along the way. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Remove gva_to_hpa()Avi Kivity2008-01-30
| | | | | | No longer used. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Simplify nonpaging_map()Avi Kivity2008-01-30
| | | | | | Instead of passing an hpa, pass a regular struct page. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Introduce gfn_to_gpa()Avi Kivity2008-01-30
| | | | | | | | Converting a frame number to an address is tricky since the data type changes size. Introduce a function to do it. This fixes an actual bug when accessing guest ptes. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Adjust page_header_update_slot() to accept a gfn instead of a gpaAvi Kivity2008-01-30
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Merge set_pte() and set_pte_common()Avi Kivity2008-01-30
| | | | | | | Since set_pte() is now the only caller of set_pte_common(), merge the two functions. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Remove set_pde()Avi Kivity2008-01-30
| | | | | | It is now identical to set_pte(). Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Remove extra gaddr parameter from set_pte_common()Avi Kivity2008-01-30
| | | | | | Similar information is available in the gfn parameter, so use that. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Move pse36 handling to the guest walkerAvi Kivity2008-01-30
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Introduce and use gpte_to_gfn()Avi Kivity2008-01-30
| | | | | | Instead of repretitively open-coding this. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Code cleanupIzik Eidus2008-01-30
| | | | | Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Don't bother the mmu if cr3 load doesn't change cr3Avi Kivity2008-01-30
| | | | | | | If the guest requests just a tlb flush, don't take the vm lock and drop the mmu context pointlessly. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Avoid unnecessary remote tlb flushes when guest updates a pteAvi Kivity2008-01-30
| | | | | | | | If all we're doing is increasing permissions on a pte (typical for demand paging), then there's not need to flush remote tlbs. Worst case they'll get a spurious page fault. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Add statistic for remote tlb flushesAvi Kivity2008-01-30
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Implement guest page fault bypass for nonpaeAvi Kivity2008-01-30
| | | | | | | | I spent an hour worrying why I see so many guest page faults on FC6 i386. Turns out bypass wasn't implemented for nonpae. Implement it so it doesn't happen again. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Split vcpu creation to avoid vcpu_load() before preemption setupAvi Kivity2008-01-30
| | | | | | | | Split kvm_arch_vcpu_create() into kvm_arch_vcpu_create() and kvm_arch_vcpu_setup(), enabling preemption notification between the two. This mean that we can now do vcpu_load() within kvm_arch_vcpu_setup(). Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Split kvm_set_memory_region() to have an arch calloutZhang Xiantao2008-01-30
| | | | | | | | Moving !user_alloc case to kvm_arch to avoid unnecessary code logic in non-x86 platform. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Recalculate mmu pages needed for every memory region changeZhang Xiantao2008-01-30
| | | | | | | | Instead of incrementally changing the mmu cache size for every memory slot operation, recalculate it from scratch. This is simpler and safer. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: prefetch up to 15 bytes of the instruction executedAvi Kivity2008-01-30
| | | | | | | Instead of fetching one byte at a time, prefetch 15 bytes (or until the next page boundary) to avoid guest page table walks. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: x86 emulator: retire ->write_std()Avi Kivity2008-01-30
| | | | | | | | Theoretically used to acccess memory known to be ordinary RAM, it was never implemented. It is questionable whether it is possible to implement it correctly. Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Selectively set PageDirty when releasing guest memoryIzik Eidus2008-01-30
| | | | | | | | | Improve dirty bit setting for pages that kvm release, until now every page that we released we marked dirty, from now only pages that have potential to get dirty we mark dirty. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Fix potential memory leak with smp real-modeIzik Eidus2008-01-30
| | | | | | | | When we map a page, we check whether some other vcpu mapped it for us and if so, bail out. But we should decrease the refcount on the page as we do so. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Export include/asm-x86/kvm.hAvi Kivity2008-01-30
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move cpuid structures to <asm/kvm.h>Jerone Young2008-01-30
| | | | | | | | | | | This patch moves structures: kvm_cpuid_entry kvm_cpuid from include/linux/kvm.h to include/asm-x86/kvm.h Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_sregs and msr structures to <asm/kvm.h>Jerone Young2008-01-30
| | | | | | | | | | | | Move structures: kvm_sregs kvm_msr_entry kvm_msrs kvm_msr_list from include/linux/kvm.h to include/asm-x86/kvm.h Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_segment & kvm_dtable structure to <asm/kvm.h>Jerone Young2008-01-30
| | | | | | | | | | This patch moves structures: kvm_segment kvm_dtable from include/linux/kvm.h to include/asm-x86/kvm.h Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move structure lapic_state to <asm/kvm.h>Jerone Young2008-01-30
| | | | | | | | This patch moves structure lapic_state from include/linux/kvm.h to include/asm-x86/kvm.h Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_regs to <asm/kvm.h>Jerone Young2008-01-30
| | | | | | | | | This patch moves structure kvm_regs to include/asm-x86/kvm.h. Each architecture will need to create there own version of this structure. Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move x86 pic strutcturesJerone Young2008-01-30
| | | | | | | | | | | This patch moves structures: kvm_pic_state kvm_ioapic_state to inclue/asm-x86/kvm.h. Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move kvm_memory_alias to asm/kvm.hJerone Young2008-01-30
| | | | | | | | | This patch moves sturct kvm_memory_alias from include/linux/kvm.h to include/asm-x86/kvm.h. Also have include/linux/kvm.h include include/asm/kvm.h. Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Move misplaced commentHollis Blanchard2008-01-30
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Correct consistent typo: "destory" -> "destroy"Hollis Blanchard2008-01-30
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Remove unused "rmap_overflow" variableHollis Blanchard2008-01-30
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Remove unused variableAvi Kivity2008-01-30
| | | | Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Simplify kvm_clear_guest_page()Izik Eidus2008-01-30
| | | | | | | | Use kvm_write_guest_page() with empty_zero_page, instead of doing kmap and memset. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: MMU: Change guest pte access to kvm_{read,write}_guest()Izik Eidus2008-01-30
| | | | | | | Things are simpler and more regular this way. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: VMX: Force seg.base == (seg.sel << 4) in real modeJan Kiszka2008-01-30
| | | | | | | | | Ensure that segment.base == segment.selector << 4 when entering the real mode on Intel so that the CPU will not bark at us. This fixes some old protected mode demo from http://www.x86.org/articles/pmbasics/tspec_a1_doc.htm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move some function declarations to x86.hZhang Xiantao2008-01-30
| | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Move some static inline functions out from kvm.h into x86.hZhang Xiantao2008-01-30
| | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move vcpu regs enumeration definition to x86.hZhang Xiantao2008-01-30
| | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move struct kvm_x86_ops definition to x86.hZhang Xiantao2008-01-30
| | | | | Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
* KVM: Portability: Move some macro definitions from kvm.h to x86.hZhang Xiantao2008-01-30
| | | | | 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-30
| | | | | | | 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>